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


PHP PHPUnit_Framework_Test::getScenario方法代码示例

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


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

示例1: groupsForTest

 public function groupsForTest(\PHPUnit_Framework_Test $test)
 {
     $groups = [];
     if ($test instanceof ScenarioDriven) {
         $groups = $test->getScenario()->getGroups();
     }
     if ($test instanceof Reported) {
         $info = $test->getReportFields();
         if (isset($info['class'])) {
             $groups = array_merge($groups, \PHPUnit_Util_Test::getGroups($info['class'], $info['name']));
         }
         $filename = $info['file'];
     } else {
         $groups = array_merge($groups, \PHPUnit_Util_Test::getGroups(get_class($test), $test->getName(false)));
         $filename = (new \ReflectionClass($test))->getFileName();
     }
     foreach ($this->testsInGroups as $group => $tests) {
         foreach ($tests as $testPattern) {
             if ($filename == $testPattern) {
                 $groups[] = $group;
             }
             if (strpos($filename . ':' . $test->getName(false), $testPattern) === 0) {
                 $groups[] = $group;
             }
         }
     }
     return array_unique($groups);
 }
开发者ID:itillawarra,项目名称:cmfive,代码行数:28,代码来源:GroupManager.php

示例2: endTest

 public function endTest(\PHPUnit_Framework_Test $test, $time)
 {
     $steps = [];
     $success = $this->testStatus == \PHPUnit_Runner_BaseTestRunner::STATUS_PASSED;
     if ($success) {
         $this->successful++;
     }
     if ($test instanceof ScenarioDriven) {
         $steps = $test->getScenario()->getSteps();
     }
     $this->timeTaken += $time;
     switch ($this->testStatus) {
         case \PHPUnit_Runner_BaseTestRunner::STATUS_FAILURE:
             $scenarioStatus = 'scenarioFailed';
             break;
         case \PHPUnit_Runner_BaseTestRunner::STATUS_SKIPPED:
             $scenarioStatus = 'scenarioSkipped';
             break;
         case \PHPUnit_Runner_BaseTestRunner::STATUS_INCOMPLETE:
             $scenarioStatus = 'scenarioIncomplete';
             break;
         case \PHPUnit_Runner_BaseTestRunner::STATUS_ERROR:
             $scenarioStatus = 'scenarioFailed';
             break;
         default:
             $scenarioStatus = 'scenarioSuccess';
     }
     $stepsBuffer = '';
     $metaStep = null;
     $subStepsBuffer = '';
     foreach ($steps as $step) {
         /** @var $step Step  **/
         if ($step->getMetaStep()) {
             $subStepsBuffer .= $this->renderStep($step);
             $metaStep = $step->getMetaStep();
             continue;
         }
         if ($step->getMetaStep() != $metaStep) {
             $stepsBuffer .= $this->renderSubsteps($metaStep, $subStepsBuffer);
             $subStepsBuffer = '';
         }
         $metaStep = $step->getMetaStep();
         $stepsBuffer .= $this->renderStep($step);
     }
     if ($subStepsBuffer and $metaStep) {
         $stepsBuffer .= $this->renderSubsteps($metaStep, $subStepsBuffer);
     }
     $scenarioTemplate = new \Text_Template($this->templatePath . 'scenario.html');
     $failure = '';
     $name = Descriptor::getTestSignature($test);
     if (isset($this->failures[$name])) {
         $failTemplate = new \Text_Template($this->templatePath . 'fail.html');
         $failTemplate->setVar(['fail' => nl2br($this->failures[$name])]);
         $failure = $failTemplate->render();
     }
     $toggle = $stepsBuffer ? '<span class="toggle">+</span>' : '';
     $scenarioTemplate->setVar(['id' => ++$this->id, 'name' => ucfirst(Descriptor::getTestAsString($test)), 'scenarioStatus' => $scenarioStatus, 'steps' => $stepsBuffer, 'toggle' => $toggle, 'failure' => $failure, 'time' => round($time, 2)]);
     $this->scenarios .= $scenarioTemplate->render();
 }
开发者ID:solutionDrive,项目名称:Codeception,代码行数:59,代码来源:HTML.php

示例3: endTest

 /**
  * A test ended.
  *
  * @param  PHPUnit_Framework_Test $test
  * @param  float                  $time
  */
 public function endTest(PHPUnit_Framework_Test $test, $time)
 {
     if ($test instanceof PHPUnit_Extensions_Story_TestCase || $test instanceof PHPUnit_Extensions_Story_SeleniumTestCase) {
         if ($this->testStatus == PHPUnit_Runner_BaseTestRunner::STATUS_PASSED) {
             $this->successful++;
             $success = TRUE;
         } else {
             $success = FALSE;
         }
         $this->onTest($this->currentTestMethodPrettified, $success, $test->getScenario()->getSteps());
     }
 }
开发者ID:pdkhuong,项目名称:BBG,代码行数:18,代码来源:ResultPrinter.php

示例4: endTest

 /**
  * A test ended.
  *
  * @param  \PHPUnit_Framework_Test $test
  * @param  float $time
  */
 public function endTest(\PHPUnit_Framework_Test $test, $time)
 {
     $steps = [];
     $success = $this->testStatus == \PHPUnit_Runner_BaseTestRunner::STATUS_PASSED;
     if ($success) {
         $this->successful++;
     }
     if ($test instanceof ScenarioDriven) {
         $steps = $test->getScenario()->getSteps();
     }
     $this->onTest($test->toString(), $success, $steps, $time);
 }
开发者ID:foxman209,项目名称:Codeception,代码行数:18,代码来源:ResultPrinter.php

示例5: startTest

 public function startTest(\PHPUnit_Framework_Test $test)
 {
     $this->dispatcher->dispatch(Events::TEST_START, new TestEvent($test));
     if (!$test instanceof CodeceptionTestCase) {
         return;
     }
     try {
         $test->getScenario()->stopIfBlocked();
         $this->startedTests[] = spl_object_hash($test);
         $this->fire(Events::TEST_BEFORE, new TestEvent($test));
     } catch (\PHPUnit_Framework_IncompleteTestError $e) {
         $this->addIncompleteTest($test, $e, 0);
     } catch (\PHPUnit_Framework_SkippedTestError $e) {
         $this->addSkippedTest($test, $e, 0);
     }
 }
开发者ID:Marfuz,项目名称:c4t_test,代码行数:16,代码来源:Listener.php

示例6: endTest

 /**
  * A test ended.
  *
  * @param  \PHPUnit_Framework_Test $test
  * @param  float                  $time
  */
 public function endTest(\PHPUnit_Framework_Test $test, $time)
 {
     $steps = array();
     if ($this->testStatus == \PHPUnit_Runner_BaseTestRunner::STATUS_PASSED) {
         $this->successful++;
         $success = TRUE;
         if ($test instanceof \Codeception\TestCase) {
             $steps = $test->getScenario()->getSteps();
         }
     } else {
         $success = FALSE;
         if ($test instanceof \Codeception\TestCase) {
             $steps = $test->getTrace();
         }
     }
     $this->onTest($test->toString(), $success, $steps, $time);
 }
开发者ID:lenninsanchez,项目名称:donadores,代码行数:23,代码来源:ResultPrinter.php


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