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


PHP PHPUnit_Framework_AssertionFailedError::getMessage方法代码示例

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


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

示例1: addFailure

 public function addFailure(PHPUnit_Framework_Test $test, PHPUnit_Framework_AssertionFailedError $e, $time)
 {
     $class = get_class($test);
     $message = $this->escape($e->getMessage());
     $trace = $this->escape($e->getTraceAsString());
     echo "##teamcity[testFailed type='failure' name='{$class}.{$test->getName()}' message='{$message}'" . " details='{$trace}']\n";
 }
开发者ID:jareddreyer,项目名称:catalogue,代码行数:7,代码来源:TeamCityListener.php

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

示例3: onNotSuccessfulTest

 protected function onNotSuccessfulTest(\Exception $e)
 {
     if ($e instanceof PredictionException) {
         $e = new \PHPUnit_Framework_AssertionFailedError($e->getMessage(), $e->getCode(), $e);
     }
     return parent::onNotSuccessfulTest($e);
 }
开发者ID:phpspec,项目名称:prophecy-phpunit,代码行数:7,代码来源:ProphecyTestCase.php

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

示例5: addFailure

 public function addFailure(PHPUnit_Framework_Test $test, PHPUnit_Framework_AssertionFailedError $e, $time)
 {
     $this->_fails += 1;
     if ($this->_fails == 1) {
         echo "\n<div class=\"failure\">";
     }
     printf("Test '%s' failed : %s.<br />\n<pre>%s</pre>\n", $test->getName(), htmlentities($e->getMessage()), (string) $e->getTraceAsString());
     //echo("Failure $this->_fails : $t<br>\n");
 }
开发者ID:Alphenus,项目名称:ilmomasiina-php,代码行数:9,代码来源:HTML_TestListener.php

示例6: addFailure

 /**
  * A failure occurred.
  *
  * @param PHPUnit_Framework_Test $test
  * @param PHPUnit_Framework_AssertionFailedError $e
  * @param float $time
  * @return void
  */
 public function addFailure(PHPUnit_Framework_Test $test, PHPUnit_Framework_AssertionFailedError $e, $time)
 {
     $message = sprintf("%s  FAILURE: %s (Duration: %s sec)", str_repeat('  ', $this->level), str_replace("\n", " ", $e->getMessage()), $this->getDuration());
     if ($this->colors) {
         $this->write("[41;37m{$message}[0m" . "\n");
     } else {
         $this->write($message . "\n");
     }
     $this->lastTestFailed = TRUE;
 }
开发者ID:aoemedia,项目名称:menta,代码行数:18,代码来源:VerboseResultPrinter.php

示例7: addFailure

 public function addFailure(PHPUnit_Framework_Test $test, PHPUnit_Framework_AssertionFailedError $e, $time)
 {
     if ($this->verbose) {
         echo "        FAIL: '" . $e->getMessage() . "'\n" . $e->getTraceAsString();
     }
     parent::addFailure($test, $e, $time);
     if ($this->_blDBResetPerTest && !isset($test->blNoDbResetAfterTest)) {
         $this->_oDBMaintenance->restoreDB($this->_iDBChangeMode, $this->_iDBChangeOutput);
         echo "|";
     }
 }
开发者ID:OXIDprojects,项目名称:debugax,代码行数:11,代码来源:oxPrinter.php

示例8: addFailure

 /**
  * A failure occurred.
  *
  * @todo Add check that $test is instance of PHPUnit_Framework_TestCase
  *
  * @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)
 {
     $failures = array();
     $testResult = $test->getTestResultObject();
     /** @var $failure PHPUnit_Framework_TestFailure */
     foreach ($testResult->failures() as $failure) {
         $hash = "{$e->getMessage()} {$e->getTraceAsString()}";
         if (isset($failures[$hash])) {
             continue;
         }
         $array = array('type' => self::MESSAGE_COMPARISON_FAILURE, 'name' => $test->getName(), 'message' => $e->getMessage(), 'details' => $e->getTraceAsString());
         /** @var $exception PHPUnit_Framework_ExpectationFailedException */
         $exception = $failure->thrownException();
         $comparisonFailure = $exception->getComparisonFailure();
         if ($comparisonFailure instanceof PHPUnit_Framework_ComparisonFailure) {
             $array += array('expected' => $comparisonFailure->getExpectedAsString(), 'actual' => $comparisonFailure->getActualAsString());
         }
         $message = $this->getServiceMessage(self::MESSAGE_TEST_FAILED, $array);
         $this->write($message);
         $failures[$hash] = true;
     }
 }
