From e4febf6d25fb57f57c81f07538d68c1cfa295db6 Mon Sep 17 00:00:00 2001 From: SimonHeimberg Date: Wed, 21 Feb 2018 17:20:22 +0100 Subject: [PATCH] PhpUnitJunit loads file in a separate function --- src/Plugin/Util/PhpUnitResultJunit.php | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/Plugin/Util/PhpUnitResultJunit.php b/src/Plugin/Util/PhpUnitResultJunit.php index 3f41cb8f..3aa29cee 100644 --- a/src/Plugin/Util/PhpUnitResultJunit.php +++ b/src/Plugin/Util/PhpUnitResultJunit.php @@ -17,13 +17,13 @@ class PhpUnitResultJunit extends PhpUnitResult */ public function parse() { - $suites = simplexml_load_file($this->outputFile); - // Reset the parsing variables $this->results = []; $this->errors = []; $this->failures = 0; + $suites = $this->loadResultFile(); + foreach ($suites->xpath('//testcase') as $testCase) { $this->parseTestcase($testCase); } @@ -127,4 +127,16 @@ class PhpUnitResultJunit extends PhpUnitResult return $msg; } + + /** + * @return \SimpleXMLElement + */ + private function loadResultFile() + { + if (true) { + $suites = simplexml_load_file($this->outputFile); + } + + return $suites; + } }