function LibraryDiscoveryIntegrationTest::testHookLibraryInfoByTheme
Tests that hook_library_info is invoked and the cache is cleared.
File
- 
              core/tests/ Drupal/ KernelTests/ Core/ Asset/ LibraryDiscoveryIntegrationTest.php, line 43 
Class
- LibraryDiscoveryIntegrationTest
- Tests the library discovery and library discovery parser.
Namespace
Drupal\KernelTests\Core\AssetCode
public function testHookLibraryInfoByTheme() : void {
  // 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.
