From eeb7e60c30f5f710b0117ca42b058621b5874b10 Mon Sep 17 00:00:00 2001
From: Alex Pott <alex.a.pott@googlemail.com>
Date: Mon, 15 Apr 2024 23:34:24 +0100
Subject: [PATCH] Issue #3439904 by thebumik, pradhumanjain2311, smustgrave,
 kristiaanvandeneynde, vensires, alexpott, larowlan: Fix Path tests that rely
 on UID1's super user behavior

---
 .../Functional/PathContentModerationTest.php  | 33 ++++++++++++++-----
 1 file changed, 24 insertions(+), 9 deletions(-)

diff --git a/core/modules/path/tests/src/Functional/PathContentModerationTest.php b/core/modules/path/tests/src/Functional/PathContentModerationTest.php
index a50e0c64ed99..7627592b78f9 100644
--- a/core/modules/path/tests/src/Functional/PathContentModerationTest.php
+++ b/core/modules/path/tests/src/Functional/PathContentModerationTest.php
@@ -31,14 +31,6 @@ class PathContentModerationTest extends BrowserTestBase {
     'content_translation',
   ];
 
-  /**
-   * {@inheritdoc}
-   *
-   * @todo Remove and fix test to not rely on super user.
-   * @see https://www.drupal.org/project/drupal/issues/3437620
-   */
-  protected bool $usesSuperUserAccessPolicy = TRUE;
-
   /**
    * {@inheritdoc}
    */
@@ -63,7 +55,30 @@ protected function setUp(): void {
     $workflow->getTypePlugin()->addEntityTypeAndBundle('node', 'moderated');
     $workflow->save();
 
-    $this->drupalLogin($this->rootUser);
+    $this->drupalLogin($this->drupalCreateUser([
+      'administer workflows',
+      'access administration pages',
+      'administer content types',
+      'administer content translation',
+      'administer nodes',
+      'view latest version',
+      'view any unpublished content',
+      'access content overview',
+      'use editorial transition create_new_draft',
+      'use editorial transition publish',
+      'use editorial transition archive',
+      'use editorial transition archived_draft',
+      'use editorial transition archived_published',
+      'administer languages',
+      'administer site configuration',
+      'administer url aliases',
+      'create url aliases',
+      'view the administration theme',
+      'translate any entity',
+      'create content translations',
+      'create moderated content',
+      'edit own moderated content',
+    ]));
 
     // Enable URL language detection and selection.
     $edit = ['language_interface[enabled][language-url]' => 1];
-- 
GitLab