You are here

protected function DateTestBase::renderTestEntity in Drupal 8

Same name in this branch
  1. 8 core/modules/datetime/src/Tests/DateTestBase.php \Drupal\datetime\Tests\DateTestBase::renderTestEntity()
  2. 8 core/modules/datetime/tests/src/Functional/DateTestBase.php \Drupal\Tests\datetime\Functional\DateTestBase::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.

File

core/modules/datetime/src/Tests/DateTestBase.php, line 166

Class

DateTestBase
Provides a base class for testing Datetime field functionality.

Namespace

Drupal\datetime\Tests

Code

protected function renderTestEntity($id, $view_mode = 'full', $reset = TRUE) {
  if ($reset) {
    $this->container
      ->get('entity_type.manager')
      ->getStorage('entity_test')
      ->resetCache([
      $id,
    ]);
  }
  $entity = EntityTest::load($id);
  $display = EntityViewDisplay::collectRenderDisplay($entity, $view_mode);
  $build = $display
    ->build($entity);
  $output = $this->container
    ->get('renderer')
    ->renderRoot($build);
  $this
    ->setRawContent($output);
  $this
    ->verbose($output);
}