function LibraryDiscoveryIntegrationTest::testHookLibraryInfoByTheme

Same name and namespace in other branches
  1. 8.9.x core/tests/Drupal/KernelTests/Core/Asset/LibraryDiscoveryIntegrationTest.php \Drupal\KernelTests\Core\Asset\LibraryDiscoveryIntegrationTest::testHookLibraryInfoByTheme()
  2. 10 core/tests/Drupal/KernelTests/Core/Asset/LibraryDiscoveryIntegrationTest.php \Drupal\KernelTests\Core\Asset\LibraryDiscoveryIntegrationTest::testHookLibraryInfoByTheme()
  3. 11.x core/tests/Drupal/KernelTests/Core/Asset/LibraryDiscoveryIntegrationTest.php \Drupal\KernelTests\Core\Asset\LibraryDiscoveryIntegrationTest::testHookLibraryInfoByTheme()

Tests that hook_library_info is invoked and the cache is cleared.

File

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

Class

LibraryDiscoveryIntegrationTest
Tests the library discovery and library discovery parser.

Namespace

Drupal\KernelTests\Core\Asset

Code

public function testHookLibraryInfoByTheme() {
    // Activate test_theme and verify that the library 'kitten' is added using
    // hook_library_info_alter().
    $this->activateTheme('test_theme');
    $this->assertNotEmpty($this->libraryDiscovery
        ->getLibraryByName('test_theme', 'kitten'));
    // Now make starterkit_theme the active theme and assert that library is not
    // added.
    $this->activateTheme('starterkit_theme');
    $this->assertFalse($this->libraryDiscovery
        ->getLibraryByName('test_theme', 'kitten'));
}

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