Skip to content

Deduplicate embedded PHP templates in PHPUnit command handlers #770

@chubes4

Description

@chubes4

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions