- What is speicher210/functional-test-bundle used for?
- It is a Symfony bundle for functional testing of REST endpoints. It provides a base test case that helps set up a test database, load Doctrine fixtures, mock Symfony DI services including private ones, and assert responses against JSON snapshots using coduo/php-matcher. It is intended for Symfony applications with PHPUnit-based endpoint tests, not for Laravel.
- Does speicher210/functional-test-bundle work with Laravel?
- No. This is a Symfony bundle that hooks into the Symfony Kernel lifecycle, config/bundles.php, and the Symfony DI container. It has no Laravel service provider, package auto-discovery, Artisan surface, or Laravel HTTP test integration. For Laravel, use Laravel's getJson and assertJson helpers plus a snapshot assertion library instead.
- Which Laravel versions does speicher210/functional-test-bundle support?
- None. The package is not a Laravel package and does not claim Laravel version support. Treat any attempt to install or register it in a Laravel app as an architecture mismatch, not a configuration problem. The equivalent Laravel capability is already covered by Laravel's built-in HTTP testing helpers and a separate snapshot library.
- How do I install speicher210/functional-test-bundle in a Symfony app?
- Install it as a dev dependency with composer require --dev speicher210/functional-test-bundle. Register Speicher210FunctionalTestBundle in config/bundles.php for dev and test only. Then require the bundle's src/Test/bootstrap.php from your PHPUnit bootstrap after your application bootstrap so the booted $kernel is available.
- How do I configure the PHPUnit bootstrap and base test class?
- Add the bundle bootstrap require after your app's config/bootstrap.php in the PHPUnit bootstrap file. Extend Speicher210FunctionalTestBundleTestRestControllerWebTestCase in your endpoint tests. You can then use helpers such as assertRestGetPath and assertRestRequestReturns404, with assertions driven by expected JSON snapshot files.
- How do JSON snapshot expected files work?
- By default the bundle looks in an Expected directory next to the test class for a file named after the test and suffixed with -1.json. The suffix increments for each REST assertion in the same test. Expected files can use coduo/php-matcher patterns such as @string@ and @[email protected](), and the optional RestRequestFailTestExpectedOutputFileUpdater extension can update expected files during test runs. Verify whether a strict fail-on-missing-snapshot mode exists before relying on it.
- Does it set up a test database and load Doctrine fixtures?
- Yes, the bundle is designed to help set up a test database and load fixtures using Doctrine fixtures. By default it looks for fixtures in a Fixtures directory relative to the test. The exact persistence assumptions, such as Doctrine ORM versus DBAL, should be verified against the package constraints and your CI database provisioning strategy.
- Can the bundle mock private Symfony DI services?
- Yes, it advertises mocking services in DI, including private services. That capability depends on manipulating Symfony's compiled container internals, which is an area that can change across Symfony major versions. Validate it against your exact Symfony version and cache warmup behavior before adopting it broadly.
- What are the production and CI concerns for this bundle?
- It is a dev and test dependency, not production runtime code, so keep it out of production registration. Snapshot assertions are golden-file tests and are brittle by construction, and the bundle assumes a disposable test database. Parallel test safety and PHPUnit major-version support are not stated in the excerpt, so verify per-test database isolation before enabling parallel CI runs.
- What are alternatives to this bundle and is it actively maintained?
- For Laravel, the practical alternative is Laravel's getJson and assertJson helpers plus a snapshot library, with no foreign Symfony container dependency. For Symfony, combine native WebTestCase patterns with a snapshot assertion library if you do not need this bundle's fixture and private-service helpers. Maintenance signals are weak: 5 stars, 0 dependents, single-source maintenance, and a release date that should be verified on Packagist and repository tags. Treat it as a narrow, higher-risk Symfony-only dependency and pilot it before wider adoption.