diff -u b/core/modules/menu_ui/tests/src/Functional/MenuUiTest.php b/core/modules/menu_ui/tests/src/Functional/MenuUiTest.php --- b/core/modules/menu_ui/tests/src/Functional/MenuUiTest.php +++ b/core/modules/menu_ui/tests/src/Functional/MenuUiTest.php @@ -94,15 +94,6 @@ 'administer menu', 'create article content', ]); - - $this->adminUserWithLinkAnyPage = $this->drupalCreateUser([ - 'access administration pages', - 'administer blocks', - 'administer menu', - 'create article content', - 'link to any page' - ]); - $this->authenticatedUser = $this->drupalCreateUser([]); } @@ -119,7 +110,6 @@ $this->doTestMenuBlock(); $this->addInvalidMenuLink(); $this->addCustomMenuCRUD(); - $this->testLoginLinkVisibility(); // Verify that the menu links rebuild is idempotent and leaves the same // number of links in the table. @@ -1061,8 +1051,16 @@ * Verify if any menu link with login URL is displayed after login. */ public function testLoginLinkVisibility() { - // Log in the administrator. - $this->drupalLogin($this->adminUserWithLinkAnyPage); + // Create user with required permissions + $adminUserWithLinkAnyPage = $this->drupalCreateUser([ + 'access administration pages', + 'administer blocks', + 'administer menu', + 'create article content', + 'link to any page' + ]); + // Log in with created user. + $this->drupalLogin($adminUserWithLinkAnyPage); $this->addMenuLink('', '/user/login', 'main'); $this->assertSession()->responseContains('The menu link has been saved.'); $this->drupalGet('');