Skip to content

Commit

Permalink
Closes #4947
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastianbergmann committed Apr 1, 2022
1 parent 5e06be7 commit 888b9c9
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
1 change: 1 addition & 0 deletions ChangeLog-9.5.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ All notable changes of the PHPUnit 9.5 release series are documented in this fil
### Fixed

* [#4938](https://github.com/sebastianbergmann/phpunit/issues/4938): Test Double code generator does not handle `void` return type declaration on `__clone()` methods
* [#4947](https://github.com/sebastianbergmann/phpunit/issues/4947): Test annotated with `@coversNothing` may lead to files missing from code coverage report

## [9.5.19] - 2022-03-15

Expand Down
6 changes: 4 additions & 2 deletions src/Util/Test.php
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,8 @@ public static function requiresCodeCoverageDataCollection(TestCase $test): bool
// If there is no @covers annotation but a @coversNothing annotation on
// the test method then code coverage data does not need to be collected
if (isset($annotations['method']['coversNothing'])) {
return false;
// @see https://github.com/sebastianbergmann/phpunit/issues/4947#issuecomment-1084480950
// return false;
}

// If there is at least one @covers annotation then
Expand All @@ -162,7 +163,8 @@ public static function requiresCodeCoverageDataCollection(TestCase $test): bool
// If there is no @covers annotation but a @coversNothing annotation
// then code coverage data does not need to be collected
if (isset($annotations['class']['coversNothing'])) {
return false;
// @see https://github.com/sebastianbergmann/phpunit/issues/4947#issuecomment-1084480950
// return false;
}

// If there is no @coversNothing annotation then
Expand Down
5 changes: 3 additions & 2 deletions tests/unit/Util/TestClassTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -1548,8 +1548,9 @@ public function canSkipCoverageProvider(): array
[CoverageClassTest::class, false],
[CoverageClassWithoutAnnotationsTest::class, false],
[CoverageCoversOverridesCoversNothingTest::class, false],
[CoverageClassNothingTest::class, true],
[CoverageMethodNothingTest::class, true],
// @see https://github.com/sebastianbergmann/phpunit/issues/4947#issuecomment-1084480950
// [CoverageClassNothingTest::class, true],
// [CoverageMethodNothingTest::class, true],
];
}

Expand Down

0 comments on commit 888b9c9

Please sign in to comment.