diff -u b/core/modules/config/lib/Drupal/config/Tests/ConfigImportRecreateTest.php b/core/modules/config/lib/Drupal/config/Tests/ConfigImportRecreateTest.php --- b/core/modules/config/lib/Drupal/config/Tests/ConfigImportRecreateTest.php +++ b/core/modules/config/lib/Drupal/config/Tests/ConfigImportRecreateTest.php @@ -64,7 +64,7 @@ $type_name = Unicode::strtolower($this->randomName(16)); $content_type = entity_create('node_type', array( 'type' => $type_name, - 'name' => 'first node type', + 'name' => 'Node type one', )); $content_type->save(); /** @var \Drupal\Core\Config\StorageInterface $active */ @@ -75,26 +75,33 @@ $config_name = $content_type->getEntityType()->getConfigPrefix() . '.' . $content_type->id(); $this->copyConfig($active, $staging); + // Delete the content type. This will also delete a field, a field instance, + // an entity view display and an entity form display. $content_type->delete(); $this->assertFalse($active->exists($config_name), 'Content type\'s old name does not exist active store.'); // Recreate with the same type - this will have a different UUID. $content_type = entity_create('node_type', array( 'type' => $type_name, - 'name' => 'second node type', + 'name' => 'Node type two', )); $content_type->save(); $this->configImporter->reset(); - $this->assertEqual(6, count($this->configImporter->getUnprocessed('create')), 'There are 6 configuration items to create.'); - $this->assertEqual(6, count($this->configImporter->getUnprocessed('delete')), 'There are 6 configuration items to delete.'); + // A node type, a field, a field instance an entity view display and an + // entity form display will be recreated. + $creates = $this->configImporter->getUnprocessed('create'); + $deletes = $this->configImporter->getUnprocessed('delete'); + $this->assertEqual(5, count($creates), 'There are 5 configuration items to create.'); + $this->assertEqual(5, count($deletes), 'There are 5 configuration items to delete.'); $this->assertEqual(0, count($this->configImporter->getUnprocessed('update')), 'There are no configuration items to update.'); + $this->assertIdentical($creates, array_reverse($deletes), 'Deletes and creates contain the same configuration names in opposite orders due to dependencies.'); $this->configImporter->import(); // Verify that there is nothing more to import. $this->assertFalse($this->configImporter->reset()->hasUnprocessedChanges()); $content_type = entity_load('node_type', $type_name); - $this->assertEqual('first node type', $content_type->label()); + $this->assertEqual('Node type one', $content_type->label()); } only in patch2: unchanged: --- a/core/modules/field/lib/Drupal/field/Entity/FieldInstanceConfig.php +++ b/core/modules/field/lib/Drupal/field/Entity/FieldInstanceConfig.php @@ -428,6 +428,13 @@ public static function postDelete(EntityStorageControllerInterface $storage_cont } } + // If this is part of a configuration synchronization then the following + // configuration updates are not necessary. + $entity = reset($instances); + if ($entity->isSyncing()) { + return; + } + // Delete fields that have no more instances. $fields_to_delete = array(); foreach ($instances as $instance) {