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.
ClockMock) while maintaining backward compatibility. Reduces friction during test suite upgrades, especially for teams migrating from older PHPUnit versions (e.g., 9.x → 10.x).ExpectUserDeprecationMessageTrait to simplify testing deprecation scenarios, reducing boilerplate and accelerating test development. Lowers the barrier to writing comprehensive test coverage for deprecated features.ClockMock for time-sensitive tests.Adopt when:
ClockMock, DnsMock, or ExpectUserDeprecationMessageTrait.Avoid when:
For Executives: *"The Symfony PHPUnit Bridge is a strategic investment to future-proof our codebase by automating deprecation detection—a critical but often overlooked part of software maintenance. Here’s why it’s a no-brainer:
ClockMock for time-sensitive tests.Ask: Do we want to find and fix deprecations manually (slow, error-prone) or automate it (fast, reliable)? This tool lets us focus on innovation, not cleanup."*
Key Outcomes:
ExpectUserDeprecationMessageTrait, reducing test boilerplate.For Engineering Teams: *"This package solves three pain points we’ve all faced:
ExpectUserDeprecationMessageTrait lets us assert deprecation messages in tests with one line of code—no more manual checks.How it works:
symfony/phpunit-bridge) to your composer.json.No downsides: It’s a drop-in solution with zero breaking changes to your existing tests. Let’s pilot it in the next sprint and measure the impact on our upgrade velocity."*
For Developers: *"This is like GitHub’s ‘required status checks’ but for deprecation warnings. Here’s what changes:
@deprecated methods, old PHPUnit syntax).ExpectUserDeprecationMessageTrait:
use Symfony\Bridge\PhpUnit\ExpectUserDeprecationMessageTrait;
class MyTest extends TestCase {
use ExpectUserDeprecationMessageTrait;
public function testDeprecation() {
$this->expectDeprecationMessage('This feature is deprecated');
deprecatedFunction();
}
}
ClockMock/DnsMock for advanced testing.Try it: Add the package, run phpunit, and watch your deprecations surface. No more ‘it works in my local’ excuses!"*
How can I help you explore Laravel packages today?