function AttachedAssetsTest::testLibraryNameConflicts

Same name in other branches
  1. 9 core/tests/Drupal/KernelTests/Core/Asset/AttachedAssetsTest.php \Drupal\KernelTests\Core\Asset\AttachedAssetsTest::testLibraryNameConflicts()
  2. 8.9.x core/tests/Drupal/KernelTests/Core/Asset/AttachedAssetsTest.php \Drupal\KernelTests\Core\Asset\AttachedAssetsTest::testLibraryNameConflicts()
  3. 10 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 441

Class

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

Namespace

Drupal\KernelTests\Core\Asset

Code

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

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.