Skip to content

Support PHPUnit versions with private TestSuite constructors #1926

Description

@chubes4

Problem

The generated wordpress.phpunit workload directly instantiates PHPUnit\Framework\TestSuite. PHPUnit versions where TestSuite::__construct() is private crash during load_tests before any component tests execute.

Reproduction

A Homeboy release test for Data Machine Events using WP Codebox 0.12.14:

STAGE_FATAL:load_tests:Uncaught Error: Call to private PHPUnit\Framework\TestSuite::__construct() from global scope in /internal/eval.php:1096

The runtime successfully installs WordPress, activates dependencies, and discovers 46 test files. The failure is in generated WP Codebox harness code. Current origin/main still directly constructs TestSuite in both plugin and core harness generators.

Downstream tracking: Extra-Chill/homeboy-extensions#2258.

Expected

Construct suites through a PHPUnit-version-compatible public API so discovered tests reach execution across supported old and new PHPUnit versions.

Acceptance criteria

  • Replace direct TestSuite construction in every generated PHPUnit harness path.
  • Preserve compatibility with supported older PHPUnit versions.
  • Add regression coverage for a PHPUnit version with a private constructor.
  • Preserve stage-specific infrastructure failure reporting.
  • Verify discovered *Test.php files reach execution.

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