feat: refactor participant card DTOs and labels
This commit is contained in:
@@ -12,6 +12,7 @@ use App\Form\Model\ParticipantDto;
|
||||
use App\Form\Service\ParticipantFieldOptionsProvider;
|
||||
use App\Service\BookingPriceCalculatorService;
|
||||
use App\Service\InsuranceService;
|
||||
use App\Service\ServiceLabelFormatter;
|
||||
use App\Service\ServiceAvailabilityCalculator;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Symfony\Contracts\Translation\TranslatorInterface;
|
||||
@@ -30,12 +31,14 @@ class ParticipantFieldOptionsProviderMandatoryServiceTest extends TestCase
|
||||
$serviceAvailabilityCalculator = $this->createMock(ServiceAvailabilityCalculator::class);
|
||||
$insuranceService = $this->createMock(InsuranceService::class);
|
||||
$priceCalculatorService = $this->createMock(BookingPriceCalculatorService::class);
|
||||
$serviceLabelFormatter = new ServiceLabelFormatter();
|
||||
$translator = $this->createMock(TranslatorInterface::class);
|
||||
|
||||
$this->provider = new ParticipantFieldOptionsProvider(
|
||||
$serviceAvailabilityCalculator,
|
||||
$insuranceService,
|
||||
$priceCalculatorService,
|
||||
$serviceLabelFormatter,
|
||||
$translator
|
||||
);
|
||||
}
|
||||
@@ -110,6 +113,28 @@ class ParticipantFieldOptionsProviderMandatoryServiceTest extends TestCase
|
||||
$this->assertArrayNotHasKey('checked', $attributes);
|
||||
}
|
||||
|
||||
public function testParkingLabelIncludesPrice(): void
|
||||
{
|
||||
$parkingService = new Service();
|
||||
$parkingService->id = 3;
|
||||
$parkingService->label = 'Parkplatz';
|
||||
$parkingService->subType = Constants::TOKEN_PARKING;
|
||||
$parkingService->available = 10;
|
||||
$parkingService->price = 12.5;
|
||||
|
||||
$travel = $this->createTravelWithAdditionalServices([$parkingService]);
|
||||
$bookingDto = new BookingDto($travel, 1);
|
||||
|
||||
$participant = new ParticipantDto();
|
||||
$participant->index = 0;
|
||||
$participant->dateOfBirth = $travel->dateFrom->modify('-25 years');
|
||||
$bookingDto->participants[0] = $participant;
|
||||
|
||||
$options = $this->provider->getFieldOptions('parking', $bookingDto, 0);
|
||||
|
||||
$this->assertSame('Parkplatz (€12,50)', $options['label']);
|
||||
}
|
||||
|
||||
public function testNullParticipantReturnsEmptyOptions(): void
|
||||
{
|
||||
$mandatoryService = $this->createMandatoryService(1, 'Ortstaxe');
|
||||
|
||||
Reference in New Issue
Block a user