You are here

protected function StableLibraryOverrideTest::getAllLibraries in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/system/src/Tests/Theme/StableLibraryOverrideTest.php \Drupal\system\Tests\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/modules/system/src/Tests/Theme/StableLibraryOverrideTest.php
Ensures that Stable overrides all relevant core library assets.

File

core/modules/system/src/Tests/Theme/StableLibraryOverrideTest.php, line 167
Contains \Drupal\system\Tests\Theme\StableLibraryOverrideTest.

Class

StableLibraryOverrideTest
Tests Stable's library overrides.

Namespace

Drupal\system\Tests\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');
  $root = \Drupal::root();
  foreach ($modules as $module_name => $module) {
    $library_file = $module
      ->getPath() . '/' . $module_name . '.libraries.yml';
    if (is_file($root . '/' . $library_file)) {
      $libraries[$module_name] = $this->libraryDiscovery
        ->getLibrariesByExtension($module_name);
    }
  }
  return $libraries;
}