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

Issue #3119373 by alexpott, BramDriesen: Configuration synchronisation that...

Issue #3119373 by alexpott, BramDriesen: Configuration synchronisation that both enables & configures a module fails and drupal_flush_all_caches()

(cherry picked from commit 939c751eb004c99231e2579c9b7145d3cb80762c)
parent 4b201446
No related branches found
No related tags found
No related merge requests found
......@@ -1062,12 +1062,15 @@ function drupal_flush_all_caches() {
// sufficient, since the list of enabled modules might have been adjusted
// above due to changed code.
$files = [];
$modules = [];
foreach ($module_data as $name => $extension) {
if ($extension->status) {
$files[$name] = $extension;
$modules[$name] = $extension->weight;
}
}
\Drupal::service('kernel')->updateModules($module_handler->getModuleList(), $files);
$modules = module_config_sort($modules);
\Drupal::service('kernel')->updateModules($modules, $files);
// New container, new module handler.
$module_handler = \Drupal::moduleHandler();
......
<?php
namespace Drupal\KernelTests\Core\Common;
use Drupal\KernelTests\KernelTestBase;
/**
* @covers ::drupal_flush_all_caches
* @group Common
*/
class DrupalFlushAllCachesTest extends KernelTestBase {
/**
* {@inheritdoc}
*/
protected static $modules = ['system'];
/**
* Tests that drupal_flush_all_caches() uses core.extension properly.
*/
public function testDrupalFlushAllCachesModuleList() {
$core_extension = \Drupal::configFactory()->getEditable('core.extension');
$module = $core_extension->get('module');
$module['system_test'] = -10;
$core_extension->set('module', module_config_sort($module))->save();
drupal_flush_all_caches();
$this->assertSame(['system_test', 'path_alias', 'system'], array_keys($this->container->getParameter('container.modules')));
}
}
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