Skip to content

getDefaultVfs() defined 3× with divergent structures — consolidate #36

Description

@remyperona

Summary

getDefaultVfs() is defined three times inside the package with divergent structures, and the precedence between them is confusing.

Where

  • VirtualFilesystemTestTrait.php — returns a wp-admin / wp-content / wp-includes / wp-config.php tree.
  • Integration/VirtualFilesystemTestCase.php — overrides it with a Tests/{Integration,Unit} tree.
  • Unit/VirtualFilesystemTestCase.php — overrides it with the same Tests/{Integration,Unit} tree.

Impact

  • The trait's default is effectively dead: both test cases (which use the trait) override it.
  • The two test-case copies are identical to each other — copy/paste duplication.
  • Consumers (e.g. WP Rocket) override getDefaultVfs() yet again, so it is unclear which layer is authoritative.

Proposed direction

Pick one source of truth. Options:

  • Keep a single default in the trait and remove the two identical test-case overrides, or
  • If Unit and Integration genuinely need the same Tests/... default, hoist it once and drop the trait's unused WP-shaped default.

Either way, document that getDefaultVfs() is the intended single override point for consumers.


Found during an audit of WP Rocket's integration test suite, which depends on this package.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions