function EntityDefinitionUpdateMultipleTypesTest::testInstallFieldableEntityTypeWithoutInCodeDefinition
Same name and namespace in other branches
- main core/tests/Drupal/KernelTests/Core/Entity/EntityDefinitionUpdateMultipleTypesTest.php \Drupal\KernelTests\Core\Entity\EntityDefinitionUpdateMultipleTypesTest::testInstallFieldableEntityTypeWithoutInCodeDefinition()
Tests creating a fieldable entity type that doesn't exist in code anymore.
File
-
core/
tests/ Drupal/ KernelTests/ Core/ Entity/ EntityDefinitionUpdateMultipleTypesTest.php, line 139
Class
- EntityDefinitionUpdateMultipleTypesTest
- Tests EntityDefinitionUpdateManager functionality.
Namespace
Drupal\KernelTests\Core\EntityCode
public function testInstallFieldableEntityTypeWithoutInCodeDefinition() : void {
$entity_type = clone $this->entityTypeManager
->getDefinition('entity_test_update');
$field_storage_definitions = \Drupal::service('entity_field.manager')->getFieldStorageDefinitions('entity_test_update');
// Remove the entity type definition. This is the same thing as removing the
// code that defines it.
$this->deleteEntityType();
// Install the entity type and check that its tables have been created.
$this->entityDefinitionUpdateManager
->installFieldableEntityType($entity_type, $field_storage_definitions);
$this->assertTrue($this->database
->schema()
->tableExists('entity_test_update'), 'The base table of the entity type has been created.');
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.