Link to the repository
[Only for premium members]
[Only for premium members]
This lesson will be a short and simple cleanup.
I've noticed the unnecessary two-line combination in SIX test methods:
tests/Feature/OrderCreateTest.php
// Create an order with the product$order = Order::factory()->create();$order->update(['user_id' => $user->id]);
So I've just changed those two-liners to one-liners:
tests/Feature/OrderCreateTest.php
// Refactored it in SIX places$order = Order::factory()->create(); $order->update(['user_id' => $user->id]); $order = Order::factory()->create(['user_id' => $user->id]);
This is another example of a feature implemented correctly but not using the Laravel feature: you can override any Factory field, passing it as an array.