function EntityDefinitionUpdateTest::testInstallAdditionalBaseFieldDuringFieldableEntityTypeInstallation
Same name and namespace in other branches
- 10 core/tests/Drupal/KernelTests/Core/Entity/EntityDefinitionUpdateTest.php \Drupal\KernelTests\Core\Entity\EntityDefinitionUpdateTest::testInstallAdditionalBaseFieldDuringFieldableEntityTypeInstallation()
- 9 core/tests/Drupal/KernelTests/Core/Entity/EntityDefinitionUpdateTest.php \Drupal\KernelTests\Core\Entity\EntityDefinitionUpdateTest::testInstallAdditionalBaseFieldDuringFieldableEntityTypeInstallation()
- 8.9.x core/tests/Drupal/KernelTests/Core/Entity/EntityDefinitionUpdateTest.php \Drupal\KernelTests\Core\Entity\EntityDefinitionUpdateTest::testInstallAdditionalBaseFieldDuringFieldableEntityTypeInstallation()
- main core/tests/Drupal/KernelTests/Core/Entity/EntityDefinitionUpdateTest.php \Drupal\KernelTests\Core\Entity\EntityDefinitionUpdateTest::testInstallAdditionalBaseFieldDuringFieldableEntityTypeInstallation()
Tests installing an additional base field while installing an entity type.
@legacy-covers ::installFieldableEntityType
File
-
core/
tests/ Drupal/ KernelTests/ Core/ Entity/ EntityDefinitionUpdateTest.php, line 84
Class
- EntityDefinitionUpdateTest
- Tests EntityDefinitionUpdateManager functionality.
Namespace
Drupal\KernelTests\Core\EntityCode
public function testInstallAdditionalBaseFieldDuringFieldableEntityTypeInstallation() : void {
$entity_type = clone $this->entityTypeManager
->getDefinition('entity_test_update');
$field_storage_definitions = \Drupal::service('entity_field.manager')->getFieldStorageDefinitions('entity_test_update');
// Enable the creation of a new base field during the installation of a
// fieldable entity type.
$this->state
->set('entity_test_update.install_new_base_field_during_create', TRUE);
// Install the entity type and check that the additional base field was also
// installed.
$this->entityDefinitionUpdateManager
->installFieldableEntityType($entity_type, $field_storage_definitions);
// Check whether the 'new_base_field' field has been installed correctly.
$field_storage_definition = $this->entityDefinitionUpdateManager
->getFieldStorageDefinition('new_base_field', 'entity_test_update');
$this->assertNotNull($field_storage_definition);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.