Skip to content

Project bootstrap mode loads project-autoload-file after the project bootstrap; PHPUnit loads it before #2621

Done

Description

@chubes4

Problem

In bootstrap-mode=project, the wordpress.phpunit run code (packages/runtime-playground/src/phpunit-command-handlers.ts) runs pg_run_project_bootstrap_stage(...) and only then pg_run_project_autoload_stage($project_autoload_file). vendor/bin/phpunit loads the project's composer autoloader before the configured bootstrap, and real bootstraps depend on that order. Jetpack's wpcomsh tests/bootstrap.php never requires vendor/autoload.php and references PHPUnit classes directly:

BOOTSTRAP FAILURE: project_bootstrap:Error: Class "PHPUnit\Runner\Version" not found at /wordpress/wp-content/plugins/wpcomsh/tests/WP_UnitTestCase_Fix.php:18

(Homeboy Lab run lab-offload-65e4465f, Codebox v0.35.0, with autoload-file= and project-autoload-file=/wordpress/wp-content/plugins/wpcomsh/vendor/autoload.php.)

Desired

When project-autoload-file is set, it is required before the project bootstrap, matching PHPUnit's own order. A bootstrap that also requires the same autoloader keeps working (require_once). The legacy fallback and the project_autoload stage markers stay.

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

Activity

  1. chubes4 commented on Dec 3, 2026

    @chubes4
    CollaboratorAuthor

    Fixed by #2622.

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