public function ViewsDataTest::setUp in Zircon Profile 8
Same name in this branch
- 8 core/modules/views/tests/src/Unit/ViewsDataTest.php \Drupal\Tests\views\Unit\ViewsDataTest::setUp()
- 8 core/modules/options/src/Tests/Views/ViewsDataTest.php \Drupal\options\Tests\Views\ViewsDataTest::setUp()
Same name and namespace in other branches
- 8.0 core/modules/options/src/Tests/Views/ViewsDataTest.php \Drupal\options\Tests\Views\ViewsDataTest::setUp()
Parameters
bool $import_test_views: Should the views specififed on the test class be imported. If you need to setup some additional stuff, like fields, you need to call false and then call createTestViews for your own.
Overrides OptionsTestBase::setUp
File
- core/
modules/ options/ src/ Tests/ Views/ ViewsDataTest.php, line 31 - Contains \Drupal\options\Tests\Views\ViewsDataTest.
Class
- ViewsDataTest
- Test to ensure views data is properly created for the Options module.
Namespace
Drupal\options\Tests\ViewsCode
public function setUp() {
parent::setUp();
$field_name = 'test_options';
$this->fieldStorage = entity_create('field_storage_config', [
'field_name' => $field_name,
'entity_type' => 'entity_test',
'type' => 'list_string',
'cardinality' => 1,
'settings' => [
'allowed_values_function' => 'options_test_dynamic_values_callback',
],
]);
$this->fieldStorage
->save();
$this->field = entity_create('field_config', [
'field_name' => $field_name,
'entity_type' => 'entity_test',
'bundle' => 'entity_test',
'required' => TRUE,
])
->save();
}