return $this->result;
}
+ public function getConsoleFormattedResult() {
+ static $status_codes = array(
+ self::RESULT_PASS => '<bg:green>** PASS **</bg>',
+ self::RESULT_FAIL => '<bg:red>** FAIL **</bg>',
+ self::RESULT_SKIP => '<bg:yellow>** SKIP **</bg>',
+ self::RESULT_BROKEN => '<bg:red>** BROKEN **</bg>',
+ self::RESULT_UNSOUND => '<bg:yellow>** UNSOUND **</bg>',
+ self::RESULT_POSTPONED => '<bg:yellow>** POSTPONED **</bg>',
+ );
+ return phutil_console_format($status_codes[$this->result]);
+ }
+
public function setDuration($duration) {
$this->duration = $duration;
return $this;
$results = $this->engine->run();
$this->testResults = $results;
- $status_codes = array(
- ArcanistUnitTestResult::RESULT_PASS => phutil_console_format(
- '<bg:green>** PASS **</bg>'),
- ArcanistUnitTestResult::RESULT_FAIL => phutil_console_format(
- '<bg:red>** FAIL **</bg>'),
- ArcanistUnitTestResult::RESULT_SKIP => phutil_console_format(
- '<bg:yellow>** SKIP **</bg>'),
- ArcanistUnitTestResult::RESULT_BROKEN => phutil_console_format(
- '<bg:red>** BROKEN **</bg>'),
- ArcanistUnitTestResult::RESULT_UNSOUND => phutil_console_format(
- '<bg:yellow>** UNSOUND **</bg>'),
- ArcanistUnitTestResult::RESULT_POSTPONED => phutil_console_format(
- '<bg:yellow>** POSTPONED **</bg>'),
- );
-
$console = PhutilConsole::getConsole();
$unresolved = array();
}
$console->writeOut(
" %s %s\n",
- $status_codes[$result_code].$duration,
+ $result->getConsoleFormattedResult().$duration,
$result->getName());
}
if ($result_code != ArcanistUnitTestResult::RESULT_PASS) {
}
}
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));
}