diff --git a/src/Form/Model/ParticipantDto.php b/src/Form/Model/ParticipantDto.php index f4e3155..5c8da02 100644 --- a/src/Form/Model/ParticipantDto.php +++ b/src/Form/Model/ParticipantDto.php @@ -186,7 +186,7 @@ class ParticipantDto $instance->lastName = $personalData->name; $instance->title = $personalData->title; $instance->gender = $personalData->gender; - $instance->nationality = $personalData->nationality; + $instance->nationality = $personalData->nationality ?: 'D'; $instance->email = $personalData->communication?->email; $instance->mobile = $personalData->communication?->mobile; $instance->dateOfBirth = $personalData->dateOfBirth; diff --git a/tests/Service/ParticipantPrepopulationServiceTest.php b/tests/Service/ParticipantPrepopulationServiceTest.php index f287c9d..ea778ce 100644 --- a/tests/Service/ParticipantPrepopulationServiceTest.php +++ b/tests/Service/ParticipantPrepopulationServiceTest.php @@ -107,10 +107,10 @@ class ParticipantPrepopulationServiceTest extends TestCase $this->assertSame('Smith', $result->lastName); $this->assertSame('jane@example.com', $result->email); - // Optional fields should be null + // Optional fields should be null (except nationality which defaults to 'D') $this->assertNull($result->title); $this->assertNull($result->gender); - $this->assertNull($result->nationality); + $this->assertSame('D', $result->nationality); $this->assertNull($result->mobile); $this->assertNull($result->height); $this->assertNull($result->weight);