/** * Paints a failing test. * * @param PHPUnit_Framework_AssertionFailedError $message Failure object displayed in * the context of the other tests. * @return void */ public function paintFail($message) { $context = $message->getTrace(); $realContext = $context[3]; $context = $context[2]; printf("FAIL on line %s\n%s in\n%s %s()\n\n", $context['line'], $message->toString(), $context['file'], $realContext['function']); }
/** * Adds the failure detail to the current test and increases the failure * count for the current suite * * @param PHPUnit_Framework_Test $test current test that is being run * @param PHPUnit_Framework_AssertionFailedError $e PHPUnit error * @param int $time */ public function addFailure(PHPUnit_Framework_Test $test, PHPUnit_Framework_AssertionFailedError $e, $time) { if ($this->currentSuite) { $this->currentSuite['failures']++; } else { $this->currentSession['failures']++; } $this->addStatus(TEST_FAILURE, $e->toString(), $this->getTestException($test, $e), $e->getTrace()); }
/** * Adds the failure detail to the current test and increases the failure * count for the current suite * * @access public * @param obj PHPUnit_Framework_Test, current test that is being run * @param obj PHPUnit_Framework_AssertationFailedError, PHPUnit error * @return void */ public function addFailure(PHPUnit_Framework_Test $test, PHPUnit_Framework_AssertionFailedError $e, $time) { $this->currentSuite['failures']++; $this->currentTest['status'] = TEST_FAILURE; $this->currentTest['message'] = $e->toString(); $this->currentTest['exception'] = $this->getTestException($test, $e); $this->currentTest['trace'] = $e->getTrace(); }
public function addFailure(PHPUnit_Framework_Test $test, PHPUnit_Framework_AssertionFailedError $e, $time) { $name = strpos($test->getName(), '::') ? $test->getName() : $this->current_test_suite . '::' . $test->getName(); $this->failed_tests[$name] = $e->toString(); }
public function addFailure(PHPUnit_Framework_Test $test, PHPUnit_Framework_AssertionFailedError $e, $time) { $this->addTestResult($test, 'Failure [' . $e->toString() .']'); }
/** * Function to extract our test file information from the $e stack trace. * Makes the error reporting more readable, since it filters out all of the PHPUnit files. * * @param PHPUnit_Framework_AssertionFailedError $e * @return string with selected files based on path */ public function getTraceFiles($e) { $trace = $e->getTrace(); $path = $this->cfg->folder . $this->cfg->path; $path = str_replace('\\', '/', $path); $message = ''; foreach ($trace as $traceLine) { if (isset($traceLine['file'])) { $file = str_replace('\\', '/', $traceLine['file']); if (stripos($file, $path) !== false) { $message .= "\n" . $traceLine['file'] . '(' . $traceLine['line'] . '): ' . $traceLine['class'] . $traceLine['type'] . $traceLine['function']; } } } return $e->toString() . $message; }