function TestDiscoveryTest::testScanDirectoryNoAbstract

Same name and namespace in other branches
  1. 9 core/tests/Drupal/Tests/Core/Test/TestDiscoveryTest.php \Drupal\Tests\Core\Test\TestDiscoveryTest::testScanDirectoryNoAbstract()
  2. 8.9.x core/tests/Drupal/Tests/Core/Test/TestDiscoveryTest.php \Drupal\Tests\Core\Test\TestDiscoveryTest::testScanDirectoryNoAbstract()
  3. 10 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 488

Class

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

Namespace

Drupal\Tests\Core\Test

Code

public function testScanDirectoryNoAbstract() : void {
    $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);
}

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