Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. TestSuite.php

function TestSuite::addTest

Adds a test to the suite.

3 calls to TestSuite::addTest()
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.
TestSuite::addTestMethod in vendor/phpunit/phpunit/src/Framework/TestSuite.php
TestSuite::addTestSuite in vendor/phpunit/phpunit/src/Framework/TestSuite.php
Adds the tests from the given class to the suite.

File

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

Class

TestSuite
@template-implements IteratorAggregate<int, Test>

Namespace

PHPUnit\Framework

Code

public function addTest(Test $test, array $groups = []) : void {
    $class = new ReflectionClass($test);
    if ($class->isAbstract()) {
        return;
    }
    $this->tests[] = $test;
    $this->clearCaches();
    if ($test instanceof self && empty($groups)) {
        $groups = $test->groups();
    }
    if ($this->containsOnlyVirtualGroups($groups)) {
        $groups[] = 'default';
    }
    foreach ($groups as $group) {
        if (!isset($this->groups[$group])) {
            $this->groups[$group] = [
                $test,
            ];
        }
        else {
            $this->groups[$group][] = $test;
        }
    }
    if ($test instanceof TestCase) {
        $test->setGroups($groups);
    }
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal