本文整理汇总了PHP中PHPUnit_Framework_AssertionFailedError::toString方法的典型用法代码示例。如果您正苦于以下问题:PHP PHPUnit_Framework_AssertionFailedError::toString方法的具体用法?PHP PHPUnit_Framework_AssertionFailedError::toString怎么用?PHP PHPUnit_Framework_AssertionFailedError::toString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PHPUnit_Framework_AssertionFailedError
的用法示例。
在下文中一共展示了PHPUnit_Framework_AssertionFailedError::toString方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: paintFail
/**
* 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']);
}
示例2: addFailure
/**
* 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());
}
示例3: addFailure
/**
* 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();
}
示例4: addFailure
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();
}
示例5: addFailure
public function addFailure(PHPUnit_Framework_Test $test, PHPUnit_Framework_AssertionFailedError $e, $time) {
$this->addTestResult($test, 'Failure [' . $e->toString() .']');
}
示例6: getTraceFiles
/**
* 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;
}