- What is richcongress/unit-bundle used for?
- It is a Symfony/PHPUnit testing helper bundle that provides a ready-to-use base test case, dependency mocking, service isolation, and test lifecycle helpers. It is intended for fast, deterministic unit tests without booting the full application container. The 1.0.x line also adds command test cases and fixture helpers for common testing boilerplate.
- How do I install richcongress/unit-bundle?
- Install it as a development dependency with Composer, typically using composer require --dev richcongress/unit-bundle. Because the 1.0.2 patch added features, the assessment recommends pinning an exact version such as 1.0.2 in CI instead of relying on a caret range. It is a test-only dependency and is not expected to have a production runtime footprint.
- Does richcongress/unit-bundle work with Laravel?
- The package overview describes a Symfony bundle, while the technical assessment evaluates Laravel-style testing utilities and discusses Laravel 10/11 on PHP 8.2+ as a stack-fit condition. Treat Laravel compatibility as unconfirmed until you verify the base test case, container annotations, and fixture helpers against your Laravel suite. If your tests use Pest, confirm that the CommandTestCase inheritance model composes with Pest expectations.
- Which PHP, Symfony, Laravel, and PHPUnit versions are supported?
- The provided notes do not publish a formal support matrix. The assessment recommends confirming the supported PHP, Symfony or Laravel, and PHPUnit versions with the maintainer before adoption. The Laravel 10/11 and PHP 8.2+ mention is a suitability condition from the assessment, not a guaranteed support statement.
- How does dependency mocking work in UnitBundle tests?
- The bundle provides helpers for replacing dependencies with mocks and isolating services so tests do not need the full container. The 1.0.2 release fixed an issue where services were not mocked during fixture loading, which shows that container resolution order matters. Validate mock lifecycle behavior if your fixture graph resolves services through the container.
- What is the buildObject helper used for?
- buildObject is a test helper for constructing objects in unit tests, and the assessment lists it among the useful testing surface changed in the 1.0.2 patch. Because it changed recently, pilot it on one new or low-traffic test suite before standardizing on it. Ask the maintainer whether buildObject is now considered stable public API.
- Can I use UnitBundle with Pest instead of PHPUnit?
- The bundle is described as PHPUnit-friendly with base test cases and lifecycle helpers. The assessment warns that if your suite is Pest-based, you should confirm the CommandTestCase inheritance model composes with Pest's expectation API before committing. The provided notes do not make an explicit Pest support claim.
- Does UnitBundle support database tests with SQLite, MySQL, or Postgres?
- The assessment flags ConnectionFactory as the component that reaches into database connection configuration, so verify it against your SQLite and MySQL test setups. It also warns that a userland DATE_FORMAT polyfill for SQLite can diverge from MySQL behavior and create silent correctness hazards. If you run Postgres-only or rely on in-memory SQLite, test that polyfill carefully or avoid depending on it.
- How do I test Symfony console commands with this bundle?
- The 1.0.2 line includes CommandTestCase and AbstractCommand support aimed at console-command tests. The assessment recommends piloting CommandTestCase on console-command tests only, where it delivers the clearest win and where real bugs were fixed. Confirm command bootstrapping and version compatibility before retrofitting existing suites.
- How stable is the 1.0.x release, and what alternatives should I compare?
- It is a test-only dependency, so production runtime risk is low, but the 1.0.x line is still settling: four features shipped in a patch release and mock lifecycle semantics were recently fixed. Pin the exact version in CI, pilot the changed helpers, and ask about maintainer roster and container-annotation test coverage before broad adoption. Alternatives to compare include Symfony KernelTestCase, PHPUnit native mocks, and Laravel's built-in testing helpers.