Skip to content

PHPUnit isolated child that loads the full WP test bootstrap dies silently, then the PHPUnit 12 TestDox collector aborts the run #2626

Done

Description

@chubes4

Follow-up to #2623 / #2624, observed on Jetpack wpcomsh (Homeboy Lab run lab-offload-79c2e002, Codebox 5c39bfa, PHPUnit 12.5.43, phpunit.12.xml.dist).

BlazeTest uses #[RunInSeparateProcess] + #[PreserveGlobalState(false)] with a data provider, so the child re-runs the project bootstrap. wpcomsh's tests/bootstrap.php defines constants, tests_add_filter(...)s and then requires the WP test library's includes/bootstrap.php, which normally shells out to install.php; Codebox skips that only in the parent. The child returns empty stdout and stderr:

..........................................F.....E
An error occurred inside PHPUnit.
Message:  PHPUnit\Logging\TestDox\TestResultCollector::record(): Argument #2 ($status) must be of type …TestStatus, null given
#6 …/ChildProcessResultProcessor.php(136): …->testFinished(Object(PHPUnit\Event\Code\TestMethod), 0)
#7 /internal/eval.php(1317) : eval()'d code(80): PHPUnit\Framework\ChildProcessResultProcessor->process(Object(BlazeTest), '', '', 'bf6a…')

Three problems:

  1. The child dies without output, so the cause is invisible. The child's exit code, stdout and stderr (including PHP fatals) must reach the test's error message.
  2. A failed child still aborts the whole run on PHPUnit 12 (TestDox collector sees testFinished with no recorded status). PHPUnit process isolation (runInSeparateProcess) crashes the whole run: proc_open is unavailable in the PHPUnit runtime #2623's contract is that only the affected test errors and the run continues.
  3. A child that runs a full WordPress test-library bootstrap (includes/bootstrap.php, with install.php handled the same way the parent handles it) must work, because that is the standard WordPress plugin test shape.

AI disclosure: Claude Opus (Pi, via Roadie) traced this from a Homeboy Lab run and wrote this issue.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions