You are here

function AttachedAssetsTest::testNoCache in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/system/src/Tests/Common/AttachedAssetsTest.php \Drupal\system\Tests\Common\AttachedAssetsTest::testNoCache()

Tests that for assets with cache = FALSE, Drupal sets preprocess = FALSE.

File

core/modules/system/src/Tests/Common/AttachedAssetsTest.php, line 248
Contains \Drupal\system\Tests\Common\AttachedAssetsTest.

Class

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

Namespace

Drupal\system\Tests\Common

Code

function testNoCache() {
  $build['#attached']['library'][] = 'common_test/no-cache';
  $assets = AttachedAssets::createFromRenderArray($build);
  $js = $this->assetResolver
    ->getJsAssets($assets, FALSE)[1];
  $this
    ->assertFalse($js['core/modules/system/tests/modules/common_test/nocache.js']['preprocess'], 'Setting cache to FALSE sets preprocess to FALSE when adding JavaScript.');
}