createBookingDto(); $bookingDto->currentStep = 1; $bookingDto->roomSelections = [ $this->createRoomSelection(10, 1), $this->createRoomSelection(11, 2), ]; self::assertSame(8, $service->calculate($bookingDto)); } public function testLaterCreateStepsUseActualParticipantCount(): void { $service = new BookingSummaryParticipantCountService(); $bookingDto = $this->createBookingDto(); $bookingDto->currentStep = 2; $bookingDto->participants = [ new ParticipantDto(), new ParticipantDto(), new ParticipantDto(), ]; self::assertSame(3, $service->calculate($bookingDto)); } public function testEditModeUsesActualParticipantCount(): void { $service = new BookingSummaryParticipantCountService(); $bookingDto = $this->createBookingDto(); $bookingDto->booking = new \App\BusProNet\Model\Booking(); $bookingDto->participants = [ new ParticipantDto(), new ParticipantDto(), ]; self::assertSame(2, $service->calculate($bookingDto)); } 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; } }