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
@@ -172,6 +172,59 @@ class BookingNewsletterOptInTest extends TestCase
|
||||
);
|
||||
}
|
||||
|
||||
public function testApplicantIsTheSeparateRecordWhenTheyDoNotTravel(): void
|
||||
{
|
||||
$bookingDto = $this->createBookingDto([['[email protected]', 12]]);
|
||||
$bookingDto->applicantTravels = false;
|
||||
|
||||
$applicant = new ParticipantDto();
|
||||
$applicant->firstName = 'Probe';
|
||||
$applicant->lastName = 'Elternteil';
|
||||
$applicant->email = '[email protected]';
|
||||
$bookingDto->applicant = $applicant;
|
||||
|
||||
$service = $this->createService($this->createStub(NewsletterManager::class));
|
||||
|
||||
$this->assertSame('[email protected]', $service->resolveApplicantEmail($bookingDto, null));
|
||||
$this->assertSame($applicant, $service->resolveApplicantParticipant($bookingDto));
|
||||
$this->assertSame('Probe Elternteil', $service->resolveRequestedByName($bookingDto));
|
||||
}
|
||||
|
||||
public function testAdultAtIndexZeroIsOfferedACompanionOptInOnASplitBooking(): void
|
||||
{
|
||||
$bookingDto = $this->createBookingDto([['[email protected]', 25]]);
|
||||
$bookingDto->applicantTravels = false;
|
||||
|
||||
$applicant = new ParticipantDto();
|
||||
$applicant->firstName = 'Probe';
|
||||
$applicant->lastName = 'Elternteil';
|
||||
$applicant->email = '[email protected]';
|
||||
$bookingDto->applicant = $applicant;
|
||||
|
||||
$service = $this->createService($this->createStub(NewsletterManager::class));
|
||||
$companions = $service->resolveCompanions($bookingDto, '[email protected]');
|
||||
|
||||
$this->assertCount(
|
||||
1,
|
||||
$companions,
|
||||
'participant[0] is an ordinary companion once the applicant stays home'
|
||||
);
|
||||
$this->assertSame('[email protected]', $companions[0]->email);
|
||||
}
|
||||
|
||||
public function testChildCarryingTheApplicantAddressIsNotOfferedACompanionOptIn(): void
|
||||
{
|
||||
$bookingDto = $this->createBookingDto([
|
||||
['[email protected]', 40],
|
||||
['[email protected]', 12],
|
||||
]);
|
||||
|
||||
$service = $this->createService($this->createStub(NewsletterManager::class));
|
||||
$companions = $service->resolveCompanions($bookingDto, '[email protected]');
|
||||
|
||||
$this->assertSame([], $companions);
|
||||
}
|
||||
|
||||
private function createService(NewsletterManager $newsletterManager): BookingNewsletterOptIn
|
||||
{
|
||||
return new BookingNewsletterOptIn($newsletterManager, new NullLogger());
|
||||
|
||||
Reference in new issue
Block a user