Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Include function coverage
  • Loading branch information
AndrewFeeney committed Jan 22, 2024
commit 822dedc171e410a9757acad53fdde6cf186d2c75
2 changes: 2 additions & 0 deletions src/Data/ProcessedCodeCoverageDataMapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,13 @@
final class ProcessedCodeCoverageDataMapper
{
const KEY_LINE_COVERAGE = 'lineCoverage';
const KEY_FUNCTION_COVERAGE = 'functionCoverage';

public function toJson(ProcessedCodeCoverageData $processedCodeCoverageData): string
{
$arrayMapping = [
self::KEY_LINE_COVERAGE => $processedCodeCoverageData->lineCoverage(),
self::KEY_FUNCTION_COVERAGE => $processedCodeCoverageData->functionCoverage(),
];

return json_encode($arrayMapping);
Expand Down
10 changes: 10 additions & 0 deletions tests/tests/Data/ProcessedCodeCoverageDataMapperTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,11 @@ public function testToJsonCoverageForBankAccount(): void
$coverage->lineCoverage(),
$decodedJson[ProcessedCodeCoverageDataMapper::KEY_LINE_COVERAGE],
);

$this->assertEquals(
$coverage->functionCoverage(),
$decodedJson[ProcessedCodeCoverageDataMapper::KEY_FUNCTION_COVERAGE],
);
}

public function testFromJsonCoverageForBankAccount(): void
Expand All @@ -44,6 +49,11 @@ public function testFromJsonCoverageForBankAccount(): void
$coverage->lineCoverage(),
$unserializedCoverage->lineCoverage(),
);

$this->assertEquals(
$coverage->functionCoverage(),
$unserializedCoverage->functionCoverage(),
);
}
}