From 30349014b7420591120ce7b9c0d74f0097863172 Mon Sep 17 00:00:00 2001 From: SimonHeimberg Date: Wed, 21 Feb 2018 17:21:53 +0100 Subject: [PATCH] PhpUnitJunit explains clearly an empty output file --- src/Plugin/Util/PhpUnitResultJunit.php | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/Plugin/Util/PhpUnitResultJunit.php b/src/Plugin/Util/PhpUnitResultJunit.php index 3aa29cee..776e6513 100644 --- a/src/Plugin/Util/PhpUnitResultJunit.php +++ b/src/Plugin/Util/PhpUnitResultJunit.php @@ -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(''); // 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 + } }