public function EntityReferenceFormatterTest::testCustomCacheTagFormatter in Drupal 9
Same name and namespace in other branches
- 8 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 171
Class
- EntityReferenceFormatterTest
- Tests the formatters functionality.
Namespace
Drupal\Tests\field\Kernel\EntityReferenceCode
public function testCustomCacheTagFormatter() {
/** @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']);
}