seed(AuthorizationSeeder::class); WebsiteType::query()->create(['codigo' => 'onticket', 'nombre' => 'OnTicket']); } public function test_authentication_is_required(): void { $this->getJson('/api/v1/adminapp/forms/fiesta-futbol-infantil/food') ->assertUnauthorized(); } public function test_it_returns_event_dates_schedules_and_services_for_the_tenant(): void { $tenant = Tenant::query()->create([ 'codigo' => 'fiesta', 'nombre' => 'Fiesta', 'dominio' => 'fiesta.test', 'website_type_code' => 'onticket', ]); $tenant->eventDates()->create([ 'date' => '2026-10-09', 'time_start' => '00:00', 'time_end' => '23:59', ]); $this->createAttribute($tenant, 'horario', [ ['value' => 'Cena', 'label' => 'Cena', 'sort_order' => 2], ['value' => 'Almuerzo', 'label' => 'Almuerzo', 'sort_order' => 1], ]); $this->createAttribute($tenant, 'servicio', [ ['value' => 'Comedor', 'label' => 'Comedor', 'sort_order' => 1], ]); Sanctum::actingAs(User::factory()->create([ 'rol_codigo' => RoleCode::AdminApp->value, 'tenant_codigo' => $tenant->codigo, ])); $this->getJson('/api/v1/adminapp/forms/fiesta-futbol-infantil/food') ->assertOk() ->assertJsonCount(1, 'data.event_dates') ->assertJsonPath('data.event_dates.0.date', '2026-10-09') ->assertJsonPath('data.schedules.0.value', 'Almuerzo') ->assertJsonPath('data.schedules.1.value', 'Cena') ->assertJsonPath('data.services.0.value', 'Comedor'); } /** @param array $options */ private function createAttribute(Tenant $tenant, string $code, array $options): void { $attribute = Attribute::query()->create([ 'tenant_codigo' => $tenant->codigo, 'codigo' => $code, 'nombre' => ucfirst($code), 'type' => FieldType::Select, 'is_required' => true, ]); $attribute->options()->createMany($options); } }