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


PHP PHPUnit_Util_Filter::getFilteredStacktrace方法代码示例

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


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

示例1: 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;
 }
开发者ID:k-kalashnikov,项目名称:geekcon.local,代码行数:14,代码来源:phpunit_test_listener_plain.php

示例2: __toString

 /**
  * @return string
  */
 public function __toString()
 {
     $string = PHPUnit_Framework_TestFailure::exceptionToString($this);
     if ($trace = PHPUnit_Util_Filter::getFilteredStacktrace($this)) {
         $string .= "\n" . $trace;
     }
     return $string;
 }
开发者ID:ronaldbao,项目名称:phpunit,代码行数:11,代码来源:Exception.php

示例3: failureDescription

 /**
  * Returns the description of the failure
  *
  * The beginning of failure messages is "Failed asserting that" in most
  * cases. This method should return the second part of that sentence.
  *
  * @param mixed $other Evaluated value or object.
  *
  * @return string
  */
 protected function failureDescription($other)
 {
     if ($other !== null) {
         $message = '';
         if ($other instanceof Throwable) {
             $message = '. Message was: "' . $other->getMessage() . '" at' . "\n" . PHPUnit_Util_Filter::getFilteredStacktrace($other);
         }
         return sprintf('exception of type "%s" matches expected exception "%s"%s', get_class($other), $this->className, $message);
     }
     return sprintf('exception of type "%s" is thrown', $this->className);
 }
开发者ID:sebastianbergmann,项目名称:phpunit,代码行数:21,代码来源:Exception.php

示例4: prepareMessage

 /**
  * @param \Exception $exception
  * @param string $dataSetName
  * @param mixed $dataSet
  * @return string
  */
 protected function prepareMessage(\Exception $exception, $dataSetName, $dataSet)
 {
     if (!is_string($dataSetName)) {
         $dataSetName = var_export($dataSet, true);
     }
     if ($exception instanceof \PHPUnit_Framework_AssertionFailedError && !$exception instanceof \PHPUnit_Framework_IncompleteTestError && !$exception instanceof \PHPUnit_Framework_SkippedTestError || $this->_options['verbose']) {
         $dataSetName = 'Data set: ' . $dataSetName . PHP_EOL;
     } else {
         $dataSetName = '';
     }
     return $dataSetName . $exception->getMessage() . PHP_EOL . \PHPUnit_Util_Filter::getFilteredStacktrace($exception);
 }
开发者ID:pradeep-wagento,项目名称:magento2,代码行数:18,代码来源:AggregateInvoker.php

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

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

示例7: __toString

 /**
  * @return string
  */
 public function __toString()
 {
     $string = \PHPUnit_Framework_TestFailure::exceptionToString($this);
     $e = $this->getWrappedException();
     $string .= "\n  Request: " . $this->requestToString($e) . "\n" . "  HTTP status Code: " . $e->getHttpStatusCode() . "\n" . "  Is transient: " . ($e->isTransient() ? 'true' : 'false') . "\n" . "  Code: " . $e->getCode() . "\n" . "  Error Subcode: " . $e->getErrorSubcode() . "\n" . "  Error User Title: " . $e->getErrorUserTitle() . "\n" . "  Error User Message: " . $e->getErrorUserMessage() . "\n";
     if ($e->getErrorBlameFieldSpecs()) {
         $string .= "  Error Blame Fields: " . $this->blameFieldSpecsToString() . "\n";
     }
     if ($trace = \PHPUnit_Util_Filter::getFilteredStacktrace($this)) {
         $string .= "\n" . $trace;
     }
     if ($this->previous) {
         $string .= "\nCaused by\n" . $this->previous;
     }
     return $string;
 }
开发者ID:Tekill,项目名称:facebook-php-ads-sdk,代码行数:19,代码来源:PHPUnitRequestExceptionWrapper.php

