function TemplateProjectTestBase::installModules
Installs modules in the UI.
Assumes that a user with the appropriate permissions is logged in.
Parameters
string[] $modules: The machine names of the modules to install.
2 calls to TemplateProjectTestBase::installModules()
- PackageUpdateTest::testPackageUpdate in core/
modules/ package_manager/ tests/ src/ Build/ PackageUpdateTest.php - Tests updating packages in a stage directory.
- TemplateProjectTestBase::createTestProject in core/
modules/ package_manager/ tests/ src/ Build/ TemplateProjectTestBase.php - Creates a test project from a given template and installs Drupal.
File
-
core/
modules/ package_manager/ tests/ src/ Build/ TemplateProjectTestBase.php, line 548
Class
- TemplateProjectTestBase
- Base class for tests which create a test site from a core project template.
Namespace
Drupal\Tests\package_manager\BuildCode
protected function installModules(array $modules) : void {
$mink = $this->getMink();
$page = $mink->getSession()
->getPage();
$assert_session = $mink->assertSession();
$this->visit('/admin/modules');
foreach ($modules as $module) {
$page->checkField("modules[{$module}][enable]");
}
$page->pressButton('Install');
// If there is a confirmation form warning about additional dependencies
// or non-stable modules, submit it.
$form_id = $assert_session->elementExists('css', 'input[type="hidden"][name="form_id"]')
->getValue();
if (preg_match('/^system_modules_(experimental_|non_stable_)?confirm_form$/', $form_id)) {
$page->pressButton('Continue');
$assert_session->statusCodeEquals(200);
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.