Skip to content
Snippets Groups Projects
Unverified Commit 4833c49b authored by Alex Pott's avatar Alex Pott
Browse files

Issue #3136762 by dww, codersukanta, webchick, larowlan: Update.php includes...

Issue #3136762 by dww, codersukanta, webchick, larowlan: Update.php includes link to 'Put site into maintenance mode' for users without permission to use it
parent ef06a015
No related branches found
No related tags found
No related merge requests found
......@@ -220,7 +220,7 @@ system.site_maintenance_mode:
_form: '\Drupal\system\Form\SiteMaintenanceModeForm'
_title: 'Maintenance mode'
requirements:
_permission: 'administer site configuration'
_permission: 'administer site configuration+administer software updates'
system.run_cron:
path: '/admin/reports/status/run-cron'
......
......@@ -659,17 +659,26 @@ public function testSuccessfulMultilingualUpdateFunctionality() {
* Tests maintenance mode link on update.php.
*/
public function testMaintenanceModeLink() {
$admin_user = $this->drupalCreateUser([
$full_admin_user = $this->drupalCreateUser([
'administer software updates',
'access administration pages',
'administer site configuration',
]);
$this->drupalLogin($admin_user);
$this->drupalLogin($full_admin_user);
$this->drupalGet($this->updateUrl, ['external' => TRUE]);
$this->assertSession()->statusCodeEquals(200);
$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->clickLink('maintenance mode');
$this->assertSession()->statusCodeEquals(200);
$this->assertEquals('Maintenance mode', $this->cssSelect('main h1')[0]->getText());
$this->assertSession()->elementContains('css', 'main h1', 'Maintenance mode');
}
/**
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment