You are here

public function NodeListBuilderTest::testCacheContexts in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/node/src/Tests/NodeListBuilderTest.php \Drupal\node\Tests\NodeListBuilderTest::testCacheContexts()

Tests that the correct cache contexts are set.

File

core/modules/node/src/Tests/NodeListBuilderTest.php, line 35
Contains \Drupal\node\Tests\NodeListBuilderTest.

Class

NodeListBuilderTest
Tests the admin listing fallback when views is not enabled.

Namespace

Drupal\node\Tests

Code

public function testCacheContexts() {

  /** @var \Drupal\Core\Entity\EntityListBuilderInterface $list_builder */
  $list_builder = $this->container
    ->get('entity.manager')
    ->getListBuilder('node');
  $build = $list_builder
    ->render();
  $this->container
    ->get('renderer')
    ->renderRoot($build);
  $this
    ->assertEqual([
    'languages:' . LanguageInterface::TYPE_INTERFACE,
    'theme',
    'url.query_args.pagers:0',
    'user.node_grants:view',
    'user.permissions',
  ], $build['#cache']['contexts']);
}