You are here

public function RenderCacheIntegrationTest::testViewAddCacheMetadata in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/views/src/Tests/RenderCacheIntegrationTest.php \Drupal\views\Tests\RenderCacheIntegrationTest::testViewAddCacheMetadata()

Ensures that saving a view calculates the cache contexts.

File

core/modules/views/src/Tests/RenderCacheIntegrationTest.php, line 300
Contains \Drupal\views\Tests\RenderCacheIntegrationTest.

Class

RenderCacheIntegrationTest
Tests the general integration between views and the render cache.

Namespace

Drupal\views\Tests

Code

public function testViewAddCacheMetadata() {
  $view = View::load('test_display');
  $view
    ->save();
  $this
    ->assertEqual([
    'languages:' . LanguageInterface::TYPE_CONTENT,
    'languages:' . LanguageInterface::TYPE_INTERFACE,
    'url.query_args',
    'user.node_grants:view',
    'user.permissions',
  ], $view
    ->getDisplay('default')['cache_metadata']['contexts']);
}