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 self) {
$this->addTest($testClass);
} elseif ($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 self($testClass));
}
} else {
throw new PHPUnit_Framework_Exception();
}
}