Constructs a new TestSuite:
mixed $theClass:
string $name:
public function __construct($theClass = '', $name = '') {
$argumentsValid = FALSE;
if (is_object($theClass) && $theClass instanceof ReflectionClass) {
$argumentsValid = TRUE;
}
else {
if (is_string($theClass) && $theClass !== '' && class_exists($theClass, FALSE)) {
$argumentsValid = TRUE;
if ($name == '') {
$name = $theClass;
}
$theClass = new ReflectionClass($theClass);
}
else {
if (is_string($theClass)) {
$this
->setName($theClass);
return;
}
}
}
if (!$argumentsValid) {
throw new PHPUnit_Framework_Exception();
}
if (!$theClass
->isSubclassOf('PHPUnit_Framework_TestCase')) {
throw new PHPUnit_Framework_Exception('Class "' . $theClass->name . '" does not extend PHPUnit_Framework_TestCase.');
}
if ($name != '') {
$this
->setName($name);
}
else {
$this
->setName($theClass
->getName());
}
$constructor = $theClass
->getConstructor();
if ($constructor !== NULL && !$constructor
->isPublic()) {
$this
->addTest(self::warning(sprintf('Class "%s" has no public constructor.', $theClass
->getName())));
return;
}
foreach ($theClass
->getMethods() as $method) {
$this
->addTestMethod($theClass, $method);
}
if (empty($this->tests)) {
$this
->addTest(self::warning(sprintf('No tests found in class "%s".', $theClass
->getName())));
}
$this->testCase = TRUE;
}