diff --git a/src/Phpunit/TestCase.php b/src/Phpunit/TestCase.php index 88aee7fa..a16a4333 100644 --- a/src/Phpunit/TestCase.php +++ b/src/Phpunit/TestCase.php @@ -63,6 +63,12 @@ protected function tearDown(): void gc_collect_cycles(); } gc_collect_cycles(); + + // fix coverage when no assertion is expected + // https://github.com/sebastianbergmann/phpunit/pull/5010 + if ($this->getNumAssertions() === 0 && $this->doesNotPerformAssertions()) { + $this->getTestResultObject()->beStrictAboutTestsThatDoNotTestAnything(false); + } } /**