You are here

public function TestDiscoveryTest::testScanDirectoryNoAbstract in Drupal 8

Same name and namespace in other branches
  1. 9 core/tests/Drupal/Tests/Core/Test/TestDiscoveryTest.php \Drupal\Tests\Core\Test\TestDiscoveryTest::testScanDirectoryNoAbstract()

Ensure TestDiscovery::scanDirectory() ignores certain abstract file types.

@covers ::scanDirectory

File

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

Class

TestDiscoveryTest
@coversDefaultClass \Drupal\Core\Test\TestDiscovery @group Test

Namespace

Drupal\Tests\Core\Test

Code

public function testScanDirectoryNoAbstract() {
  $this
    ->setupVfsWithTestClasses();
  $files = TestDiscovery::scanDirectory('Drupal\\Tests\\test_module\\Kernel\\', vfsStream::url('drupal/modules/test_module/tests/src/Kernel'));
  $this
    ->assertNotEmpty($files);
  $this
    ->assertArrayNotHasKey('Drupal\\Tests\\test_module\\Kernel\\KernelExampleTestBase', $files);
  $this
    ->assertArrayNotHasKey('Drupal\\Tests\\test_module\\Kernel\\KernelExampleTrait', $files);
  $this
    ->assertArrayNotHasKey('Drupal\\Tests\\test_module\\Kernel\\KernelExampleInterface', $files);
  $this
    ->assertArrayHasKey('Drupal\\Tests\\test_module\\Kernel\\KernelExampleTest3', $files);
}