function UpdateScriptTest::enableExtensions

Same name in other branches
  1. 10 core/modules/system/tests/src/Functional/UpdateSystem/UpdateScriptTest.php \Drupal\Tests\system\Functional\UpdateSystem\UpdateScriptTest::enableExtensions()

Enables an extension using the UI.

Parameters

string $extension_type: The extension type.

array $extension_machine_names: An array of the extension machine names.

array $extension_names: An array of extension names.

2 calls to UpdateScriptTest::enableExtensions()
UpdateScriptTest::testExtensionCompatibilityChange in core/modules/system/tests/src/Functional/UpdateSystem/UpdateScriptTest.php
Tests that extension compatibility changes are handled correctly.
UpdateScriptTest::testMissingExtension in core/modules/system/tests/src/Functional/UpdateSystem/UpdateScriptTest.php
Tests that a missing extension prevents updates.

File

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

Class

UpdateScriptTest
Tests the update script access and functionality.

Namespace

Drupal\Tests\system\Functional\UpdateSystem

Code

protected function enableExtensions(string $extension_type, array $extension_machine_names, array $extension_names) : void {
    if ($extension_type === 'module') {
        $edit = [];
        foreach ($extension_machine_names as $extension_machine_name) {
            $edit["modules[{$extension_machine_name}][enable]"] = $extension_machine_name;
        }
        $this->drupalGet('admin/modules');
        $this->submitForm($edit, 'Install');
    }
    elseif ($extension_type === 'theme') {
        $this->drupalGet('admin/appearance');
        foreach ($extension_names as $extension_name) {
            $this->click("a[title~=\"{$extension_name}\"]");
        }
    }
}

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