Commit 3304901a 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()
parent 97b964b1
......@@ -550,12 +550,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', 'system'], array_keys($this->container->getParameter('container.modules')));
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment