diff --git a/core/modules/config/lib/Drupal/config/Tests/ConfigExportImportUITest.php b/core/modules/config/lib/Drupal/config/Tests/ConfigExportImportUITest.php index 61bbb52..75017b9 100644 --- a/core/modules/config/lib/Drupal/config/Tests/ConfigExportImportUITest.php +++ b/core/modules/config/lib/Drupal/config/Tests/ConfigExportImportUITest.php @@ -158,6 +158,55 @@ function testImport() { $this->assertEqual($this->slogan, \Drupal::config('system.site')->get('slogan')); $this->drupalGet('node/add/' . $this->content_type->type); $this->assertFieldByName("{$this->field->name}[0][value]", '', 'The custom field widget is displayed'); + + // Delete the custom field. + $field_instances = entity_load_multiple('field_instance'); + foreach($field_instances as &$field_instance) { + if($field_instance->field_name == $this->field->name) { + $field_instance->delete(); + } + } + $fields = entity_load_multiple('field_entity'); + foreach($fields as &$field) { + if($field->name == $this->field->name) { + $field->delete(); + } + } + + // Ensure the custom field is deleted. + $this->drupalGet('node/add/' . $this->content_type->type); + $this->assertNoFieldByName("{$this->field->name}[0][value]", '', 'The custom field widget is not displayed'); + + // Recreate the custom field. + $field = entity_create('field_entity', array( + 'name' => $this->field->name, + 'entity_type' => 'node', + 'type' => 'text', + )); + $field->save(); + entity_create('field_instance', array( + 'field_name' => $field->name, + 'entity_type' => 'node', + 'bundle' => $this->content_type->type, + ))->save(); + entity_get_form_display('node', $this->content_type->type, 'default') + ->setComponent($field->name, array( + 'type' => 'text_textfield', + )) + ->save(); + entity_get_display('node', $this->content_type->type, 'full') + ->setComponent($field->name) + ->save(); + + // Ensure the custom field exists. + $this->drupalGet('node/add/' . $this->content_type->type); + $this->assertFieldByName("{$this->field->name}[0][value]", '', 'The custom field widget is displayed'); + + $this->doImport($filename); + + // Ensure the custom field exists. + $this->drupalGet('node/add/' . $this->content_type->type); + $this->assertFieldByName("{$this->field->name}[0][value]", '', 'The custom field widget is displayed'); } /**