Commit 65b155d9 authored by Dries's avatar Dries

Issue #1199946 by alexpott, fubhy, bojanz, steinmb, chx, catch: Fixed Disabled...

Issue #1199946 by alexpott, fubhy, bojanz, steinmb, chx, catch: Fixed Disabled modules are broken beyond repair so the 'disable' functionality needs to be removed.
parent 6b7bdcdd
......@@ -86,8 +86,10 @@ function entity_invoke_bundle_hook($hook, $entity_type, $bundle, $bundle_new = N
// Notify the entity storage controller.
$method = 'onBundle' . ucfirst($hook);
\Drupal::entityManager()->getStorageController($entity_type)->$method($bundle, $bundle_new);
$storage_controller = \Drupal::entityManager()->getStorageController($entity_type);
if (method_exists($storage_controller, $method)) {
$storage_controller->$method($bundle, $bundle_new);
}
// Invoke hook_entity_bundle_*() hooks.
\Drupal::moduleHandler()->invokeAll('entity_bundle_' . $hook, array($entity_type, $bundle, $bundle_new));
}
......
......@@ -995,7 +995,7 @@ function install_base_system(&$install_state) {
// Enable the user module so that sessions can be recorded during the
// upcoming bootstrap step.
module_enable(array('user'), FALSE);
Drupal::moduleHandler()->install(array('user'), FALSE);
// Save the list of other modules to install for the upcoming tasks.
// variable_set() can be used now that system.module is installed.
......@@ -2037,7 +2037,7 @@ function _install_module_batch($module, $module_name, &$context) {
// loaded by drupal_bootstrap in subsequent batch requests, and other
// modules possibly depending on it can safely perform their installation
// steps.
module_enable(array($module), FALSE);
Drupal::moduleHandler()->install(array($module), FALSE);
$context['results'][] = $module;
$context['message'] = t('Installed %module module.', array('%module' => $module_name));
}
......@@ -2529,7 +2529,7 @@ function install_configure_form_submit($form, &$form_state) {
// Enable update.module if this option was selected.
if ($form_state['values']['update_status_module'][1]) {
module_enable(array('file', 'update'), FALSE);
Drupal::moduleHandler()->install(array('file', 'update'), FALSE);
// Add the site maintenance account's email address to the list of
// addresses to be notified when updates are available, if selected.
......
......@@ -203,8 +203,9 @@ function language_types_disable($types) {
*/
function language_types_set(array $configurable_language_types) {
// Ensure that we are getting the defined language negotiation information. An
// invocation of module_enable() or module_disable() could outdate the cached
// information.
// invocation of \Drupal\Core\Extension\ModuleHandler::install() or
// \Drupal\Core\Extension\ModuleHandler::uninstall() could invalidate the
// cached information.
drupal_static_reset('language_types_info');
drupal_static_reset('language_negotiation_info');
......@@ -343,8 +344,9 @@ function language_negotiation_get_switch_links($type, $path) {
*/
function language_negotiation_purge() {
// Ensure that we are getting the defined language negotiation information. An
// invocation of module_enable() or module_disable() could outdate the cached
// information.
// invocation of \Drupal\Core\Extension\ModuleHandler::install() or
// \Drupal\Core\Extension\ModuleHandler::uninstall() could invalidate the
// cached information.
drupal_static_reset('language_negotiation_info');
drupal_static_reset('language_types_info');
......
......@@ -201,32 +201,21 @@ function module_load_include($type, $module, $name = NULL) {
return FALSE;
}
/**
* Enables or installs a given list of modules.
*
* @deprecated as of Drupal 8.0. Use
* \Drupal::moduleHandler()->enable($module_list, $enable_dependencies = TRUE).
*/
function module_enable($module_list, $enable_dependencies = TRUE) {
return \Drupal::moduleHandler()->enable($module_list, $enable_dependencies);
}
/**
* Disables a given set of modules.
* Installs a given list of modules.
*
* @deprecated as of Drupal 8.0. Use
* \Drupal::moduleHandler()->disable($module_list, $disable_dependents = TRUE).
* \Drupal::moduleHandler()->install($module_list, $enable_dependencies = TRUE)
*/
function module_disable($module_list, $disable_dependents = TRUE) {
\Drupal::moduleHandler()->disable($module_list, $disable_dependents);
function module_install($module_list, $enable_dependencies = TRUE) {
return \Drupal::moduleHandler()->install($module_list, $enable_dependencies);
}
/**
* Uninstalls a given list of disabled modules.
* Installs a given list of modules.
*
* @deprecated as of Drupal 8.0. Use
* \Drupal::moduleHandler()->uninstall($module_list, $uninstall_dependents = TRUE).
* \Drupal::moduleHandler()->install($module_list, $enable_dependencies = TRUE).
*/
function module_uninstall($module_list = array(), $uninstall_dependents = TRUE) {
return \Drupal::moduleHandler()->uninstall($module_list, $uninstall_dependents);
......@@ -332,7 +321,7 @@ function module_set_weight($module, $weight) {
->save();
// Prepare the new module list, sorted by weight, including filenames.
// @see module_enable()
// @see Drupal\Core\Extension\ModuleHandler::install()
$module_handler = \Drupal::moduleHandler();
$current_module_filenames = $module_handler->getModuleList();
$current_modules = array_fill_keys(array_keys($current_module_filenames), 0);
......@@ -345,13 +334,6 @@ function module_set_weight($module, $weight) {
$module_handler->setModuleList($module_filenames);
return;
}
$disabled_config = \Drupal::config('system.module.disabled');
if ($disabled_config->get($module) !== NULL) {
$disabled_config
->set($module, $weight)
->save();
return;
}
}
/**
......
......@@ -335,7 +335,6 @@ function update_prepare_d8_bootstrap() {
}
$module_config = \Drupal::config('system.module');
$disabled_modules = \Drupal::config('system.module.disabled');
$theme_config = \Drupal::config('system.theme');
$disabled_themes = \Drupal::config('system.theme.disabled');
$schema_store = \Drupal::keyValue('system.schema');
......@@ -378,9 +377,6 @@ function update_prepare_d8_bootstrap() {
if ($record->status && isset($module_data[$record->name])) {
$module_config->set('enabled.' . $record->name, $record->weight);
}
else {
$disabled_modules->set($record->name, $record->weight);
}
}
elseif ($record->type == 'theme') {
if ($record->status) {
......@@ -399,7 +395,6 @@ function update_prepare_d8_bootstrap() {
$sorted_with_filenames[$m] = drupal_get_filename('module', $m);
}
\Drupal::moduleHandler()->setModuleList($sorted_with_filenames);
$disabled_modules->save();
$theme_config->save();
$disabled_themes->save();
......@@ -490,8 +485,7 @@ function update_prepare_stored_includes() {
*/
function update_prepare_d8_language() {
if (db_table_exists('languages')) {
module_enable(array('language'));
Drupal::moduleHandler()->install(array('language'));
$languages = db_select('languages', 'l')
->fields('l')
......@@ -683,7 +677,7 @@ function update_fix_d8_requirements() {
// Make sure that file.module is enabled as it is required for the user
// picture upgrade path.
module_enable(array('file'));
Drupal::moduleHandler()->install(array('file'));
$schema = array(
'description' => 'Generic key/value storage table with an expiration.',
......@@ -727,8 +721,8 @@ function update_fix_d8_requirements() {
// views configurations.
// Like any other module APIs and services, Views' services are not available
// in update.php. Existing listings are migrated into configuration, using
// the limited standard tools of raw database queries and \Drupal::config().
module_enable(array('views'));
// the limited standard tools of raw database queries and Drupal::config().
\Drupal::moduleHandler()->install(array('views'));
update_variable_set('update_d8_requirements', TRUE);
}
......
......@@ -253,77 +253,50 @@ public function invokeAll($hook, $args = array());
public function alter($type, &$data, &$context1 = NULL, &$context2 = NULL);
/**
* Enables or installs a given list of modules.
*
* Definitions:
* - "Enabling" is the process of activating a module for use by Drupal.
* - "Disabling" is the process of deactivating a module.
* - "Installing" is the process of enabling it for the first time or after it
* has been uninstalled.
* - "Uninstalling" is the process of removing all traces of a module.
* Installs a given list of modules.
*
* Order of events:
* - Gather and add module dependencies to $module_list (if applicable).
* - For each module that is being enabled:
* - For each module that is being installed:
* - Invoke hook_module_preinstall().
* - Install module schema and update system registries and caches.
* - If the module is being enabled for the first time or had been
* uninstalled, invoke hook_install() and add it to the list of installed
* modules.
* - Invoke hook_enable().
* - Invoke hook_install() and add it to the list of installed modules.
* - Invoke hook_modules_installed().
* - Invoke hook_modules_enabled().
*
* @param $module_list
* @param array $module_list
* An array of module names.
* @param $enable_dependencies
* If TRUE, dependencies will automatically be added and enabled in the
* @param bool $enable_dependencies
* (optional) If TRUE, dependencies will automatically be installed in the
* correct order. This incurs a significant performance cost, so use FALSE
* if you know $module_list is already complete and in the correct order.
* if you know $module_list is already complete.
*
* @return
* @return bool
* FALSE if one or more dependencies are missing, TRUE otherwise.
*
* @see hook_module_preinstall()
* @see hook_install()
* @see hook_enable()
* @see hook_modules_installed()
* @see hook_modules_enabled()
*/
public function enable($module_list, $enable_dependencies = TRUE);
/**
* Disables a given set of modules.
*
* @param $module_list
* An array of module names.
* @param $disable_dependents
* If TRUE, dependent modules will automatically be added and disabled in the
* correct order. This incurs a significant performance cost, so use FALSE
* if you know $module_list is already complete and in the correct order.
*/
public function disable($module_list, $disable_dependents = TRUE);
public function install(array $module_list, $enable_dependencies = TRUE);
/**
* Uninstalls a given list of disabled modules.
*
* @param array $module_list
* The modules to uninstall. It is the caller's responsibility to ensure that
* all modules in this list have already been disabled before this function
* is called.
* The modules to uninstall.
* @param bool $uninstall_dependents
* (optional) If TRUE, the function will check that all modules which depend
* on the passed-in module list either are already uninstalled or contained in
* the list, and it will ensure that the modules are uninstalled in the
* correct order. This incurs a significant performance cost, so use FALSE if
* you know $module_list is already complete and in the correct order.
* Defaults to TRUE.
* (optional) If TRUE, dependent modules will automatically be uninstalled
* in the correct order. This incurs a significant performance cost, so use
* FALSE if you know $module_list is already complete.
*
* @return bool
* Returns TRUE if the operation succeeds or FALSE if it aborts due to an
* unsafe condition, namely, $uninstall_dependents is TRUE and a module in
* $module_list has dependents which are not already uninstalled and not also
* included in $module_list).
* FALSE if one or more dependencies are missing, TRUE otherwise.
*
* @see hook_module_preuninstall()
* @see hook_uninstall()
* @see hook_modules_uninstalled()
*/
public function uninstall($module_list = array(), $uninstall_dependents = TRUE);
public function uninstall(array $module_list, $uninstall_dependents = TRUE);
/**
* Returns an array of directories for all enabled modules. Useful for
......
......@@ -58,7 +58,7 @@ public function getImplementations($hook) {
/**
* {@inheritdoc}
*/
public function enable($module_list, $enable_dependencies = TRUE) {
public function install(array $module_list, $enable_dependencies = TRUE) {
$schema_store = \Drupal::keyValue('system.schema');
$old_schema = array();
foreach ($module_list as $module) {
......@@ -74,16 +74,13 @@ public function enable($module_list, $enable_dependencies = TRUE) {
db_create_table($table, $spec);
}
}
// Enable the module with a weight of 0.
$module_config = \Drupal::config('system.module');
$module_config
->set("enabled.$module", 0)
->set('enabled', module_config_sort($module_config->get('enabled')))
->save();
// Ensure the module is not contained in disabled modules.
\Drupal::config('system.module.disabled')
->clear($module)
->save();
$current_schema = $schema_store->get($module);
// Set the schema version if the module was not just disabled before.
......@@ -105,7 +102,7 @@ public function enable($module_list, $enable_dependencies = TRUE) {
$module_config_path = drupal_get_path('module', $module) . '/config';
if (is_dir($module_config_path)) {
$module_filestorage = new FileStorage($module_config_path);
$config_storage = drupal_container()->get('config.storage');
$config_storage = \Drupal::service('config.storage');
foreach ($module_filestorage->listAll() as $config_name) {
// If this file already exists, something in the upgrade path went
// completely wrong and we want to know.
......@@ -134,14 +131,7 @@ public function enable($module_list, $enable_dependencies = TRUE) {
/**
* {@inheritdoc}
*/
public function disable($module_list, $disable_dependents = TRUE) {
throw new \LogicException('Disabling modules is not supported during updates');
}
/**
* {@inheritdoc}
*/
public function uninstall($module_list = array(), $uninstall_dependents = TRUE) {
public function uninstall(array $module_list, $uninstall_dependents = TRUE) {
throw new \LogicException('Uninstalling modules is not supported during updates');
}
......
......@@ -35,7 +35,6 @@ public static function getInfo() {
* Tests Action uninstall.
*/
public function testActionUninstall() {
\Drupal::moduleHandler()->disable(array('action'));
\Drupal::moduleHandler()->uninstall(array('action'));
$this->assertTrue(entity_load('action', 'user_block_user_action', TRUE), 'Configuration entity \'user_block_user_action\' still exists after uninstalling action module.' );
......
......@@ -59,7 +59,7 @@ function testSettingsPage() {
// Make sure settings form is still accessible even after disabling a module
// that provides the selected plugins.
module_disable(array('aggregator_test'));
module_uninstall(array('aggregator_test'));
$this->resetAll();
$this->drupalGet('admin/config/services/aggregator/settings');
$this->assertResponse(200);
......
......@@ -72,7 +72,7 @@ function testUpdateFeedItem() {
// Make sure updating items works even after disabling a module
// that provides the selected plugins.
$this->enableTestPlugins();
module_disable(array('aggregator_test'));
module_uninstall(array('aggregator_test'));
$this->updateFeedItems($feed);
$this->assertResponse(200);
}
......
......@@ -184,7 +184,7 @@ function block_update_8005() {
* Enable the Custom Block module.
*/
function block_update_8006() {
module_enable(array('custom_block'));
Drupal::moduleHandler()->install(array('custom_block'));
}
/**
......
......@@ -238,7 +238,7 @@ function moveBlockToRegion(array $block, $region) {
* Test _block_rehash().
*/
function testBlockRehash() {
module_enable(array('block_test'));
\Drupal::moduleHandler()->install(array('block_test'));
$this->assertTrue(module_exists('block_test'), 'Test block module enabled.');
// Clear the block cache to load the block_test module's block definitions.
......@@ -267,100 +267,4 @@ function testBlockRehash() {
$this->assertEqual($settings['cache'], DRUPAL_NO_CACHE, "Test block's database entry updated to DRUPAL_NO_CACHE.");
}
/**
* Tests blocks belonging to disabled modules.
*/
function testBlockModuleDisable() {
module_enable(array('block_test'));
$this->assertTrue(module_exists('block_test'), 'Test block module enabled.');
// Clear the block cache to load the block_test module's block definitions.
$manager = $this->container->get('plugin.manager.block');
$manager->clearCachedDefinitions();
// Add test blocks in different regions and confirm they are displayed.
$blocks = array();
$regions = array('sidebar_first', 'content', 'footer');
foreach ($regions as $region) {
$blocks[$region] = $this->drupalPlaceBlock('test_cache', array('region' => $region));
}
$this->drupalGet('');
foreach ($regions as $region) {
$this->assertText($blocks[$region]->label());
}
// Disable the block test module and refresh the definitions cache.
module_disable(array('block_test'), FALSE);
$this->assertFalse(module_exists('block_test'), 'Test block module disabled.');
$manager->clearCachedDefinitions();
// Ensure that the block administration page still functions as expected.
$this->drupalGet('admin/structure/block');
$this->assertResponse(200);
// A 200 response is possible with a fatal error, so check the title too.
$this->assertTitle(t('Block layout') . ' | Drupal');
// Ensure that the disabled module's block instance is not listed.
foreach ($regions as $region) {
$this->assertNoText($blocks[$region]->label());
}
// Ensure that the disabled module's block plugin is no longer available.
$this->drupalGet('admin/structure/block/list/' . \Drupal::config('system.theme')->get('default'));
$this->assertNoText(t('Test block caching'));
// Confirm that the block is no longer displayed on the front page.
$this->drupalGet('');
$this->assertResponse(200);
foreach ($regions as $region) {
$this->assertNoText($blocks[$region]->label());
}
// Confirm that a different block instance can still be enabled by
// submitting the block library form.
// Emulate a POST submission rather than using drupalPlaceBlock() to ensure
// that the form still functions as expected.
$edit = array(
'settings[label]' => $this->randomName(8),
'machine_name' => strtolower($this->randomName(8)),
'region' => 'sidebar_first',
);
$this->drupalPostForm('admin/structure/block/add/system_powered_by_block/stark', $edit, t('Save block'));
$this->assertText(t('The block configuration has been saved.'));
$this->assertText($edit['settings[label]']);
// Update the weight of a block.
$edit = array('blocks[stark.' . $edit['machine_name'] . '][weight]' => -1);
$this->drupalPostForm('admin/structure/block', $edit, t('Save blocks'));
$this->assertText(t('The block settings have been updated.'));
// Re-enable the module and refresh the definitions cache.
module_enable(array('block_test'), FALSE);
$this->assertTrue(module_exists('block_test'), 'Test block module re-enabled.');
$manager->clearCachedDefinitions();
// Reload the admin page and confirm the block can again be configured.
$this->drupalGet('admin/structure/block');
foreach ($regions as $region) {
$this->assertLinkByHref(url('admin/structure/block/manage/' . $blocks[$region]->id()));
}
// Confirm that the blocks are again displayed on the front page in the
// correct regions.
$this->drupalGet('');
foreach ($regions as $region) {
// @todo Use a proper method for this.
$name_pieces = explode('.', $blocks[$region]->id());
$machine_name = array_pop($name_pieces);
$xpath = $this->buildXPathQuery('//div[@class=:region-class]//div[@id=:block-id]/*', array(
':region-class' => 'region region-' . drupal_html_class($region),
':block-id' => 'block-' . strtr(strtolower($machine_name), '-', '_'),
));
$this->assertFieldByXPath($xpath, NULL, format_string('Block %name found in the %region region.', array(
'%name' => $blocks[$region]->label(),
'%region' => $region,
)));
}
}
}
......@@ -6,15 +6,15 @@
*/
/**
* Implements hook_enable().
* Implements hook_install().
*
* Import breakpoints from all enabled themes.
*/
function breakpoint_enable() {
function breakpoint_install() {
// Import breakpoints from enabled themes.
$themes = array_filter(list_themes(), function ($theme) {return $theme->status;});
_breakpoint_theme_enabled(array_keys($themes));
// Import breakpoints from modules.
_breakpoint_modules_enabled(array_keys(\Drupal::moduleHandler()->getModuleList()));
_breakpoint_modules_installed(array_keys(\Drupal::moduleHandler()->getModuleList()));
}
......@@ -62,7 +62,7 @@ function breakpoint_themes_disabled($theme_list) {
}
/**
* Implements hook_modules_enabled().
* Implements hook_modules_installed().
*
* @param array $modules
* An array of the modules that were enabled.
......@@ -71,8 +71,8 @@ function breakpoint_themes_disabled($theme_list) {
*
* @todo: This should be removed if https://drupal.org/node/1813100 is resolved.
*/
function breakpoint_modules_enabled($modules) {
_breakpoint_modules_enabled($modules);
function breakpoint_modules_installed($modules) {
_breakpoint_modules_installed($modules);
}
/**
......@@ -106,12 +106,12 @@ function _breakpoint_theme_enabled($theme_list) {
}
/**
* Import breakpoints from all new enabled modules.
* Import breakpoints from all new installed modules.
*
* @param array $modules
* An array of the modules that were enabled.
* An array of the modules that were installed.
*/
function _breakpoint_modules_enabled($modules) {
function _breakpoint_modules_installed($modules) {
foreach ($modules as $module) {
$media_queries = breakpoint_get_module_media_queries($module);
_breakpoint_import_media_queries($module, $module, Breakpoint::SOURCE_TYPE_MODULE, $media_queries);
......
......@@ -118,10 +118,6 @@ public function testThemeBreakpointGroupModule() {
theme_disable(array('breakpoint_test_theme'));
$this->assertTrue(entity_load('breakpoint_group', $breakpoint_group_obj->id()), 'Breakpoint group still exists if theme is disabled.');
// Disable the test module and verify the breakpoint group still exists.
module_disable(array('breakpoint_theme_test'));
$this->assertTrue(entity_load('breakpoint_group', $breakpoint_group_obj->id()), 'Breakpoint group still exists if module is disabled.');
// Uninstall the test module and verify the breakpoint group is deleted.
module_uninstall(array('breakpoint_theme_test'));
$this->assertFalse(entity_load('breakpoint_group', $breakpoint_group_obj->id()), 'Breakpoint group is removed if module is uninstalled.');
......
......@@ -145,7 +145,7 @@ function testAdmin() {
// Now enable the ckeditor_test module, which provides one configurable
// CKEditor plugin — this should not affect the Editor config entity.
module_enable(array('ckeditor_test'));
\Drupal::moduleHandler()->install(array('ckeditor_test'));
$this->container->get('plugin.manager.ckeditor.plugin')->clearCachedDefinitions();
$this->drupalGet('admin/config/content/formats/manage/filtered_html');
$ultra_llama_mode_checkbox = $this->xpath('//input[@type="checkbox" and @name="editor[settings][plugins][llama_contextual_and_button][ultra_llama_mode]" and not(@checked)]');
......
......@@ -119,7 +119,7 @@ function testLoading() {
// NOTE: the tests in CKEditorTest already ensure that changing the
// configuration also results in modified CKEditor configuration, so we
// don't test that here.
module_enable(array('ckeditor_test'));
\Drupal::moduleHandler()->install(array('ckeditor_test'));
$this->container->get('plugin.manager.ckeditor.plugin')->clearCachedDefinitions();
$editor->settings['toolbar']['buttons'][0][] = 'Llama';
$editor->save();
......
......@@ -17,7 +17,6 @@ function comment_uninstall() {
)));
drupal_classloader_register('comment', 'core/modules/comment');
foreach ($node_types as $node_type) {
entity_invoke_bundle_hook('delete', 'comment', 'comment_node_' . $node_type);
variable_del('comment_' . $node_type);
variable_del('comment_anonymous_' . $node_type);
variable_del('comment_controls_' . $node_type);
......@@ -34,9 +33,9 @@ function comment_uninstall() {
}
/**
* Implements hook_enable().
* Implements hook_install().
*/
function comment_enable() {
function comment_install() {
// Insert records into the node_comment_statistics for nodes that are missing.
$query = db_select('node_field_data', 'n');
$query->leftJoin('node_comment_statistics', 'ncs', 'ncs.nid = n.nid AND n.default_langcode = 1');
......@@ -53,12 +52,13 @@ function comment_enable() {
}
/**
* Implements hook_modules_enabled().
* Implements hook_modules_installed().
*
* Creates comment body fields for node types existing before the Comment module
* is enabled. We use hook_modules_enabled() rather than hook_enable() so we can
* react to node types of existing modules, and those of modules being enabled
* both before and after the Comment module in the loop of module_enable().
* is enabled. We use hook_modules_installed() rather than hook_install() so we
* can react to node types of existing modules, and those of modules being
* enabled both before and after the Comment module in the loop of
* \Drupal\Core\Extension\ModuleHandler::install().
*
* There is a separate comment bundle for each node type to allow for
* per-node-type customization of comment fields. Each one of these bundles
......@@ -68,7 +68,7 @@ function comment_enable() {
*
* @see comment_node_type_insert()
*/
function comment_modules_enabled($modules) {
function comment_modules_installed($modules) {
// Only react if the Comment module is one of the modules being enabled.
// hook_node_type_insert() is used to create body fields while the comment
// module is enabled.
......
......@@ -61,31 +61,32 @@ function testCommentDefaultFields() {
}
/**
* Tests that comment module works when enabled after a content module.
* Tests that comment module works when installed after a content module.
*/
function testCommentEnable() {
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['modules[Core][comment][enable]'] = FALSE;
$this->drupalPostForm('admin/modules', $edit, t('Save configuration'));
$edit['uninstall[comment]'] = TRUE;
$this->drupalPostForm('admin/modules/uninstall', $edit, t('Uninstall'));
$this->drupalPostForm(NULL, array(), t('Uninstall'));
$this->rebuildContainer();
$this->assertFalse(module_exists('comment'), 'Comment module disabled.');
$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->drupalPostForm('admin/modules', $edit, t('Save configuration'));
// Now enable the comment module.
// Now install the comment module.
$edit = array();
$edit['modules[Core][comment][enable]'] = 'comment';
$this->drupalPostForm('admin/modules', $edit, t('Save configuration'));
$this->rebuildContainer();
$this->assertTrue(module_exists('comment'), 'Comment module enabled.');
$this->assertTrue($this->container->get('module_handler')->moduleExists('comment'), 'Comment module enabled.');
// Create nodes of each type.
$book_node = $this->drupalCreateNode(array('type' => 'book'));
......
......@@ -46,7 +46,6 @@ function testCommentUninstallWithField() {
$this->assertNotNull($field, 'The comment_body field exists.');
// Uninstall the comment module which should trigger field deletion.
$this->container->get('module_handler')->disable(array('comment'));
$this->container->get('module_handler')->uninstall(array('comment'));
// Check that the field is now deleted.
......@@ -70,7 +69,6 @@ function testCommentUninstallWithoutField() {
// Ensure that uninstallation succeeds even if the field has already been
// deleted manually beforehand.
$this->container->get('module_handler')->disable(array('comment'));
$this->container->get('module_handler')->uninstall(array('comment'));