feat: split summary DTOs into typed sub-objects

This commit is contained in:
Björn Fromme
2026-04-12 11:23:19 +02:00
parent 69705052b3
commit aa997826f8
18 changed files with 224 additions and 113 deletions
@@ -8,6 +8,7 @@ use App\BusProNet\Model\Room;
use App\BusProNet\Model\Travel;
use App\Form\Model\BookingCreateContext;
use App\Form\Model\BookingDto;
use App\Form\Model\RoomGroupsDto;
use App\Form\Model\ParticipantCardDataDto;
use App\Form\Model\ParticipantCardPriceDto;
use App\Form\Model\BookingSummaryDto;
@@ -56,13 +57,14 @@ class BookingCreateContextFactoryTest extends TestCase
->willReturn($summaryData);
$roomSelectionService = $this->createMock(BookingRoomSelectionService::class);
$groupedRooms = new RoomGroupsDto(
byPax: [$roomByPax->id => $roomByPax],
byRoom: [$roomByRoom->id => $roomByRoom],
);
$roomSelectionService->expects($this->once())
->method('groupRoomsBySelectionType')
->with([$roomByRoom->id => $roomByRoom, $roomByPax->id => $roomByPax])
->willReturn([
Room::SELECTION_TYPE_BY_PAX => [$roomByPax->id => $roomByPax],
Room::SELECTION_TYPE_BY_ROOM => [$roomByRoom->id => $roomByRoom],
]);
->willReturn($groupedRooms);
$participantCardDataService = $this->createMock(ParticipantCardDataService::class);
$participantCardDataService->expects($this->never())
@@ -86,10 +88,7 @@ class BookingCreateContextFactoryTest extends TestCase
$this->assertSame($summaryData, $context->summaryData);
$this->assertSame(null, $context->cardsData);
$this->assertFalse($context->isSubmitted);
$this->assertSame([
Room::SELECTION_TYPE_BY_PAX => [$roomByPax->id => $roomByPax],
Room::SELECTION_TYPE_BY_ROOM => [$roomByRoom->id => $roomByRoom],
], $context->groupedRooms);
$this->assertSame($groupedRooms, $context->groupedRooms);
}
public function testCreateWithParticipantCardsBuildsStep2Context(): void
@@ -124,13 +123,14 @@ class BookingCreateContextFactoryTest extends TestCase
->willReturn($summaryData);
$roomSelectionService = $this->createMock(BookingRoomSelectionService::class);
$groupedRooms = new RoomGroupsDto(
byPax: [],
byRoom: [$room->id => $room],
);
$roomSelectionService->expects($this->once())
->method('groupRoomsBySelectionType')
->with([$room->id => $room])
->willReturn([
Room::SELECTION_TYPE_BY_PAX => [],
Room::SELECTION_TYPE_BY_ROOM => [$room->id => $room],
]);
->willReturn($groupedRooms);
$participantCardDataService = $this->createMock(ParticipantCardDataService::class);
$participantCardDataService->expects($this->once())
@@ -181,13 +181,14 @@ class BookingCreateContextFactoryTest extends TestCase
->willReturn($summaryData);
$roomSelectionService = $this->createMock(BookingRoomSelectionService::class);
$groupedRooms = new RoomGroupsDto(
byPax: [],
byRoom: [$room->id => $room],
);
$roomSelectionService->expects($this->once())
->method('groupRoomsBySelectionType')
->with([$room->id => $room])
->willReturn([
Room::SELECTION_TYPE_BY_PAX => [],
Room::SELECTION_TYPE_BY_ROOM => [$room->id => $room],
]);
->willReturn($groupedRooms);
$participantCardDataService = $this->createMock(ParticipantCardDataService::class);
$participantCardDataService->expects($this->never())