Skip to content

PHPUnit runner only supports the PHPUnit 9 API; project bootstraps that load PHPUnit 10+ fail in run_tests #2619

Done

Description

@chubes4

Problem

The wordpress.phpunit run code in packages/runtime-playground/src/phpunit-command-handlers.ts builds a TestSuite and calls (new PHPUnit\\TextUI\\TestRunner())->run($suite, $phpunit_args). That is the PHPUnit 9 API. With bootstrap-mode=project, the project's bootstrap autoloads the project's own vendor/phpunit/phpunit, which takes precedence over the harness's 9.6, and on PHPUnit 10+ the call fails:

BOOTSTRAP FAILURE: run_tests:TypeError: PHPUnit\TextUI\TestRunner::run(): Argument #1 ($configuration) must be of type PHPUnit\TextUI\Configuration\Configuration, PHPUnit\Framework\TestSuite given
  at /wordpress/wp-content/plugins/wpcomsh/vendor/phpunit/phpunit/src/TextUI/TestRunner.php:30
PHPUNIT_ZERO_TESTS cause=bootstrap_failed

Observed with Jetpack's wpcomsh via Homeboy, which uses automattic/phpunit-select-config (PHPUnit 9.6 / 11 / 12 depending on PHP). Every stage before this one now passes (activation, load_deps, the project bootstrap, load_tests). Most actively maintained plugins are on PHPUnit 10+.

Desired

wordpress.phpunit executes tests with whichever PHPUnit major is actually loaded (9.6, 10, 11, 12). The structured result lines the host parses (TESTS: … FAILURES: … ERRORS: …, ALL TESTS PASSED / SOME TESTS FAILED, stage markers) and the existing filter, selected-file, changed-file and listTests behavior stay the same on every major. PHPUnit 9 behavior is unchanged.

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

Activity

  1. chubes4 commented on Dec 2, 2026

    @chubes4
    CollaboratorAuthor

    Fixed by #2620.

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