createService(); $bookingDto = $this->createBookingDto(); $bookingDto->currentStep = 1; $bookingDto->roomSelections = [ $this->createRoomSelection(10, 1), $this->createRoomSelection(11, 2), ]; $summary = $service->getSummaryData($bookingDto); $this->assertInstanceOf(BookingSummaryDto::class, $summary); $this->assertSame(8, $summary->participantCount); // 1×2 + 2×3 = 8 } public function testLaterCreateStepsUseActualParticipantCount(): void { $service = $this->createService(); $bookingDto = $this->createBookingDto(); $bookingDto->currentStep = 2; $bookingDto->participants = [ new ParticipantDto(), new ParticipantDto(), new ParticipantDto(), ]; $summary = $service->getSummaryData($bookingDto); $this->assertSame(3, $summary->participantCount); } public function testEditModeUsesActualParticipantCount(): void { $service = $this->createService(); $bookingDto = $this->createBookingDto(); $bookingDto->booking = new Booking(); $bookingDto->participants = [ new ParticipantDto(), new ParticipantDto(), ]; $summary = $service->getSummaryData($bookingDto); $this->assertSame(2, $summary->participantCount); } private function createService(): BookingSummaryAssembler { $priceCalculator = $this->createMock(BookingPriceCalculator::class); $priceCalculator->method('calculateAllParticipantIndividualPrices')->willReturn([]); $priceCalculator->method('getPricingBreakdown')->willReturn([ 'rooms' => [], 'services' => [], 'surcharges' => null, 'grandTotal' => 0.0, ]); return new BookingSummaryAssembler( $priceCalculator, $this->createMock(CmsDataProvider::class), $this->createMock(HotelLoader::class), $this->createMock(CountryDataProvider::class), $this->createMock(CacheInterface::class), new NullLogger(), ); } private function createBookingDto(): BookingDto { $travel = new Travel(); $travel->dateFrom = new \DateTimeImmutable('2030-01-01'); $travel->dateTo = new \DateTimeImmutable('2030-01-06'); $travel->rooms = [ 10 => $this->createRoom(10, 2), 11 => $this->createRoom(11, 3), ]; return new BookingDto($travel, 157047); } private function createRoom(int $id, int $maxPax): Room { $room = new Room(); $room->id = $id; $room->label = 'Room '.$id; $room->available = 4; $room->status = 'Frei'; $room->maxPax = $maxPax; return $room; } private function createRoomSelection(int $id, int $quantity): RoomSelectionDto { $selection = new RoomSelectionDto(); $selection->id = $id; $selection->quantity = $quantity; return $selection; } }