Unverified Commit 42d2b92f authored by alexpott's avatar alexpott

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

(cherry picked from commit 4833c49b)
parent 010940e4
......@@ -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');
}
/**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment