public function PHPUnit_Framework_TestSuite::addTestSuite

Adds the tests from the given class to the suite.

Parameters

mixed $testClass:

Throws

PHPUnit_Framework_Exception

1 call to PHPUnit_Framework_TestSuite::addTestSuite()
PHPUnit_Framework_TestSuite::addTestFile in drupal/core/vendor/phpunit/phpunit/PHPUnit/Framework/TestSuite.php
Wraps both <code>addTest()</code> and <code>addTestSuite</code> as well as the separate import statements for the user's convenience.

File

drupal/core/vendor/phpunit/phpunit/PHPUnit/Framework/TestSuite.php, line 279

Class

PHPUnit_Framework_TestSuite
A TestSuite is a composite of Tests. It runs a collection of test cases.

Code

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();
    }
  }
}