function HandlerFieldFieldTest::prepareView
Same name in other branches
- 9 core/modules/field/tests/src/Kernel/Views/HandlerFieldFieldTest.php \Drupal\Tests\field\Kernel\Views\HandlerFieldFieldTest::prepareView()
- 10 core/modules/field/tests/src/Kernel/Views/HandlerFieldFieldTest.php \Drupal\Tests\field\Kernel\Views\HandlerFieldFieldTest::prepareView()
- 11.x core/modules/field/tests/src/Kernel/Views/HandlerFieldFieldTest.php \Drupal\Tests\field\Kernel\Views\HandlerFieldFieldTest::prepareView()
Sets up the testing view with random field data.
Parameters
\Drupal\views\ViewExecutable $view: The view to add field data to.
4 calls to HandlerFieldFieldTest::prepareView()
- HandlerFieldFieldTest::doTestFormatterSimpleFieldRender in core/
modules/ field/ tests/ src/ Kernel/ Views/ HandlerFieldFieldTest.php - Tests that fields with formatters runs as expected.
- HandlerFieldFieldTest::doTestInaccessibleFieldRender in core/
modules/ field/ tests/ src/ Kernel/ Views/ HandlerFieldFieldTest.php - Tests inaccessible field rendering.
- HandlerFieldFieldTest::doTestMultipleFieldRender in core/
modules/ field/ tests/ src/ Kernel/ Views/ HandlerFieldFieldTest.php - Tests multi-value field rendering.
- HandlerFieldFieldTest::doTestSimpleFieldRender in core/
modules/ field/ tests/ src/ Kernel/ Views/ HandlerFieldFieldTest.php - Tests simple field rendering.
File
-
core/
modules/ field/ tests/ src/ Kernel/ Views/ HandlerFieldFieldTest.php, line 311
Class
- HandlerFieldFieldTest
- Tests the field rendering in views.
Namespace
Drupal\Tests\field\Kernel\ViewsCode
protected function prepareView(ViewExecutable $view) {
$view->storage
->invalidateCaches();
$view->initDisplay();
foreach ($this->fieldStorages as $field_storage) {
$field_name = $field_storage->getName();
$view->display_handler->options['fields'][$field_name]['id'] = $field_name;
$view->display_handler->options['fields'][$field_name]['table'] = 'node__' . $field_name;
$view->display_handler->options['fields'][$field_name]['field'] = $field_name;
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.