Summary
The package describes itself as a generic "PHPUnit extender for bootstrapping unit and WordPress integration test suites", but it hard-codes a dependency on WP Rocket's rocket_get_constant() / rocket_has_constant() helpers. Any other plugin adopting the package inherits a rocket_-prefixed coupling.
Where
Integration/ApiTrait.php — getApiCredential() returns rocket_get_constant( $name, '' ).
Fixtures/polyfills.php — polyfills both rocket_get_constant() and rocket_has_constant().
Impact
Proposed direction
- In
ApiTrait, replace the rocket_get_constant() call with a neutral accessor — inline defined()/constant(), or an injectable resolver callable that consumers can override.
- Move the
rocket_* polyfills out of the generic package and into WP Rocket's own test suite (or gate them behind a clearly WP-Rocket-specific shim).
Keeps the package generic while letting WP Rocket keep its convenience helpers on its side.
Found during an audit of WP Rocket's integration test suite, which depends on this package.
Summary
The package describes itself as a generic "PHPUnit extender for bootstrapping unit and WordPress integration test suites", but it hard-codes a dependency on WP Rocket's
rocket_get_constant()/rocket_has_constant()helpers. Any other plugin adopting the package inherits arocket_-prefixed coupling.Where
Integration/ApiTrait.php—getApiCredential()returnsrocket_get_constant( $name, '' ).Fixtures/polyfills.php— polyfills bothrocket_get_constant()androcket_has_constant().Impact
rocket_-named functions or rely on the polyfill — a leaky abstraction for a library meant to be plugin-agnostic (cf. Improve the library to include classes that could be common to all plugins. #30, "classes that could be common to all plugins").Proposed direction
ApiTrait, replace therocket_get_constant()call with a neutral accessor — inlinedefined()/constant(), or an injectable resolver callable that consumers can override.rocket_*polyfills out of the generic package and into WP Rocket's own test suite (or gate them behind a clearly WP-Rocket-specific shim).Keeps the package generic while letting WP Rocket keep its convenience helpers on its side.
Found during an audit of WP Rocket's integration test suite, which depends on this package.