Skip to content
Snippets Groups Projects
Commit cf5e2c17 authored by catch's avatar catch
Browse files

Issue #3405798 by alexpott, bircher: Config deleted during import does not...

Issue #3405798 by alexpott, bircher: Config deleted during import does not have correct initial values set
parent ca9af3d9
No related branches found
No related tags found
No related merge requests found
......@@ -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();
......
......@@ -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']);
}
/**
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment