You are here

public function LibraryDiscoveryIntegrationTest::testHookLibraryInfoByTheme in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/system/src/Tests/Asset/LibraryDiscoveryIntegrationTest.php \Drupal\system\Tests\Asset\LibraryDiscoveryIntegrationTest::testHookLibraryInfoByTheme()

Tests that hook_library_info is invoked and the cache is cleared.

File

core/modules/system/src/Tests/Asset/LibraryDiscoveryIntegrationTest.php, line 41
Contains \Drupal\system\Tests\Asset\LibraryDiscoveryIntegrationTest.

Class

LibraryDiscoveryIntegrationTest
Tests the library discovery and library discovery parser.

Namespace

Drupal\system\Tests\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
    ->assertTrue($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'));
}