You are here

public function MultipleAssetLibraryTest::testAttachableAssetInfo in Libraries API 8.3

Tests that attachable asset library info is correctly gathered.

File

tests/src/Kernel/ExternalLibrary/Asset/MultipleAssetLibraryTest.php, line 24

Class

MultipleAssetLibraryTest
Tests that external asset libraries can register multiple core libraries.

Namespace

Drupal\Tests\libraries\Kernel\ExternalLibrary\Asset

Code

public function testAttachableAssetInfo() {

  /** @var \Drupal\libraries\ExternalLibrary\Asset\AttachableAssetLibraryRegistrationInterface $library_type */
  $library_type = $this
    ->getLibraryType();
  $library = $this
    ->getLibrary();
  $expected = [
    'test_asset_multiple_library.first' => [
      'version' => '1.0.0',
      'css' => [
        'base' => [
          'http://example.com/example.first.css' => [],
        ],
      ],
      'js' => [
        'http://example.com/example.first.js' => [],
      ],
      'dependencies' => [],
    ],
    'test_asset_multiple_library.second' => [
      'version' => '1.0.0',
      'css' => [
        'base' => [
          'http://example.com/example.second.css' => [],
        ],
      ],
      'js' => [
        'http://example.com/example.second.js' => [],
      ],
      'dependencies' => [],
    ],
  ];
  $this
    ->assertEquals($expected, $library_type
    ->getAttachableAssetLibraries($library, $this->libraryManager));
}