You are here

function TaxonomyFieldTidTest::testViewsHandlerTidField in Zircon Profile 8.0

Same name and namespace in other branches
  1. 8 core/modules/taxonomy/src/Tests/Views/TaxonomyFieldTidTest.php \Drupal\taxonomy\Tests\Views\TaxonomyFieldTidTest::testViewsHandlerTidField()

File

core/modules/taxonomy/src/Tests/Views/TaxonomyFieldTidTest.php, line 27
Contains \Drupal\taxonomy\Tests\Views\TaxonomyFieldTidTest.

Class

TaxonomyFieldTidTest
Tests the taxonomy term TID field handler.

Namespace

Drupal\taxonomy\Tests\Views

Code

function testViewsHandlerTidField() {

  /** @var \Drupal\Core\Render\RendererInterface $renderer */
  $renderer = \Drupal::service('renderer');
  $view = Views::getView('test_taxonomy_tid_field');
  $this
    ->executeView($view);
  $actual = $renderer
    ->executeInRenderContext(new RenderContext(), function () use ($view) {
    return $view->field['name']
      ->advancedRender($view->result[0]);
  });
  $expected = \Drupal::l($this->term1
    ->label(), $this->term1
    ->urlInfo());
  $this
    ->assertEqual($expected, $actual);
}