function UninstallTest::testFailedInstallStatus
Same name in other branches
- 9 core/modules/system/tests/src/Functional/Module/UninstallTest.php \Drupal\Tests\system\Functional\Module\UninstallTest::testFailedInstallStatus()
- 10 core/modules/system/tests/src/Functional/Module/UninstallTest.php \Drupal\Tests\system\Functional\Module\UninstallTest::testFailedInstallStatus()
- 11.x core/modules/system/tests/src/Functional/Module/UninstallTest.php \Drupal\Tests\system\Functional\Module\UninstallTest::testFailedInstallStatus()
Tests that a module which fails to install can still be uninstalled.
File
-
core/
modules/ system/ tests/ src/ Functional/ Module/ UninstallTest.php, line 150
Class
- UninstallTest
- Tests the uninstallation of modules.
Namespace
Drupal\Tests\system\Functional\ModuleCode
public function testFailedInstallStatus() {
$account = $this->drupalCreateUser([
'administer modules',
]);
$this->drupalLogin($account);
$message = 'Exception thrown when installing module_installer_config_test with an invalid configuration file.';
try {
$this->container
->get('module_installer')
->install([
'module_installer_config_test',
]);
$this->fail($message);
} catch (EntityMalformedException $e) {
// Expected exception; just continue testing.
}
// Even though the module failed to install properly, its configuration
// status is "enabled" and should still be available to uninstall.
$this->drupalGet('admin/modules/uninstall');
$this->assertText('Module installer config test');
$edit['uninstall[module_installer_config_test]'] = TRUE;
$this->drupalPostForm('admin/modules/uninstall', $edit, t('Uninstall'));
$this->drupalPostForm(NULL, NULL, t('Uninstall'));
$this->assertText(t('The selected modules have been uninstalled.'));
$this->assertNoText('Module installer config test');
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.