You are here

public function TestDiscoveryTest::testGetTestClassesWithSelectedTypes in Drupal 8

Same name in this branch
  1. 8 core/tests/Drupal/Tests/Core/Test/TestDiscoveryTest.php \Drupal\Tests\Core\Test\TestDiscoveryTest::testGetTestClassesWithSelectedTypes()
  2. 8 core/modules/simpletest/tests/src/Unit/TestDiscoveryTest.php \Drupal\Tests\simpletest\Unit\TestDiscoveryTest::testGetTestClassesWithSelectedTypes()

@covers ::getTestClasses

File

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

Class

TestDiscoveryTest
@coversDefaultClass \Drupal\simpletest\TestDiscovery

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);
}