public function EntityDefinitionUpdateTest::testBaseFieldWithoutLabelCreateUpdateDelete in Drupal 8
Same name and namespace in other branches
- 9 core/tests/Drupal/KernelTests/Core/Entity/EntityDefinitionUpdateTest.php \Drupal\KernelTests\Core\Entity\EntityDefinitionUpdateTest::testBaseFieldWithoutLabelCreateUpdateDelete()
- 10 core/tests/Drupal/KernelTests/Core/Entity/EntityDefinitionUpdateTest.php \Drupal\KernelTests\Core\Entity\EntityDefinitionUpdateTest::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/ EntityDefinitionUpdateTest.php, line 315
Class
- EntityDefinitionUpdateTest
- Tests EntityDefinitionUpdateManager functionality.
Namespace
Drupal\KernelTests\Core\EntityCode
public function testBaseFieldWithoutLabelCreateUpdateDelete() {
// 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($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($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($changes['entity_test_update'][0]));
}