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
+74
View File
@@ -0,0 +1,74 @@
<?php
declare(strict_types=1);
namespace App\Tests\Form;
use App\Form\AccommodationStep2Type;
use App\Form\Model\AccommodationBookingDto;
use PHPUnit\Framework\TestCase;
use Symfony\Component\Form\Forms;
class AccommodationStep2TypeTest extends TestCase
{
public function testChildrenLabelIsBuiltFromMaxAdolescentAgeOption(): void
{
$form = Forms::createFormFactoryBuilder()
->getFormFactory()
->create(AccommodationStep2Type::class, new AccommodationBookingDto(), [
'max_adolescent_age' => 15,
]);
self::assertSame(
'davon Kinder (415 Jahre)',
$form->get('childrenCount')->getConfig()->getOption('label'),
);
}
public function testBlankOptionalChildCountersAreNormalizedToZero(): void
{
$dto = new AccommodationBookingDto();
$form = Forms::createFormFactoryBuilder()
->getFormFactory()
->create(AccommodationStep2Type::class, $dto);
$form->submit([
'paxCount' => '2',
'minorsCount' => '',
'childrenCount' => '',
'selectedBoardServiceId' => '',
'selectedAdditionalServiceIds' => [],
]);
self::assertTrue($form->isSynchronized());
self::assertSame(0, $dto->minorsCount);
self::assertSame(0, $dto->childrenCount);
}
public function testGroupedAdditionalServiceValuesCanSubmitUnderSelectionGroupKeys(): void
{
$dto = new AccommodationBookingDto();
$form = Forms::createFormFactoryBuilder()
->getFormFactory()
->create(AccommodationStep2Type::class, $dto, [
'additional_service_choices' => [
'Ski service' => 101,
'Board service' => 202,
],
]);
$form->submit([
'paxCount' => '2',
'minorsCount' => '0',
'childrenCount' => '0',
'selectedBoardServiceId' => '',
'selectedAdditionalServiceIds' => [
'Ski extras' => '101',
'Board extras' => '202',
],
]);
self::assertTrue($form->isSynchronized());
self::assertSame([101, 202], array_values($dto->selectedAdditionalServiceIds));
}
}