Normally you don't seed the database per se, you just create the data you need for the test, nothing more, nothing less.
Sep 20, 2024
5
Level 4
Updating table values - test cases fail
Hello, i've got a migration to update the names of some fields, however when i try to run the test cases they fail because the migration runs before the seeder so it comes back null trying to find negativekWh in this case, is there a way to maek the seeder run only on unittest before the new migration runs
$negative = \App\Models\ReadingType::where('name', 'NegativekWh')->first();
$negative->update([
'name' => 'kWh - Export',
]);
Managed to do this by putting the changes in a seperate seeder file for the test cases, however on production seeders dont get ran so i'd need a migration to do the same? But then im back to test cases failing
Please or to participate in this conversation.