protected function ResolvedLibraryDefinitionsFilesMatchTest::getAllLibraries in Drupal 9
Same name and namespace in other branches
- 8 core/tests/Drupal/KernelTests/Core/Asset/ResolvedLibraryDefinitionsFilesMatchTest.php \Drupal\KernelTests\Core\Asset\ResolvedLibraryDefinitionsFilesMatchTest::getAllLibraries()
- 10 core/tests/Drupal/KernelTests/Core/Asset/ResolvedLibraryDefinitionsFilesMatchTest.php \Drupal\KernelTests\Core\Asset\ResolvedLibraryDefinitionsFilesMatchTest::getAllLibraries()
Gets all libraries for core and all installed modules.
Return value
\Drupal\Core\Extension\Extension[]
1 call to ResolvedLibraryDefinitionsFilesMatchTest::getAllLibraries()
- ResolvedLibraryDefinitionsFilesMatchTest::testCoreLibraryCompleteness in core/
tests/ Drupal/ KernelTests/ Core/ Asset/ ResolvedLibraryDefinitionsFilesMatchTest.php - Ensures that all core module and theme library files exist.
File
- core/
tests/ Drupal/ KernelTests/ Core/ Asset/ ResolvedLibraryDefinitionsFilesMatchTest.php, line 190
Class
- ResolvedLibraryDefinitionsFilesMatchTest
- Tests that the asset files for all core libraries exist.
Namespace
Drupal\KernelTests\Core\AssetCode
protected function getAllLibraries() {
$modules = \Drupal::moduleHandler()
->getModuleList();
$extensions = $modules;
$module_list = array_keys($modules);
sort($module_list);
$this
->assertEquals($this->allModules, $module_list, 'All core modules are installed.');
$themes = $this->themeHandler
->listInfo();
$extensions += $themes;
$theme_list = array_keys($themes);
sort($theme_list);
$this
->assertEquals($this->allThemes, $theme_list, 'All core themes are installed.');
$libraries['core'] = $this->libraryDiscovery
->getLibrariesByExtension('core');
foreach ($extensions as $extension_name => $extension) {
$library_file = $extension
->getPath() . '/' . $extension_name . '.libraries.yml';
if (is_file($this->root . '/' . $library_file)) {
$libraries[$extension_name] = $this->libraryDiscovery
->getLibrariesByExtension($extension_name);
}
}
return $libraries;
}