public function CacheWebTest::testDisplayWithoutCacheStillBubblesMetadata in Drupal 9
Same name and namespace in other branches
- 8 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\PluginCode
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.');
}