feat: split booking between participants and applicant
addresses #869f2q1vu
This commit is contained in:
1 parent
2d49212b08
commit
1ff293f41f
44 files changed
+2024
-316
No files matched your search
@@ -155,6 +155,79 @@ class BookingDataProcessorTest extends TestCase
|
||||
$this->assertSame(194672, $dto->participants[0]->veg?->id);
|
||||
}
|
||||
|
||||
public function testApplicantAddressIsCopiedOntoFirstParticipantOnAnOrdinaryBooking(): void
|
||||
{
|
||||
$booking = $this->createMockBooking();
|
||||
$travel = $this->createMockTravel();
|
||||
|
||||
$booking->applicant->personId = 4711;
|
||||
$booking->participants[0]->personId = 4711;
|
||||
$booking->applicant->address = $this->createFilledAddress('Elternweg 7');
|
||||
$booking->participants[0]->address = new Address();
|
||||
$booking->participants[0]->height = null;
|
||||
|
||||
$dto = $this->processor->createBookingDtoFromBooking($booking, $travel);
|
||||
|
||||
$this->assertSame(
|
||||
'Elternweg 7',
|
||||
$dto->participants[0]->address?->street,
|
||||
'BPN returns the full record only in <anmelder>, so participant[0] is filled from it'
|
||||
);
|
||||
$this->assertSame('175', $dto->participants[0]->height);
|
||||
}
|
||||
|
||||
public function testApplicantAddressIsNotCopiedOntoFirstParticipantOnASplitBooking(): void
|
||||
{
|
||||
$booking = $this->createMockBooking();
|
||||
$travel = $this->createMockTravel();
|
||||
|
||||
// The applicant is a different person: a parent who booked for their child.
|
||||
$booking->applicant->personId = 4711;
|
||||
$booking->participants[0]->personId = 4712;
|
||||
$booking->applicant->address = $this->createFilledAddress('Elternweg 7');
|
||||
$booking->participants[0]->address = new Address();
|
||||
$booking->participants[0]->height = null;
|
||||
|
||||
$dto = $this->processor->createBookingDtoFromBooking($booking, $travel);
|
||||
|
||||
$this->assertNull(
|
||||
$dto->participants[0]->address?->street,
|
||||
"The parent's address must not be written onto the child at the next edit submit"
|
||||
);
|
||||
$this->assertNull(
|
||||
$dto->participants[0]->height,
|
||||
"The parent's body dimensions must not be written onto the child either"
|
||||
);
|
||||
}
|
||||
|
||||
public function testApplicantAddressIsCopiedWhenPersonIdsAreUnknown(): void
|
||||
{
|
||||
$booking = $this->createMockBooking();
|
||||
$travel = $this->createMockTravel();
|
||||
|
||||
$booking->applicant->address = $this->createFilledAddress('Elternweg 7');
|
||||
$booking->participants[0]->address = new Address();
|
||||
|
||||
$dto = $this->processor->createBookingDtoFromBooking($booking, $travel);
|
||||
|
||||
$this->assertSame(
|
||||
'Elternweg 7',
|
||||
$dto->participants[0]->address?->street,
|
||||
'Incomplete BPN data falls back to the established, stricter behaviour'
|
||||
);
|
||||
}
|
||||
|
||||
private function createFilledAddress(string $street): Address
|
||||
{
|
||||
$address = new Address();
|
||||
$address->street = $street;
|
||||
$address->postCode = '99999';
|
||||
$address->city = 'MusterOrt';
|
||||
$address->country = 'D';
|
||||
|
||||
return $address;
|
||||
}
|
||||
|
||||
public function testTransportationServicesProcessing(): void
|
||||
{
|
||||
$formData = $this->createFormDataWithTransportation();
|
||||
|
||||
Reference in new issue
Block a user