function TestDiscoveryTest::testGetTestClassesWithSelectedTypes

Same name and namespace in other branches
  1. 8.9.x core/modules/simpletest/tests/src/Unit/TestDiscoveryTest.php \Drupal\Tests\simpletest\Unit\TestDiscoveryTest::testGetTestClassesWithSelectedTypes()
  2. 8.9.x core/tests/Drupal/Tests/Core/Test/TestDiscoveryTest.php \Drupal\Tests\Core\Test\TestDiscoveryTest::testGetTestClassesWithSelectedTypes()
  3. 10 core/tests/Drupal/Tests/Core/Test/TestDiscoveryTest.php \Drupal\Tests\Core\Test\TestDiscoveryTest::testGetTestClassesWithSelectedTypes()
  4. 11.x core/tests/Drupal/Tests/Core/Test/TestDiscoveryTest.php \Drupal\Tests\Core\Test\TestDiscoveryTest::testGetTestClassesWithSelectedTypes()

@covers ::getTestClasses

File

core/tests/Drupal/Tests/Core/Test/TestDiscoveryTest.php, line 438

Class

TestDiscoveryTest
@coversDefaultClass <a href="/api/drupal/core%21lib%21Drupal%21Core%21Test%21TestDiscovery.php/class/TestDiscovery/9" title="Discovers available tests." class="local">\Drupal\Core\Test\TestDiscovery</a> @group Test

Namespace

Drupal\Tests\Core\Test

Code

public function testGetTestClassesWithSelectedTypes() {
    $this->setupVfsWithTestClasses();
    $extensions = [
        'test_module' => new Extension('vfs://drupal', 'module', 'modules/test_module/test_module.info.yml'),
        'test_profile_module' => new Extension('vfs://drupal', 'profile', 'profiles/test_profile/modules/test_profile_module/test_profile_module.info.yml'),
    ];
    $test_discovery = $this->getTestDiscoveryMock('vfs://drupal', $extensions);
    $result = $test_discovery->getTestClasses(NULL, [
        'PHPUnit-Kernel',
    ]);
    $this->assertCount(4, $result);
    $this->assertEquals([
        'example' => [],
        'example2' => [
            'Drupal\\Tests\\test_module\\Kernel\\KernelExampleTest3' => [
                'name' => 'Drupal\\Tests\\test_module\\Kernel\\KernelExampleTest3',
                'description' => 'Test description',
                'group' => 'example2',
                'groups' => [
                    'example2',
                    'kernel',
                ],
                'type' => 'PHPUnit-Kernel',
            ],
        ],
        'kernel' => [
            'Drupal\\Tests\\test_module\\Kernel\\KernelExampleTest3' => [
                'name' => 'Drupal\\Tests\\test_module\\Kernel\\KernelExampleTest3',
                'description' => 'Test description',
                'group' => 'example2',
                'groups' => [
                    'example2',
                    'kernel',
                ],
                'type' => 'PHPUnit-Kernel',
            ],
        ],
        'example3' => [
            'Drupal\\Tests\\test_profile_module\\Kernel\\KernelExampleTest4' => [
                'name' => 'Drupal\\Tests\\test_profile_module\\Kernel\\KernelExampleTest4',
                'description' => 'Test description',
                'group' => 'example3',
                'groups' => [
                    'example3',
                ],
                'type' => 'PHPUnit-Kernel',
            ],
        ],
    ], $result);
}

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