seed(AuthorizationSeeder::class); } public function test_authentication_is_required(): void { $this->getJson('/api/v1/adminapp/forms/fiesta-futbol-infantil/ticket') ->assertUnauthorized(); } public function test_it_returns_nested_ticket_options_using_the_frontend_presentation_mapping(): void { $headerLogo = $this->createAttachment('header.png'); $footerLogo = $this->createAttachment('footer.png'); $tenant = Tenant::query()->create([ 'codigo' => 'fiesta_futbol_infantil', 'nombre' => 'Fiesta FĂștbol Infantil', 'dominio' => 'fiesta-futbol-infantil.test', 'primary_color' => '#00973F', 'secondary_color' => '#A0A0A0', 'danger_color' => '#FF8888', 'success_color' => '#198754', 'header_bg_color' => '#ffffff', 'footer_bg_color' => '#015327', 'header_logo_id' => $headerLogo->id, 'footer_logo_id' => $footerLogo->id, ]); $this->seed([AttributeSeeder::class, FiestaFutbolInfantilProductSeeder::class]); Sanctum::actingAs(User::factory()->create([ 'rol_codigo' => RoleCode::AdminApp->value, 'tenant_codigo' => $tenant->codigo, ])); $response = $this->getJson('/api/v1/adminapp/forms/fiesta-futbol-infantil/ticket') ->assertOk() ->assertExactJson([ 'data' => [ 'statuses' => [ ['value' => 'active', 'label' => 'Activo'], ['value' => 'used', 'label' => 'Usado'], ['value' => 'expired', 'label' => 'Vencido'], ], 'categories' => [ [ 'value' => 'entradas', 'label' => 'Entradas', 'products' => [[ 'value' => 'abono', 'label' => 'Abono', 'types' => [], ]], ], [ 'value' => 'alojamientos', 'label' => 'Camping', 'products' => [ ['value' => 'Carpa', 'label' => 'Carpa', 'types' => []], ['value' => 'Motorhome', 'label' => 'Motorhome', 'types' => []], ], ], [ 'value' => 'comidas', 'label' => 'Comida', 'products' => [ [ 'value' => (string) $tenant->eventDates[0]->id, 'label' => '09/10', 'types' => [ ['value' => 'Desayuno', 'label' => 'Desayuno'], ['value' => 'Almuerzo', 'label' => 'Almuerzo'], ['value' => 'Cena', 'label' => 'Cena'], ], ], [ 'value' => (string) $tenant->eventDates[1]->id, 'label' => '10/10', 'types' => [ ['value' => 'Desayuno', 'label' => 'Desayuno'], ['value' => 'Almuerzo', 'label' => 'Almuerzo'], ['value' => 'Cena', 'label' => 'Cena'], ], ], [ 'value' => (string) $tenant->eventDates[2]->id, 'label' => '11/10', 'types' => [ ['value' => 'Desayuno', 'label' => 'Desayuno'], ['value' => 'Almuerzo', 'label' => 'Almuerzo'], ['value' => 'Cena', 'label' => 'Cena'], ], ], [ 'value' => (string) $tenant->eventDates[3]->id, 'label' => '12/10', 'types' => [ ['value' => 'Desayuno', 'label' => 'Desayuno'], ['value' => 'Almuerzo', 'label' => 'Almuerzo'], ['value' => 'Cena', 'label' => 'Cena'], ], ], ], ], [ 'value' => 'merchandising', 'label' => 'Merchandising', 'products' => [[ 'value' => 'camiseta', 'label' => 'Camiseta', 'types' => [ ['value' => 'Verde', 'label' => 'Verde'], ['value' => 'Blanco', 'label' => 'Blanco'], ], ]], ], ], ], ]); $response->assertJsonMissingPath('data.categories.0.products.0.category'); } private function createAttachment(string $filename): Attachment { return Attachment::query()->create([ 'path' => "tests/{$filename}", 'filename' => $filename, 'type' => AttachmentType::Image, 'mime_type' => 'image/png', ]); } }