Problem
Plugin and core PHPUnit command handlers duplicate large embedded PHP runtime templates.
Evidence from the investigation:
- Plugin PHPUnit template starts in
packages/runtime-playground/src/phpunit-command-handlers.ts:44.
- Core PHPUnit template starts in
packages/runtime-playground/src/phpunit-command-handlers.ts:952.
- Duplicated concepts include diagnostics logging/stage handling, PHPUnit config parsing/discovery, changed-test filtering, and PHPUnit arg parsing.
Why It Matters
Fixes to diagnostics, discovery, filtering, and runner args must be copied into multiple embedded PHP strings. That increases the chance of plugin/core behavior drifting.
Suggested Refactor
Generate plugin/core templates from shared PHP fragments:
- diagnostics/stage logging
- PHPUnit config discovery
- changed-test filtering
- PHPUnit arg normalization
Keep plugin/core-specific boot and install behavior separate.
Acceptance Criteria
- Shared PHPUnit PHP behavior has one source.
- Plugin and core PHPUnit smoke checks continue to pass.
- Template generation remains readable and reviewable.
Problem
Plugin and core PHPUnit command handlers duplicate large embedded PHP runtime templates.
Evidence from the investigation:
packages/runtime-playground/src/phpunit-command-handlers.ts:44.packages/runtime-playground/src/phpunit-command-handlers.ts:952.Why It Matters
Fixes to diagnostics, discovery, filtering, and runner args must be copied into multiple embedded PHP strings. That increases the chance of plugin/core behavior drifting.
Suggested Refactor
Generate plugin/core templates from shared PHP fragments:
Keep plugin/core-specific boot and install behavior separate.
Acceptance Criteria