drupalCreateUser(['administer modules']); $this->drupalLogin($user); $this->drupalGet('admin/modules/uninstall'); $this->getSession()->getPage()->checkField('uninstall[ban]'); $this->getSession()->getPage()->checkField('uninstall[dblog]'); $this->click('#edit-submit'); // Click the confirm button. $this->click('#edit-submit'); $this->assertSession()->responseContains('The selected modules have been uninstalled.'); $this->assertSession()->responseContains('No modules are available to uninstall.'); // We've uninstalled modules therefore we need to rebuild the container in // the test runner. $this->rebuildContainer(); $module_handler = $this->container->get('module_handler'); $this->assertFalse($module_handler->moduleExists('ban')); $this->assertFalse($module_handler->moduleExists('dblog')); } }