You are here

protected function Stable9LibraryOverrideTest::getAllLibraries in Drupal 9

Gets all libraries for core and all installed modules.

Return value

array[] An associative array of libraries keyed by extension, then by library name, and so on.

1 call to Stable9LibraryOverrideTest::getAllLibraries()
Stable9LibraryOverrideTest::testStable9LibraryOverrides in core/tests/Drupal/KernelTests/Core/Theme/Stable9LibraryOverrideTest.php
Ensures that Stable 9 overrides all relevant core library assets.

File

core/tests/Drupal/KernelTests/Core/Theme/Stable9LibraryOverrideTest.php, line 176

Class

Stable9LibraryOverrideTest
Tests Stable 9's library overrides.

Namespace

Drupal\KernelTests\Core\Theme

Code

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;
}