feat: add date_of_birth field to persons across all layers

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-04-11 09:06:29 +02:00
parent d2f282eb4c
commit 6dccf87234
18 changed files with 161 additions and 17 deletions

View File

@@ -170,6 +170,48 @@ class VolunteerRegistrationTest extends TestCase
$this->assertNotEmpty($customFields['section_preferences']);
}
public function test_volunteer_can_register_with_date_of_birth(): void
{
$response = $this->postJson("/api/v1/events/{$this->event->id}/volunteer-register", [
'first_name' => 'Mila',
'last_name' => 'de Boer',
'email' => 'mila@voorbeeld.nl',
'date_of_birth' => '1998-05-12',
]);
$response->assertStatus(201);
$person = Person::where('email', 'mila@voorbeeld.nl')->first();
$this->assertEquals('1998-05-12', $person->date_of_birth->format('Y-m-d'));
}
public function test_volunteer_can_register_without_date_of_birth(): void
{
$response = $this->postJson("/api/v1/events/{$this->event->id}/volunteer-register", [
'first_name' => 'Sem',
'last_name' => 'van Beek',
'email' => 'sem@voorbeeld.nl',
]);
$response->assertStatus(201);
$person = Person::where('email', 'sem@voorbeeld.nl')->first();
$this->assertNull($person->date_of_birth);
}
public function test_date_of_birth_must_be_before_today(): void
{
$response = $this->postJson("/api/v1/events/{$this->event->id}/volunteer-register", [
'first_name' => 'Tijn',
'last_name' => 'Kuiper',
'email' => 'tijn@voorbeeld.nl',
'date_of_birth' => now()->addDay()->format('Y-m-d'),
]);
$response->assertStatus(422);
$response->assertJsonValidationErrors('date_of_birth');
}
public function test_duplicate_email_rejected(): void
{
$this->postJson("/api/v1/events/{$this->event->id}/volunteer-register", [