class UnitTestSuite

Same name in other branches
  1. 9 core/tests/TestSuites/UnitTestSuite.php \Drupal\Tests\TestSuites\UnitTestSuite
  2. 8.9.x core/tests/TestSuites/UnitTestSuite.php \Drupal\Tests\TestSuites\UnitTestSuite
  3. 11.x core/tests/TestSuites/UnitTestSuite.php \Drupal\Tests\TestSuites\UnitTestSuite

Discovers tests for the unit test suite.

Hierarchy

  • class \Drupal\Tests\TestSuites\TestSuiteBase extends \PHPUnit\Framework\TestSuite
    • class \Drupal\Tests\TestSuites\UnitTestSuite extends \Drupal\Tests\TestSuites\TestSuiteBase

Expanded class hierarchy of UnitTestSuite

Deprecated

in drupal:10.3.0 and is removed from drupal:11.0.0. There is no replacement and test discovery will be handled differently in PHPUnit 10.

See also

https://www.drupal.org/node/3405829

File

core/tests/TestSuites/UnitTestSuite.php, line 17

Namespace

Drupal\Tests\TestSuites
View source
class UnitTestSuite extends TestSuiteBase {
    
    /**
     * Factory method which loads up a suite with all unit tests.
     *
     * @return static
     *   The test suite.
     */
    public static function suite() {
        $root = dirname(__DIR__, 3);
        $suite = new static('unit');
        $suite->addTestsBySuiteNamespace($root, 'Unit');
        return $suite;
    }

}

Members

Title Sort descending Modifiers Object type Summary Overrides
TestSuiteBase::addTestsBySuiteNamespace protected function Find and add tests to the suite for core and any extensions.
TestSuiteBase::findExtensionDirectories protected function Finds extensions in a Drupal installation. 1
UnitTestSuite::suite public static function Factory method which loads up a suite with all unit tests.

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.