feat: cap rooms sharing a contingent per booking
This commit is contained in:
1 parent
5942ecf340
commit
3d94505e8d
18 files changed
+671
-19
No files matched your search
@@ -11,11 +11,13 @@ use App\Form\Model\BookingDto;
|
||||
use App\Form\Model\BookingSummaryDto;
|
||||
use App\Form\Model\ParticipantCardDataDto;
|
||||
use App\Form\Model\ParticipantCardPriceDto;
|
||||
use App\Model\RoomContingentPool;
|
||||
use App\Service\BookingCreateContextFactory;
|
||||
use App\Service\BookingPriceCalculator;
|
||||
use App\Service\BookingSummaryAssembler;
|
||||
use App\Service\FamilyInsuranceAvailabilityChecker;
|
||||
use App\Service\ParticipantCardAssembler;
|
||||
use App\Service\RoomContingentPoolResolver;
|
||||
use App\Service\RoomPricingCalculator;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
@@ -71,6 +73,7 @@ class BookingCreateContextFactoryTest extends TestCase
|
||||
$summaryDataService,
|
||||
$priceCalculator,
|
||||
$familyInsuranceService,
|
||||
$this->createStub(RoomContingentPoolResolver::class),
|
||||
);
|
||||
|
||||
$context = $service->create($bookingDto, RoomPricingCalculator::PRICING_MODE_SELECTION);
|
||||
@@ -134,6 +137,7 @@ class BookingCreateContextFactoryTest extends TestCase
|
||||
$summaryDataService,
|
||||
$priceCalculator,
|
||||
$familyInsuranceService,
|
||||
$this->createStub(RoomContingentPoolResolver::class),
|
||||
);
|
||||
|
||||
$context = $service->createWithParticipantCards($bookingDto, true);
|
||||
@@ -188,6 +192,7 @@ class BookingCreateContextFactoryTest extends TestCase
|
||||
$summaryDataService,
|
||||
$priceCalculator,
|
||||
$familyInsuranceService,
|
||||
$this->createStub(RoomContingentPoolResolver::class),
|
||||
);
|
||||
|
||||
$context = $service->createWithParticipantPrices($bookingDto);
|
||||
@@ -198,4 +203,47 @@ class BookingCreateContextFactoryTest extends TestCase
|
||||
$this->assertNull($context->cardsData);
|
||||
$this->assertSame([10 => $room], $context->groupedRooms->byRoom);
|
||||
}
|
||||
|
||||
public function testCreateForRoomSelectionIndexesSharedPoolsByMemberRoom(): void
|
||||
{
|
||||
$travel = new Travel();
|
||||
$travel->dateFrom = new \DateTimeImmutable('2030-01-01');
|
||||
$travel->dateTo = new \DateTimeImmutable('2030-01-06');
|
||||
|
||||
$eight = new Room();
|
||||
$eight->id = 2366;
|
||||
$eight->label = '8er App mit 8 Personen';
|
||||
$eight->maxPax = 8;
|
||||
$eight->available = 1;
|
||||
$eight->status = 'Frei';
|
||||
|
||||
$seven = new Room();
|
||||
$seven->id = 2367;
|
||||
$seven->label = '8er App mit 7 Personen';
|
||||
$seven->maxPax = 7;
|
||||
$seven->available = 1;
|
||||
$seven->status = 'Frei';
|
||||
|
||||
$travel->rooms = [$eight, $seven];
|
||||
$bookingDto = new BookingDto($travel, 163113);
|
||||
|
||||
$pool = new RoomContingentPool([2366 => $eight, 2367 => $seven]);
|
||||
$poolResolver = $this->createStub(RoomContingentPoolResolver::class);
|
||||
$poolResolver->method('findSharedPools')->willReturn([$pool]);
|
||||
|
||||
$summaryDataService = $this->createStub(BookingSummaryAssembler::class);
|
||||
$summaryDataService->method('getSummaryData')->willReturn($this->createStub(BookingSummaryDto::class));
|
||||
|
||||
$service = new BookingCreateContextFactory(
|
||||
$this->createStub(ParticipantCardAssembler::class),
|
||||
$summaryDataService,
|
||||
$this->createStub(BookingPriceCalculator::class),
|
||||
$this->createStub(FamilyInsuranceAvailabilityChecker::class),
|
||||
$poolResolver,
|
||||
);
|
||||
|
||||
$context = $service->createForRoomSelection($bookingDto);
|
||||
|
||||
$this->assertSame([2366 => $pool, 2367 => $pool], $context->roomContingentPools);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user