function EntityDefinitionUpdateMultipleTypesTest::testBaseFieldWithoutLabelCreateUpdateDelete
Same name and namespace in other branches
- 11.x core/tests/Drupal/KernelTests/Core/Entity/EntityDefinitionUpdateMultipleTypesTest.php \Drupal\KernelTests\Core\Entity\EntityDefinitionUpdateMultipleTypesTest::testBaseFieldWithoutLabelCreateUpdateDelete()
Tests creating, updating, and deleting a base field with no label set.
See testBaseFieldCreateUpdateDeleteWithoutData() for more details.
File
-
core/
tests/ Drupal/ KernelTests/ Core/ Entity/ EntityDefinitionUpdateMultipleTypesTest.php, line 290
Class
- EntityDefinitionUpdateMultipleTypesTest
- Tests EntityDefinitionUpdateManager functionality.
Namespace
Drupal\KernelTests\Core\EntityCode
public function testBaseFieldWithoutLabelCreateUpdateDelete() : void {
// Add a base field, ensure the update manager reports it with the
// field id.
$this->addBaseField('string', 'entity_test_update', FALSE, FALSE);
$changes = $this->entityDefinitionUpdateManager
->getChangeSummary();
$this->assertCount(1, $changes['entity_test_update']);
$this->assertEquals('The new_base_field field needs to be installed.', strip_tags((string) $changes['entity_test_update'][0]));
$this->applyEntityUpdates();
// Add an index on the base field, ensure the update manager reports it with
// the field id.
$this->addBaseFieldIndex();
$changes = $this->entityDefinitionUpdateManager
->getChangeSummary();
$this->assertCount(1, $changes['entity_test_update']);
$this->assertEquals('The new_base_field field needs to be updated.', strip_tags((string) $changes['entity_test_update'][0]));
$this->applyEntityUpdates();
// Remove the base field, ensure the update manager reports it with the
// field id.
$this->removeBaseField();
$changes = $this->entityDefinitionUpdateManager
->getChangeSummary();
$this->assertCount(1, $changes['entity_test_update']);
$this->assertEquals('The new_base_field field needs to be uninstalled.', strip_tags((string) $changes['entity_test_update'][0]));
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.