public function PHPUnit_Framework_TestSuite::addTest

Adds a test to the suite.

Parameters

PHPUnit_Framework_Test $test:

array $groups:

5 calls to PHPUnit_Framework_TestSuite::addTest()
PHPUnit_Extensions_GroupTestSuite::__construct in drupal/core/vendor/phpunit/phpunit/PHPUnit/Extensions/GroupTestSuite.php
Constructs a new TestSuite:
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.
PHPUnit_Framework_TestSuite::addTestMethod in drupal/core/vendor/phpunit/phpunit/PHPUnit/Framework/TestSuite.php
PHPUnit_Framework_TestSuite::addTestSuite in drupal/core/vendor/phpunit/phpunit/PHPUnit/Framework/TestSuite.php
Adds the tests from the given class to the suite.
PHPUnit_Framework_TestSuite::__construct in drupal/core/vendor/phpunit/phpunit/PHPUnit/Framework/TestSuite.php
Constructs a new TestSuite:

File

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

Class

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

Code

public function addTest(PHPUnit_Framework_Test $test, $groups = array()) {
  $class = new ReflectionClass($test);
  if (!$class
    ->isAbstract()) {
    $this->tests[] = $test;
    $this->numTests = -1;
    if ($test instanceof PHPUnit_Framework_TestSuite && empty($groups)) {
      $groups = $test
        ->getGroups();
    }
    if (empty($groups)) {
      $groups = array(
        '__nogroup__',
      );
    }
    foreach ($groups as $group) {
      if (!isset($this->groups[$group])) {
        $this->groups[$group] = array(
          $test,
        );
      }
      else {
        $this->groups[$group][] = $test;
      }
    }
  }
}