$this->assertSession()->pageTextContains('This synchronization will delete data from the fields: entity_test.field_tel, entity_test.field_date.');
$this->assertSession()->pageTextContains('This synchronization will delete data from the fields: entity_test.field_test_field, entity_test.field_date.');
// This will purge all the data, delete the field and uninstall the
// Telephone and Text modules.
// field_test and Datetime modules.
$this->submitForm([],'Import all');
$this->assertSession()->pageTextNotContains('Field data will be deleted by this synchronization.');
$this->assertNull(\Drupal::service('entity.repository')->loadEntityByUuid('field_storage_config',$field_storage->uuid()),'The telephone field has been deleted by the configuration synchronization');
$this->assertNull(\Drupal::service('entity.repository')->loadEntityByUuid('field_storage_config',$field_storage->uuid()),'The field_test_field field has been deleted by the configuration synchronization');
// Test that the module can't be uninstalled from the UI while there is data
// for its fields.
@@ -107,25 +104,25 @@ public function testReEnabledField(): void {
]);
$this->drupalLogin($admin_user);
$this->drupalGet('admin/modules/uninstall');
$this->assertSession()->pageTextContains("The Telephone number field type is used in the following field: node.field_telephone");
$this->assertSession()->pageTextContains("The Link field type is used in the following field: node.field_link");
// Add another telephone field to a different entity type in order to test
// Add another link field to a different entity type in order to test
// the message for the case when multiple fields are blocking the
// uninstallation of a module.
$field_storage2=FieldStorageConfig::create([
'field_name'=>'field_telephone_2',
'field_name'=>'field_link_2',
'entity_type'=>'user',
'type'=>'telephone',
'type'=>'link',
]);
$field_storage2->save();
FieldConfig::create([
'field_storage'=>$field_storage2,
'bundle'=>'user',
'label'=>'User Telephone Number',
'label'=>'User Link',
])->save();
$this->drupalGet('admin/modules/uninstall');
$this->assertSession()->pageTextContains("The Telephone number field type is used in the following fields: node.field_telephone, user.field_telephone_2");
$this->assertSession()->pageTextContains("The Link field type is used in the following fields: node.field_link, user.field_link_2");
// Delete both fields.
$field_storage->delete();
@@ -137,7 +134,7 @@ public function testReEnabledField(): void {
@@ -101,13 +101,13 @@ public function testImportDeleteUninstall(): void {
$this->assertSame(['\\Drupal\\field\\ConfigImporterFieldPurger','process'],$steps[0],'The additional process configuration synchronization step has been added.');
// This will purge all the data, delete the field and uninstall the
$this->assertNull(\Drupal::service('entity.repository')->loadEntityByUuid('field_storage_config',$field_storage->uuid()),'The test field has been deleted by the configuration synchronization');
$this->assertFalse(isset($deleted_storage_definitions[$field_storage->uuid()]),'Telephone field has been completed removed from the system.');
$this->assertFalse(isset($deleted_storage_definitions[$field_storage->uuid()]),'test_field field has been completed removed from the system.');
$this->assertTrue(isset($deleted_storage_definitions[$unrelated_field_storage->uuid()]),'Unrelated field not purged by configuration synchronization.');
}
@@ -115,11 +115,11 @@ public function testImportDeleteUninstall(): void {
* Tests purging previously deleted fields and storages in config import.
@@ -161,7 +161,7 @@ public function testImportAlreadyDeletedUninstall(): void {
$this->assertSame(['\\Drupal\\field\\ConfigImporterFieldPurger','process'],$steps[0],'The additional process configuration synchronization step has been added.');
// This will purge all the data, delete the field and uninstall the