You are here

protected function DateTimeFieldTest::renderTestEntity in Zircon Profile 8.0

Same name and namespace in other branches
  1. 8 core/modules/datetime/src/Tests/DateTimeFieldTest.php \Drupal\datetime\Tests\DateTimeFieldTest::renderTestEntity()

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

Parameters

int $id: The entity_test ID to render.

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

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

2 calls to DateTimeFieldTest::renderTestEntity()
DateTimeFieldTest::testDateField in core/modules/datetime/src/Tests/DateTimeFieldTest.php
Tests date field functionality.
DateTimeFieldTest::testDatetimeField in core/modules/datetime/src/Tests/DateTimeFieldTest.php
Tests date and time field.

File

core/modules/datetime/src/Tests/DateTimeFieldTest.php, line 815
Contains \Drupal\datetime\Tests\DateTimeFieldTest.

Class

DateTimeFieldTest
Tests Datetime field functionality.

Namespace

Drupal\datetime\Tests

Code

protected function renderTestEntity($id, $view_mode = 'full', $reset = TRUE) {
  if ($reset) {
    \Drupal::entityManager()
      ->getStorage('entity_test')
      ->resetCache(array(
      $id,
    ));
  }
  $entity = entity_load('entity_test', $id);
  $display = EntityViewDisplay::collectRenderDisplay($entity, $view_mode);
  $build = $display
    ->build($entity);
  $output = \Drupal::service('renderer')
    ->renderRoot($build);
  $this
    ->setRawContent($output);
  $this
    ->verbose($output);
}