本文整理汇总了PHP中PHPUnit_Framework_TestFailure::getExceptionAsString方法的典型用法代码示例。如果您正苦于以下问题:PHP PHPUnit_Framework_TestFailure::getExceptionAsString方法的具体用法?PHP PHPUnit_Framework_TestFailure::getExceptionAsString怎么用?PHP PHPUnit_Framework_TestFailure::getExceptionAsString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PHPUnit_Framework_TestFailure
的用法示例。
在下文中一共展示了PHPUnit_Framework_TestFailure::getExceptionAsString方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: printDefectTrace
/**
* @param \PHPUnit_Framework_TestFailure $defect
*/
protected function printDefectTrace(\PHPUnit_Framework_TestFailure $defect)
{
$this->write($defect->getExceptionAsString());
$this->writeResults($defect->getExceptionAsString());
$trace = \PHPUnit_Util_Filter::getFilteredStacktrace($defect->thrownException());
if (!empty($trace)) {
$this->write("\n" . $trace);
$this->writeResults("\n" . $trace);
}
$e = $defect->thrownException()->getPrevious();
while ($e) {
$buffer = "\nCaused by\n" . \PHPUnit_Framework_TestFailure::exceptionToString($e) . "\n" . \PHPUnit_Util_Filter::getFilteredStacktrace($e);
$this->write($buffer);
$this->writeResults($buffer);
$e = $e->getPrevious();
}
}
示例2: printDefectTrace
/**
* @param \PHPUnit_Framework_TestFailure $defect
*/
protected function printDefectTrace(\PHPUnit_Framework_TestFailure $defect)
{
$this->write($defect->getExceptionAsString());
$this->writeNewLine();
$stackTrace = \PHPUnit_Util_Filter::getFilteredStacktrace($defect->thrownException(), false);
foreach ($stackTrace as $i => $frame) {
if (!isset($frame['file'])) {
continue;
}
$this->write(sprintf("#%d %s(%s)", $i + 1, $frame['file'], isset($frame['line']) ? $frame['line'] : '?'));
$this->writeNewLine();
}
}
示例3: _askForRetry
private function _askForRetry(PHPUnit_Framework_Test $test, Exception $e, $time)
{
if ($e instanceof PHPUnit_Framework_IncompleteTest) {
return false;
}
if ($e instanceof PHPUnit_Framework_SkippedTest) {
return false;
}
if (file_exists("/www/testtimes")) {
$app = Kwf_Registry::get('config')->application->id;
file_put_contents("/www/testtimes/failure_{$app}/" . get_class($test), time());
}
if (!$this->_retryOnError) {
return false;
}
$error = new PHPUnit_Framework_TestFailure($test, $e);
if ($test instanceof PHPUnit_Framework_SelfDescribing) {
echo $test->toString();
} else {
echo get_class($test);
}
echo "\n";
echo $error->getExceptionAsString() . PHPUnit_Util_Filter::getFilteredStacktrace($error->thrownException(), FALSE);
echo "\nTest failed. Try again? [Y/n]";
if (isset($_SERVER['USER']) && $_SERVER['USER'] == 'niko') {
$msg = Kwf_Registry::get('config')->application->name . ' Test failed. Try again?';
$msg = str_replace(" ", "\\ ", utf8_decode($msg));
system("ssh niko \"export DISPLAY=:0 && /usr/bin/kdialog --passivepopup {$msg} 2\"");
}
$stdin = fopen('php://stdin', 'r');
$input = strtolower(trim(fgets($stdin, 2)));
fclose($stdin);
if ($input == 'j' || $input == 'y' || $input == '') {
$this->run($test);
return true;
}
return false;
}
示例4: printDefectTrace
/**
* @param PHPUnit_Framework_TestFailure $defect
*/
protected function printDefectTrace(PHPUnit_Framework_TestFailure $defect)
{
$this->write($defect->getExceptionAsString() . "\n" . PHPUnit_Util_Filter::getFilteredStacktrace($defect->thrownException(), FALSE));
}
示例5: printDefectTrace
/**
* @param PHPUnit_Framework_TestFailure $defect
*/
protected function printDefectTrace(PHPUnit_Framework_TestFailure $defect)
{
$this->write($defect->getExceptionAsString() . "\n" . PHPUnit_Util_Filter::getFilteredStacktrace($defect->thrownException()));
$e = $defect->thrownException()->getPrevious();
while ($e) {
$this->write("\nCaused by\n" . PHPUnit_Framework_TestFailure::exceptionToString($e) . "\n" . PHPUnit_Util_Filter::getFilteredStacktrace($e));
$e = $e->getPrevious();
}
}
示例6: printDefectBody
/**
* @param PHPUnit_Framework_TestFailure $defect
* @param integer $count
* @param boolean $failOrError
* @param string $padding
*/
protected function printDefectBody(PHPUnit_Framework_TestFailure $defect, $count, $failOrError, $padding)
{
$error = trim($defect->getExceptionAsString());
if (!empty($error)) {
$error = explode("\n", $error);
$error = "\n" . $padding . implode("\n " . $padding, $error);
$this->write($failOrError ? $this->red($error) : $this->cyan($error));
}
}
示例7: printDefectTrace
protected function printDefectTrace(PHPUnit_Framework_TestFailure $defect)
{
$stacktrace = PHPUnit_Util_Filter::getFilteredStacktrace($defect->thrownException());
$stacktrace = str_replace([$this->backtrace, rex_path::base()], '', $stacktrace);
$this->write($defect->getExceptionAsString() . "\n" . $stacktrace);
}