You are here

protected function LinkFieldTest::renderTestEntity in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/link/src/Tests/LinkFieldTest.php \Drupal\link\Tests\LinkFieldTest::renderTestEntity()

Renders a test_entity and sets the output in the internal browser.

Parameters

int $id: The test_entity ID to render.

string $view_mode: (optional) The view mode to use for rendering.

bool $reset: (optional) Whether to reset the entity_test storage cache. Defaults to TRUE to simplify testing.

3 calls to LinkFieldTest::renderTestEntity()
LinkFieldTest::testLinkFormatter in core/modules/link/src/Tests/LinkFieldTest.php
Tests the default 'link' formatter.
LinkFieldTest::testLinkSeparateFormatter in core/modules/link/src/Tests/LinkFieldTest.php
Tests the 'link_separate' formatter.
LinkFieldTest::testLinkTitle in core/modules/link/src/Tests/LinkFieldTest.php
Tests the link title settings of a link field.

File

core/modules/link/src/Tests/LinkFieldTest.php, line 584
Contains \Drupal\link\Tests\LinkFieldTest.

Class

LinkFieldTest
Tests link field widgets and formatters.

Namespace

Drupal\link\Tests

Code

protected function renderTestEntity($id, $view_mode = 'full', $reset = TRUE) {
  if ($reset) {
    $this->container
      ->get('entity.manager')
      ->getStorage('entity_test')
      ->resetCache(array(
      $id,
    ));
  }
  $entity = entity_load('entity_test', $id);
  $display = entity_get_display($entity
    ->getEntityTypeId(), $entity
    ->bundle(), $view_mode);
  $content = $display
    ->build($entity);
  $output = \Drupal::service('renderer')
    ->renderRoot($content);
  $this
    ->setRawContent($output);
  $this
    ->verbose($output);
}