From 98648bd6b8ba4d802a9dab4d1530e975167454b7 Mon Sep 17 00:00:00 2001 From: Nathanael Noblet Date: Thu, 4 Aug 2022 12:40:56 -0600 Subject: [PATCH] Combining junit files drops the file name We were combining two junit files produced by phpunit, but the combined file loses the file name attribute. Then later when we processed with the phpmetrics project, it complained it couldn't find the file named '0'; --- src/PhpunitMerger/Command/LogCommand.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/PhpunitMerger/Command/LogCommand.php b/src/PhpunitMerger/Command/LogCommand.php index d30e6ef..10c1b63 100644 --- a/src/PhpunitMerger/Command/LogCommand.php +++ b/src/PhpunitMerger/Command/LogCommand.php @@ -95,7 +95,7 @@ private function addTestSuites(\DOMElement $parent, array $testSuites) $element->setAttribute('parent', $parent->getAttribute('name')); $attributes = $testSuite['@attributes'] ?? []; foreach ($attributes as $key => $value) { - $value = $key === 'name' ? $value : 0; + $value = $key === 'name' || $key === 'file' ? $value : 0; $element->setAttribute($key, (string)$value); } $parent->appendChild($element);