You are here

protected function ResolvedLibraryDefinitionsFilesMatchTest::getAllLibraries in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/system/src/Tests/Asset/ResolvedLibraryDefinitionsFilesMatchTest.php \Drupal\system\Tests\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/modules/system/src/Tests/Asset/ResolvedLibraryDefinitionsFilesMatchTest.php
Ensures that all core module and theme library files exist.

File

core/modules/system/src/Tests/Asset/ResolvedLibraryDefinitionsFilesMatchTest.php, line 175
Contains \Drupal\system\Tests\Asset\ResolvedLibraryDefinitionsFilesMatchTest.

Class

ResolvedLibraryDefinitionsFilesMatchTest
Tests that the asset files for all core libraries exist.

Namespace

Drupal\system\Tests\Asset

Code

protected function getAllLibraries() {
  $modules = \Drupal::moduleHandler()
    ->getModuleList();
  $extensions = $modules;
  $module_list = array_keys($modules);
  sort($module_list);
  $this
    ->assertEqual($this->allModules, $module_list, 'All core modules are installed.');
  $themes = $this->themeHandler
    ->listInfo();
  $extensions += $themes;
  $theme_list = array_keys($themes);
  sort($theme_list);
  $this
    ->assertEqual($this->allThemes, $theme_list, 'All core themes are installed.');
  $libraries['core'] = $this->libraryDiscovery
    ->getLibrariesByExtension('core');
  $root = \Drupal::root();
  foreach ($extensions as $extension_name => $extension) {
    $library_file = $extension
      ->getPath() . '/' . $extension_name . '.libraries.yml';
    if (is_file($root . '/' . $library_file)) {
      $libraries[$extension_name] = $this->libraryDiscovery
        ->getLibrariesByExtension($extension_name);
    }
  }
  return $libraries;
}