puntodev/mercadopago-fake
A Laravel/PHP package for faking Mercado Pago in tests. Simulate preferences, payments, webhooks, and API responses without real credentials or network calls, enabling fast, deterministic feature tests and safe local development.
Package role. puntodev/mercadopago-fake is a test-double for the puntodev/mercadopago SDK: it substitutes the MercadoPago HTTP client so integration code can be exercised in CI without hitting the live payments API. Blast radius is confined to the test suite and local development — it should never appear in a production dependency graph. That framing should govern how much rigor the upgrade decision deserves relative to other platform work.
Architecture fit. The package sits cleanly in the Laravel testing layer — a service-container binding / facade swap registered from a service provider, with fixture-driven responses. It does not impose architectural constraints on application code beyond "your MercadoPago interactions go through the SDK." Fit is good where teams already inject the SDK rather than calling HTTP directly; teams with hand-rolled Guzzle calls to MercadoPago endpoints get no benefit.
Breaking changes in 2.0.0. Two hard constraints, both version gates rather than API changes:
puntodev/mercadopago ^8.0 required — the fake is now version-locked to the SDK major, so SDK and fake must upgrade together.Integration feasibility. Mechanically trivial (composer require --dev), but gated by platform readiness. The realistic blocker is not this package — it is whether the PHP runtime in CI, local dev containers, and any staging-like environments can move to 8.5, and whether the application can absorb mercadopago ^8.0 at the same time. Because the fake tracks the SDK's contract, upgrading one without the other is not a supported state.
Technical risk.
mercadopago ^8.0 almost certainly changed request/response shapes or client construction. Fake responses that were accurate for 7.x may be silently wrong for 8.x if fixtures were not regenerated.Key questions.
mercadopago 8.0's actual request/response contracts, or did only the version constraint change?mercadopago ^8.0 itself require PHP 8.5, or is that constraint specific to the fake? (Determines whether this is one decision or two.)Stack fit. Dev-only Composer dependency, installed with --dev, excluded from production autoload. In Laravel it registers a provider that binds a fake client into the container; in PHPUnit/Pest it is typically activated per-test or per-suite. No runtime footprint in deployed artifacts, no queue, cache, or storage implications.
Compatibility matrix to pin.
| Our PHP | mercadopago |
mercadopago-fake |
Action |
|---|---|---|---|
| 8.5 | ^8.0 | ^2.0 | Target state |
| 8.5 | 7.x | ^2.0 | Not supported — must move SDK |
| 8.3 / 8.4 | 7.x | 1.0.2 | Frozen; no upgrade path until PHP moves |
Record this matrix in the repo README so the constraint is discoverable rather than rediscovered during a failed composer update.
Migration path. Treat as a three-step platform change, not a package bump:
puntodev/mercadopago to ^8.0 and fix real integration-code breakage — this is application work with actual production relevance and deserves its own PR and review.Sequencing and safety. Do steps 1–3 on a branch, not incrementally on main. Keep 1.0.2 available as a rollback by pinning explicitly ("puntodev/mercadopago-fake": "1.0.2") rather than allowing a floating constraint. Do not allow * or unbounded constraints on either the SDK or the fake — they are now a matched pair. If the team cannot reach PHP 8.5 within the current planning horizon, the correct decision is to stay on 1.0.2 deliberately and note the support-window risk, not to force the runtime upgrade for a test dependency.
Where to start. Do a spike in a throwaway branch: PHP 8.5 image + SDK ^8.0 + fake ^2.0, run the MercadoPago test suite, and count how many tests fail because fixtures changed versus because application code changed. That number sizes the whole effort.
Maintenance. Low ongoing effort — the package is a dev dependency with no deploy-time surface. The recurring cost is dependency hygiene: the project uses a weekly grouped Dependabot PR cadence with majors excluded, so the 2.0.0 bump will not arrive automatically. Someone must own the deliberate major upgrade, and that owner needs to be identified now or the pin silently ages.
Support. Community open source, single visible maintainer, no SLA, no vendor escalation path. Acceptable given the blast radius is limited to test reliability. Mitigation: keep the pin explicit and keep a known-good version recorded so a broken upstream release cannot disrupt CI mid-sprint.
Scaling. No production scaling dimension. The relevant scale question is CI matrix size: if the team runs parallel test jobs across multiple PHP versions, the fake must be version-constrained per matrix cell (1.0.2 for ≤8.4 legs, 2.0.0 for 8.5 legs) or the matrix legs must be collapsed to a single PHP version. Collapsing is simpler and is the recommended target state.
Failure modes to monitor.
Ramp-up. Low for engineers — the API surface is small and the usage pattern (bind a fake, assert on SDK calls) is familiar Laravel testing idiom. The real ramp-up cost is organizational: someone must understand the three-way version coupling (PHP × SDK × fake) well enough to make the pin decision and to recognize that a failing MercadoPago test after an SDK bump might mean the fake is stale, not that the code is wrong. Budget a short write-up in the repo capturing the compatibility matrix, the upgrade sequence, and the rollback pin; that document is what prevents the next engineer from attempting a partial upgrade.
How can I help you explore Laravel packages today?