§ 04.32 — Pixy Puala · Integration testing · WooCommerce · 2026

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
§ 04.32.B

Problem

What was broken

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.

§ 04.32.C

Constraints

Boundaries · published
01 Engagement Open source · authored and maintained
02 Stack PHP · Composer · PHPUnit traits
03 Scope Test primitives · provider-neutral
04 Audience WooCommerce extension and integration devs
§ 04.32.D

Decisions

Three · defended
Decision · 01

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.

Decision · 02

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.

Decision · 03

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.

§ 04.32.E

Build

Stack · tooling · what it runs on

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
§ 04.32.F

Results · Measured

Countable facts · from the repository
Tests
16 passing
doubles · signatures · traits
Negative test
1 proven
assertion fails as designed
Network calls
0 required
fully offline

The kit is exercised entirely offline; the negative example in WebhookContractExampleTest.php is the evidence that the idempotency assertion has teeth.

§ 04.32.G

Tradeoffs

What was not fixed

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.

Want this shape in your stack? The code is public. The judgement is the service.

Read the source → Start a project