PhpUnitJunit loads file in a separate function

This commit is contained in:
SimonHeimberg 2018-02-21 17:20:22 +01:00 committed by Dmitry Khomutov
parent 3cdedcd972
commit e4febf6d25
No known key found for this signature in database
GPG key ID: EC19426474B37AAC

View file

@ -17,13 +17,13 @@ class PhpUnitResultJunit extends PhpUnitResult
*/ */
public function parse() public function parse()
{ {
$suites = simplexml_load_file($this->outputFile);
// Reset the parsing variables // Reset the parsing variables
$this->results = []; $this->results = [];
$this->errors = []; $this->errors = [];
$this->failures = 0; $this->failures = 0;
$suites = $this->loadResultFile();
foreach ($suites->xpath('//testcase') as $testCase) { foreach ($suites->xpath('//testcase') as $testCase) {
$this->parseTestcase($testCase); $this->parseTestcase($testCase);
} }
@ -127,4 +127,16 @@ class PhpUnitResultJunit extends PhpUnitResult
return $msg; return $msg;
} }
/**
* @return \SimpleXMLElement
*/
private function loadResultFile()
{
if (true) {
$suites = simplexml_load_file($this->outputFile);
}
return $suites;
}
} }