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 Apr 24, 2020
1 parent c6cf433 commit 5598233
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/Symfony/Bridge/PhpUnit/Legacy/CoverageListenerTrait.php
Expand Up @@ -66,13 +66,21 @@ public function startTest($test)
return;
}

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

$r = new \ReflectionProperty(Test::class, 'annotationCache');
$r->setAccessible(true);

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

0 comments on commit 5598233

Please sign in to comment.