public function FieldKernelTest::testExclude in Zircon Profile 8.0
Same name and namespace in other branches
- 8 core/modules/views/src/Tests/Handler/FieldKernelTest.php \Drupal\views\Tests\Handler\FieldKernelTest::testExclude()
Tests the exclude setting.
File
- core/
modules/ views/ src/ Tests/ Handler/ FieldKernelTest.php, line 332 - Contains \Drupal\views\Tests\Handler\FieldKernelTest.
Class
- FieldKernelTest
- Tests the generic field handler.
Namespace
Drupal\views\Tests\HandlerCode
public function testExclude() {
/** @var \Drupal\Core\Render\RendererInterface $renderer */
$renderer = $this->container
->get('renderer');
$view = Views::getView('test_field_output');
$view
->initHandlers();
// Hide the field and see whether it's rendered.
$view->field['name']->options['exclude'] = TRUE;
$output = $view
->preview();
$output = $renderer
->renderRoot($output);
foreach ($this
->dataSet() as $entry) {
$this
->assertNotSubString($output, $entry['name']);
}
// Show and check the field.
$view->field['name']->options['exclude'] = FALSE;
$output = $view
->preview();
$output = $renderer
->renderRoot($output);
foreach ($this
->dataSet() as $entry) {
$this
->assertSubString($output, $entry['name']);
}
}