feat: let get_trip resolve a date code to its trip and date
This commit is contained in:
1 parent
754360605c
commit
3af41c06ab
4 files changed
+45
-9
No files matched your search
@@ -33,8 +33,8 @@ class TripCatalogTest extends TestCase
|
||||
self::assertSame(['country' => 'Frankreich'], $trip['destination']);
|
||||
self::assertSame(['Hotel Eins'], $trip['hotels']);
|
||||
self::assertSame([
|
||||
['dateFrom' => '2026-12-05', 'dateTo' => '2026-12-12', 'priceFrom' => 450.0, 'availability' => 'frei'],
|
||||
['dateFrom' => '2027-01-09', 'dateTo' => '2027-01-16', 'priceFrom' => 520.0, 'availability' => 'auf Anfrage'],
|
||||
['dateCode' => 'VTH2', 'dateFrom' => '2026-12-05', 'dateTo' => '2026-12-12', 'priceFrom' => 450.0, 'availability' => 'frei'],
|
||||
['dateCode' => 'VTH3', 'dateFrom' => '2027-01-09', 'dateTo' => '2027-01-16', 'priceFrom' => 520.0, 'availability' => 'auf Anfrage'],
|
||||
], $trip['nextDates']);
|
||||
self::assertSame('2026-10-08T06:00:00+00:00', $result['dataAsOf']);
|
||||
}
|
||||
@@ -93,6 +93,20 @@ class TripCatalogTest extends TestCase
|
||||
self::assertSame('GRP', $this->catalog($rows)->get('GRP')['code'] ?? null);
|
||||
}
|
||||
|
||||
public function testGetTakesADateCodeAndNarrowsToThatDate(): void
|
||||
{
|
||||
$catalog = $this->catalog([
|
||||
$this->row('VTH', 2, '2026-12-05', 'HOT1', [$this->room(450)]),
|
||||
$this->row('VTH', 3, '2027-01-09', 'HOT1', [$this->room(520)]),
|
||||
]);
|
||||
|
||||
$trip = $catalog->get('vth-3');
|
||||
|
||||
self::assertSame('VTH', $trip['code'] ?? null);
|
||||
self::assertSame(['VTH3'], array_column($trip['dates'], 'dateCode'));
|
||||
self::assertNull($catalog->get('VTH9'));
|
||||
}
|
||||
|
||||
public function testGetIsNullForACodeWithoutAPublishedProduct(): void
|
||||
{
|
||||
self::assertNull($this->catalog([$this->row('XYZ', 2, '2026-12-05', 'HOT1', [$this->room(1)])])->get('XYZ'));
|
||||
|
||||
Reference in new issue
Block a user