You are here

protected function StableLibraryOverrideTest::getAllLibraries in Drupal 8

Same name and namespace in other branches
  1. 9 core/tests/Drupal/KernelTests/Core/Theme/StableLibraryOverrideTest.php \Drupal\KernelTests\Core\Theme\StableLibraryOverrideTest::getAllLibraries()

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 StableLibraryOverrideTest::getAllLibraries()
StableLibraryOverrideTest::testStableLibraryOverrides in core/tests/Drupal/KernelTests/Core/Theme/StableLibraryOverrideTest.php
Ensures that Stable overrides all relevant core library assets.

File

core/tests/Drupal/KernelTests/Core/Theme/StableLibraryOverrideTest.php, line 169

Class

StableLibraryOverrideTest
Tests Stable'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
    ->assertEqual($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;
}