Skip to content

wordpress.phpunit discovery returns relative file paths when phpunit-xml is relative #2601

Done

Description

@chubes4

Problem

When wordpress.phpunit discovery-only=true gets a relative phpunit-xml (here, phpunit-managed.xml.dist from a component's wp_codebox_phpunit_suites), the wp-codebox/phpunit-discovery/v1 result echoes phpunit_xml back as given and returns relative file paths. Meanwhile test_root is absolute:

{"schema":"wp-codebox/phpunit-discovery/v1","plugin_slug":"extrachill-events",
 "phpunit_xml":"phpunit-managed.xml.dist",
 "test_root":"/wordpress/wp-content/plugins/extrachill-events/tests",
 "files":["./tests/Unit/Abilities/CanonicalAdapterContractsTest.php", ...]}

With the default config (phpunitXml defaults to /wordpress/wp-content/plugins/<slug>/phpunit.xml.dist, in wordpress-command-runners.ts:979), the same call returns absolute /wordpress/... paths. The output shape therefore depends on how the caller spelled the config path.

Impact

Homeboy's WordPress adapter (readDiscoveryResult in wp-codebox-phpunit-adapter.mjs) requires every file to start with /. For any component with a relative managed-suite config, it rejects the result with "WP Codebox returned an invalid PHPUnit discovery result." As a result, every homeboy review test for extrachill-events reports test_runtime_evidence.reason: internal runtime inventory producer failed (exit 1), and the runtime inventory is never produced. Execution itself is unaffected, because cwd is the plugin root, so this has gone unnoticed. Reproduced on homeboy-lab with WP Codebox v0.34.2 and the wordpress extension 3.56.7.

Target state

  • Resolve a relative phpunitXml against the plugin root once, when the runner options are built, so discovery, execution and posix.dirname(options.phpunitXml) all see one canonical absolute path.
  • Discovery files and phpunit_xml must be absolute sandbox paths, whatever the caller's spelling.
  • Add a regression test: discovery with phpunit-xml=phpunit-managed.xml.dist (relative) returns the same absolute file list as the absolute spelling.

Activity

  1. chubes4 commented on Nov 27, 2026

    @chubes4
    CollaboratorAuthor

    Fixed by #2602.

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