Ejemplo n.º 1
0
 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;
 }
Ejemplo n.º 2
0
 protected function print_test_fail(TestResult $result)
 {
     $case_name = $result->get_testcase();
     $running_time = $this->format_time($result->get_running_time());
     $c = new Color();
     $line = "\n" . $c("[")->reset() . $c(self::FAIL)->red() . $c("]")->reset() . $c(" [{$running_time} ms] [{$case_name}] ")->reset() . $c("{$result->get_name()}")->red() . $c(" line {$result->get_error_line()}")->reset() . PHP_EOL . PHP_EOL;
     echo $line;
     foreach ($result->assertions as $assertion) {
         if (!$assertion->result) {
             $exception = $assertion->exception;
             echo $exception->getMessage() . "AT " . $assertion->file_name . "]::" . $assertion->line_number . "\n";
             if ($this->output_debug) {
                 echo $exception->getTraceAsString() . PHP_EOL;
             }
         }
     }
 }