开发者ID:uyga,项目名称:phpunit-testlistener-teamcity,代码行数:31,代码来源:TestListener.php

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

示例10: addFailure

 public function addFailure(PHPUnit_Framework_Test $test, PHPUnit_Framework_AssertionFailedError $e, $time)
 {
     $this->error = true;
     echo self::TERM_RED, 'failed: ', $e->getMessage(), ' (took ', $time, 's).', self::TERM_END, "\n";
 }
开发者ID:Tobbebror,项目名称:POT,代码行数:5,代码来源:test.php

示例11: 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->lastFailureMessage = "Test FAILURE (" . $test->getName() . "): " . $e->getMessage();
 }
开发者ID:RadioCampusFrance,项目名称:airtime,代码行数:11,代码来源:PHPUnitTestRunner.php

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

示例13: addFailure

 /**
  * Implement PHPUnit_Framework_TestListener, save driver content if there was an error
  * @param \PHPUnit_Framework_Test                 $test
  * @param \PHPUnit_Framework_AssertionFailedError $failure
  * @param integer                                 $time
  */
 public function addFailure(\PHPUnit_Framework_Test $test, \PHPUnit_Framework_AssertionFailedError $failure, $time)
 {
     if ($test instanceof Testcase_Spiderling and $test->is_driver_active() and $test->driver()->is_page_active()) {
         $this->save_driver_content($test->driver(), get_class($test) . '_' . $test->getName(FALSE), $failure->getMessage());
     }
 }
开发者ID:openbuildings,项目名称:phpunit-spiderling,代码行数:12,代码来源:Saveonfailure.php

示例14: 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->failures[$test->toString()] = $e->getMessage();
     parent::addFailure($test, $e, $time);
 }
开发者ID:hitechdk,项目名称:Codeception,代码行数:12,代码来源:HTML.php

示例15: toString

 /**
  * Returns "..." in place of common prefix and "..." in
  * place of common suffix between expected and actual.
  *
  * @return string
  * @access public
  */
 public function toString()
 {
     if ($this->fExpected == null && $this->fActual == null) {
         return PHPUnit_Framework_Assert::format($this->fExpected, $this->fActual, parent::getMessage());
     }
     $end = min(strlen($this->fExpected), strlen($this->fActual));
     $i = 0;
     $j = strlen($this->fExpected) - 1;
     $k = strlen($this->fActual) - 1;
     for (; $i < $end; $i++) {
         if ($this->fExpected[$i] != $this->fActual[$i]) {
             break;
         }
     }
     for (; $k >= $i && $j >= $i; $k--, $j--) {
         if ($this->fExpected[$j] != $this->fActual[$k]) {
             break;
         }
     }
     if ($j < $i && $k < $i) {
         $expected = $this->fExpected;
         $actual = $this->fActual;
     } else {
         $expected = substr($this->fExpected, $i, $j + 1 - $i);
         $actual = substr($this->fActual, $i, $k + 1 - $i);
         if ($i <= $end && $i > 0) {
             $expected = '...' . $expected;
             $actual = '...' . $actual;
         }
         if ($j < strlen($this->fExpected) - 1) {
             $expected .= '...';
         }
         if ($k < strlen($this->fActual) - 1) {
             $actual .= '...';
         }
         return PHPUnit_Framework_Assert::format($expected, $actual, parent::getMessage());
     }
 }
开发者ID:amjadtbssm,项目名称:website,代码行数:45,代码来源:ComparisonFailure.php


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