function EntityReferenceFormatterTest::testCustomCacheTagFormatter
Same name in other branches
- 9 core/modules/field/tests/src/Kernel/EntityReference/EntityReferenceFormatterTest.php \Drupal\Tests\field\Kernel\EntityReference\EntityReferenceFormatterTest::testCustomCacheTagFormatter()
- 8.9.x core/modules/field/tests/src/Kernel/EntityReference/EntityReferenceFormatterTest.php \Drupal\Tests\field\Kernel\EntityReference\EntityReferenceFormatterTest::testCustomCacheTagFormatter()
- 10 core/modules/field/tests/src/Kernel/EntityReference/EntityReferenceFormatterTest.php \Drupal\Tests\field\Kernel\EntityReference\EntityReferenceFormatterTest::testCustomCacheTagFormatter()
Tests the merging of cache metadata.
File
-
core/
modules/ field/ tests/ src/ Kernel/ EntityReference/ EntityReferenceFormatterTest.php, line 175
Class
- EntityReferenceFormatterTest
- Tests the formatters functionality.
Namespace
Drupal\Tests\field\Kernel\EntityReferenceCode
public function testCustomCacheTagFormatter() : void {
/** @var \Drupal\Core\Render\RendererInterface $renderer */
$renderer = $this->container
->get('renderer');
$formatter = 'entity_reference_custom_cache_tag';
$build = $this->buildRenderArray([
$this->referencedEntity,
], $formatter);
$renderer->renderRoot($build);
$this->assertContains('custom_cache_tag', $build['#cache']['tags']);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.