From fbe64244e5a9f0dd278232540f3c3f83eef7752d Mon Sep 17 00:00:00 2001
From: Alex Pott <alex.a.pott@googlemail.com>
Date: Thu, 11 Apr 2024 20:35:20 +0100
Subject: [PATCH] Issue #3439893 by thebumik, vensires: Fix Layout Builder
 tests that rely on UID1's super user behavior

---
 .../src/Functional/LayoutBuilderOverridesTest.php  | 14 +++-----------
 1 file changed, 3 insertions(+), 11 deletions(-)

diff --git a/core/modules/layout_builder/tests/src/Functional/LayoutBuilderOverridesTest.php b/core/modules/layout_builder/tests/src/Functional/LayoutBuilderOverridesTest.php
index 1b663a3cb454..13966bc3a807 100644
--- a/core/modules/layout_builder/tests/src/Functional/LayoutBuilderOverridesTest.php
+++ b/core/modules/layout_builder/tests/src/Functional/LayoutBuilderOverridesTest.php
@@ -15,14 +15,6 @@
  */
 class LayoutBuilderOverridesTest extends LayoutBuilderTestBase {
 
-  /**
-   * {@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;
-
   /**
    * Tests deleting a field in-use by an overridden layout.
    */
@@ -85,9 +77,9 @@ public function testOverridesWithoutFieldUi() {
     $assert_session = $this->assertSession();
     $page = $this->getSession()->getPage();
 
-    // @todo In https://www.drupal.org/node/540008 switch this to logging in as
-    //   a user with the 'configure any layout' permission.
-    $this->drupalLogin($this->rootUser);
+    $this->drupalLogin($this->drupalCreateUser([
+      'configure any layout',
+    ]));
 
     LayoutBuilderEntityViewDisplay::load('node.bundle_with_section_field.default')
       ->enableLayoutBuilder()
-- 
GitLab