- What is richcongress/web-test-bundle and what does it actually do?
- Web Test Bundle is a small testing helper package that wraps common functional test concerns into reusable utilities. It provides ready-made HTTP client and request helpers, convenience response assertions for status codes, headers, and content, plus simple fixture and test-data integration. It is designed to sit alongside PHPUnit and standard testing tools, keeping test suites consistent and readable. It is released as a Symfony bundle, so Laravel teams should verify Composer constraints and discovery behaviour before adopting it.
- How do I install richcongress/web-test-bundle with Composer?
- Install it with Composer using the package name richcongress/web-test-bundle, pinning the exact version you have reviewed, for example composer require richcongress/web-test-bundle:0.1.4. Pin an exact version rather than floating a caret constraint, because the package is still pre-1.0. After installation, check the vendor directory and composer.json to confirm the namespace, autoload rules, and whether any service provider or bundle registration is required.
- Does this package support Laravel, and which Laravel and PHP versions are supported?
- The package is published as a Symfony bundle rather than a native Laravel package, so Laravel support depends on its Composer constraints and autoloading rather than documented Laravel integration. Check the require and require-dev blocks in its composer.json against your application's PHP and framework versions before installing. Run composer why-not or a dry-run install to surface conflicts early. If no Laravel service provider is registered, you can still use the classes directly, but confirm the supported PHP range first.
- What changed in Web Test Bundle version 0.1.4?
- Version 0.1.4 is a narrow patch release that corrects the return type of getJsonContent. It adds no new features and introduces no deprecations, but it does change a type contract. Because of that, treat it as a contract-correctness patch: low feature risk, but potentially compatibility-sensitive for existing callers.
- Is the getJsonContent return type change in 0.1.4 backward compatible?
- That depends on whether the change is a native PHP return type, a PHPDoc or static-analysis annotation, or both. A native return type change can raise TypeError or break static analysis for callers that relied on the previous loose or mixed behaviour. A docblock-only correction is effectively zero runtime risk. Review the tagged diff for v0.1.4 and run PHPStan or Psalm over your code before upgrading.
- How do I write authenticated requests or impersonate a user in functional tests?
- The bundle's stated purpose is to extend the standard web test case with helpers for authenticated requests and user impersonation, removing boilerplate from end-to-end tests. In practice you use the provided client and request helpers to attach credentials or act as a specific user before asserting on the response. Wrap those calls in your own base test case so the exact helper signatures stay isolated to one place. Validate behaviour against your application's real authentication flow rather than assuming parity with Laravel's actingAs helpers.
- What does getJsonContent return for empty, malformed, or non-JSON response bodies?
- The provided release information does not document the edge-case behaviour of getJsonContent, so you must verify it yourself. Test against a valid JSON body, an empty body, a malformed JSON string, a non-JSON payload such as HTML, and an HTTP error response. Write these cases as contract tests and record the actual return values and any thrown exceptions. Do not assume a consistent null return across error paths until you have observed it.
- Is it safe to use this package in production code, or should it stay behind an adapter?
- At v0.1.x the API is not guaranteed to be stable, so avoid making it a core architectural dependency. Keep it as a small leaf dependency and wrap it in an internal gateway class so application code depends on a local interface rather than the package API directly. That boundary preserves an exit path if the package stalls or introduces a breaking change. Add contract tests for expected return values and error cases before allowing production use, and pilot it in a non-production service first.
- How is richcongress/web-test-bundle maintained and what is its long-term support outlook?
- It is a pre-1.0 package with a low code footprint and no published long-term support commitment, and maintainer responsiveness is not established. Assign an internal owner, pin exact versions, and review patch releases manually instead of floating constraints. Because the fallback is straightforward, document a native implementation of the same JSON handling using plain PHP or your framework's built-in helpers so you can drop the dependency if needed.
- What are the alternatives to Web Test Bundle for Laravel functional tests?
- Laravel already ships HTTP testing helpers such as getJson, assertJson, assertStatus, and actingAs, along with database traits like RefreshDatabase for fixtures. Those cover most of the same ground without adding a dependency, so benchmark the bundle against them before adopting it. If your team also runs Symfony applications, the bundle may offer consistency across both stacks. Choose it for ergonomics and cross-framework uniformity, not because Laravel lacks the underlying capability.