本文整理汇总了PHP中PHPUnit_Framework_AssertionFailedError::getMessage方法的典型用法代码示例。如果您正苦于以下问题:PHP PHPUnit_Framework_AssertionFailedError::getMessage方法的具体用法?PHP PHPUnit_Framework_AssertionFailedError::getMessage怎么用?PHP PHPUnit_Framework_AssertionFailedError::getMessage使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PHPUnit_Framework_AssertionFailedError
的用法示例。
在下文中一共展示了PHPUnit_Framework_AssertionFailedError::getMessage方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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
/**
* A failure occurred.
*
* @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)
{
$this->write('fail: ' . $e->getMessage());
$trace = current(PHPUnit_Util_Filter::getFilteredStacktrace($e, FALSE));
$this->write('trace: ' . print_r($trace, 1));
$this->currentTestPass = FALSE;
}
示例3: onNotSuccessfulTest
protected function onNotSuccessfulTest(\Exception $e)
{
if ($e instanceof PredictionException) {
$e = new \PHPUnit_Framework_AssertionFailedError($e->getMessage(), $e->getCode(), $e);
}
return parent::onNotSuccessfulTest($e);
}
示例4: addFailure
/**
* A failure occurred.
*
* @param PHPUnit_Framework_Test $test
* @param PHPUnit_Framework_AssertionFailedError $e
* @param float $time
* @return void
* @author Karsten Dambekalns <karsten@typo3.org>
*/
public function addFailure(\PHPUnit_Framework_Test $test, \PHPUnit_Framework_AssertionFailedError $e, $time)
{
$testCaseTraceArr = $this->getFirstNonPHPUnitTrace($e->getTrace());
$fileName = $testCaseTraceArr['file'];
echo '<script type="text/javascript">document.getElementById("progress-bar").style.backgroundImage = "url(_Resources/Static/Packages/Testing/Media/indicator_red.gif)";</script>
<div class="test failure"><strong>Failure</strong> in <em>' . $test->getName() . '</em> ' . '<img src="_Resources/Static/Packages/Testing/Media/failure.png" alt="Detail" onclick="if(document.getElementById(\'test' . $this->currentTestNumber . '\').style.display==\'none\') document.getElementById(\'test' . $this->currentTestNumber . '\').style.display=\'block\'; else document.getElementById(\'test' . $this->currentTestNumber . '\').style.display=\'none\'" />' . '<div class="testdetail" id="test' . $this->currentTestNumber . '">' . $fileName . ':' . $testCaseTraceArr['line'] . '<br />' . htmlspecialchars($e->getMessage()) . '<br /><div class="testoutput">' . $this->getTestOutput() . '</div></div></div>';
$this->resultArray['failure']++;
$this->flushOutputBuffer();
}
示例5: 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");
}
示例6: addFailure
/**
* A failure occurred.
*
* @param PHPUnit_Framework_Test $test
* @param PHPUnit_Framework_AssertionFailedError $e
* @param float $time
* @return void
*/
public function addFailure(PHPUnit_Framework_Test $test, PHPUnit_Framework_AssertionFailedError $e, $time)
{
$message = sprintf("%s FAILURE: %s (Duration: %s sec)", str_repeat(' ', $this->level), str_replace("\n", " ", $e->getMessage()), $this->getDuration());
if ($this->colors) {
$this->write("[41;37m{$message}[0m" . "\n");
} else {
$this->write($message . "\n");
}
$this->lastTestFailed = TRUE;
}
示例7: 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 "|";
}
}
示例8: 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;
}
}
示例9: printFailure
private function printFailure(PHPUnit_Framework_AssertionFailedError $e)
{
YTestLogger::indent();
YTestLogger::say($e->getMessage() . "\n");
foreach ($e->getTrace() as $frame) {
if (array_key_exists('file', $frame)) {
$file = $frame['file'];
if (strpos($file, 'PHPUnit/') || strpos($file, 'CustomTestCase')) {
break;
}
YTestLogger::say($file . ":" . $frame['line'] . "\n");
}
}
YTestLogger::dedent();
}
示例10: addFailure
public function addFailure(PHPUnit_Framework_Test $test, PHPUnit_Framework_AssertionFailedError $e, $time)
{
$this->error = true;
echo self::TERM_RED, 'failed: ', $e->getMessage(), ' (took ', $time, 's).', self::TERM_END, "\n";
}
示例11: addFailure
/**
* A failure occurred.
*
* @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)
{
$this->lastFailureMessage = "Test FAILURE (" . $test->getName() . "): " . $e->getMessage();
}
示例12: addFailure
public function addFailure(PHPUnit_Framework_Test $test, PHPUnit_Framework_AssertionFailedError $e, $time)
{
if ($test instanceof PHPUnit_Framework_Warning) {
return;
}
$message = $e->getMessage();
print traceCommand("testFailed", "name", $test->getName(), "message", $message, "details", getTraceMessage($e->getTrace(), $this->myfilename));
flush();
}
示例13: addFailure
/**
* Implement PHPUnit_Framework_TestListener, save driver content if there was an error
* @param \PHPUnit_Framework_Test $test
* @param \PHPUnit_Framework_AssertionFailedError $failure
* @param integer $time
*/
public function addFailure(\PHPUnit_Framework_Test $test, \PHPUnit_Framework_AssertionFailedError $failure, $time)
{
if ($test instanceof Testcase_Spiderling and $test->is_driver_active() and $test->driver()->is_page_active()) {
$this->save_driver_content($test->driver(), get_class($test) . '_' . $test->getName(FALSE), $failure->getMessage());
}
}
示例14: addFailure
/**
* A failure occurred.
*
* @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)
{
$this->failures[$test->toString()] = $e->getMessage();
parent::addFailure($test, $e, $time);
}
示例15: toString
/**
* Returns "..." in place of common prefix and "..." in
* place of common suffix between expected and actual.
*
* @return string
* @access public
*/
public function toString()
{
if ($this->fExpected == null && $this->fActual == null) {
return PHPUnit_Framework_Assert::format($this->fExpected, $this->fActual, parent::getMessage());
}
$end = min(strlen($this->fExpected), strlen($this->fActual));
$i = 0;
$j = strlen($this->fExpected) - 1;
$k = strlen($this->fActual) - 1;
for (; $i < $end; $i++) {
if ($this->fExpected[$i] != $this->fActual[$i]) {
break;
}
}
for (; $k >= $i && $j >= $i; $k--, $j--) {
if ($this->fExpected[$j] != $this->fActual[$k]) {
break;
}
}
if ($j < $i && $k < $i) {
$expected = $this->fExpected;
$actual = $this->fActual;
} else {
$expected = substr($this->fExpected, $i, $j + 1 - $i);
$actual = substr($this->fActual, $i, $k + 1 - $i);
if ($i <= $end && $i > 0) {
$expected = '...' . $expected;
$actual = '...' . $actual;
}
if ($j < strlen($this->fExpected) - 1) {
$expected .= '...';
}
if ($k < strlen($this->fActual) - 1) {
$actual .= '...';
}
return PHPUnit_Framework_Assert::format($expected, $actual, parent::getMessage());
}
}