You are here

protected function UpdateTestBase::installModules in Automatic Updates 8.2

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.

1 call to UpdateTestBase::installModules()
CoreUpdateTest::createTestSite in tests/src/Build/CoreUpdateTest.php
Uses our already-installed dependencies to build a test site to update.

File

tests/src/Build/UpdateTestBase.php, line 267

Class

UpdateTestBase
Base class for tests that perform in-place updates.

Namespace

Drupal\Tests\automatic_updates\Build

Code

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');
  $form_id = $assert_session
    ->elementExists('css', 'input[type="hidden"][name="form_id"]')
    ->getValue();
  if ($form_id === 'system_modules_confirm_form') {
    $page
      ->pressButton('Continue');
    $assert_session
      ->statusCodeEquals(200);
  }
}