當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。