Loading core/lib/Drupal/Core/Config/ConfigImporter.php +6 −0 Original line number Diff line number Diff line Loading @@ -630,6 +630,12 @@ protected function processConfigurations(&$context) { $this->totalConfigurationToProcess += count($this->getUnprocessedConfiguration($op, $collection)); } } // Adjust the totals for system.theme. // @see \Drupal\Core\Config\ConfigImporter::processExtension if ($this->processedSystemTheme) { $this->totalConfigurationToProcess++; } } $operation = $this->getNextConfigurationOperation(); if (!empty($operation)) { Loading core/tests/Drupal/KernelTests/Core/Config/ConfigImporterTest.php +42 −0 Original line number Diff line number Diff line Loading @@ -858,6 +858,48 @@ public function testCustomStep() { $this->assertFalse(\Drupal::isConfigSyncing(), 'After an valid custom step \Drupal::isConfigSyncing() returns FALSE'); } /** * Tests that uninstall a theme in config import correctly imports all config. */ public function testUninstallThemeIncrementsCount(): void { $theme_installer = $this->container->get('theme_installer'); // Install our theme. $theme = 'test_basetheme'; $theme_installer->install([$theme]); $this->assertTrue($this->container->get('theme_handler')->themeExists($theme)); $sync = $this->container->get('config.storage.sync'); // Update 2 pieces of config in sync. $systemSiteName = 'system.site'; $system = $sync->read($systemSiteName); $system['name'] = 'Foo'; $sync->write($systemSiteName, $system); $cronName = 'system.cron'; $cron = $sync->read($cronName); $this->assertEquals(1, $cron['logging']); $cron['logging'] = 0; $sync->write($cronName, $cron); // Uninstall the theme in sync. $extensions = $sync->read('core.extension'); unset($extensions['theme'][$theme]); $sync->write('core.extension', $extensions); $this->configImporter()->import(); // The theme should be uninstalled. $this->assertFalse($this->container->get('theme_handler')->themeExists($theme)); // Both pieces of config should be updated. \Drupal::configFactory()->reset($systemSiteName); \Drupal::configFactory()->reset($cronName); $this->assertEquals('Foo', $this->config($systemSiteName)->get('name')); $this->assertEquals(0, $this->config($cronName)->get('logging')); } /** * Helper method to test custom config installer steps. * Loading Loading
core/lib/Drupal/Core/Config/ConfigImporter.php +6 −0 Original line number Diff line number Diff line Loading @@ -630,6 +630,12 @@ protected function processConfigurations(&$context) { $this->totalConfigurationToProcess += count($this->getUnprocessedConfiguration($op, $collection)); } } // Adjust the totals for system.theme. // @see \Drupal\Core\Config\ConfigImporter::processExtension if ($this->processedSystemTheme) { $this->totalConfigurationToProcess++; } } $operation = $this->getNextConfigurationOperation(); if (!empty($operation)) { Loading
core/tests/Drupal/KernelTests/Core/Config/ConfigImporterTest.php +42 −0 Original line number Diff line number Diff line Loading @@ -858,6 +858,48 @@ public function testCustomStep() { $this->assertFalse(\Drupal::isConfigSyncing(), 'After an valid custom step \Drupal::isConfigSyncing() returns FALSE'); } /** * Tests that uninstall a theme in config import correctly imports all config. */ public function testUninstallThemeIncrementsCount(): void { $theme_installer = $this->container->get('theme_installer'); // Install our theme. $theme = 'test_basetheme'; $theme_installer->install([$theme]); $this->assertTrue($this->container->get('theme_handler')->themeExists($theme)); $sync = $this->container->get('config.storage.sync'); // Update 2 pieces of config in sync. $systemSiteName = 'system.site'; $system = $sync->read($systemSiteName); $system['name'] = 'Foo'; $sync->write($systemSiteName, $system); $cronName = 'system.cron'; $cron = $sync->read($cronName); $this->assertEquals(1, $cron['logging']); $cron['logging'] = 0; $sync->write($cronName, $cron); // Uninstall the theme in sync. $extensions = $sync->read('core.extension'); unset($extensions['theme'][$theme]); $sync->write('core.extension', $extensions); $this->configImporter()->import(); // The theme should be uninstalled. $this->assertFalse($this->container->get('theme_handler')->themeExists($theme)); // Both pieces of config should be updated. \Drupal::configFactory()->reset($systemSiteName); \Drupal::configFactory()->reset($cronName); $this->assertEquals('Foo', $this->config($systemSiteName)->get('name')); $this->assertEquals(0, $this->config($cronName)->get('logging')); } /** * Helper method to test custom config installer steps. * Loading