- Issue created by @mondrake
- 🇮🇹Italy mondrake 🇮🇹
We are hitting a PHPUnit bug here, The file attribute of node of XML test list can be wrong. So we still need to read the file of a test class from the classloader.
- 🇮🇹Italy mondrake 🇮🇹
Very interesting side effect of this - since PHPUnit discovery actually executes the dataproviders, and includes in the discovery list as many test cases as the number of datasets provided for a test method, we can now be precise in the number of test cases run for each test class, and use that information in run-tests.sh instead of the current approximate count.
- First commit to issue fork.
- 🇬🇧United Kingdom catch
This looks really good and cleans up quite a lot of mess.
I went ahead and added @group #slow to mainly kernel tests that are now ending up towards the end of the run. This is not a fault in the ordering logic at all, it's just a side effect that some tests that happened to run earlier in a test run now could run later either purely because other tests moved around, or subtle changes in the method counting logic.
The debugging logic at the top of the test runs is great and I wonder if we should just keep that all the time.
- 🇮🇹Italy mondrake 🇮🇹
I was thinking in a follow up we could introduce a “weight“ to #slow (i.e. #slow300, #slow200, etc) and further tune the start sequence.
- 🇬🇧United Kingdom catch
@mondrake I think at the moment this is OK because we have less #slow tests than we run tests concurrently per-job (e.g. we might have 5 slow tests but start 8 at the same time), however it took a while for that to be the case and it might not be the case again, so definitely worth an issue. Even now it might save a few seconds which is worth having.
- 🇮🇹Italy mondrake 🇮🇹
We can leverage on PHPUnit API also to determine the test description, instead of doing separate parsing. On it.
- 🇮🇹Italy mondrake 🇮🇹
Filed 📌 Introduce a “weight“ to #slow tests Postponed re #12 and #13.
- 🇮🇹Italy mondrake 🇮🇹
merged with HEAD after commit of 🐛 Extend PhpUnitTestDiscoveryTest to test also PHPUnit API Active
- Status changed to Needs review
about 2 months ago 5:13pm 14 April 2025 - 🇮🇹Italy mondrake 🇮🇹
Thanks for review @mstrelan, added some of your suggestions and replied inline to some other ones; NW to address the remaining comments.
- 🇮🇹Italy mondrake 🇮🇹
Postponed on 🐛 Fix test annotations for tests introduced by #3485896 Active
- 🇮🇹Italy mondrake 🇮🇹
Found some issues while testing this in combination with 🌱 [meta] Support PHPUnit 11 in Drupal 10 Postponed . Given that one is RTBC, let's postpone on that.
- 🇮🇹Italy mondrake 🇮🇹
Rebased. Since when this was RTBC, added logic for determining group metadata information under PHPUnit 11.
- 🇬🇧United Kingdom catch
Adding this as a release priority because it will allow #[Group] to be used in contrib in combination with run-tests.sh (at least when 11.1 support is dropped).
- 🇮🇹Italy mondrake 🇮🇹
Thanks for reviews!
I'd love to add
@phpstan-type
, but I am reluctant because of 📌 Forbid limited length primary and unique keys, allow only in indexes Needs work and ✨ Support PHPStan's annotations for local type aliases and array shapes Active . - 🇦🇺Australia larowlan 🇦🇺🏝.au GMT+10
No worries, it's a nice to have and shouldn't hold this up
- 🇮🇹Italy mondrake 🇮🇹
Made some updates to the CR to provide some input how to convert tests from annotation to attributes. Would be lovely to get a review there too.
There are failing tests in the latest build that are not familiar to me as intermittent failures, but they probably need a re-run attempt at least.
- 🇮🇹Italy mondrake 🇮🇹
Only merged with head, now tests are green. There's fortuity in randomness of test failures.
I see only one unresolved MR comment from @larowlan about the file naming, but that comment was answered and seems to make sense to me. RTBC.
- 🇬🇧United Kingdom catch
OK I read through this again. It's a really nice clean-up of test discovery.
Personally I am excited about the improvements to test ordering, both for core test suite performance and also because it unblocks potential improvements in contrib as described in 📌 Lower default concurrency Active .
Committed/pushed to 11.x and cherry-picked to 11.2.x, thanks!
- 🇬🇧United Kingdom catch
I think this may have broken pipelines, e.g. https://git.drupalcode.org/issue/drupal-3046670/-/pipelines/505134 it's not possible to see the default test job. Reverting for now.
- 🇮🇹Italy mondrake 🇮🇹
Can't figure out what would be impacting pipelines here - the MR one after revert and rebase seems to work fine. Pipeline config is not touched apart from the addition of a parameter when calling
run-tests.sh
. - 🇬🇧United Kingdom catch
Yeah it doesn't make sense to me either - going to try again and trigger a couple of pipelines on different MRs in case it was a one-off.
- 🇬🇧United Kingdom catch
Seems OK now, I think it was a false alarm/ gitlab itself having a problem.
- 🇦🇺Australia larowlan 🇦🇺🏝.au GMT+10
Change record appears to already be published 👍
- 🇮🇹Italy mondrake 🇮🇹
Filed 🐛 PhpUnitApiGetTestClassesTest and PhpUnitApiFindAllClassFilesTest need to execute PHPUnit discovery before TestDiscovery Active after finding an issue while working on the followup conversions from annotations to attributes.
- 🇪🇸Spain fjgarlin
Note that this has broken testing for 11.2.x+ pipelines for all contrib.
Related issue in "gitlab_templates": 📌 MissingGroupException: Missing group metadata with run-tests.sh in 11.2.0-dev Active
Modules are either getting
MissingGroupException
orERROR: No valid tests were specified.
Key projects like Project Browser are affected 📌 Update for changes to System requirements Active , but again, this is all contrib testing NEXT_MINOR via
run-tests.sh
- 🇬🇧United Kingdom catch
Yes let's revert for now - hopefully we have enough to go on from the failed runs to figure out what's missing here.
- 🇮🇹Italy mondrake 🇮🇹
In next iteration, I would consider doing:
1) Bump PHPUnit to 11 in the lock file, instead of keeping it locked to 10. 🌱 [meta] Support PHPUnit 11 in Drupal 10 Postponed has been in for 3 weeks now and AFAICS no issue have been reported about that. PHPUnit 11 also support PHP 8.3, which is minimum for D11. We can still keep 10 in the composer.json in case anyone has the need to downgrade for incompatibility (which, again, was not found yet).
2) Include 🐛 PhpUnitApiGetTestClassesTest and PhpUnitApiFindAllClassFilesTest need to execute PHPUnit discovery before TestDiscovery Active which was meant to be a followup of this, but since now it’s open again, better do straight ahead.
Then, if 📌 MissingGroupException: Missing group metadata with run-tests.sh in 11.2.0-dev Active willl still not be resolved, it should be (theoretically) only a matter of listing the relevant directories in phpunit.xml.dist - and that would require another core fix if contrib is meant to run with core configuration.
I’d also suggest to commit initially only to 11.x to allow proper checking in gitlab templates, and only eventually backport to 11.2.x upon complete validation.
- 🇬🇧United Kingdom catch
@mondrake that all sounds good. I think defaulting to phpunit 11 is fine
- 🇫🇷France andypost
One more strong reason is that PHPUnit 10 no longer has bugfix support (since Feb'25) https://phpunit.de/supported-versions.html
So moving to 11 is required step to start transition to 12
- 🇮🇹Italy mondrake 🇮🇹
I do not understand why the CSpell job fail given that the file reported is included in the ignored paths in .cspell.json.
Then waiting for feedback to question in #3527063-8: Update for changes required by D11.2 → to see if we do need to edit the
<directory>
sections ofphpunit.xml.dist
to accomodate contrib testing.