feat: groups price calculator admin crud, booking/offer flow and api

This commit is contained in:
Björn Fromme
2026-08-03 15:25:10 +02:00
parent eabed8295a
commit 9d2aa11fdb
258 changed files with 16231 additions and 582 deletions
+50
View File
@@ -0,0 +1,50 @@
<?php
declare(strict_types=1);
namespace App\Tests\Model;
use App\Model\ContingentCalendarQuery;
use App\Model\ContingentPricesQuery;
use PHPUnit\Framework\TestCase;
use Symfony\Component\Validator\Validation;
class ContingentQueryTest extends TestCase
{
public function testCalendarQueryAcceptsValidRange(): void
{
$query = new ContingentCalendarQuery('HOTEL_1', '2026-01-01', '2026-12-31');
self::assertCount(0, $this->validator()->validate($query));
self::assertSame('2026-01-01', $query->dateFromDate()->format('Y-m-d'));
}
/**
* @dataProvider invalidCalendarQueries
*/
public function testCalendarQueryRejectsInvalidInput(ContingentCalendarQuery $query): void
{
self::assertGreaterThan(0, $this->validator()->validate($query)->count());
}
public function invalidCalendarQueries(): iterable
{
yield 'normalized invalid date' => [new ContingentCalendarQuery('HOTEL', '2026-02-31', '2026-03-01')];
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')];
}
public function testPricesQueryRequiresFourDigitYear(): void
{
self::assertCount(0, $this->validator()->validate(new ContingentPricesQuery('HOTEL', 2026)));
self::assertGreaterThan(0, $this->validator()->validate(new ContingentPricesQuery('HOTEL', 26))->count());
}
private function validator(): \Symfony\Component\Validator\Validator\ValidatorInterface
{
return Validation::createValidatorBuilder()
->enableAttributeMapping()
->getValidator();
}
}