function CacheWebTest::testDisplayWithoutCacheStillBubblesMetadata

Same name in other branches
  1. 9 core/modules/views/tests/src/Functional/Plugin/CacheWebTest.php \Drupal\Tests\views\Functional\Plugin\CacheWebTest::testDisplayWithoutCacheStillBubblesMetadata()
  2. 10 core/modules/views/tests/src/Functional/Plugin/CacheWebTest.php \Drupal\Tests\views\Functional\Plugin\CacheWebTest::testDisplayWithoutCacheStillBubblesMetadata()
  3. 11.x 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.');
}

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