function drupal_phpunit_find_extension_directories
Same name in other branches
- 9 core/tests/bootstrap.php \drupal_phpunit_find_extension_directories()
- 10 core/tests/bootstrap.php \drupal_phpunit_find_extension_directories()
- 11.x core/tests/bootstrap.php \drupal_phpunit_find_extension_directories()
Finds all valid extension directories recursively within a given directory.
Parameters
string $scan_directory: The directory that should be recursively scanned.
Return value
array An associative array of extension directories found within the scanned directory, keyed by extension name.
2 string references to 'drupal_phpunit_find_extension_directories'
- drupal_phpunit_populate_class_loader in core/
tests/ bootstrap.php - Populate class loader with additional namespaces for tests.
- TestSuiteBase::findExtensionDirectories in core/
tests/ TestSuites/ TestSuiteBase.php - Finds extensions in a Drupal installation.
File
-
core/
tests/ bootstrap.php, line 33
Code
function drupal_phpunit_find_extension_directories($scan_directory) {
$extensions = [];
$dirs = new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($scan_directory, \RecursiveDirectoryIterator::FOLLOW_SYMLINKS));
foreach ($dirs as $dir) {
if (strpos($dir->getPathname(), '.info.yml') !== FALSE) {
// Cut off ".info.yml" from the filename for use as the extension name. We
// use getRealPath() so that we can scan extensions represented by
// directory aliases.
$extensions[substr($dir->getFilename(), 0, -9)] = $dir->getPathInfo()
->getRealPath();
}
}
return $extensions;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.