FileSystemModuleDiscoveryDataProviderTrait.php in Drupal 8
File
core/tests/Drupal/KernelTests/FileSystemModuleDiscoveryDataProviderTrait.php
View source
<?php
namespace Drupal\KernelTests;
trait FileSystemModuleDiscoveryDataProviderTrait {
public function coreModuleListDataProvider() {
$prefix = dirname(__DIR__, 3) . DIRECTORY_SEPARATOR . 'modules';
$module_dirs = array_keys(iterator_to_array(new \FilesystemIterator($prefix)));
$module_names = array_map(function ($path) use ($prefix) {
return str_replace($prefix . DIRECTORY_SEPARATOR, '', $path);
}, $module_dirs);
$modules_keyed = array_combine($module_names, $module_names);
$data = array_map(function ($module) {
return [
$module,
];
}, $modules_keyed);
return $data;
}
}