public function UpdateScriptTest::testMaintenanceModeLink in Drupal 10
Same name and namespace in other branches
- 8 core/modules/system/tests/src/Functional/UpdateSystem/UpdateScriptTest.php \Drupal\Tests\system\Functional\UpdateSystem\UpdateScriptTest::testMaintenanceModeLink()
- 9 core/modules/system/tests/src/Functional/UpdateSystem/UpdateScriptTest.php \Drupal\Tests\system\Functional\UpdateSystem\UpdateScriptTest::testMaintenanceModeLink()
Tests maintenance mode link on update.php.
File
- core/
modules/ system/ tests/ src/ Functional/ UpdateSystem/ UpdateScriptTest.php, line 628
Class
- UpdateScriptTest
- Tests the update script access and functionality.
Namespace
Drupal\Tests\system\Functional\UpdateSystemCode
public function testMaintenanceModeLink() {
$full_admin_user = $this
->drupalCreateUser([
'administer software updates',
'access administration pages',
'administer site configuration',
]);
$this
->drupalLogin($full_admin_user);
$this
->drupalGet($this->updateUrl, [
'external' => TRUE,
]);
$this
->assertSession()
->statusCodeEquals(200);
$this
->updateRequirementsProblem();
$this
->clickLink('maintenance mode');
$this
->assertSession()
->statusCodeEquals(200);
$this
->assertSession()
->elementContains('css', 'main h1', 'Maintenance mode');
// Now login as a user with only 'administer software updates' (but not
// 'administer site configuration') permission and try again.
$this
->drupalLogin($this->updateUser);
$this
->drupalGet($this->updateUrl, [
'external' => TRUE,
]);
$this
->assertSession()
->statusCodeEquals(200);
$this
->updateRequirementsProblem();
$this
->clickLink('maintenance mode');
$this
->assertSession()
->statusCodeEquals(200);
$this
->assertSession()
->elementContains('css', 'main h1', 'Maintenance mode');
}