feat: derive calendar date range from price configurations

This commit is contained in:
Björn Fromme
2026-08-26 13:32:25 +02:00
parent 61e020c3d0
commit 80d734e7d6
6 changed files with 260 additions and 25 deletions
+13
View File
@@ -19,6 +19,17 @@ class ContingentQueryTest extends TestCase
self::assertSame('2026-01-01', $query->dateFromDate()->format('Y-m-d'));
}
public function testCalendarQueryAcceptsAnOmittedRange(): void
{
$query = new ContingentCalendarQuery('HOTEL_1');
self::assertCount(0, $this->validator()->validate($query));
// Null is what puts the endpoint into full-span mode; there is no separate predicate for it.
self::assertNull($query->dateFromDate());
self::assertNull($query->dateToDate());
}
/**
* @dataProvider invalidCalendarQueries
*/
@@ -33,6 +44,8 @@ class ContingentQueryTest extends TestCase
yield 'reversed range' => [new ContingentCalendarQuery('HOTEL', '2026-03-02', '2026-03-01')];
yield 'range over 366 days' => [new ContingentCalendarQuery('HOTEL', '2026-01-01', '2027-01-03')];
yield 'invalid hotel code' => [new ContingentCalendarQuery('HOTEL CODE', '2026-01-01', '2026-01-02')];
yield 'dateFrom without dateTo' => [new ContingentCalendarQuery('HOTEL', '2026-01-01')];
yield 'dateTo without dateFrom' => [new ContingentCalendarQuery('HOTEL', null, '2026-01-02')];
}
public function testPricesQueryRequiresFourDigitYear(): void