function FieldRenderedEntityTest::assertCacheabilityMetadata

Same name in other branches
  1. 9 core/modules/views/tests/src/Kernel/Handler/FieldRenderedEntityTest.php \Drupal\Tests\views\Kernel\Handler\FieldRenderedEntityTest::assertCacheabilityMetadata()
  2. 8.9.x core/modules/views/tests/src/Kernel/Handler/FieldRenderedEntityTest.php \Drupal\Tests\views\Kernel\Handler\FieldRenderedEntityTest::assertCacheabilityMetadata()
  3. 10 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

1 call to FieldRenderedEntityTest::assertCacheabilityMetadata()
FieldRenderedEntityTest::testRenderedEntityWithoutAndWithField in core/modules/views/tests/src/Kernel/Handler/FieldRenderedEntityTest.php
Tests the default rendered entity output.

File

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

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: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']);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.