本文整理汇总了PHP中PHPUnit_Framework_AssertionFailedError::getTraceAsString方法的典型用法代码示例。如果您正苦于以下问题:PHP PHPUnit_Framework_AssertionFailedError::getTraceAsString方法的具体用法?PHP PHPUnit_Framework_AssertionFailedError::getTraceAsString怎么用?PHP PHPUnit_Framework_AssertionFailedError::getTraceAsString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PHPUnit_Framework_AssertionFailedError
的用法示例。
在下文中一共展示了PHPUnit_Framework_AssertionFailedError::getTraceAsString方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: addFailure
public function addFailure(PHPUnit_Framework_Test $test, PHPUnit_Framework_AssertionFailedError $e, $time)
{
$class = get_class($test);
$message = $this->escape($e->getMessage());
$trace = $this->escape($e->getTraceAsString());
echo "##teamcity[testFailed type='failure' name='{$class}.{$test->getName()}' message='{$message}'" . " details='{$trace}']\n";
}
示例2: addFailure
public function addFailure(PHPUnit_Framework_Test $test, PHPUnit_Framework_AssertionFailedError $e, $time)
{
$this->_fails += 1;
if ($this->_fails == 1) {
echo "\n<div class=\"failure\">";
}
printf("Test '%s' failed : %s.<br />\n<pre>%s</pre>\n", $test->getName(), htmlentities($e->getMessage()), (string) $e->getTraceAsString());
//echo("Failure $this->_fails : $t<br>\n");
}
示例3: addFailure
public function addFailure(PHPUnit_Framework_Test $test, PHPUnit_Framework_AssertionFailedError $e, $time)
{
if ($this->verbose) {
echo " FAIL: '" . $e->getMessage() . "'\n" . $e->getTraceAsString();
}
parent::addFailure($test, $e, $time);
if ($this->_blDBResetPerTest && !isset($test->blNoDbResetAfterTest)) {
$this->_oDBMaintenance->restoreDB($this->_iDBChangeMode, $this->_iDBChangeOutput);
echo "|";
}
}
示例4: addFailure
/**
* A failure occurred.
*
* @todo Add check that $test is instance of PHPUnit_Framework_TestCase
*
* @param PHPUnit_Framework_Test $test
* @param PHPUnit_Framework_AssertionFailedError $e
* @param float $time
*/
public function addFailure(PHPUnit_Framework_Test $test, PHPUnit_Framework_AssertionFailedError $e, $time)
{
$failures = array();
$testResult = $test->getTestResultObject();
/** @var $failure PHPUnit_Framework_TestFailure */
foreach ($testResult->failures() as $failure) {
$hash = "{$e->getMessage()} {$e->getTraceAsString()}";
if (isset($failures[$hash])) {
continue;
}
$array = array('type' => self::MESSAGE_COMPARISON_FAILURE, 'name' => $test->getName(), 'message' => $e->getMessage(), 'details' => $e->getTraceAsString());
/** @var $exception PHPUnit_Framework_ExpectationFailedException */
$exception = $failure->thrownException();
$comparisonFailure = $exception->getComparisonFailure();
if ($comparisonFailure instanceof PHPUnit_Framework_ComparisonFailure) {
$array += array('expected' => $comparisonFailure->getExpectedAsString(), 'actual' => $comparisonFailure->getActualAsString());
}
$message = $this->getServiceMessage(self::MESSAGE_TEST_FAILED, $array);
$this->write($message);
$failures[$hash] = true;
}
}