Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message
Phpunit Bridge

Phpunit Bridge Laravel Package

symfony/phpunit-bridge

Symfony PHPUnit Bridge adds utilities around PHPUnit, with a focus on managing and asserting deprecation notices for smoother upgrades. It helps track, filter, and report deprecations during test runs, making CI output cleaner and migrations safer.

View on GitHub
Deep Wiki
Context7

Symfony PHPUnit Bridge adds practical tooling around PHPUnit to make your test suite more reliable and forward-compatible. It focuses on managing deprecations during tests, helping you spot outdated APIs early and keep upgrades smooth.

Designed for Symfony-based projects (but usable elsewhere), it provides utilities that integrate cleanly into CI and local workflows so you can enforce strict quality gates without noise.

  • Deprecation handling: collect, filter, and fail tests on deprecations
  • Improved test diagnostics for cleaner feedback in failing builds
  • Compatibility helpers to smooth PHPUnit/Symfony version differences
  • CI-friendly configuration for consistent results across environments
Frequently asked questions about Phpunit Bridge
Can I use Symfony’s PHPUnit Bridge in Laravel to catch deprecation warnings from third-party packages?
Yes, the bridge provides tools like `ExpectUserDeprecationMessageTrait` to explicitly test for deprecation notices, which is especially useful for Laravel projects relying on Symfony-based or legacy packages. It helps surface issues early during CI runs before they break production.
How do I install this package in a Laravel project?
Run `composer require symfony/phpunit-bridge` in your project root. No additional Laravel-specific configuration is needed—it integrates directly with PHPUnit’s existing test suite. Just ensure your `phpunit.xml` points to PHPUnit 9.x or 10.x.
Will this package work with Laravel’s built-in TestCase class?
Absolutely. The bridge is designed to extend PHPUnit’s core functionality, so it works seamlessly with Laravel’s `TestCase` (which inherits from PHPUnit’s `TestCase`). No changes to your test classes are required unless you want to use its deprecation-specific traits.
Does Symfony PHPUnit Bridge support Laravel’s ClockMock or DnsMock utilities?
Yes, the bridge is compatible with Laravel’s mocking utilities like `ClockMock` and `DnsMock`, especially in PHPUnit 10+. These tools are part of PHPUnit’s broader ecosystem, which the bridge enhances without conflicts.
How does this package handle deprecation notices in CI/CD pipelines?
The bridge allows you to configure deprecation notices as test failures in CI by leveraging PHPUnit’s assertion system. You can set strictness levels (e.g., fail on warnings) and generate reports, making it ideal for enforcing compatibility during automated testing.
Is there a performance impact from using this package in Laravel tests?
The bridge adds minimal overhead, primarily from deprecation capture logic. For most projects, the impact is negligible, but if you’re running performance-critical test suites, benchmark your tests before and after integration to confirm.
What PHPUnit versions does this package support, and does it work with Laravel 9/10?
The bridge supports PHPUnit 9.x and 10.x, which aligns perfectly with Laravel 9+ (PHPUnit 9) and Laravel 10+ (PHPUnit 10). Ensure your `composer.json` specifies a compatible PHPUnit version to avoid conflicts.
Can I use this package to test deprecations in PestPHP instead of PHPUnit?
While the bridge is designed for PHPUnit, PestPHP (which builds on PHPUnit) can indirectly benefit from its deprecation utilities. However, Pest’s native helpers may suffice for simpler cases. For granular control, stick with PHPUnit’s bridge.
How do I configure the bridge to ignore specific deprecation notices?
Use PHPUnit’s built-in configuration or the bridge’s traits to exclude known safe deprecations. For example, you can extend `ExpectUserDeprecationMessageTrait` and override methods to filter out specific messages. Document these exclusions in your CI pipeline.
Are there any known conflicts with Laravel’s RefreshDatabase trait or other testing utilities?
The bridge is modular and shouldn’t conflict with Laravel’s testing utilities like `RefreshDatabase`. However, if your tests heavily mock PHPUnit internals (e.g., ReflectionClass), there’s a rare risk of edge cases. Test thoroughly in a staging environment before full adoption.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
davejamesmiller/laravel-breadcrumbs
artisanry/parsedown
christhompsontldr/phpsdk
enqueue/dsn
bunny/bunny
enqueue/test
enqueue/null
enqueue/amqp-tools
milesj/emojibase
bower-asset/punycode
bower-asset/inputmask
bower-asset/jquery
bower-asset/yii2-pjax
laravel/nova
spatie/laravel-mailcoach
spatie/laravel-superseeder
laravel/liferaft
nst/json-test-suite
danielmiessler/sec-lists
jackalope/jackalope-transport