3 namespace Drupal\FunctionalTests\Installer;
5 use Drupal\Core\Extension\ModuleUninstallValidatorException;
6 use Drupal\Tests\BrowserTestBase;
9 * Tests that an install profile can require modules.
13 class InstallProfileDependenciesTest extends BrowserTestBase {
18 protected $profile = 'testing_install_profile_dependencies';
21 * Tests that an install profile can require modules.
23 public function testUninstallingModules() {
24 $user = $this->drupalCreateUser(['administer modules']);
25 $this->drupalLogin($user);
26 $this->drupalGet('admin/modules/uninstall');
27 $this->assertSession()->fieldDisabled('uninstall[dblog]');
28 $this->getSession()->getPage()->checkField('uninstall[ban]');
29 $this->click('#edit-submit');
30 // Click the confirm button.
31 $this->click('#edit-submit');
32 $this->assertSession()->responseContains('The selected modules have been uninstalled.');
33 // We've uninstalled a module therefore we need to rebuild the container in
35 $this->rebuildContainer();
36 $this->assertFalse($this->container->get('module_handler')->moduleExists('ban'));
38 $this->container->get('module_installer')->uninstall(['dblog']);
39 $this->fail('Uninstalled dblog module.');
41 catch (ModuleUninstallValidatorException $e) {
42 $this->assertContains('The Testing install profile dependencies module is required', $e->getMessage());