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


PHP PHPUnit_Framework_AssertionFailedError::getTrace方法代码示例

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


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

示例1: paintFail

 /**
  * Paints a failing test.
  *
  * @param PHPUnit_Framework_AssertionFailedError $message Failure object displayed in
  *   the context of the other tests.
  * @return void
  */
 public function paintFail($message)
 {
     $context = $message->getTrace();
     $realContext = $context[3];
     $context = $context[2];
     printf("FAIL on line %s\n%s in\n%s %s()\n\n", $context['line'], $message->toString(), $context['file'], $realContext['function']);
 }
开发者ID:yuuicchan0912,项目名称:sample2,代码行数:14,代码来源:CakeTextReporter.php

示例2: addFailure

    /**
     * A failure occurred.
     *
     * @param PHPUnit_Framework_Test $test
     * @param PHPUnit_Framework_AssertionFailedError $e
     * @param float $time
     * @return void
     * @author Karsten Dambekalns <karsten@typo3.org>
     */
    public function addFailure(\PHPUnit_Framework_Test $test, \PHPUnit_Framework_AssertionFailedError $e, $time)
    {
        $testCaseTraceArr = $this->getFirstNonPHPUnitTrace($e->getTrace());
        $fileName = $testCaseTraceArr['file'];
        echo '<script type="text/javascript">document.getElementById("progress-bar").style.backgroundImage = "url(_Resources/Static/Packages/Testing/Media/indicator_red.gif)";</script>
			<div class="test failure"><strong>Failure</strong> in <em>' . $test->getName() . '</em> ' . '<img src="_Resources/Static/Packages/Testing/Media/failure.png" alt="Detail" onclick="if(document.getElementById(\'test' . $this->currentTestNumber . '\').style.display==\'none\') document.getElementById(\'test' . $this->currentTestNumber . '\').style.display=\'block\'; else document.getElementById(\'test' . $this->currentTestNumber . '\').style.display=\'none\'" />' . '<div class="testdetail" id="test' . $this->currentTestNumber . '">' . $fileName . ':' . $testCaseTraceArr['line'] . '<br />' . htmlspecialchars($e->getMessage()) . '<br /><div class="testoutput">' . $this->getTestOutput() . '</div></div></div>';
        $this->resultArray['failure']++;
        $this->flushOutputBuffer();
    }
开发者ID:kdambekalns,项目名称:framework-benchs,代码行数:18,代码来源:TestListener.php

示例3: printFailure

 private function printFailure(PHPUnit_Framework_AssertionFailedError $e)
 {
     YTestLogger::indent();
     YTestLogger::say($e->getMessage() . "\n");
     foreach ($e->getTrace() as $frame) {
         if (array_key_exists('file', $frame)) {
             $file = $frame['file'];
             if (strpos($file, 'PHPUnit/') || strpos($file, 'CustomTestCase')) {
                 break;
             }
             YTestLogger::say($file . ":" . $frame['line'] . "\n");
         }
     }
     YTestLogger::dedent();
 }
开发者ID:rsaugier,项目名称:ytest,代码行数:15,代码来源:y_test_runner.php

示例4: addFailure

 /**
  * A test has failed.
  *
  * @param PHPUnit_Framework_Test $test the test that has failed
  * @param PHPUnit_Framework_AssertionFailedError $e the failed assertion
  * @param float $time ?
  *
  * @return void
  *
  * @throws InvalidArgumentException
  */
 public function addFailure(PHPUnit_Framework_Test $test, PHPUnit_Framework_AssertionFailedError $e, $time)
 {
     if (!$test instanceof PHPUnit_Framework_TestCase) {
         throw new InvalidArgumentException('addFailure needs $test to be a PHPUnit_Framework_TestCase.', 1334308954);
     }
     /** @var PHPUnit_Framework_TestCase $test */
     $testCaseTraceArr = $this->getFirstNonPhpUnitTrace($e->getTrace());
     $fileName = str_replace(PATH_site, '', $testCaseTraceArr['file']);
     $this->outputService->output('<script type="text/javascript">/*<![CDATA[*/setProgressBarClass("hadFailure");/*]]>*/</script>' . '<script type="text/javascript">/*<![CDATA[*/setClass("testcaseNum-' . $this->currentTestNumber . '_' . $this->currentDataProviderNumber . '","testcaseFailure");/*]]>*/</script>' . '<strong>Failure</strong> in test case <em>' . htmlspecialchars($test->getName()) . '</em>' . '<br />File: <em>' . $fileName . '</em>' . '<br />Line: <em>' . $testCaseTraceArr['line'] . '</em>');
     if (method_exists($e, 'getDescription')) {
         $message = $e->getDescription();
     } else {
         $message = $e->getMessage();
     }
     $this->outputService->output('<div class="message">' . nl2br(htmlspecialchars($message)) . '</div>');
     if ($e instanceof PHPUnit_Framework_ExpectationFailedException) {
         /** @var PHPUnit_Framework_ExpectationFailedException $e */
         $comparisonFailure = $e->getComparisonFailure();
         if ($comparisonFailure instanceof ComparisonFailure) {
             /** @var ComparisonFailure $comparisonFailure */
             $expected = $comparisonFailure->getExpectedAsString();
             $actual = $comparisonFailure->getActualAsString();
             /** @var DiffUtility $diff */
             $diff = GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Utility\\DiffUtility');
             $this->outputService->output('<code>' . $diff->makeDiffDisplay($actual, $expected) . '</code>');
         }
     }
 }
开发者ID:TrueType,项目名称:phpunit,代码行数:39,代码来源:TestListener.php

示例5: getTraceFiles

 /**
  * Function to extract our test file information from the $e stack trace.
  * Makes the error reporting more readable, since it filters out all of the PHPUnit files.
  *
  * @param PHPUnit_Framework_AssertionFailedError $e
  * @return string with selected files based on path
  */
 public function getTraceFiles($e)
 {
     $trace = $e->getTrace();
     $path = $this->cfg->folder . $this->cfg->path;
     $path = str_replace('\\', '/', $path);
     $message = '';
     foreach ($trace as $traceLine) {
         if (isset($traceLine['file'])) {
             $file = str_replace('\\', '/', $traceLine['file']);
             if (stripos($file, $path) !== false) {
                 $message .= "\n" . $traceLine['file'] . '(' . $traceLine['line'] . '): ' . $traceLine['class'] . $traceLine['type'] . $traceLine['function'];
             }
         }
     }
     return $e->toString() . $message;
 }
开发者ID:Joomla-on-NoSQL,项目名称:LaMojo,代码行数:23,代码来源:SeleniumJoomlaTestCase.php

示例6: addFailure

 public function addFailure(PHPUnit_Framework_Test $test, PHPUnit_Framework_AssertionFailedError $e, $time)
 {
     if ($test instanceof PHPUnit_Framework_Warning) {
         return;
     }
     $message = $e->getMessage();
     print traceCommand("testFailed", "name", $test->getName(), "message", $message, "details", getTraceMessage($e->getTrace(), $this->myfilename));
     flush();
 }
开发者ID:Aktubius,项目名称:Lesons_SAG,代码行数:9,代码来源:_intellij_phpunit_launcher.php


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