Rewrite of tests for test reordering #6338
Draft
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Motivated by #6270 (comment), @staabm and I discussed the current implementation of
PHPUnit\Runner\TestSuiteSorter
today.We identified code in
PHPUnit\Runner\TestSuiteSorter
that is only used in the tests for this class. This code is called twice and is potentially slow. Markus performed a quick benchmark ...... and we can see a miniscule, yet measurable, performance improvement after removing this code when running PHPUnit's own test suite.
We both do not understand the existing tests for test reordering and decided to delete them.
I have started to write end-to-end, event-based tests for common use cases of test reordering. In doing so, I already discovered behaviour that surprises me. I think of these tests as characterization tests that document the status quo.
Once the characterization tests are sufficient, we can decide on which behaviour to keep as-is, which behaviour that is currently "broken" (or is not as we assumed it to be) we want to change, and which behaviour to deprecate and later remove.
This pull request targets the
10.5
branch as I would like to have the same tests for PHPUnit >= 10. Apart from removing the aforementioned code inPHPUnit\Runner\TestSuiteSorter
that is only used by tests, I do not intend to make any production code changes for PHPUnit 10.5. Pending our evaluation after we have a sufficient amount of characterization tests, we will fix bugs in PHPUnit >= 11.