You are here

protected function StringFormatterTest::renderEntityFields in Drupal 10

Same name and namespace in other branches
  1. 8 core/modules/field/tests/src/Kernel/String/StringFormatterTest.php \Drupal\Tests\field\Kernel\String\StringFormatterTest::renderEntityFields()
  2. 9 core/modules/field/tests/src/Kernel/String/StringFormatterTest.php \Drupal\Tests\field\Kernel\String\StringFormatterTest::renderEntityFields()

Renders fields of a given entity with a given display.

Parameters

\Drupal\Core\Entity\FieldableEntityInterface $entity: The entity object with attached fields to render.

\Drupal\Core\Entity\Display\EntityViewDisplayInterface $display: The display to render the fields in.

Return value

string The rendered entity fields.

2 calls to StringFormatterTest::renderEntityFields()
StringFormatterTest::testLinkToContentForEntitiesWithNoCanonicalPath in core/modules/field/tests/src/Kernel/String/StringFormatterTest.php
Test "link_to_entity" feature on fields which are added to config entity.
StringFormatterTest::testStringFormatter in core/modules/field/tests/src/Kernel/String/StringFormatterTest.php
Tests string formatter output.

File

core/modules/field/tests/src/Kernel/String/StringFormatterTest.php, line 113

Class

StringFormatterTest
Tests the creation of text fields.

Namespace

Drupal\Tests\field\Kernel\String

Code

protected function renderEntityFields(FieldableEntityInterface $entity, EntityViewDisplayInterface $display) {
  $content = $display
    ->build($entity);
  $content = $this
    ->render($content);
  return $content;
}