public function FieldKernelTest::testRender in Drupal 8
Same name and namespace in other branches
- 9 core/modules/views/tests/src/Kernel/Handler/FieldKernelTest.php \Drupal\Tests\views\Kernel\Handler\FieldKernelTest::testRender()
- 10 core/modules/views/tests/src/Kernel/Handler/FieldKernelTest.php \Drupal\Tests\views\Kernel\Handler\FieldKernelTest::testRender()
Tests that the render function is called.
File
- core/
modules/ views/ tests/ src/ Kernel/ Handler/ FieldKernelTest.php, line 51
Class
- FieldKernelTest
- Tests the generic field handler.
Namespace
Drupal\Tests\views\Kernel\HandlerCode
public function testRender() {
/** @var \Drupal\Core\Render\RendererInterface $renderer */
$renderer = \Drupal::service('renderer');
$view = Views::getView('test_field_tokens');
$this
->executeView($view);
$random_text = $this
->randomMachineName();
$view->field['job']
->setTestValue($random_text);
$output = $renderer
->executeInRenderContext(new RenderContext(), function () use ($view) {
return $view->field['job']
->theme($view->result[0]);
});
$this
->assertEqual($output, $random_text, 'Make sure the render method rendered the manual set value.');
}