Cause
The root of the problem is a bug that only exists in the development branch of Laravel 13.x (dev-master or 13.x-dev), which is not yet released at the time of writing.
The reason why Laravel 13 was installed is because:
Testbench 11.x-dev requires laravel/framework:^13.0
My composer.json had "minimum-stability": "dev" without "prefer-stable": true
So when I ran composer require --dev orchestra/testbench, Composer pulled in the latest dev versions of both Testbench and Laravel
Solution
To avoid this kind of issue in your package development environment:
- Update your composer.json to include:
"prefer-stable": true,
"minimum-stability": "dev"
This ensures that only stable versions of packages are selected unless absolutely necessary.
- Require Testbench again:
composer remove orchestra/testbench
composer require --dev orchestra/testbench
This time, Composer will install the latest stable version of Testbench
- Run your tests again — the error should disappear.