Closed (fixed)
Project:
Drupal core
Version:
11.x-dev
Component:
system.module
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Reporter:
Created:
17 Sep 2025 at 05:04 UTC
Updated:
3 Oct 2025 at 00:59 UTC
Jump to comment: Most recent
Follow-up to #2943436: Review all tests where system module is the only dependency
Use this bash script to find and replace possible candidates. If the test fails it will be reverted. If it passes, we can review and commit the change.
find core/ -type f -name '*Test.php' \
| grep -E '/Kernel(/|Tests/)' \
| while read -r FILE; do
if grep -q "^ 'system',\$" "$FILE"; then
sed -i "/^ 'system',\$/d" "$FILE"
if ! ./vendor/bin/phpunit --stop-on-error --stop-on-fail -c core/phpunit.xml.dist "$FILE"; then
echo "Test failed for $FILE, reverting..."
git checkout -- "$FILE"
else
echo "Test passed for $FILE"
fi
fi
done
Repeat for other modules
N/A
N/A
N/A
N/A
N/A
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #3
mstrelan commentedUpdated to kernel tests only. Functional tests get system module automatically, but some tests should explicitly require it.
Comment #4
mstrelan commentedComment #5
nicxvan commentedThe other issue was only about tests that has only the one dependency.
Comment #6
smustgrave commentedAssuming there would be failures if this caused issues.
Comment #7
mstrelan commentedRe #5 does that matter? As per #6 these tests don't need system module installed, or in some cases it's already installed in a parent class. IMHO tests should seek to do the minimum amount of setup as possible to make the test pass.
Comment #8
nicxvan commentedNo sorry!
I was just commenting based on #2943436-35: Review all tests where system module is the only dependency that the other issue was scoped to singletons, I think this is great cleanup and I agree with 7, any reduction we can do is a win.
Comment #11
catchYeah this makes sense. Looking at the diff I wonder if it's worth checking the same thing for 'user'.
Committed/pushed to 11.x, thanks!
Comment #13
mstrelan commentedSure, I opened #3547554: Remove user module from kernel tests that don't need it but have some concerns that I've raised on the MR.