create([ 'notification_preferences' => [ 'photo_thresholds' => false, ], ]); $user = User::factory()->create([ 'tenant_id' => $tenant->id, 'role' => 'tenant_admin', 'email_verified_at' => now(), ]); Sanctum::actingAs($user, abilities: ['tenant-admin', 'tenant:'.$tenant->id]); $response = $this->getJson('/api/v1/tenant/settings/notifications'); $response->assertOk(); $response->assertJsonPath('data.preferences.photo_thresholds', false); $response->assertJsonStructure([ 'data' => [ 'defaults', 'preferences', 'overrides', 'meta' => ['credit_warning_sent_at', 'credit_warning_threshold'], ], ]); } public function test_super_admin_can_fetch_notification_preferences_for_specific_tenant(): void { $tenant = Tenant::factory()->create(); $superAdmin = User::factory()->create([ 'role' => 'super_admin', 'tenant_id' => null, 'email_verified_at' => now(), ]); Sanctum::actingAs($superAdmin, abilities: ['tenant-admin', 'super-admin']); $response = $this ->withHeader('X-Tenant-ID', (string) $tenant->id) ->getJson('/api/v1/tenant/settings/notifications'); $response->assertOk(); $response->assertJsonPath('data.defaults.photo_thresholds', true); } }