You are here

public function LibraryDiscoveryIntegrationTest::testLibrariesOverrideOtherAssetLibraryNames in Drupal 10

Same name and namespace in other branches
  1. 8 core/tests/Drupal/KernelTests/Core/Asset/LibraryDiscoveryIntegrationTest.php \Drupal\KernelTests\Core\Asset\LibraryDiscoveryIntegrationTest::testLibrariesOverrideOtherAssetLibraryNames()
  2. 9 core/tests/Drupal/KernelTests/Core/Asset/LibraryDiscoveryIntegrationTest.php \Drupal\KernelTests\Core\Asset\LibraryDiscoveryIntegrationTest::testLibrariesOverrideOtherAssetLibraryNames()

Tests library assets with other ways for specifying paths.

File

core/tests/Drupal/KernelTests/Core/Asset/LibraryDiscoveryIntegrationTest.php, line 138

Class

LibraryDiscoveryIntegrationTest
Tests the library discovery and library discovery parser.

Namespace

Drupal\KernelTests\Core\Asset

Code

public function testLibrariesOverrideOtherAssetLibraryNames() {

  // Activate a test theme that defines libraries overrides on other types of
  // assets.
  $this
    ->activateTheme('test_theme');

  // Assert Drupal-relative paths.
  $this
    ->assertAssetInLibrary('themes/my_theme/css/dropbutton.css', 'core', 'drupal.dropbutton', 'css');

  // Assert stream wrapper paths.
  $this
    ->assertAssetInLibrary('public://my_css/vertical-tabs.css', 'core', 'drupal.vertical-tabs', 'css');

  // Assert a protocol-relative URI.
  $this
    ->assertAssetInLibrary('//my-server/my_theme/js/overridden.js', 'core', 'drupal.displace', 'js');

  // Assert an absolute URI.
  $this
    ->assertAssetInLibrary('http://example.com/my_theme/css/farbtastic.css', 'core', 'jquery.farbtastic', 'css');
}