activateTheme example

$this->container->get('theme_installer')->install(['test_theme', 'starterkit_theme']);
    $this->libraryDiscovery = $this->container->get('library.discovery');
  }

  /** * Tests that hook_library_info is invoked and the cache is cleared. */
  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'));
  }

  /** * Tests that libraries-override are applied to library definitions. */
  
Home | Imprint | This part of the site doesn't use cookies.