test: consolidate test isolation on the fork-based approach#816
Merged
Conversation
Rewire LoopIsolation::assertInIsolation to Fork::executeClosure, dropping the Loop subprocess path for test isolation. Fork children now report exit-path throwables (e.g. LoadSandbox not-installed flows) through a shutdown hook registered in the global bootstrap, ahead of Codeception's ErrorHandler shutdown handler that would exit(125) first. The parent read loop detects EOF and surfaces child deaths instead of spinning. WP function shims move out of Fork into the fork closures of the tests needing them, so forks loading real WordPress do not fatal on redeclared functions.
It is DB-free and instantiates the stub wpdb classmap double in the suite process; under fork-based isolation that poisons later forks loading real WordPress with a wpdb redeclaration fatal. The unit suite process never loads real WordPress in forks.
Honor fwrite return values when chunking the result payload; base64-encode the payload so the terminator cannot appear inside it; report a clear error when the child exits without a result; restore the 30s read timeout the Loop-based isolation had (unbounded under --debug); guard the fork-failure and pcntl_fork fall-through paths; check chdir in assertInIsolation. Drop the unused quiet/chunk-size/terminator knobs.
Silence EINTR warnings from stream_select in the read loop, include the last PHP error in the exit-without-result report, drop the single-use instance API and the dead returned-Throwable rethrow.
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.
No description provided.