public function TestDiscovery::findAllClassFiles in Drupal 9
Same name and namespace in other branches
- 8 core/lib/Drupal/Core/Test/TestDiscovery.php \Drupal\Core\Test\TestDiscovery::findAllClassFiles()
Discovers all class files in all available extensions.
Parameters
string $extension: (optional) The name of an extension to limit discovery to; e.g., 'node'.
Return value
array A classmap containing all discovered class files; i.e., a map of fully-qualified classnames to pathnames.
1 call to TestDiscovery::findAllClassFiles()
- TestDiscovery::getTestClasses in core/
lib/ Drupal/ Core/ Test/ TestDiscovery.php - Discovers all available tests in all extensions.
File
- core/
lib/ Drupal/ Core/ Test/ TestDiscovery.php, line 233
Class
- TestDiscovery
- Discovers available tests.
Namespace
Drupal\Core\TestCode
public function findAllClassFiles($extension = NULL) {
$classmap = [];
$namespaces = $this
->registerTestNamespaces();
if (isset($extension)) {
// Include tests in the \Drupal\Tests\{$extension} namespace.
$pattern = "/Drupal\\\\(Tests\\\\)?{$extension}\\\\/";
$namespaces = array_intersect_key($namespaces, array_flip(preg_grep($pattern, array_keys($namespaces))));
}
foreach ($namespaces as $namespace => $paths) {
foreach ($paths as $path) {
if (!is_dir($path)) {
continue;
}
$classmap += static::scanDirectory($namespace, $path);
}
}
return $classmap;
}