function UpdateScriptTest::enableMissingExtensions

Same name and namespace in other branches
  1. 11.x core/modules/system/tests/src/Functional/UpdateSystem/UpdateScriptTest.php \Drupal\Tests\system\Functional\UpdateSystem\UpdateScriptTest::enableMissingExtensions()

Enables extensions the UI.

Parameters

array $extension_info: An array of extension information arrays. The array is keyed by 'module' and 'theme'.

File

core/modules/system/tests/src/Functional/UpdateSystem/UpdateScriptTest.php, line 629

Class

UpdateScriptTest
Tests the update script access and functionality.

Namespace

Drupal\Tests\system\Functional\UpdateSystem

Code

protected function enableMissingExtensions(array $extension_info) : void {
  $edit = [];
  foreach ($extension_info as $info) {
    if ($info['type'] === 'module') {
      $machine_name = $info['machine_name'];
      $edit["modules[{$machine_name}][enable]"] = $machine_name;
    }
    if (!empty($edit)) {
      $this->drupalGet('admin/modules');
      $this->submitForm($edit, 'Install');
    }
  }
  if (isset($extension_info['theme'])) {
    $this->drupalGet('admin/appearance');
    foreach ($extension_info as $info) {
      if ($info['type' === 'theme']) {
        $this->click('a[title~="' . $info['name'] . '"]');
      }
    }
  }
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.