本文整理汇总了PHP中TestCase::getClass方法的典型用法代码示例。如果您正苦于以下问题:PHP TestCase::getClass方法的具体用法?PHP TestCase::getClass怎么用?PHP TestCase::getClass使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TestCase
的用法示例。
在下文中一共展示了TestCase::getClass方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testNode
/**
* Add test result node, if it does not yet exist.
*
* @param unittest.TestCase case
* @return xml.Node
*/
protected function testNode(TestCase $case)
{
$class = $case->getClass();
if (!$this->classes->containsKey($class)) {
$this->classes[$class] = $this->tree->addChild(new Node('testsuite', NULL, array('name' => $class->getName(), 'file' => $this->uriFor($class), 'tests' => 0, 'failures' => 0, 'errors' => 0, 'skipped' => 0, 'time' => 0)));
}
return $this->classes[$class];
}
示例2: runTest
/**
* Run a single test
*
* @param unittest.TestCase test
* @return unittest.TestResult
* @throws lang.IllegalArgumentException in case given argument is not a testcase
* @throws lang.MethodNotImplementedException in case given argument is not a valid testcase
*/
public function runTest(TestCase $test)
{
$class = $test->getClass();
if (!$class->hasMethod($test->name)) {
throw new MethodNotImplementedException('Test method does not exist', $test->name);
}
$this->notifyListeners('testRunStarted', array($this));
// Run the single test
$result = new TestResult();
try {
$this->beforeClass($class);
$this->runInternal($test, $result);
$this->afterClass($class);
} catch (PrerequisitesNotMetError $e) {
$this->notifyListeners('testSkipped', array($result->setSkipped($test, $e, 0.0)));
}
$this->notifyListeners('testRunFinished', array($this, $result));
return $result;
}