Remove unused modules from kernel tests

Created on 27 October 2025, 15 days ago

Problem/Motivation

Follow-up to #3547124: Remove system module from kernel tests that don't need it and 📌 Remove user module from kernel tests that don't need it Needs review .

There are various other modules used in kernel tests that are not required. Some of these are because they are already required by the parent class, but others are genuinely not required.

Steps to reproduce

Run this bash script, might take a couple hours to complete. Then review git diff 11.x to see what can be removed and still have passing tests.

#!/bin/bash
for MODULE in core/modules/*; do
  MODULE_NAME=$(basename "$MODULE")

  while IFS= read -r FILE; do
    if grep -q "^    '$MODULE_NAME',\$" "$FILE"; then
      sed -i "/^    '$MODULE_NAME',\$/d" "$FILE"

      if ! ./vendor/bin/phpunit --stop-on-error --stop-on-fail -c core/phpunit.xml.dist "$FILE" >/dev/null 2>&1; then
        git checkout -- "$FILE"
      fi
    fi
  done < <(find core/ -type f -name '*Test.php' | grep -E '/Kernel(/|Tests/)')

done

Proposed resolution

Remaining tasks

It was suggested we could split this in to tests that can have modules removed because they are already installed in a parent class, and tests that don't need the modules installed at all, but since this is a simple bash script there is not enough context to figure that out.

User interface changes

N/A

Introduced terminology

N/A

API changes

N/A

Data model changes

N/A

Release notes snippet

N/A

📌 Task
Status

RTBC

Version

11.0 🔥

Component

phpunit

Created by

🇦🇺Australia mstrelan

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

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

No activities found.

Production build 0.71.5 2024