diff --git a/core/includes/module.inc b/core/includes/module.inc index 865172b..162b255 100644 --- a/core/includes/module.inc +++ b/core/includes/module.inc @@ -241,8 +241,8 @@ function module_uninstall($module_list = array(), $uninstall_dependents = TRUE) * * @todo The only reason for not removing this right now is that Drush uses it. */ -function module_disable($module_list, $enable_dependencies = TRUE) { - return Drupal::moduleHandler()->uninstall($module_list, $enable_dependencies); +function module_disable($module_list, $uninstall_dependents = TRUE) { + return Drupal::moduleHandler()->uninstall($module_list, $uninstall_dependents); } /** diff --git a/core/modules/comment/lib/Drupal/comment/Tests/CommentFieldsTest.php b/core/modules/comment/lib/Drupal/comment/Tests/CommentFieldsTest.php index 5615259..8bae7e6 100644 --- a/core/modules/comment/lib/Drupal/comment/Tests/CommentFieldsTest.php +++ b/core/modules/comment/lib/Drupal/comment/Tests/CommentFieldsTest.php @@ -61,6 +61,47 @@ function testCommentDefaultFields() { } /** + * Tests that comment module works when install after a content module. + */ + function testCommentInstallAfterContentModule() { + // Create a user to do module administration. + $this->admin_user = $this->drupalCreateUser(array('access administration pages', 'administer modules')); + $this->drupalLogin($this->admin_user); + + // Disable the comment module. + $edit = array(); + $edit['uninstall[comment]'] = TRUE; + $this->drupalPost('admin/modules/uninstall', $edit, t('Uninstall')); + $this->drupalPost(NULL, array(), t('Uninstall')); + $this->rebuildContainer(); + $this->assertFalse($this->container->get('module_handler')->moduleExists('comment'), 'Comment module uninstalled.'); + + // Enable core content type module (book). + $edit = array(); + $edit['modules[Core][book][enable]'] = 'book'; + $this->drupalPost('admin/modules', $edit, t('Save configuration')); + + // Now install the comment module. + $edit = array(); + $edit['modules[Core][comment][enable]'] = 'comment'; + $this->drupalPost('admin/modules', $edit, t('Save configuration')); + $this->rebuildContainer(); + $this->assertTrue($this->container->get('module_handler')->moduleExists('comment'), 'Comment module enabled.'); + + // Create nodes of each type. + $book_node = $this->drupalCreateNode(array('type' => 'book')); + + $this->drupalLogout(); + + // Try to post a comment on each node. A failure will be triggered if the + // comment body is missing on one of these forms, due to postComment() + // asserting that the body is actually posted correctly. + $this->web_user = $this->drupalCreateUser(array('access content', 'access comments', 'post comments', 'skip comment approval')); + $this->drupalLogin($this->web_user); + $this->postComment($book_node, $this->randomName(), $this->randomName()); + } + + /** * Tests that comment module works correctly with plain text format. */ function testCommentFormat() { diff --git a/core/modules/system/lib/Drupal/system/Tests/Module/VersionTest.php b/core/modules/system/lib/Drupal/system/Tests/Module/VersionTest.php index 169f432..c48e8a2 100644 --- a/core/modules/system/lib/Drupal/system/Tests/Module/VersionTest.php +++ b/core/modules/system/lib/Drupal/system/Tests/Module/VersionTest.php @@ -24,8 +24,6 @@ public static function getInfo() { * Test version dependencies. */ function testModuleVersions() { - module_install(array('system_test')); - $dependencies = array( // Alternating between being compatible and incompatible with 8.x-2.4-beta3. // The first is always a compatible. @@ -62,8 +60,7 @@ function testModuleVersions() { for ($i = 0; $i < $n; $i++) { $this->drupalGet('admin/modules'); $checkbox = $this->xpath('//input[@id="edit-modules-testing-module-test-enable"]'); - $attributes = $checkbox[0]->attributes(); - $this->assertEqual(!empty($attributes['disabled']), $i % 2, $dependencies[$i]); + $this->assertEqual(!empty($checkbox[0]['disabled']), $i % 2, $dependencies[$i]); } } } diff --git a/core/modules/system/system.admin.inc b/core/modules/system/system.admin.inc index 40bccb0..162e093 100644 --- a/core/modules/system/system.admin.inc +++ b/core/modules/system/system.admin.inc @@ -788,20 +788,20 @@ function system_modules_uninstall($form, $form_state = NULL) { // Get a list of installed modules. $all_modules = system_rebuild_module_data(); - $disabled_modules = array(); + $uninstallable_modules = array(); foreach ($all_modules as $name => $module) { if ($module->status == 1 && empty($module->info['required']) && drupal_get_installed_schema_version($name) > SCHEMA_UNINSTALLED) { - $disabled_modules[$name] = $module; + $uninstallable_modules[$name] = $module; } } // Only build the rest of the form if there are any modules available to // uninstall. - if (!empty($disabled_modules)) { + if (!empty($uninstallable_modules)) { $profile = drupal_get_profile(); - uasort($disabled_modules, 'system_sort_modules_by_info_name'); + uasort($uninstallable_modules, 'system_sort_modules_by_info_name'); $form['uninstall'] = array('#tree' => TRUE); - foreach ($disabled_modules as $module) { + foreach ($uninstallable_modules as $module) { $module_name = $module->info['name'] ? $module->info['name'] : $module->name; $form['modules'][$module->name]['#module_name'] = $module_name; $form['modules'][$module->name]['name']['#markup'] = $module_name;