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 commite06850c12b
this change is required for PHPUnit 9.1 and up. [Here's it being tested.](60c6fb972b/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 -------a0dedb9aa6
[PhpUnitBridge] Skip internal classes in CoverageListenerTrait
This commit is contained in:
commit
ba61d89ff4
@ -107,6 +107,13 @@ class CoverageListenerTrait
|
||||
$symbolAnnotations = new \ReflectionProperty($docBlock, 'symbolAnnotations');
|
||||
$symbolAnnotations->setAccessible(true);
|
||||
|
||||
// Exclude internal classes; PHPUnit 9.1+ is picky about tests covering, say, a \RuntimeException
|
||||
$covers = array_filter($covers, function ($class) {
|
||||
$reflector = new ReflectionClass($class);
|
||||
|
||||
return $reflector->isUserDefined();
|
||||
});
|
||||
|
||||
$symbolAnnotations->setValue($docBlock, array_replace($docBlock->symbolAnnotations(), [
|
||||
'covers' => $covers,
|
||||
]));
|
||||
|
Reference in New Issue
Block a user