当前位置: 首页>>代码示例>>PHP>>正文


PHP PHPUnit_Framework_TestFailure::getExceptionAsString方法代码示例

本文整理汇总了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();
     }
 }
开发者ID:psychomieze,项目名称:parallel-phpunit-resultprinter,代码行数:20,代码来源:ResultPrinter.php

示例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();
     }
 }
开发者ID:itillawarra,项目名称:cmfive,代码行数:16,代码来源:UI.php

示例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;
 }
开发者ID:xiaoguizhidao,项目名称:koala-framework,代码行数:38,代码来源:TestResult.php

示例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));
 }
开发者ID:qcodo,项目名称:qcodo,代码行数:7,代码来源:ResultPrinter.php

示例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();
     }
 }
开发者ID:ramonornela,项目名称:phpunit,代码行数:12,代码来源:ResultPrinter.php

示例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));
     }
 }
开发者ID:joskfg,项目名称:guard-phpunit2,代码行数:15,代码来源:ResultPrinter.php

示例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);
 }
开发者ID:staabm,项目名称:redaxo,代码行数:6,代码来源:tests_result_printer.php


注:本文中的PHPUnit_Framework_TestFailure::getExceptionAsString方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。