Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit ba61d89

Browse filesBrowse files
bug #38094 [PhpUnitBridge] Skip internal classes in CoverageListenerTrait (sanmai)
This PR was squashed before being merged into the 4.4 branch. Discussion ---------- [PhpUnitBridge] Skip internal classes in CoverageListenerTrait PHPUnit 9+ is picky about test covering, say, a `\RuntimeException`. Fails with the likes: "@Covers RuntimeException" is invalid Judging by the commit sebastianbergmann/phpunit@e06850c this change is required for PHPUnit 9.1 and up. [Here's it being tested.](https://github.com/sebastianbergmann/code-unit/blob/60c6fb972b3262e423be3000e7b8c67cbc477580/tests/unit/ClassMethodUnitTest.php#L49-L54) | Q | A | ------------- | --- | Branch? | 4.4 | Bug fix? | yes | New feature? | no | Deprecations? | no | Tickets | Follow-up to #38054 | License | MIT Commits ------- a0dedb9 [PhpUnitBridge] Skip internal classes in CoverageListenerTrait
2 parents f8fddf3 + a0dedb9 commit ba61d89
Copy full SHA for ba61d89

File tree

1 file changed

+7
-0
lines changed
Filter options

1 file changed

+7
-0
lines changed

‎src/Symfony/Bridge/PhpUnit/Legacy/CoverageListenerTrait.php

Copy file name to clipboardExpand all lines: src/Symfony/Bridge/PhpUnit/Legacy/CoverageListenerTrait.php
+7Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,13 @@ private function addCoversForDocBlockInsideRegistry($test, $covers)
107107
$symbolAnnotations = new \ReflectionProperty($docBlock, 'symbolAnnotations');
108108
$symbolAnnotations->setAccessible(true);
109109

110+
// Exclude internal classes; PHPUnit 9.1+ is picky about tests covering, say, a \RuntimeException
111+
$covers = array_filter($covers, function ($class) {
112+
$reflector = new ReflectionClass($class);
113+
114+
return $reflector->isUserDefined();
115+
});
116+
110117
$symbolAnnotations->setValue($docBlock, array_replace($docBlock->symbolAnnotations(), [
111118
'covers' => $covers,
112119
]));

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.