public function RowEntityTest::testEntityRow

Tests the entity row handler.

File

drupal/core/modules/views/lib/Drupal/views/Tests/Plugin/RowEntityTest.php, line 61
Contains \Drupal\views\Tests\Plugin\RowEntityTest.

Class

RowEntityTest
Tests the generic entity row plugin.

Namespace

Drupal\views\Tests\Plugin

Code

public function testEntityRow() {
  $vocab = entity_create('taxonomy_vocabulary', array(
    'name' => $this
      ->randomName(),
    'vid' => strtolower($this
      ->randomName()),
  ));
  $vocab
    ->save();
  $term = entity_create('taxonomy_term', array(
    'name' => $this
      ->randomName(),
    'vid' => $vocab
      ->id(),
  ));
  $term
    ->save();
  $view = views_get_view('test_entity_row');
  $this->content = $view
    ->preview();
  $this->content = drupal_render($this->content);
  $this
    ->assertText($term
    ->label(), 'The rendered entity appears as row in the view.');
}