Add guest policy settings
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-01-01 20:25:39 +01:00
parent 25d464215e
commit c180b37760
15 changed files with 500 additions and 19 deletions

View File

@@ -4,6 +4,8 @@ namespace Tests\Feature\Tenant;
use App\Models\Event;
use App\Models\GuestNotification;
use App\Models\GuestPolicySetting;
use Illuminate\Support\Carbon;
use Illuminate\Support\Str;
class GuestNotificationBroadcastTest extends TenantTestCase
@@ -49,6 +51,38 @@ class GuestNotificationBroadcastTest extends TenantTestCase
]);
}
public function test_guest_notification_default_ttl_applies(): void
{
$now = now();
Carbon::setTestNow($now);
GuestPolicySetting::flushCache();
GuestPolicySetting::query()->create([
'id' => 1,
'guest_notification_ttl_hours' => 6,
]);
$event = Event::factory()->for($this->tenant)->create();
$payload = [
'title' => 'Upload-Reminder',
'message' => 'Bitte lade deine letzten Fotos hoch.',
'type' => 'broadcast',
];
$response = $this->authenticatedRequest('POST', "/api/v1/tenant/events/{$event->slug}/guest-notifications", $payload);
$response->assertCreated();
$notification = GuestNotification::query()->where('event_id', $event->id)->first();
$this->assertNotNull($notification);
$this->assertNotNull($notification->expires_at);
$this->assertEquals($now->copy()->addHours(6)->toDateTimeString(), $notification->expires_at?->toDateTimeString());
Carbon::setTestNow();
}
public function test_admin_cannot_access_foreign_event(): void
{
$otherTenantEvent = Event::factory()->create([