public function FieldKernelTest::testRender in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/modules/views/src/Tests/Handler/FieldKernelTest.php \Drupal\views\Tests\Handler\FieldKernelTest::testRender()
Tests that the render function is called.
File
- core/
modules/ views/ src/ Tests/ Handler/ FieldKernelTest.php, line 55 - Contains \Drupal\views\Tests\Handler\FieldKernelTest.
Class
- FieldKernelTest
- Tests the generic field handler.
Namespace
Drupal\views\Tests\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.');
}