feat: offer non-travelling applicant choice only on selected travels

This commit is contained in:
fromme committed 2026-10-19 09:18:22 +02:00
1 parent 5b75938c73
commit b958d1a371
9 files changed
+320 -26

No files matched your search

+42
View File
@@ -148,6 +148,48 @@ class BookingDtoTest extends TestCase
$this->assertFalse($dto->isFirstParticipantApplicant());
}
public function testRestoringTheTravellingApplicantEndsTheSplit(): void
{
$dto = $this->createCreateModeDto();
$dto->applicantTravels = false;
$applicant = new ParticipantDto();
$applicant->firstName = 'Elternteil';
$dto->applicant = $applicant;
$child = new ParticipantDto();
$child->index = 0;
$child->firstName = 'Kind';
$child->assignedRoomId = 1408;
$sibling = new ParticipantDto();
$sibling->index = 1;
$dto->participants = [$child, $sibling];
$dto->restoreTravellingApplicant();
$this->assertTrue($dto->applicantTravels);
$this->assertNull($dto->applicant);
$this->assertSame($applicant, $dto->participants[0]);
$this->assertSame(0, $applicant->index);
$this->assertSame(1408, $applicant->assignedRoomId, 'The slot keeps its room');
$this->assertSame($sibling, $dto->participants[1]);
}
public function testRestoringWithoutAnApplicantRecordKeepsTheFirstParticipant(): void
{
$dto = $this->createCreateModeDto();
$dto->applicantTravels = false;
$traveller = new ParticipantDto();
$traveller->index = 0;
$dto->participants = [$traveller];
$dto->restoreTravellingApplicant();
$this->assertTrue($dto->applicantTravels);
$this->assertSame($traveller, $dto->participants[0]);
}
public function testInternalAgencyBookingNeverHasTheFirstParticipantAsApplicantInEditMode(): void
{
$dto = $this->createEditModeDto(100, 100);