You are here

public function AttachedAssetsTest::testLibraryUnknown 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::testLibraryUnknown()

Tests non-existing libraries.

File

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

Class

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

Namespace

Drupal\KernelTests\Core\Asset

Code

public function testLibraryUnknown() {
  $build['#attached']['library'][] = 'core/unknown';
  $assets = AttachedAssets::createFromRenderArray($build);
  $this
    ->assertSame([], $this->assetResolver
    ->getJsAssets($assets, FALSE)[0], 'Unknown library was not added to the page.');
}