public function DefaultConfigTest::themeListDataProvider in Drupal 9
A data provider that lists every theme in core.
Return value
array An array of theme names to test.
File
- core/
tests/ Drupal/ KernelTests/ Config/ DefaultConfigTest.php, line 118
Class
- DefaultConfigTest
- Tests that the installed config matches the default config.
Namespace
Drupal\KernelTests\ConfigCode
public function themeListDataProvider() {
$prefix = dirname(__DIR__, 4) . DIRECTORY_SEPARATOR . 'themes';
$theme_dirs = array_keys(iterator_to_array(new \FilesystemIterator($prefix)));
$theme_names = array_map(function ($path) use ($prefix) {
return str_replace($prefix . DIRECTORY_SEPARATOR, '', $path);
}, $theme_dirs);
$themes_keyed = array_combine($theme_names, $theme_names);
// Engines is not a theme.
unset($themes_keyed['engines']);
return array_map(function ($theme) {
return [
$theme,
];
}, $themes_keyed);
}