function LibraryDiscoveryIntegrationTest::testLibrariesOverridesMultiple

Same name in other branches
  1. 11.x core/tests/Drupal/KernelTests/Core/Asset/LibraryDiscoveryIntegrationTest.php \Drupal\KernelTests\Core\Asset\LibraryDiscoveryIntegrationTest::testLibrariesOverridesMultiple()

Tests libraries overrides with multiple parent themes.

File

core/tests/Drupal/KernelTests/Core/Asset/LibraryDiscoveryIntegrationTest.php, line 135

Class

LibraryDiscoveryIntegrationTest
Tests the library discovery and library discovery parser.

Namespace

Drupal\KernelTests\Core\Asset

Code

public function testLibrariesOverridesMultiple() : void {
    
    /** @var \Drupal\Core\Extension\ThemeInstallerInterface $theme_installer */
    $theme_installer = $this->container
        ->get('theme_installer');
    $theme_installer->install([
        'test_basetheme',
    ]);
    $theme_installer->install([
        'test_subtheme',
    ]);
    $theme_installer->install([
        'test_subsubtheme',
    ]);
    
    /** @var \Drupal\Core\Theme\ThemeInitializationInterface $theme_initializer */
    $theme_initializer = $this->container
        ->get('theme.initialization');
    $active_theme = $theme_initializer->initTheme('test_subsubtheme');
    $libraries_override = $active_theme->getLibrariesOverride();
    $expected_order = [
        'core/modules/system/tests/themes/test_basetheme',
        'core/modules/system/tests/themes/test_subtheme',
        'core/modules/system/tests/themes/test_subsubtheme',
    ];
    $this->assertEquals($expected_order, array_keys($libraries_override));
}

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