Skip to content

Remove WP Rocket coupling (rocket_get_constant) from the generic package #35

Description

@remyperona

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.phpgetApiCredential() 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions