protected function get_test_fail(TestResult $result) { $exception = $result->get_exception(); $output = "<li class='fail'>\n<span class='fail'>" . self::FAIL . "</span>\n"; $output .= "<span class='test_name'>{$result->get_name()} line {$result->get_error_line()}</span>\n"; $output .= "<pre class='message'>{$exception->getMessage()}</pre>\n"; $output .= "<pre class='stack_trace'>{$exception->getTraceAsString()}</pre>\n</li>\n"; return $output; }
protected function print_test_fail(TestResult $result) { $case_name = $result->get_testcase(); $running_time = $this->format_time($result->get_running_time()); $exception = $result->get_exception(); $line = $result->get_error_line(); echo "\n[" . self::RED_TEXT . self::FAIL . self::WHITE_TEXT . "] [{$running_time} ms] [{$case_name}] " . self::RED_TEXT . "{$result->get_name()}" . self::WHITE_TEXT . " line {$result->get_error_line()}\n\n"; echo $exception->getMessage() . "\n"; echo $exception->getTraceAsString() . "\n\n"; }
function test_initialize() { $test_result = new TestResult("test name"); $this->assert_equals("test name", $test_result->get_name()); }