You are here

public function PHPUnit_Framework_TestSuite::addTest in Zircon Profile 8.0

Same name and namespace in other branches
  1. 8 vendor/phpunit/phpunit/src/Framework/TestSuite.php \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 vendor/phpunit/phpunit/src/Extensions/GroupTestSuite.php
Constructs a new TestSuite:
PHPUnit_Framework_TestSuite::addTestFile in vendor/phpunit/phpunit/src/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 vendor/phpunit/phpunit/src/Framework/TestSuite.php
PHPUnit_Framework_TestSuite::addTestSuite in vendor/phpunit/phpunit/src/Framework/TestSuite.php
Adds the tests from the given class to the suite.
PHPUnit_Framework_TestSuite::__construct in vendor/phpunit/phpunit/src/Framework/TestSuite.php
Constructs a new TestSuite:

File

vendor/phpunit/phpunit/src/Framework/TestSuite.php, line 227

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 self && empty($groups)) {
      $groups = $test
        ->getGroups();
    }
    if (empty($groups)) {
      $groups = array(
        'default',
      );
    }
    foreach ($groups as $group) {
      if (!isset($this->groups[$group])) {
        $this->groups[$group] = array(
          $test,
        );
      }
      else {
        $this->groups[$group][] = $test;
      }
    }
  }
}