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


PHP PHPUnit_Util_Test::getMissingRequirements方法代码示例

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


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

示例1: run

 /**
  * Runs the tests and collects their result in a TestResult.
  *
  * @param  PHPUnit_Framework_TestResult $result
  * @return PHPUnit_Framework_TestResult
  */
 public function run(PHPUnit_Framework_TestResult $result = null)
 {
     if ($result === null) {
         $result = $this->createResult();
     }
     if (count($this) == 0) {
         return $result;
     }
     $hookMethods = PHPUnit_Util_Test::getHookMethods($this->name);
     $result->startTestSuite($this);
     try {
         $this->setUp();
         foreach ($hookMethods['beforeClass'] as $beforeClassMethod) {
             if ($this->testCase === true && class_exists($this->name, false) && method_exists($this->name, $beforeClassMethod)) {
                 if ($missingRequirements = PHPUnit_Util_Test::getMissingRequirements($this->name, $beforeClassMethod)) {
                     $this->markTestSuiteSkipped(implode(PHP_EOL, $missingRequirements));
                 }
                 call_user_func([$this->name, $beforeClassMethod]);
             }
         }
     } catch (PHPUnit_Framework_SkippedTestSuiteError $e) {
         $numTests = count($this);
         for ($i = 0; $i < $numTests; $i++) {
             $result->startTest($this);
             $result->addFailure($this, $e, 0);
             $result->endTest($this, 0);
         }
         $this->tearDown();
         $result->endTestSuite($this);
         return $result;
     } catch (Throwable $_t) {
         $t = $_t;
     } catch (Exception $_t) {
         $t = $_t;
     }
     if (isset($t)) {
         $numTests = count($this);
         for ($i = 0; $i < $numTests; $i++) {
             $result->startTest($this);
             $result->addError($this, $t, 0);
             $result->endTest($this, 0);
         }
         $this->tearDown();
         $result->endTestSuite($this);
         return $result;
     }
     foreach ($this as $test) {
         if ($result->shouldStop()) {
             break;
         }
         if ($test instanceof PHPUnit_Framework_TestCase || $test instanceof self) {
             $test->setbeStrictAboutChangesToGlobalState($this->beStrictAboutChangesToGlobalState);
             $test->setBackupGlobals($this->backupGlobals);
             $test->setBackupStaticAttributes($this->backupStaticAttributes);
             $test->setRunTestInSeparateProcess($this->runTestInSeparateProcess);
         }
         $test->run($result);
     }
     foreach ($hookMethods['afterClass'] as $afterClassMethod) {
         if ($this->testCase === true && class_exists($this->name, false) && method_exists($this->name, $afterClassMethod)) {
             call_user_func([$this->name, $afterClassMethod]);
         }
     }
     $this->tearDown();
     $result->endTestSuite($this);
     return $result;
 }
开发者ID:441420776,项目名称:phpunit,代码行数:73,代码来源:TestSuite.php

示例2: checkRequirements

 /**
  * @since Method available since Release 3.6.0
  */
 protected function checkRequirements()
 {
     if (!$this->name || !method_exists($this, $this->name)) {
         return;
     }
     $missingRequirements = PHPUnit_Util_Test::getMissingRequirements(get_class($this), $this->name);
     if ($missingRequirements) {
         $this->markTestSkipped(implode(PHP_EOL, $missingRequirements));
     }
 }
开发者ID:emsdog,项目名称:lumen-todo,代码行数:13,代码来源:TestCase.php

示例3: testGetMissingRequirements

 /**
  * @covers       PHPUnit_Util_Test::getMissingRequirements
  * @dataProvider missingRequirementsProvider
  */
 public function testGetMissingRequirements($test, $result)
 {
     $this->assertEquals($result, PHPUnit_Util_Test::getMissingRequirements('RequirementsTest', $test));
 }
开发者ID:scrobot,项目名称:Lumen,代码行数:8,代码来源:TestTest.php


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