I think the concept of https://stackoverflow.com/a/38591471/3872647 is correct, but overwriting code this way will likely lead to incompatiblities in the future which trips up new developers.
This post describes a better way by setting TestCase::$seed = true
, where --seed
is only executed once per test class https://masteringlaravel.io/daily/2023-12-04-you-dont-need-to-manually-run-seeders-in-your-tests