Skip to content

Commit

Permalink
[PhpUnitBridge] Mark parent class also covered in CoverageListener
Browse files Browse the repository at this point in the history
  • Loading branch information
lyrixx committed May 4, 2020
1 parent cfa048c commit dcb5653
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/Symfony/Bridge/PhpUnit/Legacy/CoverageListenerTrait.php
Expand Up @@ -73,10 +73,19 @@ public function startTest($test)
$r = new \ReflectionProperty($testClass, 'annotationCache');
$r->setAccessible(true);

$covers = $sutFqcn;
if (!\is_array($sutFqcn)) {
$covers = [$sutFqcn];
while ($parent = get_parent_class($sutFqcn)) {
$covers[] = $parent;
$sutFqcn = $parent;
}
}

$cache = $r->getValue();
$cache = array_replace_recursive($cache, array(
\get_class($test) => array(
'covers' => \is_array($sutFqcn) ? $sutFqcn : array($sutFqcn),
'covers' => $covers,
),
));
$r->setValue($testClass, $cache);
Expand Down

0 comments on commit dcb5653

Please sign in to comment.