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.
Summary
getDefaultVfs()is defined three times inside the package with divergent structures, and the precedence between them is confusing.Where
VirtualFilesystemTestTrait.php— returns awp-admin/wp-content/wp-includes/wp-config.phptree.Integration/VirtualFilesystemTestCase.php— overrides it with aTests/{Integration,Unit}tree.Unit/VirtualFilesystemTestCase.php— overrides it with the sameTests/{Integration,Unit}tree.Impact
usethe trait) override it.getDefaultVfs()yet again, so it is unclear which layer is authoritative.Proposed direction
Pick one source of truth. Options:
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.