fix: enable bookings without ski passes

This commit is contained in:
Björn Fromme
2026-08-11 11:16:11 +02:00
parent 6c1073e41c
commit af04ff690d
10 changed files with 480 additions and 124 deletions
@@ -9,7 +9,9 @@ use App\BusProNet\Model\Travel;
use App\Form\Model\BookingDto;
use App\Form\Model\ParticipantDto;
use App\Form\Service\CreateFieldStateProvider;
use App\Form\Service\ServiceAgeEvaluator;
use App\Service\ParticipantEligibilityChecker;
use App\Service\ServiceAvailabilityCalculator;
use PHPUnit\Framework\TestCase;
/**
@@ -24,7 +26,10 @@ class CreateFieldStateProviderTest extends TestCase
protected function setUp(): void
{
$this->provider = new CreateFieldStateProvider(new ParticipantEligibilityChecker());
$this->provider = new CreateFieldStateProvider(new ParticipantEligibilityChecker(
new ServiceAgeEvaluator(),
new ServiceAvailabilityCalculator()
));
}
public function testDependentInsuranceFieldHidesWhenApplicantSelectsFamilyInsuranceThenReappearsAfterSwitch(): void
@@ -134,6 +134,17 @@ class ParticipantFieldOptionsProviderSkiPassAvailabilityTest extends TestCase
}
}
public function testTravelWithoutSkiPassesRendersNoField(): void
{
$bookingDto = $this->createBookingDto([]);
$this->assertSame(
[],
$this->provider->getFieldOptions('skiPass', $bookingDto, 0),
'The field has to be absent entirely, not rendered with an empty choice list'
);
}
/** @return int[] */
private function getSkiPassChoiceIds(BookingDto $bookingDto): array
{