fix test result printer (#233)

This commit is contained in:
sunxyw
2023-01-04 13:45:48 +08:00
committed by GitHub
parent 690f8aed10
commit 0c13cded89

View File

@@ -115,12 +115,13 @@ class ZMResultPrinter extends CliTestDoxPrinter
protected function printFooter(TestResult $result): void protected function printFooter(TestResult $result): void
{ {
if ($result->failureCount() === 0) { $non_passed = $result->failureCount() + $result->errorCount() + $result->warningCount();
if ($non_passed === 0) {
$color = 'bg-green,fg-white,bold'; $color = 'bg-green,fg-white,bold';
$text = '[OK] No errors'; $text = '[GOOD] All tests passed';
} else { } else {
$color = 'bg-red,fg-white,bold'; $color = 'bg-red,fg-white,bold';
$text = '[ERROR] Found ' . $result->failureCount() . ' failures'; $text = '[FAIL] Found ' . $non_passed . ' non-passed tests';
} }
$this->writeWithColor($color, "\n {$text} "); $this->writeWithColor($color, "\n {$text} ");
} }