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


PHP PHPUnit_Framework_Test::getStatus方法代码示例

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


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

 public function endTest(Test $test, $time)
 {
     $this->currentTest = null;
     if ($test instanceof TestCase && $test->getStatus() === TestRunner::STATUS_PASSED) {
         $this->storage->record($this->run, $test, $time, StorageInterface::STATUS_PASSED);
     }
 }
开发者ID:petertilsen,项目名称:phpunit-clever-and-smart,代码行数:7,代码来源:TestListener.php

示例3: endTest

 public function endTest(PHPUnit_Framework_Test $test, $time)
 {
     $this->tests++;
     switch ($test->getStatus()) {
         case PHPUnit_Runner_BaseTestRunner::STATUS_PASSED:
             echo '.';
             break;
         case PHPUnit_Runner_BaseTestRunner::STATUS_FAILURE:
             echo 'F';
             break;
         case PHPUnit_Runner_BaseTestRunner::STATUS_ERROR:
             echo 'E';
             break;
         case PHPUnit_Runner_BaseTestRunner::STATUS_INCOMPLETE:
             echo 'I';
             break;
         case PHPUnit_Runner_BaseTestRunner::STATUS_SKIPPED:
             echo 'S';
             break;
     }
     if ($this->tests % 60 == 0) {
         echo "\n";
     }
     $this->totalTime += $time;
 }
开发者ID:humansky,项目名称:qframe,代码行数:25,代码来源:Listener.php

示例4: endTest

 /**
  * A test ended.
  *
  * @param  PHPUnit_Framework_Test $test
  * @param  float                  $time
  */
 public function endTest(PHPUnit_Framework_Test $test, $time)
 {
     if (!$test instanceof PHPUnit_Framework_Warning) {
         if ($test->getStatus() == PHPUnit_Runner_BaseTestRunner::STATUS_PASSED) {
             $ifStatus = array('assigned', 'new', 'reopened');
             $newStatus = 'closed';
             $message = 'Automatically closed by PHPUnit (test passed).';
             $resolution = 'fixed';
             $cumulative = TRUE;
         } else {
             if ($test->getStatus() == PHPUnit_Runner_BaseTestRunner::STATUS_FAILURE) {
                 $ifStatus = array('closed');
                 $newStatus = 'reopened';
                 $message = 'Automatically reopened by PHPUnit (test failed).';
                 $resolution = '';
                 $cumulative = FALSE;
             } else {
                 return;
             }
         }
         $name = $test->getName();
         $tickets = PHPUnit_Util_Test::getTickets(get_class($test), $name);
         foreach ($tickets as $ticket) {
             // Remove this test from the totals (if it passed).
             if ($test->getStatus() == PHPUnit_Runner_BaseTestRunner::STATUS_PASSED) {
                 unset($this->ticketCounts[$ticket][$name]);
             }
             // Only close tickets if ALL referenced cases pass
             // but reopen tickets if a single test fails.
             if ($cumulative) {
                 // Determine number of to-pass tests:
                 if (count($this->ticketCounts[$ticket]) > 0) {
                     // There exist remaining test cases with this reference.
                     $adjustTicket = FALSE;
                 } else {
                     // No remaining tickets, go ahead and adjust.
                     $adjustTicket = TRUE;
                 }
             } else {
                 $adjustTicket = TRUE;
             }
             if ($adjustTicket && in_array($ticketInfo[3]['status'], $ifStatus)) {
                 $this->updateTicket($ticket, $newStatus, $message, $resolution);
             }
         }
     }
 }
开发者ID:nblackman,项目名称:pimcore,代码行数:53,代码来源:TicketListener.php

示例5: endTest

 /**
  * A test ended.
  *
  * @param \PHPUnit_Framework_Test $test
  * @param float                   $time
  *
  * @return void
  */
 public function endTest(\PHPUnit_Framework_Test $test, $time)
 {
     if ($test instanceof \PHPUnit_Framework_TestCase) {
         $assertionCount = $test->getNumAssertions();
         $this->numAssertions += $assertionCount;
         if ($test->getStatus() == \PHPUnit_Runner_BaseTestRunner::STATUS_FAILURE) {
             $status = 'failures';
         } elseif ($test->getStatus() == \PHPUnit_Runner_BaseTestRunner::STATUS_ERROR) {
             $status = 'errors';
         } elseif ($test->getStatus() == \PHPUnit_Runner_BaseTestRunner::STATUS_INCOMPLETE) {
             $status = 'incompletes';
         } elseif ($test->getStatus() == \PHPUnit_Runner_BaseTestRunner::STATUS_SKIPPED) {
             $status = 'skips';
         } elseif ($test->getStatus() == \PHPUnit_Runner_BaseTestRunner::STATUS_RISKY) {
             $status = 'risky';
         } else {
             $status = 'tests';
         }
         if (count($this->suites) - $this->endedSuites > 1) {
             $suiteName = end($this->suites);
             $this->stats[$suiteName][$status]++;
             $this->stats[$suiteName]['assertions'] += $assertionCount;
         }
         // updates also top test suite
         $suiteName = reset($this->suites);
         $this->stats[$suiteName][$status]++;
         $this->stats[$suiteName]['assertions'] += $assertionCount;
     }
     if (method_exists($test, 'hasOutput') && $test->hasOutput()) {
         $output = $test->getActualOutput();
     } else {
         $output = '';
     }
     $testName = $test->getName();
     $context = array('testName' => $testName, 'testDescriptionArr' => \PHPUnit_Util_Test::describe($test, false), 'testDescriptionStr' => $test->toString(), 'operation' => __FUNCTION__, 'output' => $output);
     if (isset($assertionCount)) {
         $context['assertionCount'] = $assertionCount;
     }
     $this->logger->info(sprintf("Test '%s' ended.", $testName), $context);
 }
开发者ID:jclaveau,项目名称:phpunit-LoggerTestListener,代码行数:48,代码来源:AbstractLoggerTestListener.php

示例6: endTest

 /**
  * A test ended.
  *
  * @param PHPUnit_Framework_Test $test
  * @param float                  $time
  */
 public function endTest(\PHPUnit_Framework_Test $test, $time)
 {
     if (false === $test instanceof $this->testTypeOfInterest) {
         return;
     }
     $assertion = array('@type' => 'earl:Assertion', 'earl:assertedBy' => $this->options['developer-url'], 'earl:mode' => 'earl:automatic', 'earl:test' => $test->getTestId(), 'earl:result' => array('@type' => 'earl:TestResult', 'earl:outcome' => $this->earlStatuses[$test->getStatus()], 'dc:date' => date('c')));
     $this->assertions[] = $assertion;
 }
开发者ID:janul,项目名称:JsonLD,代码行数:14,代码来源:EarlReportGenerator.php

示例7: endTest

 /**
  * A test ended.
  *
  * @param PHPUnit_Framework_Test $test Test case
  * @param float                  $time Time taken
  *
  * @return void
  */
 public function endTest(PHPUnit_Framework_Test $test, $time)
 {
     $this->runs[] = array('name' => $test->getName(), 'size' => $test->getSize(), 'status' => $test->getStatus(), 'statusMessage' => $test->getStatusMessage(), 'assertions' => $test->getNumAssertions(), 'result' => $test->getResult(), 'annotations' => $test->getAnnotations(), 'timeTaken' => $time, 'output' => $test->getActualOutput());
 }
开发者ID:benmatselby,项目名称:phpunit-testlistener-mongo,代码行数:12,代码来源:Mongo.php


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