feat: offer rooms on request by Anf code suffix

This commit is contained in:
fromme committed 2026-11-11 11:35:38 +01:00
1 parent 2936d8947a
commit 0b0286787b
11 files changed
+204 -41

No files matched your search

+21
View File
@@ -100,6 +100,27 @@ class TripCatalogTest extends TestCase
self::assertFalse($trip['dates'][1]['hotels'][0]['bookable']);
}
public function testRoomsOnRequestByCodeAreListedOnRequest(): void
{
$rows = [
// The office sells the suffixed room on request on purpose; the plain one stays sold out.
$this->row('VTH', 2, '2026-12-05', 'HOT1', [$this->room(2000, available: 1, maxPax: 6, status: 'Anfrage', code: '6erSDAnf'), $this->room(300, status: 'Anfrage')]),
// A free room makes the date free, whatever else is on request.
$this->row('VTH', 3, '2027-01-09', 'HOT1', [$this->room(2000, available: 1, maxPax: 6, status: 'Anfrage', code: '6erSDAnf'), $this->room(500)]),
];
$catalog = $this->catalog($rows);
$results = $catalog->search(new TripCriteria())['results'];
self::assertSame(['auf Anfrage', 'frei'], array_column($results, 'availability'));
self::assertSame([2000.0, 500.0], array_column($results, 'priceFrom'));
self::assertSame(['VTH2', 'VTH3'], array_column($catalog->search(new TripCriteria(persons: 6))['results'], 'dateCode'), 'its places count');
$trip = $catalog->get('VTH');
self::assertNotNull($trip);
self::assertSame(['auf Anfrage', 'ausgebucht'], array_column($trip['dates'][0]['hotels'][0]['rooms'], 'availability'));
self::assertTrue($trip['dates'][0]['hotels'][0]['bookable']);
}
public function testTheTravelPeriodContainsTheTripAndPricesApplyToTheAbPrice(): void
{
$rows = [$this->row('VTH', 2, '2026-12-05', 'HOT1', [$this->room(450), $this->room(700)])];