feat: indicate family insurance eligibility
This commit is contained in:
@@ -14,6 +14,7 @@ use App\Form\Model\ParticipantCardPriceDto;
|
||||
use App\Service\BookingCreateContextFactory;
|
||||
use App\Service\BookingPriceCalculator;
|
||||
use App\Service\BookingSummaryAssembler;
|
||||
use App\Service\FamilyInsuranceAvailabilityChecker;
|
||||
use App\Service\ParticipantCardAssembler;
|
||||
use App\Service\RoomPricingCalculator;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
@@ -62,10 +63,14 @@ class BookingCreateContextFactoryTest extends TestCase
|
||||
$priceCalculator->expects($this->never())
|
||||
->method('calculateAllParticipantIndividualPrices');
|
||||
|
||||
$familyInsuranceService = $this->createMock(FamilyInsuranceAvailabilityChecker::class);
|
||||
$familyInsuranceService->method('isFamilyInsuranceUpgradeAvailable')->willReturn(true);
|
||||
|
||||
$service = new BookingCreateContextFactory(
|
||||
$participantCardDataService,
|
||||
$summaryDataService,
|
||||
$priceCalculator,
|
||||
$familyInsuranceService,
|
||||
);
|
||||
|
||||
$context = $service->create($bookingDto, RoomPricingCalculator::PRICING_MODE_SELECTION);
|
||||
@@ -73,6 +78,7 @@ class BookingCreateContextFactoryTest extends TestCase
|
||||
$this->assertInstanceOf(BookingCreateContext::class, $context);
|
||||
$this->assertSame($bookingDto, $context->bookingDto);
|
||||
$this->assertSame($summaryData, $context->summaryData);
|
||||
$this->assertTrue($context->familyInsuranceUpgradeAvailable);
|
||||
$this->assertNull($context->cardsData);
|
||||
$this->assertFalse($context->isSubmitted);
|
||||
$this->assertSame([11 => $roomByPax], $context->groupedRooms->byPax);
|
||||
@@ -120,10 +126,14 @@ class BookingCreateContextFactoryTest extends TestCase
|
||||
$priceCalculator->expects($this->never())
|
||||
->method('calculateAllParticipantIndividualPrices');
|
||||
|
||||
$familyInsuranceService = $this->createMock(FamilyInsuranceAvailabilityChecker::class);
|
||||
$familyInsuranceService->method('isFamilyInsuranceUpgradeAvailable')->willReturn(true);
|
||||
|
||||
$service = new BookingCreateContextFactory(
|
||||
$participantCardDataService,
|
||||
$summaryDataService,
|
||||
$priceCalculator,
|
||||
$familyInsuranceService,
|
||||
);
|
||||
|
||||
$context = $service->createWithParticipantCards($bookingDto, true);
|
||||
@@ -131,6 +141,7 @@ class BookingCreateContextFactoryTest extends TestCase
|
||||
$this->assertInstanceOf(BookingCreateContext::class, $context);
|
||||
$this->assertSame([$cardData], $context->cardsData);
|
||||
$this->assertTrue($context->isSubmitted);
|
||||
$this->assertTrue($context->familyInsuranceUpgradeAvailable);
|
||||
$this->assertSame([], $context->groupedRooms->byPax);
|
||||
$this->assertSame([10 => $room], $context->groupedRooms->byRoom);
|
||||
}
|
||||
@@ -169,16 +180,21 @@ class BookingCreateContextFactoryTest extends TestCase
|
||||
->with($bookingDto)
|
||||
->willReturn([123.45]);
|
||||
|
||||
$familyInsuranceService = $this->createMock(FamilyInsuranceAvailabilityChecker::class);
|
||||
$familyInsuranceService->method('isFamilyInsuranceUpgradeAvailable')->willReturn(true);
|
||||
|
||||
$service = new BookingCreateContextFactory(
|
||||
$participantCardDataService,
|
||||
$summaryDataService,
|
||||
$priceCalculator,
|
||||
$familyInsuranceService,
|
||||
);
|
||||
|
||||
$context = $service->createWithParticipantPrices($bookingDto);
|
||||
|
||||
$this->assertInstanceOf(BookingCreateContext::class, $context);
|
||||
$this->assertSame([123.45], $context->participantPrices);
|
||||
$this->assertTrue($context->familyInsuranceUpgradeAvailable);
|
||||
$this->assertNull($context->cardsData);
|
||||
$this->assertSame([10 => $room], $context->groupedRooms->byRoom);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user