protected function StableLibraryOverrideTestBase::getAllLibraries in Drupal 10
Gets all libraries for core and all installed modules.
Return value
array[] An associative array of libraries keyed by extension, then by library name, then by asset type.
File
- core/
tests/ Drupal/ KernelTests/ Core/ Theme/ StableLibraryOverrideTestBase.php, line 120
Class
- StableLibraryOverrideTestBase
- Tests the behavior of a theme when base_theme info key is missing.
Namespace
Drupal\KernelTests\Core\ThemeCode
protected function getAllLibraries() {
$modules = \Drupal::moduleHandler()
->getModuleList();
$module_list = array_keys($modules);
sort($module_list);
$this
->assertEquals($this->allModules, $module_list, 'All core modules are installed.');
$libraries['core'] = $this->libraryDiscovery
->getLibrariesByExtension('core');
foreach ($modules as $module_name => $module) {
$library_file = $module
->getPath() . '/' . $module_name . '.libraries.yml';
if (is_file($this->root . '/' . $library_file)) {
$libraries[$module_name] = $this->libraryDiscovery
->getLibrariesByExtension($module_name);
}
}
return $libraries;
}