Adds the tests from the given class to the suite.
mixed $testClass:
public function addTestSuite($testClass) {
if (is_string($testClass) && class_exists($testClass)) {
$testClass = new ReflectionClass($testClass);
}
if (!is_object($testClass)) {
throw PHPUnit_Util_InvalidArgumentHelper::factory(1, 'class name or object');
}
if ($testClass instanceof PHPUnit_Framework_TestSuite) {
$this
->addTest($testClass);
}
else {
if ($testClass instanceof ReflectionClass) {
$suiteMethod = FALSE;
if (!$testClass
->isAbstract()) {
if ($testClass
->hasMethod(PHPUnit_Runner_BaseTestRunner::SUITE_METHODNAME)) {
$method = $testClass
->getMethod(PHPUnit_Runner_BaseTestRunner::SUITE_METHODNAME);
if ($method
->isStatic()) {
$this
->addTest($method
->invoke(NULL, $testClass
->getName()));
$suiteMethod = TRUE;
}
}
}
if (!$suiteMethod && !$testClass
->isAbstract()) {
$this
->addTest(new PHPUnit_Framework_TestSuite($testClass));
}
}
else {
throw new PHPUnit_Framework_Exception();
}
}
}