Skip to content

Commit

Permalink
Update XPath query in PHPUnit enricher to support namespace in class
Browse files Browse the repository at this point in the history
name attribute

Fixes #332
  • Loading branch information
theseer committed May 6, 2018
1 parent 48c3b0f commit 6e8d871
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/generator/enricher/phpunit/PHPUnit.php
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ private function loadXML($fname) {
);
}
$dom->registerNamespace('pu', self::XMLNS);

return $dom;
} catch (fDOMException $e) {
throw new EnricherException(
Expand All @@ -148,8 +149,9 @@ private function processUnit(fDOMDocument $unit, fDOMDocument $coverage) {
$classNamespace = $unit->documentElement->getAttribute('namespace');

$classNode = $coverage->queryOne(
sprintf('//pu:class[@name = "%s" and pu:namespace[@name = "%s"]]', $className, $classNamespace)
sprintf('//pu:class[@name = "%2$s\%1$s" or (@name = "%1$s" and pu:namespace[@name = "%2$s"])]', $className, $classNamespace)
);

if (!$classNode) {
// This class seems to be newer than the last phpunit run
return;
Expand Down

0 comments on commit 6e8d871

Please sign in to comment.