Skip to content

Run tests for packages whose PHP source uses autoload.files #377

Closed

Description

@coisa

Problem

A PHP function-only package with Composer autoload.files and a real tests directory is classified as having no PHP source. dev-tools tests therefore returns success without executing PHPUnit, and reporting can skip coverage.

Evidence

At 35d27ee20066fd9e234d228bb866102c64c7ef1a, ProjectCapabilitiesResolver.php:43 lists only psr-4, psr-0, and classmap. resolveHasPhpSourceFiles never reads autoload.files. TestsCommand:198–206 returns success for that result before enqueuing PHPUnit.

Reproduction

Use a disposable project containing functions.php, tests/, and {"autoload":{"files":["functions.php"]}}, without a class autoload map. Calling the unmodified capability resolver returns hasTests=true, hasPhpSource=false, canRunTests=false.

The resolver result was reproduced with PHP 8.4.26 and minimal metadata/filesystem doubles against real temporary files. The command's successful-skip branch is statically verified; a full Composer/PHPUnit integration execution has not been performed in this audit.

Expected behavior

Function-only PHP packages are testable PHP projects. Their tests must run and failures must propagate; truly empty/guide-only repositories must retain their intentional skip behavior. API documentation discovery and testability need not share the same set of autoload types.

Acceptance criteria

  • Detect existing PHP source declared in autoload.files when determining testability.
  • A failing test in a files-only fixture makes dev-tools tests fail instead of silently succeeding.
  • Coverage/report orchestration recognizes the same testable fixture.
  • Preserve guide-only/empty project behavior and existing PSR/classmap detection.
  • Add focused resolver tests and an isolated command/consumer regression.

Architectural / isolation criteria

Keep source-surface detection in the dedicated project-capability service; commands remain orchestrators. Separate API-documentation requirements from testability rather than forcing function files into an unrelated namespace model. Keep filesystem and metadata boundaries injectable.

Related work and scope

Follow-up to closed #325/#326 and #344/#345, not a duplicate of their guide-only scope. #366 intentionally keeps files-only Wiki API skips; this report is about PHPUnit/testability. Open #376 was checked through all 249 changed files and only adds formatting in the affected resolver/command; it does not fix this behavior. No extraction/architecture redesign, code changes, merge, or release is requested.

Priority: high (false-green verification); confidence: high. Labels, milestone, assignee and project omitted because matching assignment metadata was not established; issue-type/project writes are unavailable through the connector.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions