diff --git a/core/modules/comment/src/Tests/CommentFieldsTest.php b/core/modules/comment/src/Tests/CommentFieldsTest.php index 46de1bea41c18dfb181705bd5e5247e6e8a485b4..07e6cbf7f2528ca1b73c6bea5a30ddf1c1e4bcef 100644 --- a/core/modules/comment/src/Tests/CommentFieldsTest.php +++ b/core/modules/comment/src/Tests/CommentFieldsTest.php @@ -208,12 +208,12 @@ function testCommentInstallAfterContentModule() { // Install core content type module (book). $edit = array(); - $edit['modules[Core][book][enable]'] = 'book'; + $edit['book[enable]'] = 'book'; $this->drupalPostForm('admin/modules', $edit, t('Install')); // Now install the comment module. $edit = array(); - $edit['modules[Core][comment][enable]'] = 'comment'; + $edit['comment[enable]'] = 'comment'; $this->drupalPostForm('admin/modules', $edit, t('Install')); $this->rebuildContainer(); $this->assertTrue($this->container->get('module_handler')->moduleExists('comment'), 'Comment module enabled.'); diff --git a/core/modules/config/src/Tests/ConfigInstallWebTest.php b/core/modules/config/src/Tests/ConfigInstallWebTest.php index 4898f70c8c9457dd30a575c79e5fc16b38382a29..de2fde807bf3e87853b0e7f4cb64861611a5ca80 100644 --- a/core/modules/config/src/Tests/ConfigInstallWebTest.php +++ b/core/modules/config/src/Tests/ConfigInstallWebTest.php @@ -122,7 +122,7 @@ public function testPreExistingConfigInstall() { // will install the config_test module first because it is a dependency of // config_install_fail_test. // @see \Drupal\system\Form\ModulesListForm::submitForm() - $this->drupalPostForm('admin/modules', array('modules[Testing][config_test][enable]' => TRUE, 'modules[Testing][config_install_fail_test][enable]' => TRUE), t('Install')); + $this->drupalPostForm('admin/modules', array('config_test[enable]' => TRUE, 'config_install_fail_test[enable]' => TRUE), t('Install')); $this->assertRaw('Unable to install Configuration install fail test, config_test.dynamic.dotted.default already exists in active configuration.'); // Uninstall the config_test module to test the confirm form. @@ -133,7 +133,7 @@ public function testPreExistingConfigInstall() { // The user is shown a confirm form because the config_test module is a // dependency. // @see \Drupal\system\Form\ModulesListConfirmForm::submitForm() - $this->drupalPostForm('admin/modules', array('modules[Testing][config_install_fail_test][enable]' => TRUE), t('Install')); + $this->drupalPostForm('admin/modules', array('config_install_fail_test[enable]' => TRUE), t('Install')); $this->drupalPostForm(NULL, array(), t('Continue')); $this->assertRaw('Unable to install Configuration install fail test, config_test.dynamic.dotted.default already exists in active configuration.'); @@ -147,7 +147,7 @@ public function testPreExistingConfigInstall() { ->set('label', 'Je suis Charlie') ->save(); - $this->drupalPostForm('admin/modules', array('modules[Testing][config_install_fail_test][enable]' => TRUE), t('Install')); + $this->drupalPostForm('admin/modules', array('config_install_fail_test[enable]' => TRUE), t('Install')); $this->assertRaw('Unable to install Configuration install fail test, config_test.dynamic.dotted.default, language/fr/config_test.dynamic.dotted.default already exist in active configuration.'); // Test installing a theme through the UI that has existing configuration. @@ -178,16 +178,16 @@ public function testUnmetDependenciesInstall() { $this->drupalLogin($this->adminUser); // We need to install separately since config_install_dependency_test does // not depend on config_test and order is important. - $this->drupalPostForm('admin/modules', array('modules[Testing][config_test][enable]' => TRUE), t('Install')); - $this->drupalPostForm('admin/modules', array('modules[Testing][config_install_dependency_test][enable]' => TRUE), t('Install')); + $this->drupalPostForm('admin/modules', array('config_test[enable]' => TRUE), t('Install')); + $this->drupalPostForm('admin/modules', array('config_install_dependency_test[enable]' => TRUE), t('Install')); $this->assertRaw('Unable to install Config install dependency test due to unmet dependencies: config_test.dynamic.other_module_test_with_dependency (config_other_module_config_test, config_test.dynamic.dotted.english)'); - $this->drupalPostForm('admin/modules', array('modules[Testing][config_test_language][enable]' => TRUE), t('Install')); - $this->drupalPostForm('admin/modules', array('modules[Testing][config_install_dependency_test][enable]' => TRUE), t('Install')); + $this->drupalPostForm('admin/modules', array('config_test_language[enable]' => TRUE), t('Install')); + $this->drupalPostForm('admin/modules', array('config_install_dependency_test[enable]' => TRUE), t('Install')); $this->assertRaw('Unable to install Config install dependency test due to unmet dependencies: config_test.dynamic.other_module_test_with_dependency (config_other_module_config_test)'); - $this->drupalPostForm('admin/modules', array('modules[Testing][config_other_module_config_test][enable]' => TRUE), t('Install')); - $this->drupalPostForm('admin/modules', array('modules[Testing][config_install_dependency_test][enable]' => TRUE), t('Install')); + $this->drupalPostForm('admin/modules', array('config_other_module_config_test[enable]' => TRUE), t('Install')); + $this->drupalPostForm('admin/modules', array('config_install_dependency_test[enable]' => TRUE), t('Install')); $this->rebuildContainer(); $this->assertTrue(entity_load('config_test', 'other_module_test_with_dependency'), 'The config_test.dynamic.other_module_test_with_dependency configuration has been created during install.'); } @@ -197,7 +197,7 @@ public function testUnmetDependenciesInstall() { */ public function testConfigModuleRequirements() { $this->drupalLogin($this->adminUser); - $this->drupalPostForm('admin/modules', array('modules[Core][config][enable]' => TRUE), t('Install')); + $this->drupalPostForm('admin/modules', array('config[enable]' => TRUE), t('Install')); $directory = config_get_config_directory(CONFIG_SYNC_DIRECTORY); file_unmanaged_delete_recursive($directory); diff --git a/core/modules/config_translation/src/Tests/ConfigTranslationInstallTest.php b/core/modules/config_translation/src/Tests/ConfigTranslationInstallTest.php index 7daa305f95b17f8a8af66e78fb130f5c2c9fbff6..fdeb8d57a47a10075b63bd984f2f34c93ae38e42 100644 --- a/core/modules/config_translation/src/Tests/ConfigTranslationInstallTest.php +++ b/core/modules/config_translation/src/Tests/ConfigTranslationInstallTest.php @@ -63,7 +63,7 @@ public function testConfigTranslation() { $this->drupalPostForm('admin/config/regional/language/add', ['predefined_langcode' => 'fr'], t('Add custom language')); $edit = [ - 'modules[Multilingual][config_translation][enable]' => TRUE, + 'config_translation[enable]' => TRUE, ]; $this->drupalPostForm('admin/modules', $edit, t('Install')); diff --git a/core/modules/content_translation/src/Tests/ContentTranslationEnableTest.php b/core/modules/content_translation/src/Tests/ContentTranslationEnableTest.php index 26987b4d414fc6f41842fc4569ecbd7d099d1e7f..b26733189f581bc2660c01439d7fd8d91525c460 100644 --- a/core/modules/content_translation/src/Tests/ContentTranslationEnableTest.php +++ b/core/modules/content_translation/src/Tests/ContentTranslationEnableTest.php @@ -24,8 +24,8 @@ public function testEnable() { // Enable modules and make sure the related config entity type definitions // are installed. $edit = [ - 'modules[Multilingual][content_translation][enable]' => TRUE, - 'modules[Multilingual][language][enable]' => TRUE, + 'content_translation[enable]' => TRUE, + 'language[enable]' => TRUE, ]; $this->drupalPostForm('admin/modules', $edit, t('Install')); diff --git a/core/modules/forum/src/Tests/ForumUninstallTest.php b/core/modules/forum/src/Tests/ForumUninstallTest.php index 1978e6b311b0fcbf56bfbd330179aafa30c37d25..e63f47adaaff409813fe01203898ad83b1292ebb 100644 --- a/core/modules/forum/src/Tests/ForumUninstallTest.php +++ b/core/modules/forum/src/Tests/ForumUninstallTest.php @@ -118,7 +118,7 @@ public function testForumUninstallWithField() { $this->assertFalse((bool) NodeType::load('forum'), 'Node type with machine forum deleted.'); // Double check everything by reinstalling the forum module again. - $this->drupalPostForm('admin/modules', ['modules[Core][forum][enable]' => 1], 'Install'); + $this->drupalPostForm('admin/modules', ['forum[enable]' => 1], 'Install'); $this->assertText('Module Forum has been enabled.'); } diff --git a/core/modules/language/src/Tests/LanguageListModuleInstallTest.php b/core/modules/language/src/Tests/LanguageListModuleInstallTest.php index 3df9bdc0b1102aec184430fa36503f473e808d03..b42d0174489638fefba50be793d77792f430b2ed 100644 --- a/core/modules/language/src/Tests/LanguageListModuleInstallTest.php +++ b/core/modules/language/src/Tests/LanguageListModuleInstallTest.php @@ -28,7 +28,7 @@ function testModuleInstallLanguageList() { $admin_user = $this->drupalCreateUser(array('access administration pages', 'administer modules')); $this->drupalLogin($admin_user); $edit = array(); - $edit['modules[Multilingual][language][enable]'] = 'language'; + $edit['language[enable]'] = 'language'; $this->drupalPostForm('admin/modules', $edit, t('Install')); $this->assertEqual(\Drupal::state()->get('language_test.language_count_preinstall', 0), 1, 'Using LanguageManager::getLanguages() returns 1 language during Language installation.'); diff --git a/core/modules/language/src/Tests/LanguageNegotiationInfoTest.php b/core/modules/language/src/Tests/LanguageNegotiationInfoTest.php index ee4c6d4ce748ef4a5bdcdb09b5a311b9dda573dc..f633795594feb17d3033a470da36049988457682 100644 --- a/core/modules/language/src/Tests/LanguageNegotiationInfoTest.php +++ b/core/modules/language/src/Tests/LanguageNegotiationInfoTest.php @@ -184,7 +184,7 @@ public function testConfigLangTypeAlterations() { $this->assertTrue($this->isLanguageTypeConfigurable($test_type), 'Language type is now configurable.'); // After installing another module, the config should be the same. - $this->drupalPostForm('admin/modules', ['modules[Testing][test_module][enable]' => 1], t('Install')); + $this->drupalPostForm('admin/modules', ['test_module[enable]' => 1], t('Install')); $this->assertTrue($this->isLanguageTypeConfigurable($test_type), 'Language type is still configurable.'); // After uninstalling the other module, the config should be the same. diff --git a/core/modules/locale/src/Tests/LocaleConfigTranslationImportTest.php b/core/modules/locale/src/Tests/LocaleConfigTranslationImportTest.php index 67faa81929b0b59c3072588d4547b2d3ff919962..c3c050a968c9b1586a562f9e5eee8a969d2dadae 100644 --- a/core/modules/locale/src/Tests/LocaleConfigTranslationImportTest.php +++ b/core/modules/locale/src/Tests/LocaleConfigTranslationImportTest.php @@ -109,7 +109,7 @@ public function testConfigTranslationModuleInstall() { ->save(); // Install any module. - $this->drupalPostForm('admin/modules', ['modules[Core][dblog][enable]' => 'dblog'], t('Install')); + $this->drupalPostForm('admin/modules', ['dblog[enable]' => 'dblog'], t('Install')); $this->assertText('Module Database Logging has been enabled.'); // Get the front page and ensure that the translated configuration still diff --git a/core/modules/locale/src/Tests/LocaleConfigTranslationTest.php b/core/modules/locale/src/Tests/LocaleConfigTranslationTest.php index 3ee988a8defcd2551b1f8ffd8b899563207d55b7..9a00d0775ef188941e84b618d9b47e980c03eccb 100644 --- a/core/modules/locale/src/Tests/LocaleConfigTranslationTest.php +++ b/core/modules/locale/src/Tests/LocaleConfigTranslationTest.php @@ -119,7 +119,7 @@ public function testConfigTranslation() { $this->assertFalse($string, 'Configuration strings have been created upon installation.'); // Enable the image module. - $this->drupalPostForm('admin/modules', array('modules[Field types][image][enable]' => "1"), t('Install')); + $this->drupalPostForm('admin/modules', array('image[enable]' => "1"), t('Install')); $this->rebuildContainer(); $string = $this->storage->findString(array('source' => 'Medium (220×220)', 'context' => '', 'type' => 'configuration')); @@ -198,12 +198,12 @@ public function testConfigTranslation() { public function testOptionalConfiguration() { $this->assertNodeConfig(FALSE, FALSE); // Enable the node module. - $this->drupalPostForm('admin/modules', ['modules[Core][node][enable]' => "1"], t('Install')); + $this->drupalPostForm('admin/modules', ['node[enable]' => "1"], t('Install')); $this->drupalPostForm(NULL, [], t('Continue')); $this->rebuildContainer(); $this->assertNodeConfig(TRUE, FALSE); // Enable the views module (which node provides some optional config for). - $this->drupalPostForm('admin/modules', ['modules[Core][views][enable]' => "1"], t('Install')); + $this->drupalPostForm('admin/modules', ['views[enable]' => "1"], t('Install')); $this->rebuildContainer(); $this->assertNodeConfig(TRUE, TRUE); } diff --git a/core/modules/locale/src/Tests/LocaleLocaleLookupTest.php b/core/modules/locale/src/Tests/LocaleLocaleLookupTest.php index ea4f93705f8b4784358bca73dc86db96833b0b44..bc9bb65247c93f0a8e7afe178dc2afd0bb75c78a 100644 --- a/core/modules/locale/src/Tests/LocaleLocaleLookupTest.php +++ b/core/modules/locale/src/Tests/LocaleLocaleLookupTest.php @@ -37,7 +37,7 @@ protected function setUp() { */ public function testCircularDependency() { // Ensure that we can enable early_translation_test on a non-english site. - $this->drupalPostForm('admin/modules', array('modules[Testing][early_translation_test][enable]' => TRUE), t('Install')); + $this->drupalPostForm('admin/modules', array('early_translation_test[enable]' => TRUE), t('Install')); $this->assertResponse(200); } diff --git a/core/modules/locale/src/Tests/LocaleUpdateTest.php b/core/modules/locale/src/Tests/LocaleUpdateTest.php index 05cda3619d8e7d62e7efe7b2c5894139e3aef5be..743dba5febd481b36ceccd77b0590ed2259ee05b 100644 --- a/core/modules/locale/src/Tests/LocaleUpdateTest.php +++ b/core/modules/locale/src/Tests/LocaleUpdateTest.php @@ -308,7 +308,7 @@ public function testEnableUninstallModule() { // Enable a module. $edit = array( - 'modules[Testing][locale_test_translate][enable]' => 'locale_test_translate', + 'locale_test_translate[enable]' => 'locale_test_translate', ); $this->drupalPostForm('admin/modules', $edit, t('Install')); @@ -343,7 +343,7 @@ public function testEnableLanguage() { // Enable a module. $edit = array( - 'modules[Testing][locale_test_translate][enable]' => 'locale_test_translate', + 'locale_test_translate[enable]' => 'locale_test_translate', ); $this->drupalPostForm('admin/modules', $edit, t('Install')); @@ -387,7 +387,7 @@ public function testEnableCustomLanguage() { // Enable a module. $edit = array( - 'modules[Testing][locale_test_translate][enable]' => 'locale_test_translate', + 'locale_test_translate[enable]' => 'locale_test_translate', ); $this->drupalPostForm('admin/modules', $edit, t('Install')); diff --git a/core/modules/system/src/Form/ModulesListForm.php b/core/modules/system/src/Form/ModulesListForm.php index e74d898ca45e6889ecbc227be08dfd10986cf6f4..aaeb06fe7c85446e6367dea3b21a45874a6dfd27 100644 --- a/core/modules/system/src/Form/ModulesListForm.php +++ b/core/modules/system/src/Form/ModulesListForm.php @@ -145,11 +145,11 @@ public function buildForm(array $form, FormStateInterface $form_state) { uasort($modules, 'system_sort_modules_by_info_name'); // Iterate over each of the modules. - $form['modules']['#tree'] = TRUE; foreach ($modules as $filename => $module) { if (empty($module->info['hidden'])) { $package = $module->info['package']; $form['modules'][$package][$filename] = $this->buildRow($modules, $module, $distribution); + $form['modules'][$package][$filename]['#tree'] = TRUE; } } @@ -357,8 +357,6 @@ protected function buildRow(array $modules, Extension $module, $distribution) { * An array of modules to install and their dependencies. */ protected function buildModuleList(FormStateInterface $form_state) { - $packages = $form_state->getValue('modules'); - // Build a list of modules to install. $modules = array( 'install' => array(), @@ -366,24 +364,22 @@ protected function buildModuleList(FormStateInterface $form_state) { 'experimental' => [], ); - // Required modules have to be installed. - // @todo This should really not be handled here. $data = system_rebuild_module_data(); foreach ($data as $name => $module) { - if (!empty($module->required) && !$this->moduleHandler->moduleExists($name)) { + // If the module is installed there is nothing to do. + if ($this->moduleHandler->moduleExists($name)) { + continue; + } + // Required modules have to be installed. + if (!empty($module->required)) { $modules['install'][$name] = $module->info['name']; } - } - - // First, build a list of all modules that were selected. - foreach ($packages as $package => $items) { - foreach ($items as $name => $checkbox) { - if ($checkbox['enable'] && !$this->moduleHandler->moduleExists($name)) { - $modules['install'][$name] = $data[$name]->info['name']; - // Identify experimental modules. - if ($package == 'Core (Experimental)') { - $modules['experimental'][$name] = $data[$name]->info['name']; - } + // Selected modules should be installed. + elseif (($checkbox = $form_state->getValue($name, FALSE)) && $checkbox['enable']) { + $modules['install'][$name] = $data[$name]->info['name']; + // Identify experimental modules. + if ($data[$name]->info['package'] == 'Core (Experimental)') { + $modules['experimental'][$name] = $data[$name]->info['name']; } } } diff --git a/core/modules/system/src/Tests/Installer/InstallerTranslationMultipleLanguageTest.php b/core/modules/system/src/Tests/Installer/InstallerTranslationMultipleLanguageTest.php index 84dfad3e91b05d2309e4efbe3293adad7d12b4d3..a4e8d00b27084c1da88f299ce383a7883b29a837 100644 --- a/core/modules/system/src/Tests/Installer/InstallerTranslationMultipleLanguageTest.php +++ b/core/modules/system/src/Tests/Installer/InstallerTranslationMultipleLanguageTest.php @@ -117,8 +117,8 @@ public function testTranslationsLoaded() { // Activate a module, to make sure that config is not overridden by module // installation. $edit = array( - 'modules[Core][views][enable]' => TRUE, - 'modules[Core][filter][enable]' => TRUE, + 'views[enable]' => TRUE, + 'filter[enable]' => TRUE, ); $this->drupalPostForm('admin/modules', $edit, t('Install')); diff --git a/core/modules/system/src/Tests/Installer/InstallerTranslationTest.php b/core/modules/system/src/Tests/Installer/InstallerTranslationTest.php index fd6e0019b0a5fe022204688d96fd0e38c4e7a625..aa4a36db38f88c52a9b2cebafe79593df28332d7 100644 --- a/core/modules/system/src/Tests/Installer/InstallerTranslationTest.php +++ b/core/modules/system/src/Tests/Installer/InstallerTranslationTest.php @@ -84,7 +84,7 @@ public function testInstaller() { $this->assertEqual($account->language()->getId(), 'de', 'New user is German.'); // Ensure that we can enable basic_auth on a non-english site. - $this->drupalPostForm('admin/modules', array('modules[Web services][basic_auth][enable]' => TRUE), t('Install')); + $this->drupalPostForm('admin/modules', array('basic_auth[enable]' => TRUE), t('Install')); $this->assertResponse(200); // Assert that the theme CSS was added to the page. diff --git a/core/modules/system/src/Tests/Module/ClassLoaderTest.php b/core/modules/system/src/Tests/Module/ClassLoaderTest.php index bc2dfd5fc72d9136ac631c9053e229a8ab238c96..cee6cc9101e6617787983bd46bf6a2795351814b 100644 --- a/core/modules/system/src/Tests/Module/ClassLoaderTest.php +++ b/core/modules/system/src/Tests/Module/ClassLoaderTest.php @@ -76,8 +76,8 @@ function testClassLoadingDisabledModules() { public function testMultipleModules() { $this->drupalLogin($this->rootUser); $edit = [ - "modules[Testing][module_install_class_loader_test1][enable]" => TRUE, - "modules[Testing][module_install_class_loader_test2][enable]" => TRUE, + "module_install_class_loader_test1[enable]" => TRUE, + "module_install_class_loader_test2[enable]" => TRUE, ]; $this->drupalPostForm('admin/modules', $edit, t('Install')); $this->rebuildContainer(); diff --git a/core/modules/system/src/Tests/Module/DependencyTest.php b/core/modules/system/src/Tests/Module/DependencyTest.php index 8b219b27bc2e67d261ce78f0e9afd616f1cc123a..eb1a75cfedaa3b771685ceba8b946c3443513c46 100644 --- a/core/modules/system/src/Tests/Module/DependencyTest.php +++ b/core/modules/system/src/Tests/Module/DependencyTest.php @@ -14,12 +14,12 @@ class DependencyTest extends ModuleTestBase { */ function testProjectNamespaceForDependencies() { $edit = array( - 'modules[Core][filter][enable]' => TRUE, + 'filter[enable]' => TRUE, ); $this->drupalPostForm('admin/modules', $edit, t('Install')); // Enable module with project namespace to ensure nothing breaks. $edit = array( - 'modules[Testing][system_project_namespace_test][enable]' => TRUE, + 'system_project_namespace_test[enable]' => TRUE, ); $this->drupalPostForm('admin/modules', $edit, t('Install')); $this->assertModules(array('system_project_namespace_test'), TRUE); @@ -31,7 +31,7 @@ function testProjectNamespaceForDependencies() { function testEnableWithoutDependency() { // Attempt to enable Content Translation without Language enabled. $edit = array(); - $edit['modules[Multilingual][content_translation][enable]'] = 'content_translation'; + $edit['content_translation[enable]'] = 'content_translation'; $this->drupalPostForm('admin/modules', $edit, t('Install')); $this->assertText(t('Some required modules must be enabled'), 'Dependency required.'); @@ -57,7 +57,7 @@ function testMissingModules() { // as missing a dependency. $this->drupalGet('admin/modules'); $this->assertRaw(t('@module (missing)', array('@module' => Unicode::ucfirst('_missing_dependency'))), 'A module with missing dependencies is marked as such.'); - $checkbox = $this->xpath('//input[@type="checkbox" and @disabled="disabled" and @name="modules[Testing][system_dependencies_test][enable]"]'); + $checkbox = $this->xpath('//input[@type="checkbox" and @disabled="disabled" and @name="system_dependencies_test[enable]"]'); $this->assert(count($checkbox) == 1, 'Checkbox for the module is disabled.'); } @@ -72,7 +72,7 @@ function testIncompatibleModuleVersionDependency() { '@module' => 'System incompatible module version test (>2.0)', '@version' => '1.0', )), 'A module that depends on an incompatible version of a module is marked as such.'); - $checkbox = $this->xpath('//input[@type="checkbox" and @disabled="disabled" and @name="modules[Testing][system_incompatible_module_version_dependencies_test][enable]"]'); + $checkbox = $this->xpath('//input[@type="checkbox" and @disabled="disabled" and @name="system_incompatible_module_version_dependencies_test[enable]"]'); $this->assert(count($checkbox) == 1, 'Checkbox for the module is disabled.'); } @@ -86,7 +86,7 @@ function testIncompatibleCoreVersionDependency() { $this->assertRaw(t('@module (incompatible with this version of Drupal core)', array( '@module' => 'System incompatible core version test', )), 'A module that depends on a module with an incompatible core version is marked as such.'); - $checkbox = $this->xpath('//input[@type="checkbox" and @disabled="disabled" and @name="modules[Testing][system_incompatible_core_version_dependencies_test][enable]"]'); + $checkbox = $this->xpath('//input[@type="checkbox" and @disabled="disabled" and @name="system_incompatible_core_version_dependencies_test[enable]"]'); $this->assert(count($checkbox) == 1, 'Checkbox for the module is disabled.'); } @@ -101,8 +101,8 @@ function testEnableRequirementsFailureDependency() { // Attempt to install both modules at the same time. $edit = array(); - $edit['modules[Testing][requirements1_test][enable]'] = 'requirements1_test'; - $edit['modules[Testing][requirements2_test][enable]'] = 'requirements2_test'; + $edit['requirements1_test[enable]'] = 'requirements1_test'; + $edit['requirements2_test[enable]'] = 'requirements2_test'; $this->drupalPostForm('admin/modules', $edit, t('Install')); // Makes sure the modules were NOT installed. @@ -133,15 +133,15 @@ function testModuleEnableOrder() { // Enable the modules through the UI, verifying that the dependency chain // is correct. $edit = array(); - $edit['modules[Core][color][enable]'] = 'color'; + $edit['color[enable]'] = 'color'; $this->drupalPostForm('admin/modules', $edit, t('Install')); $this->assertModules(array('color'), FALSE); // Note that dependencies are sorted alphabetically in the confirmation // message. $this->assertText(t('You must enable the Configuration Manager, Help modules to install Color.')); - $edit['modules[Core][config][enable]'] = 'config'; - $edit['modules[Core][help][enable]'] = 'help'; + $edit['config[enable]'] = 'config'; + $edit['help[enable]'] = 'help'; $this->drupalPostForm('admin/modules', $edit, t('Install')); $this->assertModules(array('color', 'config', 'help'), TRUE); @@ -155,7 +155,7 @@ function testModuleEnableOrder() { */ function testUninstallDependents() { // Enable the forum module. - $edit = array('modules[Core][forum][enable]' => 'forum'); + $edit = array('forum[enable]' => 'forum'); $this->drupalPostForm('admin/modules', $edit, t('Install')); $this->drupalPostForm(NULL, array(), t('Continue')); $this->assertModules(array('forum'), TRUE); diff --git a/core/modules/system/src/Tests/Module/ExperimentalModuleTest.php b/core/modules/system/src/Tests/Module/ExperimentalModuleTest.php index 7b1a376bd03043f352aa6594940fc66e6dc29132..97e386572d99e261cee0c93d925e85707aceb7d4 100644 --- a/core/modules/system/src/Tests/Module/ExperimentalModuleTest.php +++ b/core/modules/system/src/Tests/Module/ExperimentalModuleTest.php @@ -36,7 +36,7 @@ public function testExperimentalConfirmForm() { // First, test installing a non-experimental module with no dependencies. // There should be no confirmation form and no experimental module warning. $edit = []; - $edit["modules[Testing][test_page_test][enable]"] = TRUE; + $edit["test_page_test[enable]"] = TRUE; $this->drupalPostForm('admin/modules', $edit, t('Install')); $this->assertText('Module Test page has been enabled.'); $this->assertNoText('Experimental modules are provided for testing purposes only.'); @@ -48,7 +48,7 @@ public function testExperimentalConfirmForm() { // There should be a confirmation form with an experimental warning, but no // list of dependencies. $edit = []; - $edit["modules[Core (Experimental)][experimental_module_test][enable]"] = TRUE; + $edit["experimental_module_test[enable]"] = TRUE; $this->drupalPostForm('admin/modules', $edit, 'Install'); // The module should not be enabled and there should be a warning and a @@ -70,7 +70,7 @@ public function testExperimentalConfirmForm() { // Test enabling a module that is not itself experimental, but that depends // on an experimental module. $edit = []; - $edit["modules[Testing][experimental_module_dependency_test][enable]"] = TRUE; + $edit["experimental_module_dependency_test[enable]"] = TRUE; $this->drupalPostForm('admin/modules', $edit, 'Install'); // The module should not be enabled and there should be a warning and a @@ -98,8 +98,8 @@ public function testExperimentalConfirmForm() { // still a warning about experimental modules, but no message about // dependencies, since the user specifically enabled the dependency. $edit = []; - $edit["modules[Core (Experimental)][experimental_module_test][enable]"] = TRUE; - $edit["modules[Testing][experimental_module_dependency_test][enable]"] = TRUE; + $edit["experimental_module_test[enable]"] = TRUE; + $edit["experimental_module_dependency_test[enable]"] = TRUE; $this->drupalPostForm('admin/modules', $edit, 'Install'); // The module should not be enabled and there should be a warning and a @@ -110,7 +110,7 @@ public function testExperimentalConfirmForm() { $this->assertText('The following modules are experimental: Experimental Test'); // Ensure the non-experimental module is not listed as experimental. - $this->assertNoText('The following modules are experimental: Experimental Test, Experimental Dependency Test'); + $this->assertNoText('The following modules are experimental: Experimental Dependency Test, Experimental Test'); $this->assertNoText('The following modules are experimental: Experimental Dependency Test'); // There should be no message about enabling dependencies. @@ -118,13 +118,13 @@ public function testExperimentalConfirmForm() { // Enable the module and confirm that it worked. $this->drupalPostForm(NULL, [], 'Continue'); - $this->assertText('2 modules have been enabled: Experimental Test, Experimental Dependency Test'); + $this->assertText('2 modules have been enabled: Experimental Dependency Test, Experimental Test'); // Try to enable an experimental module that can not be due to // hook_requirements(). \Drupal::state()->set('experimental_module_requirements_test_requirements', TRUE); $edit = []; - $edit["modules[Core (Experimental)][experimental_module_requirements_test][enable]"] = TRUE; + $edit["experimental_module_requirements_test[enable]"] = TRUE; $this->drupalPostForm('admin/modules', $edit, 'Install'); $this->assertUrl('admin/modules', [], 'If the module can not be installed we are not taken to the confirm form.'); $this->assertText('The Experimental Test Requirements module can not be installed.'); diff --git a/core/modules/system/src/Tests/Module/HookRequirementsTest.php b/core/modules/system/src/Tests/Module/HookRequirementsTest.php index ccbbff980e6db34bb9072c56f3a27e984fc5f8ba..09155d6764b1f598f807ea1e304d5c8c9689f779 100644 --- a/core/modules/system/src/Tests/Module/HookRequirementsTest.php +++ b/core/modules/system/src/Tests/Module/HookRequirementsTest.php @@ -16,7 +16,7 @@ function testHookRequirementsFailure() { // Attempt to install the requirements1_test module. $edit = array(); - $edit['modules[Testing][requirements1_test][enable]'] = 'requirements1_test'; + $edit['requirements1_test[enable]'] = 'requirements1_test'; $this->drupalPostForm('admin/modules', $edit, t('Install')); // Makes sure the module was NOT installed. diff --git a/core/modules/system/src/Tests/Module/InstallUninstallTest.php b/core/modules/system/src/Tests/Module/InstallUninstallTest.php index d8d625babd96eb42ff4a925ae518e0b79b2a005b..797b329d019f8ccaea373af2f6fc52c5d3b1d660 100644 --- a/core/modules/system/src/Tests/Module/InstallUninstallTest.php +++ b/core/modules/system/src/Tests/Module/InstallUninstallTest.php @@ -59,8 +59,7 @@ public function testInstallUninstall() { unset($all_modules['help']); $this->assertModuleNotInstalled('help'); $edit = array(); - $package = $required_modules['help']->info['package']; - $edit["modules[$package][help][enable]"] = TRUE; + $edit["help[enable]"] = TRUE; $this->drupalPostForm('admin/modules', $edit, t('Install')); $this->assertText('has been enabled', 'Modules status has been updated.'); $this->assertText(t('hook_modules_installed fired for help')); @@ -93,7 +92,7 @@ public function testInstallUninstall() { // Install the module. $edit = array(); $package = $module->info['package']; - $edit["modules[$package][$name][enable]"] = TRUE; + $edit[$name . '[enable]'] = TRUE; $this->drupalPostForm('admin/modules', $edit, t('Install')); // Handle experimental modules, which require a confirmation screen. @@ -191,7 +190,7 @@ public function testInstallUninstall() { $edit = array(); $experimental = FALSE; foreach ($all_modules as $name => $module) { - $edit['modules[' . $module->info['package'] . '][' . $name . '][enable]'] = TRUE; + $edit[$name . '[enable]'] = TRUE; // Track whether there is at least one experimental module. if ($module->info['package'] == 'Core (Experimental)') { $experimental = TRUE; diff --git a/core/modules/system/src/Tests/Module/RequiredTest.php b/core/modules/system/src/Tests/Module/RequiredTest.php index 004854ba28413ce4e897e3be57287a57896e8894..83732694a162dcb7a1b7c8fcaae2060c72468580 100644 --- a/core/modules/system/src/Tests/Module/RequiredTest.php +++ b/core/modules/system/src/Tests/Module/RequiredTest.php @@ -18,7 +18,7 @@ function testDisableRequired() { // Check to make sure the checkbox for each required module is disabled // and checked (or absent from the page if the module is also hidden). if (!empty($info['required'])) { - $field_name = "modules[{$info['package']}][$module][enable]"; + $field_name = $module . '[enable]'; if (empty($info['hidden'])) { $this->assertFieldByXPath("//input[@name='$field_name' and @disabled='disabled' and @checked='checked']", '', format_string('Field @name was disabled and checked.', array('@name' => $field_name))); } diff --git a/core/modules/system/src/Tests/Module/VersionTest.php b/core/modules/system/src/Tests/Module/VersionTest.php index 031d4bad663ac5b901549054705dde53fd09e102..529499e175bf11d946098365765f426f5ac2a843 100644 --- a/core/modules/system/src/Tests/Module/VersionTest.php +++ b/core/modules/system/src/Tests/Module/VersionTest.php @@ -48,7 +48,7 @@ function testModuleVersions() { $n = count($dependencies); for ($i = 0; $i < $n; $i++) { $this->drupalGet('admin/modules'); - $checkbox = $this->xpath('//input[@id="edit-modules-testing-module-test-enable"]'); + $checkbox = $this->xpath('//input[@id="edit-module-test-enable"]'); $this->assertEqual(!empty($checkbox[0]['disabled']), $i % 2, $dependencies[$i]); } } diff --git a/core/modules/system/src/Tests/System/MainContentFallbackTest.php b/core/modules/system/src/Tests/System/MainContentFallbackTest.php index 551e4c744f1863b1163c284d1a24a72d7e52a1d5..f19ba648db2608c1fb06def59e4cac587b1d8d70 100644 --- a/core/modules/system/src/Tests/System/MainContentFallbackTest.php +++ b/core/modules/system/src/Tests/System/MainContentFallbackTest.php @@ -64,7 +64,7 @@ function testMainContentFallback() { // Enable the block module again. $this->drupalLogin($this->adminUser); $edit = array(); - $edit['modules[Core][block][enable]'] = 'block'; + $edit['block[enable]'] = 'block'; $this->drupalPostForm('admin/modules', $edit, t('Install')); $this->assertText(t('Module Block has been enabled.'), 'Modules status has been updated.'); $this->rebuildContainer(); diff --git a/core/modules/toolbar/src/Tests/ToolbarAdminMenuTest.php b/core/modules/toolbar/src/Tests/ToolbarAdminMenuTest.php index 56b9d69a19839f2b96ea662b03cb8b8dca94d119..86db81dbccd4cd36a784c8783c071f6ad23ff3d4 100644 --- a/core/modules/toolbar/src/Tests/ToolbarAdminMenuTest.php +++ b/core/modules/toolbar/src/Tests/ToolbarAdminMenuTest.php @@ -112,7 +112,7 @@ function testModuleStatusChangeSubtreesHashCacheClear() { // Enable a module. $edit = array(); - $edit['modules[Core][taxonomy][enable]'] = TRUE; + $edit['taxonomy[enable]'] = TRUE; $this->drupalPostForm('admin/modules', $edit, t('Install')); $this->rebuildContainer(); diff --git a/core/modules/update/src/Tests/UpdateUploadTest.php b/core/modules/update/src/Tests/UpdateUploadTest.php index 39b6944b98e6508879e27bebfe9ac2e3b2916236..457e1a6c11bf7b469eebbbccb44ee8859aa4066c 100644 --- a/core/modules/update/src/Tests/UpdateUploadTest.php +++ b/core/modules/update/src/Tests/UpdateUploadTest.php @@ -98,7 +98,7 @@ public function testUploadModule() { $this->assertEqual($info['version'], '8.x-1.0'); // Enable the module. - $this->drupalPostForm('admin/modules', array('modules[Testing][update_test_new_module][enable]' => TRUE), t('Install')); + $this->drupalPostForm('admin/modules', array('update_test_new_module[enable]' => TRUE), t('Install')); // Define the update XML such that the new module downloaded above needs an // update from 8.x-1.0 to 8.x-1.1.