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.
This commit is contained in:
Thorsten Bus 2026-03-06 10:28:27 +01:00
parent 2a23f0d210
commit 894e26f37d

View file

@ -99,30 +99,35 @@ public function test_services_index_zeigt_nur_heutige_und_kuenftige_services_mit
'service_id' => $todayService->id, 'service_id' => $todayService->id,
'type' => 'sermon', 'type' => 'sermon',
'expire_date' => null, 'expire_date' => null,
'uploaded_at' => Carbon::today()->subDays(2),
]); ]);
Slide::factory()->create([ Slide::factory()->create([
'service_id' => null, 'service_id' => null,
'type' => 'information', 'type' => 'information',
'expire_date' => Carbon::today()->addDay(), 'expire_date' => Carbon::today()->addDay(),
'uploaded_at' => Carbon::today()->subDays(3),
]); ]);
Slide::factory()->create([ Slide::factory()->create([
'service_id' => null, 'service_id' => null,
'type' => 'information', 'type' => 'information',
'expire_date' => Carbon::today()->addDays(5), 'expire_date' => Carbon::today()->addDays(5),
'uploaded_at' => Carbon::today()->subDays(2),
]); ]);
Slide::factory()->create([ Slide::factory()->create([
'service_id' => $todayService->id, 'service_id' => $todayService->id,
'type' => 'information', 'type' => 'information',
'expire_date' => Carbon::today()->addDays(10), 'expire_date' => Carbon::today()->addDays(10),
'uploaded_at' => Carbon::today()->subDay(),
]); ]);
Slide::factory()->create([ Slide::factory()->create([
'service_id' => null, 'service_id' => null,
'type' => 'information', 'type' => 'information',
'expire_date' => Carbon::today()->subDay(), 'expire_date' => Carbon::today()->subDay(),
'uploaded_at' => Carbon::today()->subDays(5),
]); ]);
$response = $this->actingAs($user)->get(route('services.index')); $response = $this->actingAs($user)->get(route('services.index'));