fix: properly handle 'veg' services in booking edit flow

This commit is contained in:
Björn Fromme
2026-04-29 11:59:39 +02:00
parent 287c299c41
commit c0c8ad515c
9 changed files with 89 additions and 4 deletions
@@ -109,6 +109,49 @@ class BookingDataProcessorTest extends TestCase
$this->assertEquals('1', $service['@zuordnung']);
}
public function testVegServiceIsIncludedInUpdatePayload(): void
{
$formData = $this->createCompleteFormData();
$vegService = $this->createMockService(194672);
$formData->travel->additionalServices[194672] = $vegService;
$formData->participants[0]->veg = $vegService;
$result = $this->processor->createUpdateRequestPayload($formData);
$this->assertNotEmpty($result['zusatzleistungen']['zusatzleistung']);
$vegPayload = null;
foreach ($result['zusatzleistungen']['zusatzleistung'] as $service) {
if (194672 === $service['@idleistung']) {
$vegPayload = $service;
break;
}
}
$this->assertNotNull($vegPayload);
$this->assertSame(1, $vegPayload['@anzahl']);
$this->assertSame('1', $vegPayload['@zuordnung']);
}
public function testVegSelectionIsRestoredWhenHydratingBookingDto(): void
{
$booking = $this->createMockBooking();
$travel = $this->createMockTravel();
$vegService = $this->createMockService(194672);
$vegService->subType = 'VEG';
$vegService->mapping = [0];
$booking->additionalServices[194672] = $vegService;
$travel->additionalServices[194672] = $vegService;
$dto = $this->processor->createBookingDtoFromBooking($booking, $travel);
$this->assertNotNull($dto->participants[0]->veg);
$this->assertSame(194672, $dto->participants[0]->veg?->id);
}
public function testTransportationServicesProcessing(): void
{
$formData = $this->createFormDataWithTransportation();