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


PHP PHPUnit_Framework_TestFailure::thrownException方法代码示例

本文整理汇总了PHP中PHPUnit_Framework_TestFailure::thrownException方法的典型用法代码示例。如果您正苦于以下问题:PHP PHPUnit_Framework_TestFailure::thrownException方法的具体用法?PHP PHPUnit_Framework_TestFailure::thrownException怎么用?PHP PHPUnit_Framework_TestFailure::thrownException使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PHPUnit_Framework_TestFailure的用法示例。


在下文中一共展示了PHPUnit_Framework_TestFailure::thrownException方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: printDefectTrace

 protected function printDefectTrace(\PHPUnit_Framework_TestFailure $defect)
 {
     $this->write($this->formatExceptionMsg($defect->getExceptionAsString()));
     $trace = \PHPUnit_Util_Filter::getFilteredStacktrace($defect->thrownException());
     if (!empty($trace)) {
         $this->write("\n" . $trace);
     }
     $exception = $defect->thrownException()->getPrevious();
     while ($exception) {
         $this->write("\nCaused by\n" . \PHPUnit_Framework_TestFailure::exceptionToString($e) . "\n" . \PHPUnit_Util_Filter::getFilteredStacktrace($e));
         $exception = $exception->getPrevious();
     }
 }
开发者ID:diablomedia,项目名称:phpunit-pretty-printer,代码行数:13,代码来源:PrettyPrinter.php

示例2: printDefectTrace

 protected function printDefectTrace(\PHPUnit_Framework_TestFailure $defect)
 {
     $e = $defect->thrownException();
     if (!$e instanceof \atk4\core\PHPUnit_AgileExceptionWrapper) {
         return parent::printDefectTrace($defect);
     }
     $this->write((string) $e);
     $p = $e->getPrevious();
     if ($p instanceof \atk4\core\Exception or $p instanceof \atk4\dsql\Exception) {
         $this->write($p->getColorfulText());
     }
 }
开发者ID:atk4,项目名称:core,代码行数:12,代码来源:PHPUnit_AgileResultPrinter.php

示例3: 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

示例4: _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

示例5: getException

 /**
  * Gets the thrown exception from a PHPUnit_Framework_TestFailure.
  *
  * @param PHPUnit_Framework_TestFailure $error
  * @since Method available since Release 3.6.0
  * @see   https://github.com/sebastianbergmann/phpunit/issues/74
  */
 protected function getException(PHPUnit_Framework_TestFailure $error)
 {
     $exception = $error->thrownException();
     if ($exception instanceof __PHP_Incomplete_Class) {
         $exceptionArray = array();
         foreach ((array) $exception as $key => $value) {
             $key = substr($key, strrpos($key, "") + 1);
             $exceptionArray[$key] = $value;
         }
         $exception = new PHPUnit_Framework_SyntheticError(sprintf('%s: %s', $exceptionArray['_PHP_Incomplete_Class_Name'], $exceptionArray['message']), $exceptionArray['code'], $exceptionArray['file'], $exceptionArray['line'], $exceptionArray['trace']);
     }
     return $exception;
 }
开发者ID:DaveNascimento,项目名称:civicrm-packages,代码行数:20,代码来源:PHP.php

示例6: 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

示例7: printDefectTrace

 /**
  * @param PHPUnit_Framework_TestFailure $defect
  */
 protected function printDefectTrace(PHPUnit_Framework_TestFailure $defect)
 {
     $e = $defect->thrownException();
     $this->write((string) $e);
     while ($e = $e->getPrevious()) {
         $this->write("\nCaused by\n" . $e);
     }
 }
开发者ID:stephenmoore56,项目名称:mooredatabase-laravel,代码行数:11,代码来源:ResultPrinter.php

