WooCommerce Integration Contract Test Kit
PHP · CONTRACT TESTING
Extracted from the Resilient WooCommerce system so the testing tools outlive the project that needed them. Integrators get deterministic doubles instead of hitting a live payment or shipping provider from a test suite.
- Maintainer
- Pixy Puala
- Vertical
- Integration testing · WooCommerce
- Year
- 2026
- Role
- Open source
- Stack
- PHP
- Status
- ● Public repo
- Verified
- Source on GitHub
Problem
Integration tests that call real providers are slow, flaky and occasionally expensive. Teams respond by not testing the retry and replay paths at all — which are precisely the paths that fail in production and duplicate a customer's payment.
Constraints
Decisions
Cassettes match on a canonical request signature
HttpDouble records and replays request/response pairs keyed by a canonical signature, so replay is deterministic rather than order-dependent.
Reproduce WooCommerce's exact signature scheme
Constant-time HMAC-SHA256 verification matching Woo's real scheme — a test double that verifies differently from production is worse than none.
Prove the assertion by failing it
A worked example test demonstrates the idempotency assertion failing against a deliberately non-idempotent handler. An assertion nobody has seen fail is not known to work.
Build
Stack
- ▸ PHP · Composer
- ▸ PHPUnit traits · AssertsHttpInteractions · AssertsWebhookContracts
- ▸ HttpDouble · record/replay cassettes
- ▸ WebhookSignature · constant-time HMAC-SHA256
- ▸ Worked negative-test example
Tooling
- ✓ kept Composer · PHPUnit · GitHub Actions
Results · Measured
The kit is exercised entirely offline; the negative example in WebhookContractExampleTest.php is the evidence that the idempotency assertion has teeth.
Tradeoffs
The kit deliberately stops short of wiring against a real WooCommerce install or payment provider — that belongs to the consuming project, and baking it in would make the primitives less reusable, not more.