From 894e26f37d2dc478cfd9248b271897e3e95fc5d0 Mon Sep 17 00:00:00 2001 From: Thorsten Bus Date: Fri, 6 Mar 2026 10:28:27 +0100 Subject: [PATCH] fix(test): use deterministic uploaded_at in ServiceControllerTest Faker's dateTimeBetween ignores Carbon::setTestNow, producing dates after the frozen test time. This caused the info_slides_count assertion to fail non-deterministically when the system date diverged from the test-frozen date. --- tests/Feature/ServiceControllerTest.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tests/Feature/ServiceControllerTest.php b/tests/Feature/ServiceControllerTest.php index 686d994..c1d5f63 100644 --- a/tests/Feature/ServiceControllerTest.php +++ b/tests/Feature/ServiceControllerTest.php @@ -99,30 +99,35 @@ public function test_services_index_zeigt_nur_heutige_und_kuenftige_services_mit 'service_id' => $todayService->id, 'type' => 'sermon', 'expire_date' => null, + 'uploaded_at' => Carbon::today()->subDays(2), ]); Slide::factory()->create([ 'service_id' => null, 'type' => 'information', 'expire_date' => Carbon::today()->addDay(), + 'uploaded_at' => Carbon::today()->subDays(3), ]); Slide::factory()->create([ 'service_id' => null, 'type' => 'information', 'expire_date' => Carbon::today()->addDays(5), + 'uploaded_at' => Carbon::today()->subDays(2), ]); Slide::factory()->create([ 'service_id' => $todayService->id, 'type' => 'information', 'expire_date' => Carbon::today()->addDays(10), + 'uploaded_at' => Carbon::today()->subDay(), ]); Slide::factory()->create([ 'service_id' => null, 'type' => 'information', 'expire_date' => Carbon::today()->subDay(), + 'uploaded_at' => Carbon::today()->subDays(5), ]); $response = $this->actingAs($user)->get(route('services.index'));