Fix private PHPUnit TestSuite constructor compatibility#1927
Merged
Conversation
This was referenced Jul 21, 2026
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.
Summary
TestSuite::empty()when that public factory existsReflectionClasstoaddTestSuite()across API generationsrun_testsRoot cause
Both generated harness paths in
packages/runtime-playground/src/phpunit-command-handlers.tsdirectly callednew PHPUnit\\Framework\\TestSuite(...)duringload_tests. PHPUnit 10 and newer expose a private constructor and require the publicTestSuite::empty()factory, so the generated PHP terminated before any discovered component test executed. The same paths also passed a class-name string toaddTestSuite(), while newer PHPUnit versions require aReflectionClass.The suite creation is now guarded by
method_exists(TestSuite::class, 'empty'): PHPUnit 10+ uses the public factory, while PHPUnit 9, which has noempty()method, retains its public constructor. PassingReflectionClassworks in PHPUnit 9 and is required by newer versions. Factory/construction errors remain classified asload_testsinfrastructure failures rather than workload assertion failures.Downstream tracking: Extra-Chill/homeboy-extensions#2258.
Test evidence
npx tsx tests/phpunit-project-autoload.test.ts- passednpm run test:phpunit-runtime-failure-diagnostics- passednpm run test:playground-phpunit-bootstrap-failure-integration- passednpm run test:playground-phpunit-readonly-cache-integration- passednpm run build- passedgit diff --check- passedThe focused regression executes plugin and core generated harness tails in both compatibility modes and asserts
STAGE_OK:load_tests,STAGE_BEGIN:run_tests,STAGE_OK:run_tests, no infrastructure failure marker, and an execution marker written by the discovered test.Closes #1926