protected function DynamicEntityReferenceConfigEntityBaseFieldTest::setUp in Dynamic Entity Reference 8.2
Overrides EntityKernelTestBase::setUp
File
- tests/
src/ Kernel/ DynamicEntityReferenceConfigEntityBaseFieldTest.php, line 67
Class
- DynamicEntityReferenceConfigEntityBaseFieldTest
- Base field tests for referencing config entities.
Namespace
Drupal\Tests\dynamic_entity_reference\KernelCode
protected function setUp() : void {
parent::setUp();
$this
->installConfig([
'config_test',
]);
$this
->installEntitySchema('entity_test_rev');
$this->state = $this->container
->get('state');
// Setup some states for controlling the base field configuration.
// @see dynamic_entity_reference_entity_test_entity_base_field_info()
$this->state
->set('dynamic_entity_reference_entity_test_cardinality', 1);
$this->state
->set('dynamic_entity_reference_entity_test_entities', [
$this->entityType,
'config_test',
]);
$this->state
->set('dynamic_entity_reference_entity_test_exclude', [
$this->entityType,
]);
// Add a config entity for referencing.
$this->configTestReference = $this->container
->get('entity_type.manager')
->getStorage('config_test')
->create([
'id' => mb_strtolower($this
->randomMachineName()),
'label' => $this
->randomString(),
'style' => mb_strtolower($this
->randomMachineName()),
]);
$this->configTestReference
->save();
}