1
0
Fork 0

Only treat errors as real failures, fixes #5601

pull/5503/merge
Jordi Boggiano 2016-09-12 11:00:38 +02:00
parent cfdeb61779
commit b29d810d63
1 changed files with 30 additions and 11 deletions

View File

@ -385,23 +385,42 @@ EOT
private function outputResult($result) private function outputResult($result)
{ {
$io = $this->getIO(); $io = $this->getIO();
$hadError = false;
if (true === $result) { if (true === $result) {
$io->write('<info>OK</info>'); $io->write('<info>OK</info>');
return;
}
if ($result instanceof \Exception) {
$result = '<error>['.get_class($result).'] '.$result->getMessage().'</error>';
}
if (!$result) {
// falsey results should be considered as an error, even if there is nothing to output
$hadError = true;
} else { } else {
$this->failures++; if (!is_array($result)) {
$io->write('<error>FAIL</error>'); $result = array($result);
if ($result instanceof \Exception) { }
$io->write('['.get_class($result).'] '.$result->getMessage()); foreach ($result as $message) {
} elseif ($result) { if (false !== strpos($message, '<error>')) {
if (is_array($result)) { $hadError = true;
foreach ($result as $message) {
$io->write($message);
}
} else {
$io->write($result);
} }
} }
} }
if ($hadError) {
$io->write('<error>FAIL</error>');
$this->failures++;
} else {
$io->write('<warning>WARNING</warning>');
}
if ($result) {
foreach ($result as $message) {
$io->write($message);
}
}
} }
private function checkPlatform() private function checkPlatform()