diff --git a/core/modules/comment/tests/src/Functional/CommentStatisticsTest.php b/core/modules/comment/tests/src/Functional/CommentStatisticsTest.php index 64ccf1d2b31ca620a9ec4f82a4dcd5e3abe5b54d..9a309f16e0ab53373eacc3d49a6d55ab4d4338cf 100644 --- a/core/modules/comment/tests/src/Functional/CommentStatisticsTest.php +++ b/core/modules/comment/tests/src/Functional/CommentStatisticsTest.php @@ -15,14 +15,6 @@ */ class CommentStatisticsTest extends CommentTestBase { - /** - * {@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; - /** * A secondary user for posting comments. * @@ -41,12 +33,17 @@ class CommentStatisticsTest extends CommentTestBase { protected function setUp(): void { parent::setUp(); + // Add more permissions the admin user. + $this->adminUser->addRole($this->drupalCreateRole([ + 'administer permissions', + 'access administration pages', + 'administer site configuration', + ]))->save(); // Create a second user to post comments. $this->webUser2 = $this->drupalCreateUser([ 'post comments', 'create article content', 'edit own comments', - 'post comments', 'skip comment approval', 'access comments', 'access content', @@ -88,7 +85,8 @@ public function testCommentNodeCommentStatistics() { // Prepare for anonymous comment submission (comment approval enabled). // Note we don't use user_role_change_permissions(), because that caused // random test failures. - $this->drupalLogin($this->rootUser); + $this->drupalLogin($this->adminUser); + $this->drupalGet('admin/people/permissions'); $edit = [ 'anonymous[access comments]' => 1, @@ -117,7 +115,7 @@ public function testCommentNodeCommentStatistics() { // Prepare for anonymous comment submission (no approval required). // Note we don't use user_role_change_permissions(), because that caused // random test failures. - $this->drupalLogin($this->rootUser); + $this->drupalLogin($this->adminUser); $this->drupalGet('admin/people/permissions'); $edit = [ 'anonymous[skip comment approval]' => 1,