function TestDiscoveryTest::testGetTestClassesWithSelectedTypes

@covers ::getTestClasses

File

core/modules/simpletest/tests/src/Unit/TestDiscoveryTest.php, line 159

Class

TestDiscoveryTest
@coversDefaultClass \Drupal\simpletest\TestDiscovery[[api-linebreak]]

Namespace

Drupal\Tests\simpletest\Unit

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.