Minimize login as admin user to change settings in comment functional tests

Created on 21 June 2023, 12 months ago
Updated 29 July 2023, 11 months ago

Problem/Motivation

Discovered whilst working on 🐛 [random test failure] Random failure in CommentStatisticsTest Fixed :

Currently the functional tests in the comment module use a lot of login/logout as an admin user solely to change settings.
However the methods that are used to change settings don't require admin permissions.

The change-a-comment-setting methods that are frequently surrounded by admin log in/out and can do without that are:

\Drupal\Tests\comment\Functional\CommentTestBase::setCommentAnonymous()
\Drupal\Tests\comment\Functional\CommentTestBase::setCommentPreview()
\Drupal\Tests\comment\Functional\CommentTestBase::setCommentForm()
\Drupal\Tests\comment\Functional\CommentTestBase::setCommentSubject()
\Drupal\Tests\comment\Functional\CommentTestBase::setCommentSettings()
user_role_change_permissions()

Steps to reproduce

Proposed resolution

Let's not log in/out as an admin user when we can change settings without needing admin power.
This should shave off a few seconds when running the tests.

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

📌 Task
Status

Fixed

Version

11.0 🔥

Component
Comment 

Last updated 3 days ago

Created by

🇳🇱Netherlands Spokje

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.69.0 2024