/** * Print a failure message and provide some explanatory output * about what went wrong if so configured. * * @param ParserTestResult $testResult * @return bool */ private function showFailure(ParserTestResult $testResult) { if ($this->showFailure) { if (!$this->showProgress) { # In quiet mode we didn't show the 'Testing' message before the # test, in case it succeeded. Show it now: $this->showTesting($testResult->getDescription()); } print $this->term->color('31') . 'FAILED!' . $this->term->reset() . "\n"; if ($this->showOutput) { print "--- Expected ---\n{$testResult->expected}\n"; print "--- Actual ---\n{$testResult->actual}\n"; } if ($this->showDiffs) { print $this->quickDiff($testResult->expected, $testResult->actual); if (!$this->wellFormed($testResult->actual)) { print "XML error: {$this->xmlError}\n"; } } } return false; }
function record($test, ParserTestResult $result) { $this->results[$test['desc']] = $result->isSuccess() ? 1 : 0; }
/** * Record an individual test item's success or failure to the db * * @param array $test * @param ParserTestResult $result */ function record($test, ParserTestResult $result) { $this->db->insert('testitem', ['ti_run' => $this->curRun, 'ti_name' => $test['desc'], 'ti_success' => $result->isSuccess() ? 1 : 0], __METHOD__); }