public function EntityDefinitionUpdateTest::testInstallFieldableEntityTypeWithoutInCodeDefinition in Drupal 9
Same name and namespace in other branches
- 8 core/tests/Drupal/KernelTests/Core/Entity/EntityDefinitionUpdateTest.php \Drupal\KernelTests\Core\Entity\EntityDefinitionUpdateTest::testInstallFieldableEntityTypeWithoutInCodeDefinition()
- 10 core/tests/Drupal/KernelTests/Core/Entity/EntityDefinitionUpdateTest.php \Drupal\KernelTests\Core\Entity\EntityDefinitionUpdateTest::testInstallFieldableEntityTypeWithoutInCodeDefinition()
Tests creating a fieldable entity type that doesn't exist in code anymore.
@covers ::installFieldableEntityType
File
- core/
tests/ Drupal/ KernelTests/ Core/ Entity/ EntityDefinitionUpdateTest.php, line 178
Class
- EntityDefinitionUpdateTest
- Tests EntityDefinitionUpdateManager functionality.
Namespace
Drupal\KernelTests\Core\EntityCode
public function testInstallFieldableEntityTypeWithoutInCodeDefinition() {
$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.');
}