Skip to content

Conversation

sebastianbergmann
Copy link
Owner

@sebastianbergmann sebastianbergmann commented Aug 27, 2025

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 ...

5e3b1f7f9c874d67

... 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 in PHPUnit\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.

@sebastianbergmann sebastianbergmann added feature/test-runner CLI test runner type/tests Tests! Yes, PHPUnit, too, needs tests. labels Aug 27, 2025
Copy link

codecov bot commented Aug 27, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 94.37%. Comparing base (439901d) to head (7d35e3b).
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@             Coverage Diff              @@
##               10.5    #6338      +/-   ##
============================================
- Coverage     94.61%   94.37%   -0.24%     
+ Complexity     6650     6641       -9     
============================================
  Files           690      690              
  Lines         21253    21237      -16     
============================================
- Hits          20109    20043      -66     
- Misses         1144     1194      +50     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature/test-runner CLI test runner type/tests Tests! Yes, PHPUnit, too, needs tests.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant