PhpUnitJson reports an unfinished test as error at the end

This commit is contained in:
SimonHeimberg 2017-12-12 09:06:25 +01:00
commit 80e01a7e9e

View file

@ -40,11 +40,22 @@ class PhpUnitResultJson extends PhpUnitResult
$this->failures = 0;
if ($events) {
$started = null;
foreach ($events as $event) {
if (isset($event['event']) && $event['event'] == self::EVENT_TEST) {
$this->parseTestcase($event);
$started = null;
} elseif (isset($event['event']) && $event['event'] == self::EVENT_TEST_START) {
$started = $event;
}
}
if ($started) {
$event = $started;
$event['status'] = 'error';
$event['message'] = 'Test is not finished';
$event['output'] = '';
$this->parseTestcase($event);
}
}
return $this;