示例8: printTest

 /**
  * Print test
  *
  * @param array $test
  * @param null $name
  * @return string
  */
 public function printTest(array $test, $name = NULL)
 {
     $testName = $name ? $name : $test['testName'];
     $roundPrecision = $test['time'] < 10 ? 2 : 0;
     $result = '';
     $result .= '<div class="test ' . $this->getStatusName($test['status']) . '">';
     $result .= '<div class="duration">' . round($test['time'], $roundPrecision) . 's</div>';
     $result .= '<h2>' . $this->shorten($testName) . '</h2>';
     $result .= '<div class="description">';
     if (!empty($test['description'])) {
         $result .= '<p>' . nl2br($test['description']) . '</p>';
     }
     $result .= '</div><!-- description -->';
     if (isset($test['loggedTestSteps'])) {
         $result .= $this->renderTestSteps($test['loggedTestSteps']);
     }
     if (is_array($test['info'])) {
         $result .= '<ul class="info">';
         foreach ($test['info'] as $info) {
             $result .= '<li>' . $info . '</li>';
         }
         $result .= '</ul>';
     }
     $result .= '<div class="content">';
     if ($test['exception'] instanceof Exception) {
         $e = $test['exception'];
         /* @var $e Exception */
         $result .= '<div class="exception">';
         $result .= '<i>' . nl2br($this->escape(PHPUnit_Util_Filter::getFilteredStacktrace($e))) . '</i>' . "<br />\n";
         $result .= '<pre>' . $this->escape(PHPUnit_Framework_TestFailure::exceptionToString($e)) . '</pre>';
         $result .= '</div><!-- exception -->';
     }
     if (isset($test['screenshots'])) {
         $result .= '<div class="screenshots">';
         $result .= $this->printScreenshots($test['screenshots']);
         $result .= '</div><!-- screenshots -->';
     }
     $result .= '</div><!-- content -->';
     $result .= '</div><!-- test -->';
     return $result;
 }
开发者ID:aoemedia,项目名称:menta,代码行数:48,代码来源:HtmlResultView.php

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

示例10: printResult

 public function printResult(PHPUnit_Framework_TestResult $result)
 {
     echo '<h1>QCubed ' . QCUBED_VERSION_NUMBER_ONLY . ' Unit Tests - PHPUnit ' . PHPUnit_Runner_Version::id() . '</h1>';
     foreach ($this->results as $suiteName => $suite) {
         $strHtml = "<b>{$suiteName}</b><br />";
         foreach ($suite as $testName => $test) {
             $status = $test['status'];
             $status = ucfirst($status);
             if ($test['status'] !== 'passed') {
                 $status = '<span style="color:red">' . $status . '</span>';
             } else {
                 $status = '<span style="color:green">' . $status . '</span>';
             }
             $strHtml .= "{$status}: {$testName}";
             $strHtml = "{$strHtml}<br />";
             if (isset($test['errors'])) {
                 foreach ($test['errors'] as $error) {
                     $strHtml .= nl2br(htmlentities($error['e']->__toString())) . '<br />';
                 }
             }
             if (isset($test['results'])) {
                 foreach ($test['results'] as $error) {
                     $strMessage = $error['e']->toString() . "\n";
                     // get first line
                     $lines = explode("\n", PHPUnit_Util_Filter::getFilteredStacktrace($error['e']));
                     $strMessage .= $lines[0] . "\n";
                     $strHtml .= nl2br(htmlentities($strMessage)) . '<br />';
                 }
             }
         }
         echo $strHtml;
     }
     $str = "\nRan " . $result->count() . " tests in " . $result->time() . " seconds.\n";
     $str .= $result->failureCount() . " assertions failed.\n";
     $str .= $result->errorCount() . " exceptions were thrown.\n";
     echo nl2br($str);
 }
开发者ID:vaibhav-kaushal,项目名称:qc-framework,代码行数:37,代码来源:qcubed_unit_tests.php

