You are here

protected function FieldRenderedEntityTest::assertCacheabilityMetadata in Drupal 10

Same name and namespace in other branches
  1. 8 core/modules/views/tests/src/Kernel/Handler/FieldRenderedEntityTest.php \Drupal\Tests\views\Kernel\Handler\FieldRenderedEntityTest::assertCacheabilityMetadata()
  2. 9 core/modules/views/tests/src/Kernel/Handler/FieldRenderedEntityTest.php \Drupal\Tests\views\Kernel\Handler\FieldRenderedEntityTest::assertCacheabilityMetadata()

Ensures that the expected cacheability metadata is applied.

@internal

Parameters

array $build: The render array

File

core/modules/views/tests/src/Kernel/Handler/FieldRenderedEntityTest.php, line 148

Class

FieldRenderedEntityTest
Tests the core Drupal\views\Plugin\views\field\RenderedEntity handler.

Namespace

Drupal\Tests\views\Kernel\Handler

Code

protected function assertCacheabilityMetadata(array $build) : void {
  $this
    ->assertEqualsCanonicalizing([
    'config:core.entity_view_display.entity_test.entity_test.foobar',
    'config:views.view.test_field_entity_test_rendered',
    'entity_test:1',
    'entity_test:2',
    'entity_test:3',
    'entity_test_list',
    'entity_test_view',
  ], $build['#cache']['tags']);
  $this
    ->assertEqualsCanonicalizing([
    'entity_test_view_grants',
    'languages:language_interface',
    'theme',
    'url.query_args',
    'user.permissions',
  ], $build['#cache']['contexts']);
}