PhpUnitJunit explains clearly an empty output file

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

View file

@ -133,10 +133,23 @@ class PhpUnitResultJunit extends PhpUnitResult
*/
private function loadResultFile()
{
if (!file_exists($this->outputFile) || 0 === filesize($this->outputFile)) {
$this->internalProblem('empty output file');
return new \SimpleXMLElement('<empty/>'); // new empty element
}
if (true) {
$suites = simplexml_load_file($this->outputFile);
}
return $suites;
}
private function internalProblem($description)
{
throw new \Exception($description);
// alternative to error throwing: append to $this->errors
}
}