8000 [PhpUnitBridge] Skip internal classes in CoverageListenerTrait · symfony/symfony@a0dedb9 · GitHub
[go: up one dir, main page]

Skip to content

Commit a0dedb9

Browse files
sanmainicolas-grekas
authored andcommitted
[PhpUnitBridge] Skip internal classes in CoverageListenerTrait
1 parent 2248fa5 commit a0dedb9

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

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

Lines 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