function TaxonomyFieldVidTest::testViewsHandlerVidField
Same name in other branches
- 8.9.x core/modules/taxonomy/tests/src/Kernel/Views/TaxonomyFieldVidTest.php \Drupal\Tests\taxonomy\Kernel\Views\TaxonomyFieldVidTest::testViewsHandlerVidField()
- 10 core/modules/taxonomy/tests/src/Kernel/Views/TaxonomyFieldVidTest.php \Drupal\Tests\taxonomy\Kernel\Views\TaxonomyFieldVidTest::testViewsHandlerVidField()
- 11.x core/modules/taxonomy/tests/src/Kernel/Views/TaxonomyFieldVidTest.php \Drupal\Tests\taxonomy\Kernel\Views\TaxonomyFieldVidTest::testViewsHandlerVidField()
Tests the field handling for the Vocabulary ID.
File
-
core/
modules/ taxonomy/ tests/ src/ Kernel/ Views/ TaxonomyFieldVidTest.php, line 81
Class
- TaxonomyFieldVidTest
- Tests the taxonomy term VID field handler.
Namespace
Drupal\Tests\taxonomy\Kernel\ViewsCode
public function testViewsHandlerVidField() {
/** @var \Drupal\Core\Render\RendererInterface $renderer */
$renderer = \Drupal::service('renderer');
$view = Views::getView('test_taxonomy_vid_field');
$this->executeView($view);
$actual = $renderer->executeInRenderContext(new RenderContext(), function () use ($view) {
return $view->field['vid']
->advancedRender($view->result[0]);
});
$vocabulary = Vocabulary::load($this->term1
->bundle());
$expected = $vocabulary->get('name');
$this->assertEquals($expected, $actual);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.