protected function 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 test_entity controller cache. Defaults to TRUE to simplify testing.

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

File

drupal/core/modules/field/modules/link/lib/Drupal/link/Tests/LinkFieldTest.php, line 459
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) {
    entity_get_controller('test_entity')
      ->resetCache(array(
      $id,
    ));
  }
  $entity = field_test_entity_test_load($id);
  field_attach_prepare_view('test_entity', array(
    $entity
      ->id() => $entity,
  ), $view_mode);
  $entity->content = field_attach_view('test_entity', $entity, $view_mode);
  $output = drupal_render($entity->content);
  $this
    ->drupalSetContent($output);
  $this
    ->verbose($output);
}