/** * * Formats a test line, logs it, and saves the info. * * @param int $exit Pass, skip, todo, or fail. * * @param string $name The test name. * * @param string $note Additional note about the test. * * @param string $diag Diagnostics for the test. * * @return void * */ protected function _done($exit, $name, $note = null, $diag = null) { $this->_info['done']++; $text = ''; if (is_array($diag) || is_object($diag)) { $diag = $this->_var->dump($diag); } $diag = trim($diag); if ($diag) { $text = "{$text}\n# " . str_replace("\n", "\n# ", trim($diag)); } if ($text) { $text .= "\n"; } $num = $this->_info['done']; $note = ltrim($note, '# '); switch ($exit) { case Solar_Test::EXIT_FAIL: $type = 'fail'; $text .= "not ok {$num} - {$name} # FAIL {$note}"; break; case Solar_Test::EXIT_TODO: $type = 'todo'; $text .= "not ok {$num} - {$name} # TODO {$note}"; break; case Solar_Test::EXIT_SKIP: $type = 'skip'; $text .= "ok {$num} - {$name} # SKIP {$note}"; break; case Solar_Test::EXIT_PASS: $type = 'pass'; $text .= "ok {$num} - {$name}"; break; default: $type = 'fail'; $text .= "not ok {$num} - {$name} # FAIL exit code '{$exit}'"; break; } $this->_test_result = $type; $this->_log($text); $this->_info[$type][$name] = array($num, $note); }