本文整理汇总了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;
}
示例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));
}
}
示例3: testGetMissingRequirements
/**
* @covers PHPUnit_Util_Test::getMissingRequirements
* @dataProvider missingRequirementsProvider
*/
public function testGetMissingRequirements($test, $result)
{
$this->assertEquals($result, PHPUnit_Util_Test::getMissingRequirements('RequirementsTest', $test));
}