diff options
author | Alex Pott <alex.a.pott@googlemail.com> | 2024-04-23 14:57:40 +0100 |
---|---|---|
committer | Alex Pott <alex.a.pott@googlemail.com> | 2024-04-23 14:57:40 +0100 |
commit | 941b7e795ddc99995c93cb3a38a98565695f5f9f (patch) | |
tree | 521a454bd725d72ba11ec81b7495c69714fd2c76 | |
parent | 1c914f2dc9afbb2a8bd503e548f6a720ee0a8f5b (diff) | |
download | drupal-941b7e795ddc99995c93cb3a38a98565695f5f9f.tar.gz drupal-941b7e795ddc99995c93cb3a38a98565695f5f9f.zip |
Issue #3439871 by SolimanHarkas, vensires: Fix Help tests that rely on UID1's super user behavior
3 files changed, 16 insertions, 28 deletions
diff --git a/core/modules/help/tests/src/Functional/HelpTest.php b/core/modules/help/tests/src/Functional/HelpTest.php index 73b0855cc31..e617c860bf2 100644 --- a/core/modules/help/tests/src/Functional/HelpTest.php +++ b/core/modules/help/tests/src/Functional/HelpTest.php @@ -35,14 +35,6 @@ class HelpTest extends BrowserTestBase { /** * {@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} */ protected $defaultTheme = 'claro'; @@ -77,7 +69,10 @@ class HelpTest extends BrowserTestBase { public function testHelp() { // Log in the root user to ensure as many admin links appear as possible on // the module overview pages. - $this->drupalLogin($this->rootUser); + $this->drupalLogin($this->drupalCreateUser([ + 'access help pages', + 'access administration pages', + ])); $this->verifyHelp(); // Log in the regular user. diff --git a/core/modules/help/tests/src/Functional/HelpTopicSearchTest.php b/core/modules/help/tests/src/Functional/HelpTopicSearchTest.php index 0403dc30b14..8b693644206 100644 --- a/core/modules/help/tests/src/Functional/HelpTopicSearchTest.php +++ b/core/modules/help/tests/src/Functional/HelpTopicSearchTest.php @@ -31,14 +31,6 @@ class HelpTopicSearchTest extends HelpTopicTranslatedTestBase { /** * {@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} */ protected $defaultTheme = 'stark'; @@ -266,7 +258,10 @@ class HelpTopicSearchTest extends HelpTopicTranslatedTestBase { \Drupal::service('module_installer')->uninstall(['help_topics_test']); // Ensure we can uninstall help_topics and use the help system without // breaking. - $this->drupalLogin($this->rootUser); + $this->drupalLogin($this->createUser([ + 'administer modules', + 'access help pages', + ])); $edit = []; $edit['uninstall[help]'] = TRUE; $this->drupalGet('admin/modules/uninstall'); @@ -283,7 +278,10 @@ class HelpTopicSearchTest extends HelpTopicTranslatedTestBase { public function testUninstallSearch() { // Ensure we can uninstall search and use the help system without // breaking. - $this->drupalLogin($this->rootUser); + $this->drupalLogin($this->createUser([ + 'administer modules', + 'access help pages', + ])); $edit = []; $edit['uninstall[search]'] = TRUE; $this->drupalGet('admin/modules/uninstall'); diff --git a/core/modules/help/tests/src/Functional/HelpTopicsSyntaxTest.php b/core/modules/help/tests/src/Functional/HelpTopicsSyntaxTest.php index adbb2987d7c..dda97aeb9f0 100644 --- a/core/modules/help/tests/src/Functional/HelpTopicsSyntaxTest.php +++ b/core/modules/help/tests/src/Functional/HelpTopicsSyntaxTest.php @@ -31,14 +31,6 @@ class HelpTopicsSyntaxTest extends BrowserTestBase { /** * {@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} */ protected $defaultTheme = 'stark'; @@ -46,7 +38,10 @@ class HelpTopicsSyntaxTest extends BrowserTestBase { * Tests that all Core help topics can be rendered and have good syntax. */ public function testHelpTopics() { - $this->drupalLogin($this->rootUser); + $this->drupalLogin($this->createUser([ + 'administer modules', + 'access help pages', + ])); // Enable all modules and themes, so that all routes mentioned in topics // will be defined. |