function ModuleHandlerTest::testUninstallProfileDependency in Service Container 7.2
Same name and namespace in other branches
- 7 lib/Drupal/service_container/Tests/ModuleHandlerTest.php \Drupal\service_container\Tests\ModuleHandlerTest::testUninstallProfileDependency()
Tests uninstalling a module that is a "dependency" of a profile.
File
- lib/
Drupal/ service_container/ Tests/ ModuleHandlerTest.php, line 205 - Contains \Drupal\service_container\Tests\ModuleHandlerTest.
Class
- ModuleHandlerTest
- Tests the module_handler implementation of the service_container.
Namespace
Drupal\service_container\TestsCode
function testUninstallProfileDependency() {
return;
$profile = 'minimal';
$dependency = 'dblog';
$this
->settingsSet('install_profile', $profile);
$this
->enableModules(array(
'module_test',
$profile,
));
drupal_static_reset('system_rebuild_module_data');
$data = system_rebuild_module_data();
$this
->assertTrue(isset($data[$profile]->requires[$dependency]));
$this
->moduleInstaller()
->install(array(
$dependency,
));
$this
->assertTrue($this
->moduleHandler()
->moduleExists($dependency));
// Uninstall the profile module "dependency".
$result = $this
->moduleInstaller()
->uninstall(array(
$dependency,
));
$this
->assertTrue($result, 'ModuleHandler::uninstall() returns TRUE.');
$this
->assertFalse($this
->moduleHandler()
->moduleExists($dependency));
$this
->assertEqual(drupal_get_installed_schema_version($dependency), SCHEMA_UNINSTALLED, "{$dependency} module was uninstalled.");
// Verify that the installation profile itself was not uninstalled.
$uninstalled_modules = \Drupal::state()
->get('module_test.uninstall_order') ?: array();
$this
->assertTrue(in_array($dependency, $uninstalled_modules), "{$dependency} module is in the list of uninstalled modules.");
$this
->assertFalse(in_array($profile, $uninstalled_modules), 'The installation profile is not in the list of uninstalled modules.');
}