You are here

public function AttachedAssetsTest::testLibraryNameConflicts in Drupal 9

Same name and namespace in other branches
  1. 8 core/tests/Drupal/KernelTests/Core/Asset/AttachedAssetsTest.php \Drupal\KernelTests\Core\Asset\AttachedAssetsTest::testLibraryNameConflicts()

Tests that multiple modules can implement libraries with the same name.

See also

common_test.library.yml

File

core/tests/Drupal/KernelTests/Core/Asset/AttachedAssetsTest.php, line 462

Class

AttachedAssetsTest
Tests #attached assets: attached asset libraries and JavaScript settings.

Namespace

Drupal\KernelTests\Core\Asset

Code

public function testLibraryNameConflicts() {

  /** @var \Drupal\Core\Asset\LibraryDiscoveryInterface $library_discovery */
  $library_discovery = \Drupal::service('library.discovery');
  $farbtastic = $library_discovery
    ->getLibraryByName('common_test', 'jquery.farbtastic');
  $this
    ->assertEquals('0.1', $farbtastic['version'], 'Alternative libraries can be added to the page.');
}