protected function OptionsFieldUnitTestBase::setUp in Drupal 8
Same name and namespace in other branches
- 9 core/modules/options/tests/src/Kernel/OptionsFieldUnitTestBase.php \Drupal\Tests\options\Kernel\OptionsFieldUnitTestBase::setUp()
Set the default field storage backend for fields created during tests.
Overrides FieldKernelTestBase::setUp
1 call to OptionsFieldUnitTestBase::setUp()
- OptionsFormattersTest::setUp in core/
modules/ options/ tests/ src/ Kernel/ OptionsFormattersTest.php - Set the default field storage backend for fields created during tests.
1 method overrides OptionsFieldUnitTestBase::setUp()
- OptionsFormattersTest::setUp in core/
modules/ options/ tests/ src/ Kernel/ OptionsFormattersTest.php - Set the default field storage backend for fields created during tests.
File
- core/
modules/ options/ tests/ src/ Kernel/ OptionsFieldUnitTestBase.php, line 52
Class
- OptionsFieldUnitTestBase
- Base class for Options module integration tests.
Namespace
Drupal\Tests\options\KernelCode
protected function setUp() {
parent::setUp();
$this->container
->get('router.builder')
->rebuild();
$this->fieldStorageDefinition = [
'field_name' => $this->fieldName,
'entity_type' => 'entity_test',
'type' => 'list_integer',
'cardinality' => 1,
'settings' => [
'allowed_values' => [
1 => 'One',
2 => 'Two',
3 => 'Three',
],
],
];
$this->fieldStorage = FieldStorageConfig::create($this->fieldStorageDefinition);
$this->fieldStorage
->save();
$this->field = FieldConfig::create([
'field_storage' => $this->fieldStorage,
'bundle' => 'entity_test',
]);
$this->field
->save();
\Drupal::service('entity_display.repository')
->getFormDisplay('entity_test', 'entity_test')
->setComponent($this->fieldName, [
'type' => 'options_buttons',
])
->save();
}