Skip to content

Commit

Permalink
bug #36569 [PhpUnitBridge] Mark parent class also covered in Coverage…
Browse files Browse the repository at this point in the history
…Listener (lyrixx)

This PR was merged into the 3.4 branch.

Discussion
----------

[PhpUnitBridge] Mark parent class also covered in CoverageListener

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | no
| New feature?  | yes
| Deprecations? | no
| Tickets       |
| License       | MIT
| Doc PR        |

Commits
-------

dcb5653 [PhpUnitBridge] Mark parent class also covered in CoverageListener
  • Loading branch information
fabpot committed May 5, 2020
2 parents 6340e87 + dcb5653 commit 9b89115
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 9b89115

Please sign in to comment.