classCoverage
final class Coverage
Builds the coverage report and applies the overall, per-source and differential gates.
Methods§
public function report(
Project $project,
Analysis $analysis,
string|null $snapshotFile = null,
bool $allowRemoved = false,
float|null $minimum = null,
float|null $diffMinimum = null,
): array<string, mixed>Builds the coverage report of an analysis.
Parameters
$project | Project | The loaded project |
$analysis | Analysis | The analysis of its sources |
$snapshotFile | string|null | The coverage snapshot of a trusted base revision to compare with |
$allowRemoved | bool | Whether units the snapshot lists may be missing from the scope |
$minimum | float|null | The overall threshold, overriding the configured one |
$diffMinimum | float|null | The differential threshold, overriding the configured one |
Returns
array<string, mixed> The report; "passed" is false when a gate failsThrows
InvalidInputException When the snapshot cannot be read or is not a coverage snapshotJsonException When the snapshot is not JSON or a record cannot be encodedTest cases 14
AnalyzerTest::testAnalyzeUsesIndependentScopeAndReasonedDispositioncallsCoverageTest::testReportAppliesTheDifferentialThresholdToNewAndChangedUnitscallsCoverageTest::testReportAppliesTheOverallThresholdcallsCoverageTest::testReportAppliesTheSourceThresholdscallsCoverageTest::testReportDescribesEveryUnitAndPassesWithoutGatescallsCoverageTest::testReportFailsAPositiveOverallThresholdWithoutUnitscallsCoverageTest::testReportFailsTheDifferentialGateForANewUncoveredUnitcallsCoverageTest::testReportFailsWithTheErrorsOfTheAnalysiscallsCoverageTest::testReportRejectsAFileThatIsNotASnapshotcallsCoverageTest::testReportRejectsRemovedUnitsUnlessAllowedcallsCoverageTest::testReportRequiresASnapshotForAPositiveDifferentialThresholdcallsCoverageTest::testReportSkipsTheDifferentialThresholdWithoutChangedUnitscallsSnapshotTest::testCompareDetectsChangedClaimsNewUnitsAndRemovedScopecallsSnapshotTest::testReadRejectsACoverageReportcalls
Called from 1
Calls 4
- method-call Analysis::summary() line 34
- new Snapshot line 51
- method-call Snapshot::compare() line 52
- method-call Snapshot::read() line 52
Test cases 17§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.
Dedicated tests 11
CoverageTest::testReportAppliesTheDifferentialThresholdToNewAndChangedUnitscallsCoverageTest::testReportAppliesTheOverallThresholdcallsCoverageTest::testReportAppliesTheSourceThresholdscallsCoverageTest::testReportDescribesEveryUnitAndPassesWithoutGatescallsCoverageTest::testReportFailsAPositiveOverallThresholdWithoutUnitscallsCoverageTest::testReportFailsTheDifferentialGateForANewUncoveredUnitcallsCoverageTest::testReportFailsWithTheErrorsOfTheAnalysiscallsCoverageTest::testReportRejectsAFileThatIsNotASnapshotcallsCoverageTest::testReportRejectsRemovedUnitsUnlessAllowedcallsCoverageTest::testReportRequiresASnapshotForAPositiveDifferentialThresholdcallsCoverageTest::testReportSkipsTheDifferentialThresholdWithoutChangedUnitscalls