You are here

public function CacheWebTest::testDisplayWithoutCacheStillBubblesMetadata in Drupal 8

Same name and namespace in other branches
  1. 9 core/modules/views/tests/src/Functional/Plugin/CacheWebTest.php \Drupal\Tests\views\Functional\Plugin\CacheWebTest::testDisplayWithoutCacheStillBubblesMetadata()

Tests that a display without caching still contains the cache metadata.

File

core/modules/views/tests/src/Functional/Plugin/CacheWebTest.php, line 91

Class

CacheWebTest
Tests pluggable caching for views via a web test.

Namespace

Drupal\Tests\views\Functional\Plugin

Code

public function testDisplayWithoutCacheStillBubblesMetadata() {
  $view = Views::getView('test_display');
  $uncached_block = $view
    ->buildRenderable('block_1', [], FALSE);
  $cached_block = $view
    ->buildRenderable('block_1', [], TRUE);
  $this
    ->assertEqual($uncached_block['#cache']['contexts'], $cached_block['#cache']['contexts'], 'Cache contexts are the same when you render the view cached and uncached.');
}