function ResolvedLibraryDefinitionsFilesMatchTest::getAllLibraries

Same name and namespace in other branches
  1. 9 core/tests/Drupal/KernelTests/Core/Asset/ResolvedLibraryDefinitionsFilesMatchTest.php \Drupal\KernelTests\Core\Asset\ResolvedLibraryDefinitionsFilesMatchTest::getAllLibraries()
  2. 10 core/tests/Drupal/KernelTests/Core/Asset/ResolvedLibraryDefinitionsFilesMatchTest.php \Drupal\KernelTests\Core\Asset\ResolvedLibraryDefinitionsFilesMatchTest::getAllLibraries()
  3. 11.x 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\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');
    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;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.