diff --git a/src/unit/ArcanistUnitTestResult.php b/src/unit/ArcanistUnitTestResult.php index a30789c2..3b43f60a 100644 --- a/src/unit/ArcanistUnitTestResult.php +++ b/src/unit/ArcanistUnitTestResult.php @@ -66,6 +66,18 @@ final class ArcanistUnitTestResult { return $this->result; } + public function getConsoleFormattedResult() { + static $status_codes = array( + self::RESULT_PASS => '** PASS **', + self::RESULT_FAIL => '** FAIL **', + self::RESULT_SKIP => '** SKIP **', + self::RESULT_BROKEN => '** BROKEN **', + self::RESULT_UNSOUND => '** UNSOUND **', + self::RESULT_POSTPONED => '** POSTPONED **', + ); + return phutil_console_format($status_codes[$this->result]); + } + public function setDuration($duration) { $this->duration = $duration; return $this; diff --git a/src/workflow/ArcanistUnitWorkflow.php b/src/workflow/ArcanistUnitWorkflow.php index c4eb2e85..692580c1 100644 --- a/src/workflow/ArcanistUnitWorkflow.php +++ b/src/workflow/ArcanistUnitWorkflow.php @@ -147,21 +147,6 @@ EOTEXT $results = $this->engine->run(); $this->testResults = $results; - $status_codes = array( - ArcanistUnitTestResult::RESULT_PASS => phutil_console_format( - '** PASS **'), - ArcanistUnitTestResult::RESULT_FAIL => phutil_console_format( - '** FAIL **'), - ArcanistUnitTestResult::RESULT_SKIP => phutil_console_format( - '** SKIP **'), - ArcanistUnitTestResult::RESULT_BROKEN => phutil_console_format( - '** BROKEN **'), - ArcanistUnitTestResult::RESULT_UNSOUND => phutil_console_format( - '** UNSOUND **'), - ArcanistUnitTestResult::RESULT_POSTPONED => phutil_console_format( - '** POSTPONED **'), - ); - $console = PhutilConsole::getConsole(); $unresolved = array(); @@ -180,7 +165,7 @@ EOTEXT } $console->writeOut( " %s %s\n", - $status_codes[$result_code].$duration, + $result->getConsoleFormattedResult().$duration, $result->getName()); } if ($result_code != ArcanistUnitTestResult::RESULT_PASS) { @@ -197,9 +182,11 @@ EOTEXT } } if ($postponed_count) { + $postponed = id(new ArcanistUnitTestResult()) + ->setResult(ArcanistUnitTestResult::RESULT_POSTPONED); $console->writeOut( "%s %s\n", - $status_codes[ArcanistUnitTestResult::RESULT_POSTPONED], + $postponed->getConsoleFormattedResult(), pht('%d test(s)', $postponed_count)); }