You are here

public function LibraryDiscoveryIntegrationTest::testHookLibraryInfoByTheme in Drupal 8

Same name and namespace in other branches
  1. 9 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'));
}