From e179bbe259fbdd8bafd260caf1d4e93d3e66fc81 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Fromme?= Date: Mon, 13 Apr 2026 12:23:18 +0200 Subject: [PATCH] feat: remove deprecated booking service alias --- src/Service/BookingService.php | 19 ----------- tests/Service/BookingServiceBabyTest.php | 42 ++++++++++++------------ 2 files changed, 21 insertions(+), 40 deletions(-) diff --git a/src/Service/BookingService.php b/src/Service/BookingService.php index c232755..64bd40b 100644 --- a/src/Service/BookingService.php +++ b/src/Service/BookingService.php @@ -232,14 +232,6 @@ class BookingService } } - /** - * @deprecated Use preselectDefaultServices() instead. - */ - public function preselectMandatoryServices(BookingDto $bookingDto): void - { - $this->preselectDefaultServices($bookingDto); - } - private function canPreselectServicesForParticipant( BookingDto $bookingDto, int $participantIndex, @@ -649,15 +641,4 @@ class BookingService $bookingDto->bookingStatus = $this->bookingStatusRuleRegistry->evaluateStatus($bookingDto); } - /** - * Ensures the booking DTO has the correct number of participant objects. - * - * Creates or removes ParticipantDto objects based on room selections. - * Preserves existing participant data when adjusting the count. - * Optionally prepopulates the applicant (index 0) from an authenticated user. - * - * @param BookingDto $bookingDto The booking DTO to update - * @param \Symfony\Component\Security\Core\User\UserInterface|null $user Optional authenticated user for prepopulation - * @param callable|null $prepopulateCallback Callback to prepopulate applicant: fn(UserInterface, ParticipantDto): ParticipantDto - */ } diff --git a/tests/Service/BookingServiceBabyTest.php b/tests/Service/BookingServiceBabyTest.php index 72524cc..9c06ee2 100644 --- a/tests/Service/BookingServiceBabyTest.php +++ b/tests/Service/BookingServiceBabyTest.php @@ -52,7 +52,7 @@ class BookingServiceBabyTest extends TestCase $participant->additionalServices = []; $bookingDto->participants[0] = $participant; - $this->bookingService->preselectMandatoryServices($bookingDto); + $this->bookingService->preselectDefaultServices($bookingDto); $this->assertEmpty($participant->additionalServices, 'Mandatory services should not be preselected for baby participants'); } @@ -69,7 +69,7 @@ class BookingServiceBabyTest extends TestCase $participant->additionalServices = []; $bookingDto->participants[0] = $participant; - $this->bookingService->preselectMandatoryServices($bookingDto); + $this->bookingService->preselectDefaultServices($bookingDto); $this->assertEmpty($participant->additionalServices, 'Mandatory services should not be preselected for participants at BABY_MAX_AGE'); } @@ -91,7 +91,7 @@ class BookingServiceBabyTest extends TestCase ->method('isParticipantEligible') ->willReturn(true); - $this->bookingService->preselectMandatoryServices($bookingDto); + $this->bookingService->preselectDefaultServices($bookingDto); $this->assertNotEmpty($participant->additionalServices, 'Mandatory services should be preselected for non-baby participants'); $this->assertCount(1, $participant->additionalServices); @@ -115,7 +115,7 @@ class BookingServiceBabyTest extends TestCase ->method('isParticipantEligible') ->willReturn(true); - $this->bookingService->preselectMandatoryServices($bookingDto); + $this->bookingService->preselectDefaultServices($bookingDto); $this->assertNotEmpty($participant->additionalServices, 'Mandatory services should be preselected for adult participants'); $this->assertCount(1, $participant->additionalServices); @@ -146,7 +146,7 @@ class BookingServiceBabyTest extends TestCase ->with($bookingDto, 1) // Only called for adult ->willReturn(true); - $this->bookingService->preselectMandatoryServices($bookingDto); + $this->bookingService->preselectDefaultServices($bookingDto); $this->assertEmpty($babyParticipant->additionalServices, 'Baby should not have mandatory services preselected'); $this->assertNotEmpty($adultParticipant->additionalServices, 'Adult should have mandatory services preselected'); @@ -164,7 +164,7 @@ class BookingServiceBabyTest extends TestCase $participant->additionalServices = []; $bookingDto->participants[0] = $participant; - $this->bookingService->preselectMandatoryServices($bookingDto); + $this->bookingService->preselectDefaultServices($bookingDto); $this->assertEmpty($participant->additionalServices, 'Mandatory services should not be preselected for newborn babies'); } @@ -186,7 +186,7 @@ class BookingServiceBabyTest extends TestCase $participant->additionalServices = []; $bookingDto->participants[0] = $participant; - $this->bookingService->preselectMandatoryServices($bookingDto); + $this->bookingService->preselectDefaultServices($bookingDto); // At age 1, participant is a baby and should be skipped $this->assertEmpty($participant->additionalServices, 'Age should be calculated at travel date, not current date'); @@ -207,7 +207,7 @@ class BookingServiceBabyTest extends TestCase ->method('isParticipantEligible') ->willReturn(true); - $this->bookingService->preselectMandatoryServices($bookingDto); + $this->bookingService->preselectDefaultServices($bookingDto); $this->assertCount(1, $participant->additionalServices); $this->assertSame('Auto Book Service', $participant->additionalServices[0]->label); @@ -229,7 +229,7 @@ class BookingServiceBabyTest extends TestCase ->method('isParticipantEligible') ->willReturn(true); - $this->bookingService->preselectMandatoryServices($bookingDto); + $this->bookingService->preselectDefaultServices($bookingDto); $this->assertEmpty($participant->additionalServices); } @@ -250,7 +250,7 @@ class BookingServiceBabyTest extends TestCase ->method('isParticipantEligible') ->willReturn(true); - $this->bookingService->preselectMandatoryServices($bookingDto); + $this->bookingService->preselectDefaultServices($bookingDto); $this->assertCount(1, $participant->additionalServices); $this->assertSame('Mandatory And Auto Book Service', $participant->additionalServices[0]->label); @@ -270,7 +270,7 @@ class BookingServiceBabyTest extends TestCase ->method('isParticipantEligible') ->willReturn(true); - $this->bookingService->preselectMandatoryServices($bookingDto); + $this->bookingService->preselectDefaultServices($bookingDto); $this->assertNotNull($participant->skiPass); $this->assertSame('Auto Book Ski Pass', $participant->skiPass?->label); @@ -291,7 +291,7 @@ class BookingServiceBabyTest extends TestCase ->method('isParticipantEligible') ->willReturn(true); - $this->bookingService->preselectMandatoryServices($bookingDto); + $this->bookingService->preselectDefaultServices($bookingDto); $this->assertNull($participant->skiPass); } @@ -311,7 +311,7 @@ class BookingServiceBabyTest extends TestCase ->method('isParticipantEligible') ->willReturn(true); - $this->bookingService->preselectMandatoryServices($bookingDto); + $this->bookingService->preselectDefaultServices($bookingDto); $this->assertNotNull($participant->skiPass); $this->assertSame('Mandatory And Auto Book Ski Pass', $participant->skiPass?->label); @@ -331,7 +331,7 @@ class BookingServiceBabyTest extends TestCase ->method('isParticipantEligible') ->willReturn(true); - $this->bookingService->preselectMandatoryServices($bookingDto); + $this->bookingService->preselectDefaultServices($bookingDto); $this->assertCount(1, $participant->board); $this->assertSame('Auto Book Board', $participant->board[0]->label); @@ -352,7 +352,7 @@ class BookingServiceBabyTest extends TestCase ->method('isParticipantEligible') ->willReturn(true); - $this->bookingService->preselectMandatoryServices($bookingDto); + $this->bookingService->preselectDefaultServices($bookingDto); $this->assertSame([], $participant->board); } @@ -372,7 +372,7 @@ class BookingServiceBabyTest extends TestCase ->method('isParticipantEligible') ->willReturn(true); - $this->bookingService->preselectMandatoryServices($bookingDto); + $this->bookingService->preselectDefaultServices($bookingDto); $this->assertCount(1, $participant->board); $this->assertSame('Mandatory And Auto Book Board', $participant->board[0]->label); @@ -393,7 +393,7 @@ class BookingServiceBabyTest extends TestCase ->method('isParticipantEligible') ->willReturn(true); - $this->bookingService->preselectMandatoryServices($bookingDto); + $this->bookingService->preselectDefaultServices($bookingDto); $this->assertCount(1, $participant->rentals); $this->assertSame('Auto Book Rental', $participant->rentals[0]->label); @@ -415,7 +415,7 @@ class BookingServiceBabyTest extends TestCase ->method('isParticipantEligible') ->willReturn(true); - $this->bookingService->preselectMandatoryServices($bookingDto); + $this->bookingService->preselectDefaultServices($bookingDto); $this->assertSame([], $participant->rentals); } @@ -436,7 +436,7 @@ class BookingServiceBabyTest extends TestCase ->method('isParticipantEligible') ->willReturn(true); - $this->bookingService->preselectMandatoryServices($bookingDto); + $this->bookingService->preselectDefaultServices($bookingDto); $this->assertCount(1, $participant->rentals); $this->assertSame('Mandatory And Auto Book Rental', $participant->rentals[0]->label); @@ -456,7 +456,7 @@ class BookingServiceBabyTest extends TestCase ->method('isParticipantEligible') ->willReturn(true); - $this->bookingService->preselectMandatoryServices($bookingDto); + $this->bookingService->preselectDefaultServices($bookingDto); $this->assertSame([], $participant->rentals); } @@ -480,7 +480,7 @@ class BookingServiceBabyTest extends TestCase ->method('isParticipantEligible') ->willReturn(true); - $this->bookingService->preselectMandatoryServices($bookingDto); + $this->bookingService->preselectDefaultServices($bookingDto); $this->assertSame([], $participant->rentals); }