Make GenericModuleTestBase tests 30% faster

Created on 4 August 2025, 12 days ago

Problem/Motivation

There are currently 78 test classes extending GenericModuleTestBase. That means any unnecessary work is performed over and over again. One step we can remove is creating and logging in a user to load the help page for a module. Instead we can just grant anonymous users access to the help pages. For me that saves around 1.7 seconds per test, or 2m 13s overall.

Steps to reproduce

time ./vendor/bin/phpunit -c core --filter=testModuleGenericIssues

Before:

real    6m58.566s
user    3m23.528s
sys     0m29.718s

After:

real    4m45.496s
user    3m4.862s
sys     0m29.171s

Proposed resolution

-    $this->drupalLogin($this->createUser(['access help pages']));
+    user_role_grant_permissions(\Drupal\user\RoleInterface::ANONYMOUS_ID, ['access help pages']);

Remaining tasks

User interface changes

Introduced terminology

API changes

Data model changes

Release notes snippet

πŸ“Œ Task
Status

Active

Version

11.0 πŸ”₯

Component

system.module

Created by

πŸ‡¦πŸ‡ΊAustralia mstrelan

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

Merge Requests

Comments & Activities

Production build 0.71.5 2024