Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 9b89115

Browse files
committed
bug #36569 [PhpUnitBridge] Mark parent class also covered in CoverageListener (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
2 parents 6340e87 + dcb5653 commit 9b89115

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

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

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,10 +73,19 @@ public function startTest($test)
7373
$r = new \ReflectionProperty($testClass, 'annotationCache');
7474
$r->setAccessible(true);
7575

76+
$covers = $sutFqcn;
77+
if (!\is_array($sutFqcn)) {
78+
$covers = [$sutFqcn];
79+
while ($parent = get_parent_class($sutFqcn)) {
80+
$covers[] = $parent;
81+
$sutFqcn = $parent;
82+
}
83+
}
84+
7685
$cache = $r->getValue();
7786
$cache = array_replace_recursive($cache, array(
7887
\get_class($test) => array(
79-
'covers' => \is_array($sutFqcn) ? $sutFqcn : array($sutFqcn),
88+
'covers' => $covers,
8089
),
8190
));
8291
$r->setValue($testClass, $cache);

0 commit comments

Comments
 (0)