public function RenderCacheIntegrationTest::testViewAddCacheMetadata in Drupal 9
Same name and namespace in other branches
- 8 core/modules/views/tests/src/Kernel/RenderCacheIntegrationTest.php \Drupal\Tests\views\Kernel\RenderCacheIntegrationTest::testViewAddCacheMetadata()
Ensures that saving a view calculates the cache contexts.
File
- core/
modules/ views/ tests/ src/ Kernel/ RenderCacheIntegrationTest.php, line 284
Class
- RenderCacheIntegrationTest
- Tests the general integration between views and the render cache.
Namespace
Drupal\Tests\views\KernelCode
public function testViewAddCacheMetadata() {
$view = View::load('test_display');
$view
->save();
$this
->assertEqualsCanonicalizing([
'languages:' . LanguageInterface::TYPE_CONTENT,
'languages:' . LanguageInterface::TYPE_INTERFACE,
'url.query_args',
'user.node_grants:view',
'user.permissions',
], $view
->getDisplay('default')['cache_metadata']['contexts']);
}