sanmai/phpunit-legacy-adapter
Compatibility adapter for running legacy PHPUnit test suites on newer PHPUnit versions. Helps bridge API changes, keep older tests passing, and smooth migrations without rewriting everything. Suitable for maintaining long-lived PHP projects with outdated test setups.
This package provides a bridge to run tests written for PHPUnit 8–9 using newer PHPUnit versions (10+), by automatically mapping deprecated classes and namespaces. Start by installing via Composer: composer require --dev sanmai/phpunit-legacy-adapter. Once installed, the adapter loads automatically—no configuration needed for basic use—but you can opt-in to stricter behavior via config if desired. The first use case is typically upgrading a legacy Laravel project’s test suite (e.g., upgrading from Laravel 8 to 9/10) without rewriting all tests immediately.
PHPUnit\Framework\TestCase extends or assertSelectCount() calls) while running tests against PHPUnit 10+.phpunit.xml and TestCase classes. No changes to tests/TestCase.php required—just add the adapter as a dev dependency.phpunit-legacy-adapter + vimeo/psalm or static analysis) without duplicating test files.PHPUnit_Util_Log_TeamCity).assertRegExp() being deprecated—even with the adapter—because core PHPUnit logic itself changed. Consider running tests with --display-deprecations to surface issues early.assertNotNull($x) with assertThat($x, isNotNull())).phpunit-legacy-adapter version compatibility: Ensure the adapter version supports your target PHPUnit version (e.g., sanmai/phpunit-legacy-adapter ^10.0 for PHPUnit 10+). Its last release was May 2023, so verify alignment with PHPUnit 11+.How can I help you explore Laravel packages today?