function AttachedAssetsTest::testDefault

Same name in other branches
  1. 9 core/tests/Drupal/KernelTests/Core/Asset/AttachedAssetsTest.php \Drupal\KernelTests\Core\Asset\AttachedAssetsTest::testDefault()
  2. 8.9.x core/tests/Drupal/KernelTests/Core/Asset/AttachedAssetsTest.php \Drupal\KernelTests\Core\Asset\AttachedAssetsTest::testDefault()
  3. 11.x core/tests/Drupal/KernelTests/Core/Asset/AttachedAssetsTest.php \Drupal\KernelTests\Core\Asset\AttachedAssetsTest::testDefault()

Tests that default CSS and JavaScript is empty.

File

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

Class

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

Namespace

Drupal\KernelTests\Core\Asset

Code

public function testDefault() : void {
    $assets = new AttachedAssets();
    $this->assertEquals([], $this->assetResolver
        ->getCssAssets($assets, FALSE, \Drupal::languageManager()->getCurrentLanguage()), 'Default CSS is empty.');
    [
        $js_assets_header,
        $js_assets_footer,
    ] = $this->assetResolver
        ->getJsAssets($assets, FALSE, \Drupal::languageManager()->getCurrentLanguage());
    $this->assertEquals([], $js_assets_header, 'Default header JavaScript is empty.');
    $this->assertEquals([], $js_assets_footer, 'Default footer JavaScript is empty.');
}

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