Back

Has anyone here had to fix parallel tests when using RefreshDatabase on a Laravel 11 repo?

I've got a test suite that works fine in normal testing, and in parallel on L10, but in L11 it seems it completely breaks and the seeded database data is not present in the test case.

There seem to be a handful of issues related to this, but none of them have a true resolution and deviate off into other problems that were fixed.
github.com/laravel/framework/issues/52414


github.com/laravel/framework/issues/50790
github.com/laravel/framework/issues/50840

I'm thinking there's an undocumented impacting change when it comes to that trait and parallel tests.

I have a slightly modified RefreshDatabase that starts from a DB sql dump and runs migrations from there, rather than running migrate:fresh.

1

236

Ended up source diving a bit, and I think the root cause was around cli command argument parsing with Artisan. I swapped:

$this->artisan('migrate', ['--seed' => 1]);


For

$this->artisan('migrate', ['--seeder' => DatabaseSeeder::class]);

94