Loading core/lib/Drupal/Core/Config/ConfigImporter.php +3 −3 Original line number Diff line number Diff line Loading @@ -992,13 +992,13 @@ protected function importConfig($collection, $op, $name) { else { $config = new Config($name, $this->storageComparer->getTargetStorage($collection), $this->eventDispatcher, $this->typedConfigManager); } if ($old_data = $this->storageComparer->getTargetStorage($collection)->read($name)) { $config->initWithData($old_data); } if ($op == 'delete') { $config->delete(); } else { if ($old_data = $this->storageComparer->getTargetStorage($collection)->read($name)) { $config->initWithData($old_data); } $data = $this->storageComparer->getSourceStorage($collection)->read($name); $config->setData($data ? $data : []); $config->save(); Loading core/tests/Drupal/KernelTests/Core/Config/ConfigImporterTest.php +10 −0 Original line number Diff line number Diff line Loading @@ -918,6 +918,16 @@ public function testConfigEvents(): void { $this->assertSame(['key' => 'bar'], $event['current_config_data']); $this->assertSame(['key' => 'bar'], $event['raw_config_data']); $this->assertSame(['key' => 'foo'], $event['original_config_data']); // Import the configuration that deletes 'config_events_test.test'. $this->container->get('config.storage.sync')->delete('config_events_test.test'); $this->configImporter()->import(); $this->assertFalse($this->container->get('config.storage')->exists('config_events_test.test')); $event = \Drupal::state()->get('config_events_test.event', []); $this->assertSame(ConfigEvents::DELETE, $event['event_name']); $this->assertSame([], $event['current_config_data']); $this->assertSame([], $event['raw_config_data']); $this->assertSame(['key' => 'bar'], $event['original_config_data']); } /** Loading Loading
core/lib/Drupal/Core/Config/ConfigImporter.php +3 −3 Original line number Diff line number Diff line Loading @@ -992,13 +992,13 @@ protected function importConfig($collection, $op, $name) { else { $config = new Config($name, $this->storageComparer->getTargetStorage($collection), $this->eventDispatcher, $this->typedConfigManager); } if ($old_data = $this->storageComparer->getTargetStorage($collection)->read($name)) { $config->initWithData($old_data); } if ($op == 'delete') { $config->delete(); } else { if ($old_data = $this->storageComparer->getTargetStorage($collection)->read($name)) { $config->initWithData($old_data); } $data = $this->storageComparer->getSourceStorage($collection)->read($name); $config->setData($data ? $data : []); $config->save(); Loading
core/tests/Drupal/KernelTests/Core/Config/ConfigImporterTest.php +10 −0 Original line number Diff line number Diff line Loading @@ -918,6 +918,16 @@ public function testConfigEvents(): void { $this->assertSame(['key' => 'bar'], $event['current_config_data']); $this->assertSame(['key' => 'bar'], $event['raw_config_data']); $this->assertSame(['key' => 'foo'], $event['original_config_data']); // Import the configuration that deletes 'config_events_test.test'. $this->container->get('config.storage.sync')->delete('config_events_test.test'); $this->configImporter()->import(); $this->assertFalse($this->container->get('config.storage')->exists('config_events_test.test')); $event = \Drupal::state()->get('config_events_test.event', []); $this->assertSame(ConfigEvents::DELETE, $event['event_name']); $this->assertSame([], $event['current_config_data']); $this->assertSame([], $event['raw_config_data']); $this->assertSame(['key' => 'bar'], $event['original_config_data']); } /** Loading