function CacheWebTest::testDisplayWithoutCacheStillBubblesMetadata

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()
  2. 8.9.x core/modules/views/tests/src/Functional/Plugin/CacheWebTest.php \Drupal\Tests\views\Functional\Plugin\CacheWebTest::testDisplayWithoutCacheStillBubblesMetadata()
  3. 10 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() : void {
    $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.');
}

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