Fixed flappy test

This commit is contained in:
snipe
2026-05-14 11:45:20 +01:00
parent 407e2d0246
commit 4548ed8a45
+1 -1
View File
@@ -59,7 +59,7 @@ class AssetFactory extends Factory
// the explicit boolean gets set in the saving() method on the observer
$asset->asset_eol_date = $this->faker->boolean(5)
? CarbonImmutable::parse($asset->purchase_date)->addMonths(rand(0, 20))->format('Y-m-d')
: CarbonImmutable::parse($asset->purchase_date)->addMonths($asset->model->eol)->format('Y-m-d');
: CarbonImmutable::parse($asset->purchase_date)->addMonths($asset->model?->eol ?? rand(12, 60))->format('Y-m-d');
});
}