You are here

public function TestDiscoveryTest::testGetTestClasses in SimpleTest 8.3

@covers ::getTestClasses

File

tests/src/Unit/TestDiscoveryTest.php, line 109

Class

TestDiscoveryTest
@coversDefaultClass \Drupal\simpletest\TestDiscovery

Namespace

Drupal\Tests\simpletest\Unit

Code

public function testGetTestClasses() {
  $this
    ->setupVfsWithTestClasses();
  $extensions = [
    'test_module' => new Extension('vfs://drupal', 'module', 'modules/test_module/test_module.info.yml'),
  ];
  $test_discovery = $this
    ->getTestDiscoveryMock('vfs://drupal', $extensions);
  $result = $test_discovery
    ->getTestClasses();
  $this
    ->assertCount(3, $result);
  $this
    ->assertEquals([
    'example' => [
      'Drupal\\Tests\\test_module\\Functional\\FunctionalExampleTest' => [
        'name' => 'Drupal\\Tests\\test_module\\Functional\\FunctionalExampleTest',
        'description' => 'Test description',
        'group' => 'example',
        'groups' => [
          'example',
        ],
        'type' => 'PHPUnit-Functional',
      ],
    ],
    'example2' => [
      'Drupal\\Tests\\test_module\\Functional\\FunctionalExampleTest2' => [
        'name' => 'Drupal\\Tests\\test_module\\Functional\\FunctionalExampleTest2',
        'description' => 'Test description',
        'group' => 'example2',
        'groups' => [
          'example2',
        ],
        'type' => 'PHPUnit-Functional',
      ],
      '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',
      ],
    ],
  ], $result);
}