function TestSuiteBaseTest::testAddTestsBySuiteNamespaceCore

Same name in other branches
  1. 9 core/tests/Drupal/Tests/Core/Test/TestSuiteBaseTest.php \Drupal\Tests\Core\Test\TestSuiteBaseTest::testAddTestsBySuiteNamespaceCore()
  2. 8.9.x core/tests/Drupal/Tests/Core/Test/TestSuiteBaseTest.php \Drupal\Tests\Core\Test\TestSuiteBaseTest::testAddTestsBySuiteNamespaceCore()

Tests for special case behavior of unit test suite namespaces in core.

@group legacy

@covers ::addTestsBySuiteNamespace

@dataProvider provideCoreTests

File

core/tests/Drupal/Tests/Core/Test/TestSuiteBaseTest.php, line 93

Class

TestSuiteBaseTest
@coversDefaultClass \Drupal\Tests\TestSuites\TestSuiteBase

Namespace

Drupal\Tests\Core\Test

Code

public function testAddTestsBySuiteNamespaceCore($filesystem, $suite_namespace, $expected_tests) : void {
    $this->expectDeprecation('Drupal\\Tests\\Core\\Test\\StubTestSuiteBase is 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 https://www.drupal.org/node/3405829');
    // Set up the file system.
    $vfs = vfsStream::setup('root');
    vfsStream::create($filesystem, $vfs);
    // Make a stub suite base to test.
    $stub = new StubTestSuiteBase('test_me');
    // Access addTestsBySuiteNamespace().
    $ref_add_tests = new \ReflectionMethod($stub, 'addTestsBySuiteNamespace');
    // Invoke addTestsBySuiteNamespace().
    $ref_add_tests->invokeArgs($stub, [
        vfsStream::url('root'),
        $suite_namespace,
    ]);
    // Determine if we loaded the expected test files.
    $this->assertEquals($expected_tests, $stub->testFiles);
}

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