You are here

public function AttachedAssetsTest::testLibraryUnknown in Drupal 8

Same name and namespace in other branches
  1. 9 core/tests/Drupal/KernelTests/Core/Asset/AttachedAssetsTest.php \Drupal\KernelTests\Core\Asset\AttachedAssetsTest::testLibraryUnknown()
  2. 10 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 68

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.');
}