feat: extract room grouping from booking service

This commit is contained in:
Björn Fromme committed 2026-04-11 18:28:32 +02:00
1 parent 8b72f8c277
commit f31ac660d2
8 files changed
+120 -136

No files matched your search

@@ -0,0 +1,43 @@
<?php
declare(strict_types=1);
namespace App\Tests\Service;
use App\BusProNet\Model\Room;
use App\Service\BookingRoomSelectionService;
use PHPUnit\Framework\TestCase;
class BookingRoomSelectionServiceTest extends TestCase
{
private BookingRoomSelectionService $service;
protected function setUp(): void
{
$this->service = new BookingRoomSelectionService();
}
public function testGroupRoomsBySelectionTypeSplitsAndSortsRooms(): void
{
$rooms = [
10 => $this->createRoom(10, '2 Bett Zimmer', 4),
11 => $this->createRoom(11, 'Suite', 2),
12 => $this->createRoom(12, '3 Bett Zimmer', 6),
];
$groups = $this->service->groupRoomsBySelectionType($rooms);
$this->assertSame([10, 12], array_keys($groups[Room::SELECTION_TYPE_BY_PAX]));
$this->assertSame([11], array_keys($groups[Room::SELECTION_TYPE_BY_ROOM]));
}
private function createRoom(int $id, string $label, int $maxPax): Room
{
$room = new Room();
$room->id = $id;
$room->label = $label;
$room->maxPax = $maxPax;
return $room;
}
}