Commit 826245d5 authored by alexpott's avatar alexpott

Issue #2324055 by dawehner, cilefen, znerol: Split up the module manager into...

Issue #2324055 by dawehner, cilefen, znerol: Split up the module manager into runtime information and extension information
parent b6c1c2fb
......@@ -288,7 +288,10 @@ services:
arguments: ['@container.namespaces', '@cache.discovery', '@module_handler']
module_handler:
class: Drupal\Core\Extension\ModuleHandler
arguments: ['@app.root', '%container.modules%', '@kernel', '@cache.bootstrap']
arguments: ['@app.root', '%container.modules%', '@cache.bootstrap']
module_installer:
class: Drupal\Core\Extension\ModuleInstaller
arguments: ['@app.root', '@module_handler', '@kernel']
theme_handler:
class: Drupal\Core\Extension\ThemeHandler
arguments: ['@app.root', '@config.factory', '@module_handler', '@state', '@info_parser', '@logger.channel.default', '@asset.css.collection_optimizer', '@config.installer', '@config.manager', '@router.builder_indicator']
......
......@@ -978,7 +978,7 @@ function install_base_system(&$install_state) {
// Enable the user module so that sessions can be recorded during the
// upcoming bootstrap step.
\Drupal::moduleHandler()->install(array('user'), FALSE);
\Drupal::service('module_installer')->install(array('user'), FALSE);
// Save the list of other modules to install for the upcoming tasks.
// State can be set to the database now that system.module is installed.
......@@ -1797,7 +1797,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.
\Drupal::moduleHandler()->install(array($module), FALSE);
\Drupal::service('module_installer')->install(array($module), FALSE);
$context['results'][] = $module;
$context['message'] = t('Installed %module module.', array('%module' => $module_name));
}
......
......@@ -615,7 +615,7 @@ function drupal_install_system($install_state) {
\Drupal::service('config.installer')->installDefaultConfig('core', 'core');
// Install System module and rebuild the newly available routes.
$kernel->getContainer()->get('module_handler')->install(array('system'), FALSE);
$kernel->getContainer()->get('module_installer')->install(array('system'), FALSE);
\Drupal::service('router.builder')->rebuild();
// Ensure default language is saved.
......
......@@ -157,10 +157,10 @@ function module_load_include($type, $module, $name = NULL) {
* @see \Drupal\Core\Extension\ModuleHandlerInterface::install()
*
* @deprecated in Drupal 8.x-dev, will be removed before Drupal 8.0. Use
* \Drupal::moduleHandler()->install($module_list, $enable_dependencies = TRUE).
* \Drupal::service('module_installer')->install($module_list, $enable_dependencies = TRUE).
*/
function module_install($module_list, $enable_dependencies = TRUE) {
return \Drupal::moduleHandler()->install($module_list, $enable_dependencies);
return \Drupal::service('module_installer')->install($module_list, $enable_dependencies);
}
/**
......@@ -169,10 +169,10 @@ function module_install($module_list, $enable_dependencies = TRUE) {
* @see \Drupal\Core\Extension\ModuleHandlerInterface::module_install()
*
* @deprecated in Drupal 8.x-dev, will be removed before Drupal 8.0. Use
* \Drupal::moduleHandler()->uninstall($module_list, $enable_dependencies = TRUE).
* \Drupal::service('module_installer')->uninstall($module_list, $enable_dependencies = TRUE).
*/
function module_uninstall($module_list = array(), $uninstall_dependents = TRUE) {
return \Drupal::moduleHandler()->uninstall($module_list, $uninstall_dependents);
return \Drupal::service('module_installer')->uninstall($module_list, $uninstall_dependents);
}
/**
......
......@@ -8,6 +8,7 @@
namespace Drupal\Core\Config;
use Drupal\Core\Extension\ModuleHandlerInterface;
use Drupal\Core\Extension\ModuleInstallerInterface;
use Drupal\Core\Extension\ThemeHandlerInterface;
use Drupal\Component\Utility\String;
use Drupal\Core\Config\Entity\ImportableEntityStorageInterface;
......@@ -155,6 +156,13 @@ class ConfigImporter {
*/
protected $totalConfigurationToProcess = 0;
/**
* The module installer.
*
* @var \Drupal\Core\Extension\ModuleInstallerInterface
*/
protected $moduleInstaller;
/**
* Constructs a configuration import object.
*
......@@ -171,18 +179,21 @@ class ConfigImporter {
* The typed configuration manager.
* @param \Drupal\Core\Extension\ModuleHandlerInterface $module_handler
* The module handler
* @param \Drupal\Core\Extension\ModuleInstallerInterface $module_installer
* The module installer.
* @param \Drupal\Core\Extension\ThemeHandlerInterface $theme_handler
* The theme handler
* @param \Drupal\Core\StringTranslation\TranslationInterface $string_translation
* The string translation service.
*/
public function __construct(StorageComparerInterface $storage_comparer, EventDispatcherInterface $event_dispatcher, ConfigManagerInterface $config_manager, LockBackendInterface $lock, TypedConfigManagerInterface $typed_config, ModuleHandlerInterface $module_handler, ThemeHandlerInterface $theme_handler, TranslationInterface $string_translation) {
public function __construct(StorageComparerInterface $storage_comparer, EventDispatcherInterface $event_dispatcher, ConfigManagerInterface $config_manager, LockBackendInterface $lock, TypedConfigManagerInterface $typed_config, ModuleHandlerInterface $module_handler, ModuleInstallerInterface $module_installer, ThemeHandlerInterface $theme_handler, TranslationInterface $string_translation) {
$this->storageComparer = $storage_comparer;
$this->eventDispatcher = $event_dispatcher;
$this->configManager = $config_manager;
$this->lock = $lock;
$this->typedConfigManager = $typed_config;
$this->moduleHandler = $module_handler;
$this->moduleInstaller = $module_installer;
$this->themeHandler = $theme_handler;
$this->stringTranslation = $string_translation;
foreach ($this->storageComparer->getAllCollectionNames() as $collection) {
......@@ -750,7 +761,7 @@ protected function processExtension($type, $op, $name) {
->setSyncing(TRUE)
->setSourceStorage($this->storageComparer->getSourceStorage());
if ($type == 'module') {
$this->moduleHandler->$op(array($name), FALSE);
$this->moduleInstaller->$op(array($name), FALSE);
// Installing a module can cause a kernel boot therefore reinject all the
// services.
$this->reInjectMe();
......
......@@ -292,52 +292,6 @@ public function invokeAll($hook, array $args = array());
*/
public function alter($type, &$data, &$context1 = NULL, &$context2 = NULL);
/**
* 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 installed:
* - Invoke hook_module_preinstall().
* - Install module schema and update system registries and caches.
* - Invoke hook_install() and add it to the list of installed modules.
* - Invoke hook_modules_installed().
*
* @param array $module_list
* An array of module names.
* @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.
*
* @return bool
* FALSE if one or more dependencies are missing, TRUE otherwise.
*
* @see hook_module_preinstall()
* @see hook_install()
* @see hook_modules_installed()
*/
public function install(array $module_list, $enable_dependencies = TRUE);
/**
* Uninstalls a given list of disabled modules.
*
* @param array $module_list
* The modules to uninstall.
* @param bool $uninstall_dependents
* (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
* FALSE if one or more dependencies are missing, TRUE otherwise.
*
* @see hook_module_preuninstall()
* @see hook_uninstall()
* @see hook_modules_uninstalled()
*/
public function uninstall(array $module_list, $uninstall_dependents = TRUE);
/**
* Returns an array of directories for all enabled modules. Useful for
* tasks such as finding a file that exists in all module directories.
......
This diff is collapsed.
<?php
/**
* @file
* Contains \Drupal\Core\Extension\ModuleInstallerInterface.
*/
namespace Drupal\Core\Extension;
/**
* Provides the installation of modules with creating the db schema and more.
*/
interface ModuleInstallerInterface {
/**
* 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 installed:
* - Invoke hook_module_preinstall().
* - Install module schema and update system registries and caches.
* - Invoke hook_install() and add it to the list of installed modules.
* - Invoke hook_modules_installed().
*
* @param array $module_list
* An array of module names.
* @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.
*
* @return bool
* FALSE if one or more dependencies are missing, TRUE otherwise.
*
* @see hook_module_preinstall()
* @see hook_install()
* @see hook_modules_installed()
*/
public function install(array $module_list, $enable_dependencies = TRUE);
/**
* Uninstalls a given list of modules.
*
* @param array $module_list
* The modules to uninstall.
* @param bool $uninstall_dependents
* (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
* FALSE if one or more dependencies are missing, TRUE otherwise.
*
* @see hook_module_preuninstall()
* @see hook_uninstall()
* @see hook_modules_uninstalled()
*/
public function uninstall(array $module_list, $uninstall_dependents = TRUE);
}
......@@ -7,7 +7,7 @@
namespace Drupal\Core\Installer\Form;
use Drupal\Core\Extension\ModuleHandlerInterface;
use Drupal\Core\Extension\ModuleInstallerInterface;
use Drupal\Core\Form\FormBase;
use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Locale\CountryManagerInterface;
......@@ -35,11 +35,11 @@ class SiteConfigureForm extends FormBase {
protected $state;
/**
* The module handler.
* The module installer.
*
* @var \Drupal\Core\Extension\ModuleHandlerInterface
* @var \Drupal\Core\Extension\ModuleInstallerInterface
*/
protected $moduleHandler;
protected $moduleInstaller;
/**
* The country manager.
......@@ -64,16 +64,16 @@ class SiteConfigureForm extends FormBase {
* The user storage.
* @param \Drupal\Core\State\StateInterface $state
* The state service.
* @param \Drupal\Core\Extension\ModuleHandlerInterface $module_handler
* The module handler.
* @param \Drupal\Core\Extension\ModuleInstallerInterface $module_installer
* The module installer.
* @param \Drupal\Core\Locale\CountryManagerInterface $country_manager
* The country manager.
*/
public function __construct($root, UserStorageInterface $user_storage, StateInterface $state, ModuleHandlerInterface $module_handler, CountryManagerInterface $country_manager) {
public function __construct($root, UserStorageInterface $user_storage, StateInterface $state, ModuleInstallerInterface $module_installer, CountryManagerInterface $country_manager) {
$this->root = $root;
$this->userStorage = $user_storage;
$this->state = $state;
$this->moduleHandler = $module_handler;
$this->moduleInstaller = $module_installer;
$this->countryManager = $country_manager;
}
......@@ -85,7 +85,7 @@ public static function create(ContainerInterface $container) {
$container->get('app.root'),
$container->get('entity.manager')->getStorage('user'),
$container->get('state'),
$container->get('module_handler'),
$container->get('module_installer'),
$container->get('country_manager')
);
}
......@@ -264,7 +264,7 @@ public function submitForm(array &$form, FormStateInterface $form_state) {
// Enable update.module if this option was selected.
$update_status_module = $form_state->getValue('update_status_module');
if ($update_status_module[1]) {
$this->moduleHandler->install(array('file', 'update'), FALSE);
$this->moduleInstaller->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.
......
......@@ -28,7 +28,7 @@ class ActionUninstallTest extends WebTestBase {
* Tests Action uninstall.
*/
public function testActionUninstall() {
\Drupal::moduleHandler()->uninstall(array('action'));
\Drupal::service('module_installer')->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.' );
......
......@@ -54,7 +54,7 @@ function testSettingsPage() {
// Make sure settings form is still accessible even after uninstalling a module
// that provides the selected plugins.
$this->container->get('module_handler')->uninstall(array('aggregator_test'));
$this->container->get('module_installer')->uninstall(array('aggregator_test'));
$this->resetAll();
$this->drupalGet('admin/config/services/aggregator/settings');
$this->assertResponse(200);
......
......@@ -67,7 +67,7 @@ function testUpdateFeedItem() {
// Make sure updating items works even after uninstalling a module
// that provides the selected plugins.
$this->enableTestPlugins();
$this->container->get('module_handler')->uninstall(array('aggregator_test'));
$this->container->get('module_installer')->uninstall(array('aggregator_test'));
$this->updateFeedItems($feed);
$this->assertResponse(200);
}
......
......@@ -160,7 +160,7 @@ function testExistingFormat() {
// Now enable the ckeditor_test module, which provides one configurable
// CKEditor plugin — this should not affect the Editor config entity.
\Drupal::moduleHandler()->install(array('ckeditor_test'));
\Drupal::service('module_installer')->install(array('ckeditor_test'));
$this->resetAll();
$this->container->get('plugin.manager.ckeditor.plugin')->clearCachedDefinitions();
$this->drupalGet('admin/config/content/formats/manage/filtered_html');
......
......@@ -115,7 +115,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.
\Drupal::moduleHandler()->install(array('ckeditor_test'));
\Drupal::service('module_installer')->install(array('ckeditor_test'));
$this->resetAll();
$this->container->get('plugin.manager.ckeditor.plugin')->clearCachedDefinitions();
$editor_settings = $editor->getSettings();
......
......@@ -19,7 +19,7 @@ class CommentTitleTest extends CommentTestBase {
*/
public function testCommentEmptyTitles() {
// Enables module that sets comments to an empty string.
\Drupal::moduleHandler()->install(array('comment_empty_title_test'));
\Drupal::service('module_installer')->install(array('comment_empty_title_test'));
// Set comments to have a subject with preview disabled.
$this->setCommentPreview(DRUPAL_DISABLED);
......
......@@ -42,7 +42,7 @@ function testCommentUninstallWithField() {
$this->assertNotNull($field_storage, 'The comment_body field exists.');
// Uninstall the comment module which should trigger field deletion.
$this->container->get('module_handler')->uninstall(array('comment'));
$this->container->get('module_installer')->uninstall(array('comment'));
// Check that the field is now deleted.
$field_storage = FieldStorageConfig::loadByName('comment', 'comment_body');
......@@ -65,7 +65,7 @@ function testCommentUninstallWithoutField() {
// Ensure that uninstallation succeeds even if the field has already been
// deleted manually beforehand.
$this->container->get('module_handler')->uninstall(array('comment'));
$this->container->get('module_installer')->uninstall(array('comment'));
}
}
......@@ -13,6 +13,7 @@
use Drupal\Core\Config\TypedConfigManagerInterface;
use Drupal\Core\Entity\EntityManagerInterface;
use Drupal\Core\Extension\ModuleHandlerInterface;
use Drupal\Core\Extension\ModuleInstallerInterface;
use Drupal\Core\Extension\ThemeHandlerInterface;
use Drupal\Core\Config\ConfigManagerInterface;
use Drupal\Core\Form\FormBase;
......@@ -92,6 +93,13 @@ class ConfigSync extends FormBase {
*/
protected $themeHandler;
/**
* The module installer.
*
* @var \Drupal\Core\Extension\ModuleInstallerInterface
*/
protected $moduleInstaller;
/**
* Constructs the object.
*
......@@ -111,10 +119,12 @@ class ConfigSync extends FormBase {
* The typed configuration manager.
* @param \Drupal\Core\Extension\ModuleHandlerInterface $module_handler
* The module handler
* @param \Drupal\Core\Extension\ModuleInstallerInterface $module_installer
* The module installer.
* @param \Drupal\Core\Extension\ThemeHandlerInterface $theme_handler
* The theme handler
*/
public function __construct(StorageInterface $staging_storage, StorageInterface $active_storage, StorageInterface $snapshot_storage, LockBackendInterface $lock, EventDispatcherInterface $event_dispatcher, ConfigManagerInterface $config_manager, TypedConfigManagerInterface $typed_config, ModuleHandlerInterface $module_handler, ThemeHandlerInterface $theme_handler) {
public function __construct(StorageInterface $staging_storage, StorageInterface $active_storage, StorageInterface $snapshot_storage, LockBackendInterface $lock, EventDispatcherInterface $event_dispatcher, ConfigManagerInterface $config_manager, TypedConfigManagerInterface $typed_config, ModuleHandlerInterface $module_handler, ModuleInstallerInterface $module_installer, ThemeHandlerInterface $theme_handler) {
$this->stagingStorage = $staging_storage;
$this->activeStorage = $active_storage;
$this->snapshotStorage = $snapshot_storage;
......@@ -123,6 +133,7 @@ public function __construct(StorageInterface $staging_storage, StorageInterface
$this->configManager = $config_manager;
$this->typedConfigManager = $typed_config;
$this->moduleHandler = $module_handler;
$this->moduleInstaller = $module_installer;
$this->themeHandler = $theme_handler;
}
......@@ -139,6 +150,7 @@ public static function create(ContainerInterface $container) {
$container->get('config.manager'),
$container->get('config.typed'),
$container->get('module_handler'),
$container->get('module_installer'),
$container->get('theme_handler')
);
}
......@@ -300,6 +312,7 @@ public function submitForm(array &$form, FormStateInterface $form_state) {
$this->lock,
$this->typedConfigManager,
$this->moduleHandler,
$this->moduleInstaller,
$this->themeHandler,
$this->getStringTranslation()
);
......
......@@ -213,7 +213,7 @@ function testValueValidation() {
* Tests data type handling.
*/
public function testDataTypes() {
\Drupal::moduleHandler()->install(array('config_test'));
\Drupal::service('module_installer')->install(array('config_test'));
$storage = new DatabaseStorage($this->container->get('database'), 'config');
$name = 'config_test.types';
$config = $this->container->get('config.factory')->get($name);
......
......@@ -53,7 +53,7 @@ public function testInstallUninstall() {
});
// Install every module possible.
\Drupal::moduleHandler()->install(array_keys($all_modules));
\Drupal::service('module_installer')->install(array_keys($all_modules));
$this->assertModules(array_keys($all_modules), TRUE);
foreach($all_modules as $module => $info) {
......@@ -100,7 +100,7 @@ public function testInstallUninstall() {
$this->assertTrue(isset($modules_to_uninstall['comment']), 'The comment module will be disabled');
// Uninstall all modules that can be uninstalled.
\Drupal::moduleHandler()->uninstall(array_keys($modules_to_uninstall));
\Drupal::service('module_installer')->uninstall(array_keys($modules_to_uninstall));
$this->assertModules(array_keys($modules_to_uninstall), FALSE);
foreach($modules_to_uninstall as $module => $info) {
......
......@@ -54,6 +54,7 @@ protected function setUp() {
$this->container->get('lock'),
$this->container->get('config.typed'),
$this->container->get('module_handler'),
$this->container->get('module_installer'),
$this->container->get('theme_handler'),
$this->container->get('string_translation')
);
......
......@@ -59,6 +59,7 @@ protected function setUp() {
$this->container->get('lock.persistent'),
$this->container->get('config.typed'),
$this->container->get('module_handler'),
$this->container->get('module_installer'),
$this->container->get('theme_handler'),
$this->container->get('string_translation')
);
......
......@@ -95,7 +95,7 @@ function testImport() {
// handled correctly. Options depends on Text so Text should be installed
// first. Since they were enabled during the test setup the core.extension
// file in staging will already contain them.
\Drupal::moduleHandler()->uninstall(array('text', 'options'));
\Drupal::service('module_installer')->uninstall(array('text', 'options'));
// Set the state system to record installations and uninstallations.
\Drupal::state()->set('ConfigImportUITest.core.extension.modules_installed', array());
......
......@@ -58,6 +58,7 @@ protected function setUp() {
$this->container->get('lock'),
$this->container->get('config.typed'),
$this->container->get('module_handler'),
$this->container->get('module_installer'),
$this->container->get('theme_handler'),
$this->container->get('string_translation')
);
......
......@@ -34,7 +34,7 @@ function testIntegrationModuleReinstallation() {
$default_configuration_entity = 'config_test.dynamic.config_integration_test';
// Install the config_test module we're integrating with.
\Drupal::moduleHandler()->install(array('config_test'));
\Drupal::service('module_installer')->install(array('config_test'));
// Verify the configuration does not exist prior to installation.
$config_static = \Drupal::config($default_config);
......@@ -43,7 +43,7 @@ function testIntegrationModuleReinstallation() {
$this->assertIdentical($config_entity->isNew(), TRUE);
// Install the integration module.
\Drupal::moduleHandler()->install(array('config_integration_test'));
\Drupal::service('module_installer')->install(array('config_integration_test'));
// Verify that default module config exists.
\Drupal::configFactory()->reset($default_config);
......@@ -66,7 +66,7 @@ function testIntegrationModuleReinstallation() {
$this->container->get('config.factory')->reset();
// Disable and uninstall the integration module.
$this->container->get('module_handler')->uninstall(array('config_integration_test'));
$this->container->get('module_installer')->uninstall(array('config_integration_test'));
// Verify the integration module's config was uninstalled.
$config_static = \Drupal::config($default_config);
......@@ -78,7 +78,7 @@ function testIntegrationModuleReinstallation() {
$this->assertIdentical($config_entity->get('label'), 'Customized integration config label');
// Reinstall the integration module.
\Drupal::moduleHandler()->install(array('config_integration_test'));
\Drupal::service('module_installer')->install(array('config_integration_test'));
// Verify the integration module's config was re-installed.
\Drupal::configFactory()->reset($default_config);
......@@ -132,14 +132,14 @@ function testInstallProfileConfigOverwrite() {
// Turn on the test module, which will attempt to replace the
// configuration data. This attempt to replace the active configuration
// should be ignored.
\Drupal::moduleHandler()->install(array('config_existing_default_config_test'));
\Drupal::service('module_installer')->install(array('config_existing_default_config_test'));
// Verify that the test module has not been able to change the data.
$config = \Drupal::config($config_name);
$this->assertIdentical($config->get(), $expected_profile_data);
// Disable and uninstall the test module.
\Drupal::moduleHandler()->uninstall(array('config_existing_default_config_test'));
\Drupal::service('module_installer')->uninstall(array('config_existing_default_config_test'));
// Verify that the data hasn't been altered by removing the test module.
$config = \Drupal::config($config_name);
......
......@@ -93,7 +93,7 @@ public function testUninstall() {
* The module name.
*/
protected function installModule($module) {
$this->container->get('module_handler')->install(array($module));
$this->container->get('module_installer')->install(array($module));
$this->container = \Drupal::getContainer();
}
......@@ -104,7 +104,7 @@ protected function installModule($module) {
* The module name.
*/
protected function uninstallModule($module) {
$this->container->get('module_handler')->uninstall(array($module));
$this->container->get('module_installer')->uninstall(array($module));
$this->container = \Drupal::getContainer();
}
......
......@@ -98,7 +98,7 @@ public function testAddEditorToNewFormat() {
* Enables the unicorn editor.
*/
protected function enableUnicornEditor() {
\Drupal::moduleHandler()->install(array('editor_test'));
\Drupal::service('module_installer')->install(array('editor_test'));
$this->rebuildContainer();
$this->resetAll();
}
......
......@@ -49,7 +49,7 @@ public function testFieldHelp() {
$this->drupalGet('admin/help/field');
// Enable the Options, Email and Field API Test modules.
\Drupal::moduleHandler()->install(array('options', 'field_test'));
\Drupal::service('module_installer')->install(array('options', 'field_test'));
$this->resetAll();
\Drupal::service('plugin.manager.field.widget')->clearCachedDefinitions();
\Drupal::service('plugin.manager.field.field_type')->clearCachedDefinitions();
......
......@@ -40,7 +40,7 @@ function testImportCreateDefault() {
// Enable field_test_config module and check that the field and storage
// shipped in the module's default config were created.
\Drupal::moduleHandler()->install(array('field_test_config'));
\Drupal::service('module_installer')->install(array('field_test_config'));
// A field storage with one single field.
$field_storage = entity_load('field_storage_config', $field_storage_id);
......
......@@ -136,7 +136,7 @@ function testFormatterUI() {
$this->assertFieldByName('field_test_settings_edit');
// Uninstall the module providing third party settings and ensure the button
// is no longer there.
\Drupal::moduleHandler()->uninstall(array('field_third_party_test'));
\Drupal::service('module_installer')->uninstall(array('field_third_party_test'));
$this->drupalGet($manage_display);
$this->assertNoFieldByName('field_test_settings_edit');
}
......
......@@ -233,7 +233,7 @@ function testAddOrphanTopic() {
$this->assertEqual(0, $nid_count, 'A forum node was not created when missing a forum vocabulary.');
// Reset the defaults for future tests.
\Drupal::moduleHandler()->install(array('forum'));
\Drupal::service('module_installer')->install(array('forum'));
}
/**
......
......@@ -145,7 +145,7 @@ public function testForumUninstallWithoutFieldStorage() {
// Ensure that uninstallation succeeds even if the field has already been
// deleted manually beforehand.
$this->container->get('module_handler')->uninstall(array('forum'));
$this->container->get('module_installer')->uninstall(array('forum'));
}
}
......@@ -36,7 +36,7 @@ public function testConfigOverrideImport() {
// Uninstall the language module and its dependencies so we can test
// enabling the language module and creating overrides at the same time
// during a configuration synchronisation.
\Drupal::moduleHandler()->uninstall(array('language'));
\Drupal::service('module_installer')->uninstall(array('language'));
// Ensure that the current site has no overrides registered to the
// ConfigFactory.
$this->rebuildContainer();
......@@ -66,7 +66,7 @@ public function testConfigOverrideImport() {
*/
public function testConfigOverrideImportEvents() {
// Enable the config_events_test module so we can record events occurring.
\Drupal::moduleHandler()->install(array('config_events_test'));
\Drupal::service('module_installer')->install(array('config_events_test'));
$this->rebuildContainer();
ConfigurableLanguage::createFromLangcode('fr')->save();
......
......@@ -75,7 +75,7 @@ function testInfoAlterations() {
// Alter LanguageInterface::TYPE_CONTENT to be configurable.
'language_test.content_language_type' => TRUE,
));
$this->container->get('module_handler')->install(array('language_test'));
$this->container->get('module_installer')->install(array('language_test'));
$this->resetAll();
// Check that fixed language types are properly configured without the need
......@@ -135,7 +135,7 @@ function testInfoAlterations() {
// Uninstall language_test and check that everything is set back to the
// original status.
$this->container->get('module_handler')->uninstall(array('language_test'));
$this->container->get('module_installer')->uninstall(array('language_test'));
$this->rebuildContainer();
// Check that only the core language types are available.
......
......@@ -199,7 +199,7 @@ function testMenuLinkReparenting($module = 'menu_test') {
* Tests uninstalling a module providing default links.
*/
public function testModuleUninstalledMenuLinks() {
\Drupal::moduleHandler()->install(array('menu_test'));
\Drupal::service('module_installer')->install(array('menu_test'));