From 20f3c89d02f131178d5ff8f29e729446cf9fe865 Mon Sep 17 00:00:00 2001
From: Alex Pott <alex.a.pott@googlemail.com>
Date: Mon, 27 Dec 2021 13:54:54 +0000
Subject: [PATCH] Issue #3205909 by kunal.sachdev, tedbow, phenaproxima: Ensure
 only needed permissions are used for Update module functional tests

---
 .../src/Functional/FileTransferAuthorizeFormTest.php     | 1 -
 .../update/tests/src/Functional/UpdateSemverCoreTest.php | 9 +++++++++
 .../update/tests/src/Functional/UpdateSemverTestBase.php | 4 +---
 3 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/core/modules/update/tests/src/Functional/FileTransferAuthorizeFormTest.php b/core/modules/update/tests/src/Functional/FileTransferAuthorizeFormTest.php
index 833b0d3b1ae5..20d48d93b1a5 100644
--- a/core/modules/update/tests/src/Functional/FileTransferAuthorizeFormTest.php
+++ b/core/modules/update/tests/src/Functional/FileTransferAuthorizeFormTest.php
@@ -26,7 +26,6 @@ protected function setUp(): void {
     $admin_user = $this->drupalCreateUser([
       'administer modules',
       'administer software updates',
-      'administer site configuration',
     ]);
     $this->drupalLogin($admin_user);
 
diff --git a/core/modules/update/tests/src/Functional/UpdateSemverCoreTest.php b/core/modules/update/tests/src/Functional/UpdateSemverCoreTest.php
index 64b371c57369..974b6eb48624 100644
--- a/core/modules/update/tests/src/Functional/UpdateSemverCoreTest.php
+++ b/core/modules/update/tests/src/Functional/UpdateSemverCoreTest.php
@@ -344,6 +344,10 @@ public function testModulePageUpToDate() {
    * Checks the messages at admin/modules when an update is missing.
    */
   public function testModulePageRegularUpdate() {
+    $this->drupalLogin($this->drupalCreateUser([
+      'administer site configuration',
+      'administer modules',
+    ]));
     $this->setProjectInstalledVersion('8.0.0');
     // Instead of using refreshUpdateStatus(), set these manually.
     $this->config('update.settings')
@@ -366,6 +370,11 @@ public function testModulePageRegularUpdate() {
    * Checks the messages at admin/modules when a security update is missing.
    */
   public function testModulePageSecurityUpdate() {
+    $this->drupalLogin($this->drupalCreateUser([
+      'administer site configuration',
+      'administer modules',
+      'administer themes',
+    ]));
     $this->setProjectInstalledVersion('8.0.0');
     // Instead of using refreshUpdateStatus(), set these manually.
     $this->config('update.settings')
diff --git a/core/modules/update/tests/src/Functional/UpdateSemverTestBase.php b/core/modules/update/tests/src/Functional/UpdateSemverTestBase.php
index 03bdb3c7e7f3..f16e4f13498e 100644
--- a/core/modules/update/tests/src/Functional/UpdateSemverTestBase.php
+++ b/core/modules/update/tests/src/Functional/UpdateSemverTestBase.php
@@ -41,9 +41,7 @@ protected function setUp(): void {
     parent::setUp();
     $admin_user = $this->drupalCreateUser([
       'administer site configuration',
-      'administer modules',
-      'administer themes',
-      ]);
+    ]);
     $this->drupalLogin($admin_user);
     $this->drupalPlaceBlock('local_actions_block');
   }
-- 
GitLab