You are here

TaxonomyFieldTidTest.php in Zircon Profile 8

Same filename and directory in other branches
  1. 8.0 core/modules/taxonomy/src/Tests/Views/TaxonomyFieldTidTest.php

File

core/modules/taxonomy/src/Tests/Views/TaxonomyFieldTidTest.php
View source
<?php

/**
 * @file
 * Contains \Drupal\taxonomy\Tests\Views\TaxonomyFieldTidTest.
 */
namespace Drupal\taxonomy\Tests\Views;

use Drupal\Core\Render\RenderContext;
use Drupal\views\Views;

/**
 * Tests the taxonomy term TID field handler.
 *
 * @group taxonomy
 */
class TaxonomyFieldTidTest extends TaxonomyTestBase {

  /**
   * Views used by this test.
   *
   * @var array
   */
  public static $testViews = array(
    'test_taxonomy_tid_field',
  );
  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);
  }

}

Classes

Namesort descending Description
TaxonomyFieldTidTest Tests the taxonomy term TID field handler.