function StableLibraryOverrideTestBase::getAllLibraries

Same name in other branches
  1. 9 core/tests/Drupal/KernelTests/Core/Theme/StableLibraryOverrideTestBase.php \Drupal\KernelTests\Core\Theme\StableLibraryOverrideTestBase::getAllLibraries()
  2. 11.x core/tests/Drupal/KernelTests/Core/Theme/StableLibraryOverrideTestBase.php \Drupal\KernelTests\Core\Theme\StableLibraryOverrideTestBase::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, then by asset type.

1 call to StableLibraryOverrideTestBase::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/StableLibraryOverrideTestBase.php, line 122

Class

StableLibraryOverrideTestBase
Tests the behavior of a theme when base_theme info key is missing.

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

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