feat: split booking between participants and applicant

addresses #869f2q1vu
This commit is contained in:
fromme committed 2026-10-19 09:18:22 +02:00
1 parent 2d49212b08
commit 1ff293f41f
44 files changed
+2024 -316

No files matched your search

+47 -1
View File
@@ -5,6 +5,7 @@ declare(strict_types=1);
namespace App\Tests\Service;
use App\BusProNet\Model\Booking;
use App\BusProNet\Model\Insurance;
use App\BusProNet\Model\Travel;
use App\Exception\ParticipantNotFoundException;
use App\Form\Model\BookingDto;
@@ -80,8 +81,53 @@ class ParticipantFormSupportTest extends TestCase
}
/**
* array<string, int>|null $bodyDimensionRanges
* array<string, int>|null $bodyDimensionRanges.
*/
public function testBlankTravellerKeepsTheRoomAssignmentAndDropsTheRest(): void
{
$previous = new ParticipantDto();
$previous->index = 0;
$previous->assignedRoomId = 4711;
$previous->firstName = 'Elternteil';
$previous->email = '[email protected]';
$previous->dateOfBirth = new \DateTimeImmutable('1981-03-16');
$traveller = $this->createService()->createBlankTravellerFrom($previous);
$this->assertSame(0, $traveller->index);
$this->assertSame(4711, $traveller->assignedRoomId);
$this->assertNull($traveller->firstName);
$this->assertNull($traveller->email);
$this->assertNull(
$traveller->dateOfBirth,
'The services were derived from an age that no longer applies to this slot'
);
}
public function testClearFamilyInsuranceRemovesOnlyFamilyPolicies(): void
{
$bookingDto = $this->createBookingDto();
$familyInsurance = new Insurance();
$familyInsurance->familyInsurance = true;
$bookingDto->participants[0]->insurance = $familyInsurance;
$bookingDto->participants[0]->bulkInsuranceBooking = true;
$ordinaryInsurance = new Insurance();
$ordinaryInsurance->familyInsurance = false;
$bookingDto->participants[1]->insurance = $ordinaryInsurance;
$this->createService()->clearFamilyInsurance($bookingDto);
$this->assertNull($bookingDto->participants[0]->insurance);
$this->assertFalse($bookingDto->participants[0]->bulkInsuranceBooking);
$this->assertSame(
$ordinaryInsurance,
$bookingDto->participants[1]->insurance,
'Only the family policy goes; an ordinary one is still valid on a split booking'
);
}
private function createService(?array $bodyDimensionRanges = null): ParticipantFormSupport
{
$bodyDimensionRanges ??= [