feat: remove deprecated booking service alias
This commit is contained in:
@@ -232,14 +232,6 @@ class BookingService
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated Use preselectDefaultServices() instead.
|
|
||||||
*/
|
|
||||||
public function preselectMandatoryServices(BookingDto $bookingDto): void
|
|
||||||
{
|
|
||||||
$this->preselectDefaultServices($bookingDto);
|
|
||||||
}
|
|
||||||
|
|
||||||
private function canPreselectServicesForParticipant(
|
private function canPreselectServicesForParticipant(
|
||||||
BookingDto $bookingDto,
|
BookingDto $bookingDto,
|
||||||
int $participantIndex,
|
int $participantIndex,
|
||||||
@@ -649,15 +641,4 @@ class BookingService
|
|||||||
$bookingDto->bookingStatus = $this->bookingStatusRuleRegistry->evaluateStatus($bookingDto);
|
$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
|
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ class BookingServiceBabyTest extends TestCase
|
|||||||
$participant->additionalServices = [];
|
$participant->additionalServices = [];
|
||||||
$bookingDto->participants[0] = $participant;
|
$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');
|
$this->assertEmpty($participant->additionalServices, 'Mandatory services should not be preselected for baby participants');
|
||||||
}
|
}
|
||||||
@@ -69,7 +69,7 @@ class BookingServiceBabyTest extends TestCase
|
|||||||
$participant->additionalServices = [];
|
$participant->additionalServices = [];
|
||||||
$bookingDto->participants[0] = $participant;
|
$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');
|
$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')
|
->method('isParticipantEligible')
|
||||||
->willReturn(true);
|
->willReturn(true);
|
||||||
|
|
||||||
$this->bookingService->preselectMandatoryServices($bookingDto);
|
$this->bookingService->preselectDefaultServices($bookingDto);
|
||||||
|
|
||||||
$this->assertNotEmpty($participant->additionalServices, 'Mandatory services should be preselected for non-baby participants');
|
$this->assertNotEmpty($participant->additionalServices, 'Mandatory services should be preselected for non-baby participants');
|
||||||
$this->assertCount(1, $participant->additionalServices);
|
$this->assertCount(1, $participant->additionalServices);
|
||||||
@@ -115,7 +115,7 @@ class BookingServiceBabyTest extends TestCase
|
|||||||
->method('isParticipantEligible')
|
->method('isParticipantEligible')
|
||||||
->willReturn(true);
|
->willReturn(true);
|
||||||
|
|
||||||
$this->bookingService->preselectMandatoryServices($bookingDto);
|
$this->bookingService->preselectDefaultServices($bookingDto);
|
||||||
|
|
||||||
$this->assertNotEmpty($participant->additionalServices, 'Mandatory services should be preselected for adult participants');
|
$this->assertNotEmpty($participant->additionalServices, 'Mandatory services should be preselected for adult participants');
|
||||||
$this->assertCount(1, $participant->additionalServices);
|
$this->assertCount(1, $participant->additionalServices);
|
||||||
@@ -146,7 +146,7 @@ class BookingServiceBabyTest extends TestCase
|
|||||||
->with($bookingDto, 1) // Only called for adult
|
->with($bookingDto, 1) // Only called for adult
|
||||||
->willReturn(true);
|
->willReturn(true);
|
||||||
|
|
||||||
$this->bookingService->preselectMandatoryServices($bookingDto);
|
$this->bookingService->preselectDefaultServices($bookingDto);
|
||||||
|
|
||||||
$this->assertEmpty($babyParticipant->additionalServices, 'Baby should not have mandatory services preselected');
|
$this->assertEmpty($babyParticipant->additionalServices, 'Baby should not have mandatory services preselected');
|
||||||
$this->assertNotEmpty($adultParticipant->additionalServices, 'Adult should have mandatory services preselected');
|
$this->assertNotEmpty($adultParticipant->additionalServices, 'Adult should have mandatory services preselected');
|
||||||
@@ -164,7 +164,7 @@ class BookingServiceBabyTest extends TestCase
|
|||||||
$participant->additionalServices = [];
|
$participant->additionalServices = [];
|
||||||
$bookingDto->participants[0] = $participant;
|
$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');
|
$this->assertEmpty($participant->additionalServices, 'Mandatory services should not be preselected for newborn babies');
|
||||||
}
|
}
|
||||||
@@ -186,7 +186,7 @@ class BookingServiceBabyTest extends TestCase
|
|||||||
$participant->additionalServices = [];
|
$participant->additionalServices = [];
|
||||||
$bookingDto->participants[0] = $participant;
|
$bookingDto->participants[0] = $participant;
|
||||||
|
|
||||||
$this->bookingService->preselectMandatoryServices($bookingDto);
|
$this->bookingService->preselectDefaultServices($bookingDto);
|
||||||
|
|
||||||
// At age 1, participant is a baby and should be skipped
|
// 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');
|
$this->assertEmpty($participant->additionalServices, 'Age should be calculated at travel date, not current date');
|
||||||
@@ -207,7 +207,7 @@ class BookingServiceBabyTest extends TestCase
|
|||||||
->method('isParticipantEligible')
|
->method('isParticipantEligible')
|
||||||
->willReturn(true);
|
->willReturn(true);
|
||||||
|
|
||||||
$this->bookingService->preselectMandatoryServices($bookingDto);
|
$this->bookingService->preselectDefaultServices($bookingDto);
|
||||||
|
|
||||||
$this->assertCount(1, $participant->additionalServices);
|
$this->assertCount(1, $participant->additionalServices);
|
||||||
$this->assertSame('Auto Book Service', $participant->additionalServices[0]->label);
|
$this->assertSame('Auto Book Service', $participant->additionalServices[0]->label);
|
||||||
@@ -229,7 +229,7 @@ class BookingServiceBabyTest extends TestCase
|
|||||||
->method('isParticipantEligible')
|
->method('isParticipantEligible')
|
||||||
->willReturn(true);
|
->willReturn(true);
|
||||||
|
|
||||||
$this->bookingService->preselectMandatoryServices($bookingDto);
|
$this->bookingService->preselectDefaultServices($bookingDto);
|
||||||
|
|
||||||
$this->assertEmpty($participant->additionalServices);
|
$this->assertEmpty($participant->additionalServices);
|
||||||
}
|
}
|
||||||
@@ -250,7 +250,7 @@ class BookingServiceBabyTest extends TestCase
|
|||||||
->method('isParticipantEligible')
|
->method('isParticipantEligible')
|
||||||
->willReturn(true);
|
->willReturn(true);
|
||||||
|
|
||||||
$this->bookingService->preselectMandatoryServices($bookingDto);
|
$this->bookingService->preselectDefaultServices($bookingDto);
|
||||||
|
|
||||||
$this->assertCount(1, $participant->additionalServices);
|
$this->assertCount(1, $participant->additionalServices);
|
||||||
$this->assertSame('Mandatory And Auto Book Service', $participant->additionalServices[0]->label);
|
$this->assertSame('Mandatory And Auto Book Service', $participant->additionalServices[0]->label);
|
||||||
@@ -270,7 +270,7 @@ class BookingServiceBabyTest extends TestCase
|
|||||||
->method('isParticipantEligible')
|
->method('isParticipantEligible')
|
||||||
->willReturn(true);
|
->willReturn(true);
|
||||||
|
|
||||||
$this->bookingService->preselectMandatoryServices($bookingDto);
|
$this->bookingService->preselectDefaultServices($bookingDto);
|
||||||
|
|
||||||
$this->assertNotNull($participant->skiPass);
|
$this->assertNotNull($participant->skiPass);
|
||||||
$this->assertSame('Auto Book Ski Pass', $participant->skiPass?->label);
|
$this->assertSame('Auto Book Ski Pass', $participant->skiPass?->label);
|
||||||
@@ -291,7 +291,7 @@ class BookingServiceBabyTest extends TestCase
|
|||||||
->method('isParticipantEligible')
|
->method('isParticipantEligible')
|
||||||
->willReturn(true);
|
->willReturn(true);
|
||||||
|
|
||||||
$this->bookingService->preselectMandatoryServices($bookingDto);
|
$this->bookingService->preselectDefaultServices($bookingDto);
|
||||||
|
|
||||||
$this->assertNull($participant->skiPass);
|
$this->assertNull($participant->skiPass);
|
||||||
}
|
}
|
||||||
@@ -311,7 +311,7 @@ class BookingServiceBabyTest extends TestCase
|
|||||||
->method('isParticipantEligible')
|
->method('isParticipantEligible')
|
||||||
->willReturn(true);
|
->willReturn(true);
|
||||||
|
|
||||||
$this->bookingService->preselectMandatoryServices($bookingDto);
|
$this->bookingService->preselectDefaultServices($bookingDto);
|
||||||
|
|
||||||
$this->assertNotNull($participant->skiPass);
|
$this->assertNotNull($participant->skiPass);
|
||||||
$this->assertSame('Mandatory And Auto Book Ski Pass', $participant->skiPass?->label);
|
$this->assertSame('Mandatory And Auto Book Ski Pass', $participant->skiPass?->label);
|
||||||
@@ -331,7 +331,7 @@ class BookingServiceBabyTest extends TestCase
|
|||||||
->method('isParticipantEligible')
|
->method('isParticipantEligible')
|
||||||
->willReturn(true);
|
->willReturn(true);
|
||||||
|
|
||||||
$this->bookingService->preselectMandatoryServices($bookingDto);
|
$this->bookingService->preselectDefaultServices($bookingDto);
|
||||||
|
|
||||||
$this->assertCount(1, $participant->board);
|
$this->assertCount(1, $participant->board);
|
||||||
$this->assertSame('Auto Book Board', $participant->board[0]->label);
|
$this->assertSame('Auto Book Board', $participant->board[0]->label);
|
||||||
@@ -352,7 +352,7 @@ class BookingServiceBabyTest extends TestCase
|
|||||||
->method('isParticipantEligible')
|
->method('isParticipantEligible')
|
||||||
->willReturn(true);
|
->willReturn(true);
|
||||||
|
|
||||||
$this->bookingService->preselectMandatoryServices($bookingDto);
|
$this->bookingService->preselectDefaultServices($bookingDto);
|
||||||
|
|
||||||
$this->assertSame([], $participant->board);
|
$this->assertSame([], $participant->board);
|
||||||
}
|
}
|
||||||
@@ -372,7 +372,7 @@ class BookingServiceBabyTest extends TestCase
|
|||||||
->method('isParticipantEligible')
|
->method('isParticipantEligible')
|
||||||
->willReturn(true);
|
->willReturn(true);
|
||||||
|
|
||||||
$this->bookingService->preselectMandatoryServices($bookingDto);
|
$this->bookingService->preselectDefaultServices($bookingDto);
|
||||||
|
|
||||||
$this->assertCount(1, $participant->board);
|
$this->assertCount(1, $participant->board);
|
||||||
$this->assertSame('Mandatory And Auto Book Board', $participant->board[0]->label);
|
$this->assertSame('Mandatory And Auto Book Board', $participant->board[0]->label);
|
||||||
@@ -393,7 +393,7 @@ class BookingServiceBabyTest extends TestCase
|
|||||||
->method('isParticipantEligible')
|
->method('isParticipantEligible')
|
||||||
->willReturn(true);
|
->willReturn(true);
|
||||||
|
|
||||||
$this->bookingService->preselectMandatoryServices($bookingDto);
|
$this->bookingService->preselectDefaultServices($bookingDto);
|
||||||
|
|
||||||
$this->assertCount(1, $participant->rentals);
|
$this->assertCount(1, $participant->rentals);
|
||||||
$this->assertSame('Auto Book Rental', $participant->rentals[0]->label);
|
$this->assertSame('Auto Book Rental', $participant->rentals[0]->label);
|
||||||
@@ -415,7 +415,7 @@ class BookingServiceBabyTest extends TestCase
|
|||||||
->method('isParticipantEligible')
|
->method('isParticipantEligible')
|
||||||
->willReturn(true);
|
->willReturn(true);
|
||||||
|
|
||||||
$this->bookingService->preselectMandatoryServices($bookingDto);
|
$this->bookingService->preselectDefaultServices($bookingDto);
|
||||||
|
|
||||||
$this->assertSame([], $participant->rentals);
|
$this->assertSame([], $participant->rentals);
|
||||||
}
|
}
|
||||||
@@ -436,7 +436,7 @@ class BookingServiceBabyTest extends TestCase
|
|||||||
->method('isParticipantEligible')
|
->method('isParticipantEligible')
|
||||||
->willReturn(true);
|
->willReturn(true);
|
||||||
|
|
||||||
$this->bookingService->preselectMandatoryServices($bookingDto);
|
$this->bookingService->preselectDefaultServices($bookingDto);
|
||||||
|
|
||||||
$this->assertCount(1, $participant->rentals);
|
$this->assertCount(1, $participant->rentals);
|
||||||
$this->assertSame('Mandatory And Auto Book Rental', $participant->rentals[0]->label);
|
$this->assertSame('Mandatory And Auto Book Rental', $participant->rentals[0]->label);
|
||||||
@@ -456,7 +456,7 @@ class BookingServiceBabyTest extends TestCase
|
|||||||
->method('isParticipantEligible')
|
->method('isParticipantEligible')
|
||||||
->willReturn(true);
|
->willReturn(true);
|
||||||
|
|
||||||
$this->bookingService->preselectMandatoryServices($bookingDto);
|
$this->bookingService->preselectDefaultServices($bookingDto);
|
||||||
|
|
||||||
$this->assertSame([], $participant->rentals);
|
$this->assertSame([], $participant->rentals);
|
||||||
}
|
}
|
||||||
@@ -480,7 +480,7 @@ class BookingServiceBabyTest extends TestCase
|
|||||||
->method('isParticipantEligible')
|
->method('isParticipantEligible')
|
||||||
->willReturn(true);
|
->willReturn(true);
|
||||||
|
|
||||||
$this->bookingService->preselectMandatoryServices($bookingDto);
|
$this->bookingService->preselectDefaultServices($bookingDto);
|
||||||
|
|
||||||
$this->assertSame([], $participant->rentals);
|
$this->assertSame([], $participant->rentals);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user