示例8: printDefectTrace

 /**
  * @param  PHPUnit_Framework_TestFailure $defect
  * @access protected
  */
 protected function printDefectTrace(PHPUnit_Framework_TestFailure $defect)
 {
     $e = $defect->thrownException();
     if ($e instanceof PHPUnit_Framework_SelfDescribing) {
         $buffer = $e->toString();
         if (!empty($buffer)) {
             $buffer .= "\n";
         }
         if ($e instanceof PHPUnit_Framework_ExpectationFailedException) {
             $comparisonFailure = $e->getComparisonFailure();
             if ($comparisonFailure !== NULL) {
                 if ($comparisonFailure instanceof PHPUnit_Framework_ComparisonFailure_Scalar) {
                     $buffer .= sprintf("Failed asserting that %s matches expected value %s.\n", PHPUnit_Util_Type::toString($comparisonFailure->getActual()), PHPUnit_Util_Type::toString($comparisonFailure->getExpected()));
                 } else {
                     if (PHPUnit_Framework_ComparisonFailure::hasDiff() && ($comparisonFailure instanceof PHPUnit_Framework_ComparisonFailure_Array || $comparisonFailure instanceof PHPUnit_Framework_ComparisonFailure_Object || $comparisonFailure instanceof PHPUnit_Framework_ComparisonFailure_String)) {
                         $buffer .= sprintf("Failed asserting that two %ss are equal.\n%s\n", strtolower(substr(get_class($comparisonFailure), 36)), $comparisonFailure->toString());
                     }
                 }
                 if ($this->verbose && !$comparisonFailure instanceof PHPUnit_Framework_ComparisonFailure_Array && !$comparisonFailure instanceof PHPUnit_Framework_ComparisonFailure_Object && !$comparisonFailure instanceof PHPUnit_Framework_ComparisonFailure_String) {
                     $buffer .= $comparisonFailure->toString() . "\n";
                 }
             } else {
                 $buffer .= $e->getDescription() . "\n";
             }
         }
     } else {
         if ($e instanceof PHPUnit_Framework_Error) {
             $buffer = $e->getMessage() . "\n";
         } else {
             $buffer = get_class($e) . ': ' . $e->getMessage() . "\n";
         }
     }
     $this->write($buffer . PHPUnit_Util_Filter::getFilteredStacktrace($defect->thrownException(), FALSE));
 }
开发者ID:dalinhuang,项目名称:shopexts,代码行数:38,代码来源:ResultPrinter.php

示例9: 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

示例10: printDefectTrace

 /**
  * @param  PHPUnit_Framework_TestFailure $defect
  * @param  string                        $padding
  */
 protected function printDefectTrace(PHPUnit_Framework_TestFailure $defect, $padding = 0)
 {
     $trace = trim(PHPUnit_Util_Filter::getFilteredStacktrace($defect->thrownException()));
     if (!empty($trace)) {
         $trace = explode("\n", $trace);
         $trace = "\n" . $padding . '# ' . implode("\n{$padding}# ", $trace);
         $this->write($this->cyan($trace));
     }
 }
开发者ID:joskfg,项目名称:guard-phpunit2,代码行数:13,代码来源:ResultPrinter.php

示例11: printDefectTrace

 /**
  * @param  PHPUnit_Framework_TestFailure $defect
  * @access protected
  */
 protected function printDefectTrace(PHPUnit_Framework_TestFailure $defect)
 {
     $this->write('<description>');
     $e = $defect->thrownException();
     if ($e instanceof PHPUnit_Framework_SelfDescribing) {
         $this->write($e->toString(), true);
         if ($e instanceof PHPUnit_Framework_ExpectationFailedException) {
             $comparisonFailure = $e->getComparisonFailure();
             if ($comparisonFailure !== NULL && $comparisonFailure instanceof PHPUnit_Framework_ComparisonFailure_String) {
                 $this->write($comparisonFailure->toString(), true);
             }
         }
     } elseif ($e instanceof PHPUnit_Framework_Error) {
         $this->write($e->getMessage(), true);
     } else {
         $this->write(get_class($e) . ': ' . $e->getMessage(), true);
     }
     $this->write(PHPUnit_Util_Filter::getFilteredStacktrace($defect->thrownException(), FALSE), true);
     $this->write('</description>');
 }
开发者ID:JVS-IS,项目名称:ICONITO-EcoleNumerique,代码行数:24,代码来源:CopixTestXMLPrinter.class.php

示例12: 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

示例13: printDefectTrace

 /**
  * @param  PHPUnit_Framework_TestFailure $defect
  * @access protected
  */
 protected function printDefectTrace(PHPUnit_Framework_TestFailure $defect)
 {
     print $defect->thrownException()->toString() . "\n";
     print PHPUnit_Runner_BaseTestRunner::getFilteredStack($defect->thrownException());
 }
开发者ID:amjadtbssm,项目名称:website,代码行数:9,代码来源:ResultPrinter.php


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