symfony/phpunit-bridge
Symfony PHPUnit Bridge adds PHPUnit utilities with a focus on managing and asserting deprecations. It improves test output, helps catch legacy API usage, and eases upgrades by tracking deprecation notices during your test suite runs.
Architecture Fit
TestCase patching to extend Laravel’s TestCase (via Illuminate\Foundation\Testing\TestCase), enabling deprecation tracking without modifying core Laravel logic.symfony/http-client, security-bundle, mailer). Acts as a bridge to unify testing practices across both ecosystems, reducing fragmentation in hybrid codebases.Integration Feasibility
@group cleanup). Laravel’s default PHPUnit version (9.x in LTS, 10.x in newer releases) ensures compatibility with minimal configuration.Illuminate\Foundation\Testing\TestCase to inherit Symfony’s deprecation utilities (e.g., ExpectUserDeprecationMessageTrait). No manual setup required for basic usage.strtotime() in ClockMock), ensuring compatibility with modern Laravel projects.Reflection*::setAccessible() for PHP < 8.1), reducing migration risk.Technical Risk
phpunit.xml overrides to isolate the bridge.ExpectUserDeprecationMessageTrait selectively or configure allowed deprecations.shell_exec(), but Laravel projects must ensure their own codebase is compatible with PHP 8.5+ if upgrading.Key Questions
HttpClient or Security.)@group).TestCase patching?Stack Fit
HttpClient, Security, Mailer, or other bundles that emit deprecation warnings.Reflection*::setAccessible() behavior changes). Laravel 9+ (PHP 8.0+) may need minor adjustments.Migration Path
Assessment Phase:
phpunit.xml) for custom listeners or extensions that may conflict.Integration:
composer require symfony/phpunit-bridge
TestCase (optional): If custom behavior is needed, create a base test class:
use Symfony\Bridge\PhpUnit\ExpectUserDeprecationMessageTrait;
use Illuminate\Foundation\Testing\TestCase as LaravelTestCase;
abstract class BaseTestCase extends LaravelTestCase
{
use ExpectUserDeprecationMessageTrait;
}
phpunit.xml):
<php>
<ini name="error_reporting" value="-1" />
<ini name="display_errors" value="1" />
</php>
Validation:
ClockMock and DnsMock for time-sensitive logic (e.g., scheduled tasks).refreshDatabase()).CI/CD Enforcement:
- name: Run tests with deprecation checks
run: php artisan test --fail-on-deprecations
Compatibility
symfony/http-client, symfony/security-core).Sequencing
Maintenance
Support
ExpectUserDeprecationMessageTrait) and interpret test failures. Provide a runbook for common deprecation scenarios.Scaling
How can I help you explore Laravel packages today?