function TaxonomyFieldTidTest::testViewsHandlerTidField
Tests the taxonomy field handler.
File
- 
              core/
modules/ taxonomy/ tests/ src/ Kernel/ Views/ TaxonomyFieldTidTest.php, line 62  
Class
- TaxonomyFieldTidTest
 - Tests the taxonomy term TID field handler.
 
Namespace
Drupal\Tests\taxonomy\Kernel\ViewsCode
public 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 = Link::fromTextAndUrl($this->term1
    ->label(), $this->term1
    ->toUrl());
  $this->assertEquals($expected->toString(), $actual);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.