- Add GET /api/v1/public/events/{slug}/registration-data endpoint for fetching
event sections and time slots without auth
- Create 5-step registration form: personal info, details, motivation, section
preferences, availability
- VeeValidate + Zod validation per step with Dutch error messages
- Auth-aware: pre-fills name/email for authenticated users
- Mobile responsive with custom chip-based step indicator
- Success page with contextual actions (dashboard vs login)
- Types, composable (TanStack Query), and Zod schemas
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
86 lines
2.4 KiB
PHP
86 lines
2.4 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace Tests\Feature\Api\V1;
|
|
|
|
use App\Models\CrowdType;
|
|
use App\Models\Event;
|
|
use App\Models\FestivalSection;
|
|
use App\Models\Organisation;
|
|
use App\Models\TimeSlot;
|
|
use Illuminate\Foundation\Testing\RefreshDatabase;
|
|
use Tests\TestCase;
|
|
|
|
class PublicRegistrationDataTest extends TestCase
|
|
{
|
|
use RefreshDatabase;
|
|
|
|
private Organisation $organisation;
|
|
|
|
protected function setUp(): void
|
|
{
|
|
parent::setUp();
|
|
$this->organisation = Organisation::factory()->create();
|
|
}
|
|
|
|
public function test_returns_registration_data_for_open_event(): void
|
|
{
|
|
$event = Event::factory()->create([
|
|
'organisation_id' => $this->organisation->id,
|
|
'status' => 'registration_open',
|
|
'slug' => 'test-event-2026',
|
|
]);
|
|
|
|
$section = FestivalSection::factory()->create([
|
|
'event_id' => $event->id,
|
|
'type' => 'standard',
|
|
]);
|
|
|
|
FestivalSection::factory()->create([
|
|
'event_id' => $event->id,
|
|
'type' => 'cross_event',
|
|
]);
|
|
|
|
$timeSlot = TimeSlot::factory()->create([
|
|
'event_id' => $event->id,
|
|
'person_type' => 'VOLUNTEER',
|
|
]);
|
|
|
|
TimeSlot::factory()->create([
|
|
'event_id' => $event->id,
|
|
'person_type' => 'CREW',
|
|
]);
|
|
|
|
$response = $this->getJson('/api/v1/public/events/test-event-2026/registration-data');
|
|
|
|
$response->assertOk()
|
|
->assertJsonPath('data.event.id', $event->id)
|
|
->assertJsonPath('data.event.name', $event->name)
|
|
->assertJsonCount(1, 'data.sections')
|
|
->assertJsonPath('data.sections.0.id', $section->id)
|
|
->assertJsonCount(1, 'data.time_slots')
|
|
->assertJsonPath('data.time_slots.0.id', $timeSlot->id);
|
|
}
|
|
|
|
public function test_returns_404_for_non_registration_open_event(): void
|
|
{
|
|
Event::factory()->create([
|
|
'organisation_id' => $this->organisation->id,
|
|
'status' => 'draft',
|
|
'slug' => 'draft-event',
|
|
]);
|
|
|
|
$response = $this->getJson('/api/v1/public/events/draft-event/registration-data');
|
|
|
|
$response->assertNotFound();
|
|
}
|
|
|
|
public function test_returns_404_for_nonexistent_slug(): void
|
|
{
|
|
$response = $this->getJson('/api/v1/public/events/does-not-exist/registration-data');
|
|
|
|
$response->assertNotFound();
|
|
}
|
|
}
|