You are here

public function MapBaseFieldTest::testUninstallMapItemBaseField in Drupal 9

Same name and namespace in other branches
  1. 8 core/tests/Drupal/KernelTests/Core/Field/MapBaseFieldTest.php \Drupal\KernelTests\Core\Field\MapBaseFieldTest::testUninstallMapItemBaseField()

Tests uninstalling map item base field.

File

core/tests/Drupal/KernelTests/Core/Field/MapBaseFieldTest.php, line 46

Class

MapBaseFieldTest
Tests map base fields.

Namespace

Drupal\KernelTests\Core\Field

Code

public function testUninstallMapItemBaseField() {
  $definitions['data_map'] = BaseFieldDefinition::create('map')
    ->setLabel(t('Data'))
    ->setRequired(TRUE);
  $this->state
    ->set('entity_test_update.additional_base_field_definitions', $definitions);
  $this->entityDefinitionUpdateManager
    ->installFieldStorageDefinition('data_map', 'entity_test_update', 'entity_test', $definitions['data_map']);
  $entity = EntityTestUpdate::create([
    'data_map' => [
      'key' => 'value',
    ],
  ]);
  $entity
    ->save();
  $this->entityDefinitionUpdateManager
    ->uninstallFieldStorageDefinition($definitions['data_map']);
}