protected function 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 drupal/core/modules/datetime/lib/Drupal/datetime/Tests/DatetimeFieldTest.php
Tests date field functionality.
DatetimeFieldTest::testDatetimeField in drupal/core/modules/datetime/lib/Drupal/datetime/Tests/DatetimeFieldTest.php
Tests date and time field.

File

drupal/core/modules/datetime/lib/Drupal/datetime/Tests/DatetimeFieldTest.php, line 423
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) {
    entity_get_controller('entity_test')
      ->resetCache(array(
      $id,
    ));
  }
  $entity = entity_load('entity_test', $id);
  $display = entity_get_display('entity_test', $entity
    ->bundle(), 'full');
  field_attach_prepare_view('entity_test', array(
    $entity
      ->id() => $entity,
  ), array(
    $entity
      ->bundle() => $display,
  ), $view_mode);
  $entity->content = field_attach_view($entity, $display, $view_mode);
  $output = drupal_render($entity->content);
  $this
    ->drupalSetContent($output);
  $this
    ->verbose($output);
}