function TestBase::checkTestHierarchyMismatch

Fail the test if it belongs to a PHPUnit-based framework.

This would probably be caused by automated test conversions such as those in https://www.drupal.org/project/drupal/issues/2770921.

1 call to TestBase::checkTestHierarchyMismatch()
TestBase::run in core/modules/simpletest/src/TestBase.php
Run all tests in this class.

File

core/modules/simpletest/src/TestBase.php, line 262

Class

TestBase
Base class for Drupal tests.

Namespace

Drupal\simpletest

Code

public function checkTestHierarchyMismatch() {
    // We can use getPhpunitTestSuite() because it uses a regex on the class'
    // namespace to deduce the PHPUnit test suite.
    if (TestDiscovery::getPhpunitTestSuite(get_class($this)) !== FALSE) {
        $this->fail(get_class($this) . ' incorrectly subclasses ' . __CLASS__ . ', it should probably extend \\Drupal\\Tests\\BrowserTestBase instead.');
    }
}

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