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


PHP PHPUnit_Framework_Test::getTestResultObject方法代码示例

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


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

示例1: endTest

 /**
  * endTest is called after each test and checks if \Mockery::close() has
  * been called, and will let the test fail if it hasn't.
  *
  * @param  PHPUnit_Framework_Test $test
  * @param  float                  $time
  */
 public function endTest(\PHPUnit_Framework_Test $test, $time)
 {
     if (!$test instanceof \PHPUnit_Framework_TestCase) {
         // We need the getTestResultObject and getStatus methods which are
         // not part of the interface.
         return;
     }
     if ($test->getStatus() !== \PHPUnit_Runner_BaseTestRunner::STATUS_PASSED) {
         // If the test didn't pass there is no guarantee that
         // verifyMockObjects and assertPostConditions have been called.
         // And even if it did, the point here is to prevent false
         // negatives, not to make failing tests fail for more reasons.
         return;
     }
     try {
         // The self() call is used as a sentinel. Anything that throws if
         // the container is closed already will do.
         \Mockery::self();
     } catch (\LogicException $_) {
         return;
     }
     $e = new \PHPUnit_Framework_ExpectationFailedException(sprintf("Mockery's expectations have not been verified. Make sure that \\Mockery::close() is called at the end of the test. Consider using %s\\MockeryPHPUnitIntegration or extending %s\\MockeryTestCase.", __NAMESPACE__, __NAMESPACE__));
     $result = $test->getTestResultObject();
     $result->addFailure($test, $e, $time);
 }
开发者ID:padraic,项目名称:mockery,代码行数:32,代码来源:TestListener.php

示例2: endTest

 /**
  * After each test, perform Mockery verification tasks and cleanup the
  * statically stored Mockery container for the next test.
  *
  * @param  PHPUnit_Framework_Test $test
  * @param  float                  $time
  */
 public function endTest(\PHPUnit_Framework_Test $test, $time)
 {
     try {
         \Mockery::close();
     } catch (\Exception $e) {
         $result = $test->getTestResultObject();
         $result->addError($test, $e, $time);
     }
 }
开发者ID:sudroid,项目名称:comicake,代码行数:16,代码来源:TestListener.php

示例3: endTest

 /**
  * @param PHPUnit_Framework_Test $test
  * @param float $time
  */
 public function endTest(\PHPUnit_Framework_Test $test, $time)
 {
     try {
         if ($test instanceof \PHPUnit_Framework_TestCase) {
             $test->addToAssertionCount(MatcherAssert::getCount());
         }
     } catch (\Exception $e) {
         $result = $test->getTestResultObject();
         $result->addError($test, $e, $time);
     }
 }
开发者ID:graze,项目名称:hamcrest-test-listener,代码行数:15,代码来源:TestListener.php

示例4: endTest

 /**
  * After each test, perform ehough_mockery_Mockery verification tasks and cleanup the
  * statically stored ehough_mockery_Mockery container for the next test.
  *
  * @param  PHPUnit_Framework_Test $test
  * @param  float                  $time
  */
 public function endTest(PHPUnit_Framework_Test $test, $time)
 {
     try {
         $container = ehough_mockery_Mockery::getContainer();
         if ($container != null) {
             $expectation_count = $container->mockery_getExpectationCount();
             $test->addToAssertionCount($expectation_count);
         }
         ehough_mockery_Mockery::close();
     } catch (Exception $e) {
         $result = $test->getTestResultObject();
         $result->addError($test, $e, $time);
     }
 }
开发者ID:ehough,项目名称:mockery,代码行数:21,代码来源:TestListener.php

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

示例6: endTest

 /**
  * A test ended.
  *
  * @param   PHPUnit_Framework_Test  $test
  * @param   float                   $time
  * @return  void
  */
 public function endTest(PHPUnit_Framework_Test $test, $time)
 {
     $t =& $this->test($test->getName());
     if (!$t['status']) {
         $t['status'] = 'passed';
     }
     $deprecated = $test->getTestResultObject()->deprecatedFeatures();
     $t['deprecated'] = array_diff($deprecated, $this->deprecated);
     $t['assertions'] = $test->getNumAssertions();
     $t['output'] = ob_get_contents();
     $t['time'] = $time;
     $this->deprecated = $deprecated;
     $this->test(null);
     ob_end_clean();
 }
开发者ID:phpgit,项目名称:PHPUnit_Html,代码行数:22,代码来源:PHPUnit_Html_Printer.php


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