You are here

public function EntityListBuilderTest::testCacheContexts in Zircon Profile 8

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

Tests that the correct cache contexts are set.

File

core/modules/system/src/Tests/Entity/EntityListBuilderTest.php, line 63
Contains \Drupal\system\Tests\Entity\EntityListBuilderTest.

Class

EntityListBuilderTest
Tests entity list builder functionality.

Namespace

Drupal\system\Tests\Entity

Code

public function testCacheContexts() {

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