示例11: fromPHPUnitTestResult

 /**
  * Creates a Streamwide_PHPUnit_Runner_TestCaseResult from a PHPUnit_Framework_TestResult.
  *
  * @param Streamwide_PHPUnit_Runner_TestCase    $testCase   test case
  * @param PHPUnit_Framework_TestResult $testResult test result
  * @return Streamwide_PHPUnit_Runner_TestCaseResult test case result
  */
 public static function fromPHPUnitTestResult(Streamwide_PHPUnit_Runner_TestCase $testCase, PHPUnit_Framework_TestResult $testResult)
 {
     $passed = $testResult->passed();
     $skipped = $testResult->skipped();
     $errors = $testResult->errors();
     $failures = $testResult->failures();
     $notImplemented = $testResult->notImplemented();
     $time = $testResult->time();
     $statusMessage = null;
     $codeCoverage = null;
     if (!empty($passed)) {
         $status = Streamwide_PHPUnit_Runner_TestCaseResult::PASSED;
         $codeCoverage = $testResult->getCodeCoverageInformation();
     } else {
         if (!empty($skipped)) {
             $status = Streamwide_PHPUnit_Runner_TestCaseResult::SKIPPED;
             $statusMessage = $skipped[0]->toStringVerbose(true);
         } else {
             if (!empty($notImplemented)) {
                 $status = Streamwide_PHPUnit_Runner_TestCaseResult::NOT_IMPLEMENTED;
                 $statusMessage = $notImplemented[0]->toStringVerbose(true);
             } else {
                 if (!empty($errors)) {
                     $status = Streamwide_PHPUnit_Runner_TestCaseResult::ERROR;
                     $statusMessage = $errors[0]->toStringVerbose(true) . PHPUnit_Util_Filter::getFilteredStacktrace($errors[0]->thrownException());
                 } else {
                     if (!empty($failures)) {
                         $status = Streamwide_PHPUnit_Runner_TestCaseResult::FAILED;
                         $statusMessage = $failures[0]->toStringVerbose(true) . PHPUnit_Util_Filter::getFilteredStacktrace($failures[0]->thrownException());
                     }
                 }
             }
         }
     }
     $testCaseResult = new Streamwide_PHPUnit_Runner_TestCaseResult($testCase, $status, $statusMessage, null, $time, $codeCoverage);
     return $testCaseResult;
 }
开发者ID:cwcw,项目名称:cms,代码行数:44,代码来源:Factory.php

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

示例13: addSkippedTest

 /**
  * Skipped test.
  *
  * @param  PHPUnit_Framework_Test $test
  * @param  Exception              $e
  * @param  float                  $time
  */
 public function addSkippedTest(PHPUnit_Framework_Test $test, Exception $e, $time)
 {
     $message = PHPUnit_Framework_TestFailure::exceptionToString($e) . "\n" . PHPUnit_Util_Filter::getFilteredStacktrace($e, FALSE);
     $this->storeResult(PHPUnit_Runner_BaseTestRunner::STATUS_SKIPPED, $time, $message);
     $this->currentTestSuccess = FALSE;
 }
开发者ID:xiplias,项目名称:pails,代码行数:13,代码来源:Database.php

示例14: addSkippedTest

 /**
  * Skipped test.
  *
  * @param PHPUnit_Framework_Test $test
  * @param Exception              $e
  * @param float                  $time
  */
 public function addSkippedTest(PHPUnit_Framework_Test $test, Exception $e, $time)
 {
     $this->writeCase('error', $time, PHPUnit_Util_Filter::getFilteredStacktrace($e, false), 'Skipped Test: ' . $e->getMessage(), $test);
     $this->currentTestPass = false;
 }
开发者ID:matijn-experty,项目名称:phpunit,代码行数:12,代码来源:JSON.php

示例15: doAddFault

 /**
  * Method which generalizes addError() and addFailure()
  *
  * @param PHPUnit_Framework_Test $test
  * @param Exception              $e
  * @param float                  $time
  * @param string                 $type
  */
 private function doAddFault(PHPUnit_Framework_Test $test, Exception $e, $time, $type)
 {
     if ($this->currentTestCase === null) {
         return;
     }
     if ($test instanceof PHPUnit_Framework_SelfDescribing) {
         $buffer = $test->toString() . "\n";
     } else {
         $buffer = '';
     }
     $buffer .= PHPUnit_Framework_TestFailure::exceptionToString($e) . "\n" . PHPUnit_Util_Filter::getFilteredStacktrace($e);
     $fault = $this->document->createElement($type, PHPUnit_Util_XML::prepareString($buffer));
     $fault->setAttribute('type', get_class($e));
     $this->currentTestCase->appendChild($fault);
 }
开发者ID:ronaldbao,项目名称:phpunit,代码行数:23,代码来源:JUnit.php


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