feat: add bookable flag to product export rooms

This commit is contained in:
fromme committed 2026-11-10 17:32:38 +01:00
1 parent 2b27b9809d
commit 0ff312c0c0
10 files changed
+126 -28

No files matched your search

+23 -1
View File
@@ -59,7 +59,7 @@ class TripCatalogTest extends TestCase
self::assertSame(500.0, $hotelOne['priceFrom'], 'the cheapest room with places left; the stopped room does not count');
self::assertSame(['Skipass', 'Bus', 'Halbpension', 'Programm'], $hotelOne['includes']);
self::assertSame(['neu'], $hotelOne['flags']);
self::assertSame('auf Anfrage', $result['results'][2]['availability']);
self::assertSame('ausgebucht', $result['results'][2]['availability'], 'a room on request is sold out');
self::assertSame('2026-10-08T06:00:00+00:00', $result['dataAsOf']);
self::assertSame(1, count($this->catalog([$this->row('VTH', 2, '2026-12-05', 'HOT1', [$this->room(1)]), $this->row('VTH', 3, '2027-01-09', 'HOT1', [$this->room(1)])])->search(new TripCriteria(limit: 1))['results']));
}
@@ -78,6 +78,28 @@ class TripCatalogTest extends TestCase
self::assertSame(['VTH2'], array_column($this->catalog($rows)->search(new TripCriteria(persons: 2))['results'], 'dateCode'));
}
public function testRoomsOnRequestOrWithoutRoomsLeftAreListedAsSoldOut(): void
{
$rows = [
// The room on request has rooms left but is sold out: its 6 places and lower price do not count.
$this->row('VTH', 2, '2026-12-05', 'HOT1', [$this->room(400, available: 1, maxPax: 2), $this->room(300, available: 3, maxPax: 2, status: 'Anfrage')]),
$this->row('VTH', 3, '2027-01-09', 'HOT1', [$this->room(500, available: 0), $this->room(450, status: 'Anfrage')]),
];
$catalog = $this->catalog($rows);
$results = $catalog->search(new TripCriteria())['results'];
self::assertSame(['VTH2', 'VTH3'], array_column($results, 'dateCode'), 'sold-out dates stay listed, as on the website');
self::assertSame([400.0, 450.0], array_column($results, 'priceFrom'));
self::assertSame(['frei', 'ausgebucht'], array_column($results, 'availability'));
self::assertSame([], $catalog->search(new TripCriteria(persons: 3))['results']);
$trip = $catalog->get('VTH');
self::assertNotNull($trip);
self::assertSame(['frei', 'ausgebucht'], array_column($trip['dates'][0]['hotels'][0]['rooms'], 'availability'));
self::assertTrue($trip['dates'][0]['hotels'][0]['bookable']);
self::assertFalse($trip['dates'][1]['hotels'][0]['bookable']);
}
public function testTheTravelPeriodContainsTheTripAndPricesApplyToTheAbPrice(): void
{
$rows = [$this->row('VTH', 2, '2026-12-05', 'HOT1', [$this->room(450), $this->room(700)])];