fix(overrides): updates test suite sorter for phpunit 13 orders - #1784
Open
tomiichx wants to merge 1 commit into
Open
fix(overrides): updates test suite sorter for phpunit 13 orders#1784tomiichx wants to merge 1 commit into
tomiichx wants to merge 1 commit into
Conversation
tomiichx
marked this pull request as draft
July 29, 2026 10:32
tomiichx
force-pushed
the
fix/order-by-duration-and-size
branch
from
July 29, 2026 10:38
f0e2a5f to
a8676db
Compare
tomiichx
marked this pull request as ready for review
July 29, 2026 10:38
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
What:
Description:
On Pest 5, four
--order-byvalues crash at CLI-parse time, before a single test runs:Same failure for
duration-ascending,duration-descending, andsize-descending.Reproduced on Pest 5.0.1, PHPUnit 13.2.4, PHP 8.4.23.
The cause is
overrides/Runner/TestSuiteSorter.php, whichBootOverridesloads in placeof PHPUnit's class. It still declares the PHPUnit 12 constants:
PHPUnit 13 renamed both and added descending variants (
src/Runner/TestSuiteSorter.php:38-45):Builder.phpresolves the new names, the override does not define them, and PHP failson the constant lookup. Worth noting that the
durationarm is also where PHPUnit emitsits "use
duration-ascendinginstead" deprecation, so users never see that notice either.--order-by=sizehappens to still work becauseORDER_SIZEandORDER_SIZE_ASCENDINGare both
5, but it resolves through a constant the override defines under the old name,which is luck rather than correctness.
This PR updates the override to declare PHPUnit 13's four constants and extends the
$ordercomparisons inreorderTestsInSuite()so ascending and descending are handledseparately for both duration and size, matching PHPUnit 13's implementation. The old
ORDER_DURATIONandORDER_SIZEnames are dropped rather than aliased, since keepingthem would let the override drift from PHPUnit again.
Anyone upgrading from Pest 4 with
--order-by=durationin their config, which is commonfor parallel suites, currently gets a hard crash that points into PHPUnit instead of Pest.