feat: automatically assign rooms only for unique room type selection
This commit is contained in:
@@ -167,7 +167,7 @@ class ParticipantCardDataServiceTest extends TestCase
|
||||
$this->assertEquals('Unbekanntes Zimmer', $result['roomName']);
|
||||
}
|
||||
|
||||
public function testGetCardDataWithZeroPrice(): void
|
||||
public function testGetCardDataWithZeroPriceAndNoRoom(): void
|
||||
{
|
||||
$travel = new Travel();
|
||||
$travel->rooms = [];
|
||||
@@ -175,6 +175,7 @@ class ParticipantCardDataServiceTest extends TestCase
|
||||
$participant = new ParticipantDto();
|
||||
$participant->firstName = 'Max';
|
||||
$participant->lastName = 'Mustermann';
|
||||
$participant->assignedRoomId = null; // No room assigned
|
||||
|
||||
$bookingDto = new BookingDto($travel, 1);
|
||||
$bookingDto->participants = [$participant];
|
||||
@@ -185,6 +186,36 @@ class ParticipantCardDataServiceTest extends TestCase
|
||||
|
||||
$result = $this->service->getCardData($bookingDto, 0);
|
||||
|
||||
// When no room assigned and price is zero, display dash (incomplete configuration)
|
||||
$this->assertEquals('-', $result['price']);
|
||||
}
|
||||
|
||||
public function testGetCardDataWithZeroPriceButRoomAssigned(): void
|
||||
{
|
||||
// Create test room
|
||||
$room = new Room();
|
||||
$room->id = 1;
|
||||
$room->label = 'Doppelzimmer';
|
||||
$room->price = 0.0;
|
||||
|
||||
$travel = new Travel();
|
||||
$travel->rooms = [$room];
|
||||
|
||||
$participant = new ParticipantDto();
|
||||
$participant->firstName = 'Max';
|
||||
$participant->lastName = 'Mustermann';
|
||||
$participant->assignedRoomId = 1; // Room is assigned
|
||||
|
||||
$bookingDto = new BookingDto($travel, 1);
|
||||
$bookingDto->participants = [$participant];
|
||||
|
||||
$this->priceCalculator
|
||||
->method('calculateAllParticipantIndividualPrices')
|
||||
->willReturn([0.0]);
|
||||
|
||||
$result = $this->service->getCardData($bookingDto, 0);
|
||||
|
||||
// When room is assigned but price is zero, display formatted zero price
|
||||
$this->assertEquals('0,00 €', $result['price']);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user