feat(admin): finalize live show settings and related tests
Some checks failed
linter / quality (push) Has been cancelled
tests / ci (push) Has been cancelled
tests / ui (push) Has been cancelled

This commit is contained in:
Codex Agent
2026-02-06 08:43:50 +01:00
parent 0a08f2704f
commit 61d1bbc707
8 changed files with 314 additions and 6 deletions

View File

@@ -52,6 +52,25 @@ class LiveShowDataModelTest extends TestCase
$this->assertSame($newDate->copy()->addDay()->endOfDay()->toIso8601String(), $event->live_show_token_expires_at?->toIso8601String());
}
public function test_ensuring_existing_live_show_token_does_not_mutate_existing_expiry(): void
{
$this->freezeTime(function (): void {
$eventDate = now()->addDays(5)->startOfDay();
$event = Event::factory()->create(['date' => $eventDate]);
$event->rotateLiveShowToken();
$customExpiry = now()->addHours(6)->toImmutable();
$event->forceFill(['live_show_token_expires_at' => $customExpiry])->saveQuietly();
$initialExpiry = $event->refresh()->live_show_token_expires_at?->toIso8601String();
$this->travel(6)->hours();
$event->refresh()->ensureLiveShowToken();
$expiryAfterEnsure = $event->refresh()->live_show_token_expires_at?->toIso8601String();
$this->assertNotNull($initialExpiry);
$this->assertSame($initialExpiry, $expiryAfterEnsure);
});
}
public function test_photo_live_status_is_cast_and_defaults_to_none(): void
{
$photo = Photo::factory()->create();

View File

@@ -62,4 +62,32 @@ class LiveShowLinkControllerTest extends TenantTestCase
$this->assertIsString($rotatedToken);
$this->assertNotSame($firstToken, $rotatedToken);
}
public function test_loading_live_show_link_does_not_mutate_existing_expiry(): void
{
$this->freezeTime(function (): void {
$event = Event::factory()
->for($this->tenant)
->create([
'name' => ['de' => 'Live-Show Ablauf', 'en' => 'Live Show Expiry'],
'slug' => 'live-show-fixed-expiry',
'date' => now()->addDays(3)->startOfDay(),
]);
$event->ensureLiveShowToken();
$customExpiry = now()->addHours(4)->toImmutable();
$event->forceFill(['live_show_token_expires_at' => $customExpiry])->saveQuietly();
$first = $this->authenticatedRequest('GET', "/api/v1/tenant/events/{$event->slug}/live-show/link");
$first->assertOk();
$firstExpiry = $first->json('data.expires_at');
$this->travel(8)->hours();
$second = $this->authenticatedRequest('GET', "/api/v1/tenant/events/{$event->slug}/live-show/link");
$second->assertOk();
$this->assertIsString($firstExpiry);
$this->assertSame($firstExpiry, $second->json('data.expires_at'));
});
}
}