Issue #2958649 by acbramley, moshe weitzman, fenstrat: Incorrect totals count when importing config that contains a theme uninstall
(cherry picked from commit 3761dff8c3
)
merge-requests/3234/head
parent
251a94657a
commit
10441d9600
|
@ -630,6 +630,12 @@ class ConfigImporter {
|
||||||
$this->totalConfigurationToProcess += count($this->getUnprocessedConfiguration($op, $collection));
|
$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();
|
$operation = $this->getNextConfigurationOperation();
|
||||||
if (!empty($operation)) {
|
if (!empty($operation)) {
|
||||||
|
|
|
@ -858,6 +858,48 @@ class ConfigImporterTest extends KernelTestBase {
|
||||||
$this->assertFalse(\Drupal::isConfigSyncing(), 'After an valid custom step \Drupal::isConfigSyncing() returns FALSE');
|
$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.
|
* Helper method to test custom config installer steps.
|
||||||
*
|
*
|
||||||
|
|
Loading…
Reference in New Issue