diff --git a/core/modules/config/lib/Drupal/config/Tests/ConfigInstallTest.php b/core/modules/config/lib/Drupal/config/Tests/ConfigInstallTest.php index b549119..e2a614d 100644 --- a/core/modules/config/lib/Drupal/config/Tests/ConfigInstallTest.php +++ b/core/modules/config/lib/Drupal/config/Tests/ConfigInstallTest.php @@ -64,4 +64,22 @@ function testModuleInstallation() { $this->assertFalse(isset($GLOBALS['hook_config_test']['predelete'])); $this->assertFalse(isset($GLOBALS['hook_config_test']['delete'])); } + + function testModuleInstallImport() { + // Create an empty system.module fiel so import will work. + config('system.module')->save(); + $staging = $this->container->get('config.storage.staging'); + $data = array( + 'enabled' => array( + 'config_module_enable' => 0, + ) + ); + $staging->write('system.module', $data); + config_import(); + $config_enabled_modules = config('system.module')->get('enabled'); + $this->assertTrue(isset($config_enabled_modules['config_module_enable']), 'Enabled module in active configuration.'); + $this->assertTrue(drupal_container()->get('module_handler')->moduleExists('config_module_enable'), 'Enabled module is loaded.'); + $this->assertTrue(db_table_exists('config_module_enable'), 'Schema created by module exists.'); + $this->assertEqual(config('config_module_enable.system')->get('foo'), 'foo', 'Default config for the module has been installed.'); + } } diff --git a/core/modules/config/tests/config_module_enable/config/config_module_enable.system.yml b/core/modules/config/tests/config_module_enable/config/config_module_enable.system.yml new file mode 100644 index 0000000..c34eddf --- /dev/null +++ b/core/modules/config/tests/config_module_enable/config/config_module_enable.system.yml @@ -0,0 +1,2 @@ +foo: bar +404: herp diff --git a/core/modules/config/tests/config_module_enable/config_test_module_enable.info b/core/modules/config/tests/config_module_enable/config_test_module_enable.info new file mode 100644 index 0000000..3687c34 --- /dev/null +++ b/core/modules/config/tests/config_module_enable/config_test_module_enable.info @@ -0,0 +1,5 @@ +name = Configuration import module enable +package = Core +version = VERSION +core = 8.x +hidden = TRUE diff --git a/core/modules/config/tests/config_module_enable/config_test_module_enable.install b/core/modules/config/tests/config_module_enable/config_test_module_enable.install new file mode 100644 index 0000000..0de34f3 --- /dev/null +++ b/core/modules/config/tests/config_module_enable/config_test_module_enable.install @@ -0,0 +1,26 @@ + 'A table to test enabling a module through config_import', + 'fields' => array( + 'type' => array( + 'type' => 'varchar', + 'length' => 128, + 'not null' => TRUE, + 'description' => 'The name of the entity type a mapping applies to (node, user, comment, etc.).', + ), + ), + 'primary key' => array('type'), + ); + + return $schema; +} diff --git a/core/modules/config/tests/config_module_enable/config_test_module_enable.module b/core/modules/config/tests/config_module_enable/config_test_module_enable.module new file mode 100644 index 0000000..91af8ec --- /dev/null +++ b/core/modules/config/tests/config_module_enable/config_test_module_enable.module @@ -0,0 +1,6 @@ +