Same name and namespace in other branches
  1. 8.9.x core/modules/views/tests/src/Functional/Plugin/CacheWebTest.php \Drupal\Tests\views\Functional\Plugin\CacheWebTest::testDisplayWithoutCacheStillBubblesMetadata()
  2. 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 93

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
    ->assertEquals($uncached_block['#cache']['contexts'], $cached_block['#cache']['contexts'], 'Cache contexts are the same when you render the view cached and uncached.');
}