Needs review
Project:
Drupal core
Version:
main
Component:
phpunit
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Reporter:
Created:
14 Oct 2026 at 13:23 UTC
Updated:
24 Oct 2026 at 10:54 UTC
Jump to comment: Most recent
If you run core's tests on main with code coverage turned on, 48 test classes trigger a PHPUnit warning and the run fails.
phpunit.xml.dist has a <source> section that tells PHPUnit which files to measure for code coverage.
The 48 tests that fail name code outside <source>. At a minumum, I think we should add .module and .inc files, and ../composer, to <source>.
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
dries commentedI did some digging and opened an MR for this.
PHPUnit's <directory> element only picks up
.phpfiles, unless you give it a suffix. Core's <source> doesn't set one anywhere.That has been the case since at least Drupal 8.0. What changed is that PHPUnit 12.0 started checking coverage targets against <source>.
The MR adds the suffixes and composer/:
<include> - <directory>./includes</directory> + <directory suffix=".inc">./includes</directory> <directory>./lib</directory> <directory>./modules</directory> + <directory suffix=".module">./modules</directory> + <directory suffix=".inc">./modules</directory> <directory>../modules</directory> + <directory>../composer</directory> </include> <exclude> <directory>./lib/Drupal/Component</directory> <directory>./modules/*/src/Tests</directory> <directory>./modules/*/tests</directory> + <directory suffix=".module">./modules/*/tests</directory> + <directory suffix=".inc">./modules/*/tests</directory>PHPUnit takes one suffix per line, so each file type gets its own line. The two exclude lines are there for the same reason: the existing
./modules/*/testsexclude only removes.phpfiles, and the test directories also have.moduleand.incfiles.This is what each line does:
Comment #4
dries commentedComment #5
mondrakeI filed a related issue.