speicher210/functional-test-bundle
Symfony bundle for functional REST endpoint tests: sets up test databases, loads Doctrine fixtures, mocks even private DI services, and validates responses via JSON snapshots using php-matcher, with optional automatic expected-file updates.
--dev only), so the real cost is coupling, not license.assertRestGetPath() / assertRestRequestReturns404() style helpers make it low-friction to add regression coverage per endpoint, which supports a decision like "freeze the public API contract with snapshot tests before a refactor" or "gate a v2 API behind full endpoint coverage."Adopt (or rather, pilot) when all of these hold:
config/bundles.php and bootstraps against a Symfony Kernel. It will not work in a Laravel app without a Symfony kernel present — treat framework mismatch as disqualifying.require .../src/Test/bootstrap.php exposing $kernel).dev/test-only — i.e., contained blast radius. A breakage blocks CI, not production.Look elsewhere when:
$this->getJson() / assertJsonStructure() helpers, Http::fake(), and RefreshDatabase. Nothing here transfers.spatie/phpunit-snapshot-assertions is framework-agnostic, orders of magnitude more adopted, and better maintained. Pair it with Symfony's own WebTestCase and you replicate most of this bundle's value with far less bus-factor risk.doctrine/doctrine-fixtures-bundle or zenstruck/foundry for object factories; this bundle's fixture loading is thin by comparison.For executives (one paragraph): This is a small, free, MIT-licensed developer tool that makes it cheaper to write automated tests for our REST APIs — specifically, it catches unintended changes to API responses before they ship. The cost is effectively zero in licence terms and it is installed only in test environments, so it cannot affect production. The caveat is that it is a niche, single-maintainer Symfony component with almost no community adoption, so we should treat it as a pilot: adopt it behind our existing test suite, keep it isolated, and be ready to fork or replace it. It is an engineering-efficiency line item, not a product bet.
For engineering (one paragraph): Symfony bundle providing RestControllerWebTestCase as a PHPUnit base class. Value props: (1) boilerplate-free kernel bootstrap via a requires-able Test/bootstrap.php, (2) DB setup + fixture loading hooks, (3) DI service mocking including private services — the differentiating capability, (4) snapshot-based response assertions so assertRestGetPath('/api/user/1') asserts the whole payload in one line. Requirements: PHPUnit, Symfony kernel, --dev install, bundle enabled in dev/test. Risks: PHPUnit/Symfony version drift, undocumented snapshot-update workflow, one maintainer. Mitigation: wrap our own thin base class over it so our tests depend on our API, not theirs; that makes a swap to WebTestCase + spatie/phpunit-snapshot-assertions a contained refactor. Success metric: time-to-add a regression test per endpoint, and count of API contract regressions caught pre-release.
How can I help you explore Laravel packages today?