Issue #2679008 by webflo, stBorchert, clemens.tolboom, gilesmc, dawehner: Module weight is not taken into account after module installation
parent
31a3fe830c
commit
8a016678c7
|
@ -136,6 +136,10 @@ class ModuleInstaller implements ModuleInstallerInterface {
|
||||||
throw new ExtensionNameLengthException("Module name '$module' is over the maximum allowed length of " . DRUPAL_EXTENSION_NAME_MAX_LENGTH . ' characters');
|
throw new ExtensionNameLengthException("Module name '$module' is over the maximum allowed length of " . DRUPAL_EXTENSION_NAME_MAX_LENGTH . ' characters');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Load a new config object for each iteration, otherwise changes made
|
||||||
|
// in hook_install() are not reflected in $extension_config.
|
||||||
|
$extension_config = \Drupal::configFactory()->getEditable('core.extension');
|
||||||
|
|
||||||
// Check the validity of the default configuration. This will throw
|
// Check the validity of the default configuration. This will throw
|
||||||
// exceptions if the configuration is not valid.
|
// exceptions if the configuration is not valid.
|
||||||
$config_installer->checkConfigurationToInstall('module', $module);
|
$config_installer->checkConfigurationToInstall('module', $module);
|
||||||
|
|
|
@ -0,0 +1,14 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @file
|
||||||
|
* Install, update and uninstall functions for the module_handler_test_multiple module.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Implements hook_install().
|
||||||
|
*/
|
||||||
|
function module_handler_test_multiple_install() {
|
||||||
|
// Set weight of module.
|
||||||
|
module_set_weight('module_handler_test_multiple', 1);
|
||||||
|
}
|
|
@ -5,3 +5,5 @@ package: Testing
|
||||||
version: VERSION
|
version: VERSION
|
||||||
core: 8.x
|
core: 8.x
|
||||||
hidden: true
|
hidden: true
|
||||||
|
dependencies:
|
||||||
|
- module_handler_test_multiple
|
||||||
|
|
|
@ -0,0 +1,17 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @file
|
||||||
|
* Utility functions for the module_handler_test_multiple_child module.
|
||||||
|
*
|
||||||
|
* Install, update and uninstall functions for the
|
||||||
|
* module_handler_test_multiple_child module.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Implements hook_install().
|
||||||
|
*/
|
||||||
|
function module_handler_test_multiple_child_install() {
|
||||||
|
// Set weight of module.
|
||||||
|
module_set_weight('module_handler_test_multiple_child', 1);
|
||||||
|
}
|
|
@ -44,4 +44,20 @@ class ModuleInstallerTest extends KernelTestBase {
|
||||||
$this->container->get('router.route_provider')->getRouteByName('router_test.1');
|
$this->container->get('router.route_provider')->getRouteByName('router_test.1');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Tests config changes by hook_install() are saved for dependent modules.
|
||||||
|
*
|
||||||
|
* @covers ::install
|
||||||
|
*/
|
||||||
|
public function testConfigChangeOnInstall() {
|
||||||
|
// Install the child module so the parent is installed automatically.
|
||||||
|
$this->container->get('module_installer')->install(['module_handler_test_multiple_child']);
|
||||||
|
$modules = $this->config('core.extension')->get('module');
|
||||||
|
|
||||||
|
$this->assertArrayHasKey('module_handler_test_multiple', $modules, 'Module module_handler_test_multiple is installed');
|
||||||
|
$this->assertArrayHasKey('module_handler_test_multiple_child', $modules, 'Module module_handler_test_multiple_child is installed');
|
||||||
|
$this->assertEquals(1, $modules['module_handler_test_multiple'], 'Weight of module_handler_test_multiple is set.');
|
||||||
|
$this->assertEquals(1, $modules['module_handler_test_multiple_child'], 'Weight of module_handler_test_multiple_child is set.');
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue