function UpdateScriptTest::enableExtension

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

Enables an extension using the UI.

Parameters

string $extension_type: The extension type.

string $extension_machine_name: The extension machine name.

string $extension_name: The extension name.

2 calls to UpdateScriptTest::enableExtension()
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 485

Class

UpdateScriptTest
Tests the update script access and functionality.

Namespace

Drupal\Tests\system\Functional\UpdateSystem

Code

protected function enableExtension($extension_type, $extension_machine_name, $extension_name) {
    if ($extension_type === 'module') {
        $edit = [
            "modules[{$extension_machine_name}][enable]" => $extension_machine_name,
        ];
        $this->drupalPostForm('admin/modules', $edit, t('Install'));
    }
    elseif ($extension_type === 'theme') {
        $this->drupalGet('admin/appearance');
        $this->click("a[title~=\"{$extension_name}\"]");
    }
}

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