getExceptionAsString() public method

Returns a description for the thrown exception.
public getExceptionAsString ( ) : string
return string
コード例 #1
0
 /**
  * @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
0
ファイル: UI.php プロジェクト: itillawarra/cmfive
 /**
  * @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
0
 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
0
ファイル: ResultPrinter.php プロジェクト: qcodo/qcodo
 /**
  * @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
0
ファイル: ResultPrinter.php プロジェクト: ramonornela/phpunit
 /**
  * @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
0
 /**
  * @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
0
 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);
 }