function EntityFormDisplayValidationTest::setUpEnvironment
Same name and namespace in other branches
- main core/tests/Drupal/KernelTests/Core/Entity/EntityFormDisplayValidationTest.php \Drupal\KernelTests\Core\Entity\EntityFormDisplayValidationTest::setUpEnvironment()
Overrides ConfigEntityValidationTestBase::setUpEnvironment
File
-
core/
tests/ Drupal/ KernelTests/ Core/ Entity/ EntityFormDisplayValidationTest.php, line 44
Class
- EntityFormDisplayValidationTest
- Tests validation of entity_form_display entities.
Namespace
Drupal\KernelTests\Core\EntityCode
protected function setUpEnvironment() : void {
parent::setUpEnvironment();
$this->installEntitySchema('node');
$this->installEntitySchema('user');
$this->installConfig('node');
$this->createContentType([
'type' => 'one',
]);
$this->createContentType([
'type' => 'two',
]);
EntityTestBundle::create([
'id' => 'one',
])->save();
EntityTestBundle::create([
'id' => 'two',
])->save();
EntityFormMode::create([
'id' => 'node.test',
'label' => 'Test',
'targetEntityType' => 'node',
])->save();
$text_field_storage_config = FieldStorageConfig::create([
'type' => 'text_long',
'field_name' => 'novel',
'entity_type' => 'user',
]);
$text_field_storage_config->save();
FieldConfig::create([
'field_storage' => $text_field_storage_config,
'bundle' => 'user',
'dependencies' => [
'config' => [
$text_field_storage_config->getConfigDependencyName(),
],
],
])
->save();
$this->entity = $this->container
->get(EntityDisplayRepositoryInterface::class)
->getFormDisplay('node', 'one', 'test');
$this->entity
->save();
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.