Contract tests against the provider’s own document

A mock is your belief about the provider, and a contract test compares that belief with their published schema.

// nightly, against the sandbox
$spec = (new ValidatorBuilder())
    ->fromJsonFile('specs/provider-openapi.json')
    ->getResponseValidator();

$response = $this->client->get('/v2/charges/ch_test');

$spec->validate($operation, $psrResponse);
// fails when THEY change something, before it reaches you

Running it on a schedule rather than on every push is the right cadence, because the thing it detects is their change and not yours. The failure is informational — it means the fixtures need re-recording and the client may need updating — so it belongs in a channel rather than blocking a deploy. It only works if the provider publishes a machine-readable specification, which in 2021 many still do not.