function LibraryDiscoveryIntegrationTest::testHookLibraryInfoByTheme

Same name in other branches
  1. 9 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 36

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 classy the active theme and assert that library is not added.
    $this->activateTheme('classy');
    $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.