function ModulesListFormWebTest::testModulesListFormStatusMessage
Same name in other branches
- 9 core/modules/system/tests/src/Functional/Form/ModulesListFormWebTest.php \Drupal\Tests\system\Functional\Form\ModulesListFormWebTest::testModulesListFormStatusMessage()
- 10 core/modules/system/tests/src/Functional/Form/ModulesListFormWebTest.php \Drupal\Tests\system\Functional\Form\ModulesListFormWebTest::testModulesListFormStatusMessage()
Tests the status message when enabling one or more modules.
File
-
core/
modules/ system/ tests/ src/ Functional/ Form/ ModulesListFormWebTest.php, line 71
Class
Namespace
Drupal\Tests\system\Functional\FormCode
public function testModulesListFormStatusMessage() : void {
$this->drupalGet('admin/modules');
// Enable a module that does not define permissions.
$edit = [
'modules[layout_discovery][enable]' => 'layout_discovery',
];
$this->submitForm($edit, 'Install');
$this->assertSession()
->elementTextContains('xpath', "//div[@role='contentinfo' and h2[text()='Status message']]", 'Module Layout Discovery has been installed.');
$this->assertSession()
->elementNotExists('xpath', "//div[@role='contentinfo' and h2[text()='Status message']]//a");
// Enable a module that defines permissions.
$edit = [
'modules[filter][enable]' => 'filter',
];
$this->submitForm($edit, 'Install');
$this->assertSession()
->elementTextContains('xpath', "//div[@role='contentinfo' and h2[text()='Status message']]", 'Module Filter has been installed.');
$this->assertSession()
->elementExists('xpath', "//div[@role='contentinfo' and h2[text()='Status message']]//a[contains(@href, '/admin/people/permissions/module/filter')]");
// Enable a module that has dependencies and both define permissions.
$edit = [
'modules[content_moderation][enable]' => 'content_moderation',
];
$this->submitForm($edit, 'Install');
$this->submitForm([], 'Continue');
$this->assertSession()
->elementTextContains('xpath', "//div[@role='contentinfo' and h2[text()='Status message']]", '2 modules have been installed: Content Moderation, Workflows.');
$this->assertSession()
->elementExists('xpath', "//div[@role='contentinfo' and h2[text()='Status message']]//a[contains(@href, '/admin/people/permissions/module/content_moderation%2Cworkflows')]");
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.