feat: replace *Service suffix with role-based class names
This commit is contained in:
@@ -107,21 +107,21 @@ services:
|
||||
arguments:
|
||||
$path: '%path_to_keys%'
|
||||
|
||||
App\Service\TravelSnapshotService:
|
||||
App\Service\TravelSnapshotManager:
|
||||
arguments:
|
||||
$retentionBufferDays: '%travel_snapshot_retention_buffer_days%'
|
||||
|
||||
App\Service\TravelDataService:
|
||||
App\Service\TravelDataProvider:
|
||||
arguments:
|
||||
$logger: '@monolog.logger.core'
|
||||
$preferRemote: '%env(bool:APP_TRAVEL_PREFER_REMOTE)%'
|
||||
$enableFallback: '%env(bool:APP_TRAVEL_ENABLE_FALLBACK)%'
|
||||
|
||||
App\Service\BookingEditDataLoaderService:
|
||||
App\Service\BookingEditDataLoader:
|
||||
arguments:
|
||||
$bpnCache: '@bpn.cache'
|
||||
|
||||
App\Service\VoucherValidationService:
|
||||
App\Service\VoucherValidator:
|
||||
arguments:
|
||||
$cache: '@cache.app'
|
||||
$logger: '@monolog.logger.bpn'
|
||||
@@ -169,7 +169,7 @@ services:
|
||||
$rules:
|
||||
- '@App\BusProNet\Service\StatusRule\ChaperonServiceStatusRule'
|
||||
|
||||
App\Service\CmsDataService:
|
||||
App\Service\CmsDataProvider:
|
||||
arguments:
|
||||
$httpClient: '@typo3.client'
|
||||
$apiKey: 'AbcAbc123'# dummy key, not yet implemented
|
||||
@@ -178,7 +178,7 @@ services:
|
||||
tags:
|
||||
- { name: monolog.processor }
|
||||
|
||||
App\Service\NewsletterDoubleOptInService:
|
||||
App\Service\NewsletterManager:
|
||||
arguments:
|
||||
$newsletterConfirmationTtlHours: '%newsletter_confirmation_ttl_hours%'
|
||||
|
||||
|
||||
@@ -12,8 +12,8 @@ use App\Form\Model\BankAccountDto;
|
||||
use App\Form\Model\BookingDto;
|
||||
use App\Form\Model\ParticipantDto;
|
||||
use App\Form\Model\RoomSelectionDto;
|
||||
use App\Service\BookingPriceCalculatorService;
|
||||
use App\Service\InsuranceService;
|
||||
use App\Service\BookingPriceCalculator;
|
||||
use App\Service\InsuranceManager;
|
||||
|
||||
/**
|
||||
* Processes booking form data and converts it into BusProNet API payload format.
|
||||
@@ -25,8 +25,8 @@ use App\Service\InsuranceService;
|
||||
class BookingDataProcessor
|
||||
{
|
||||
public function __construct(
|
||||
private readonly InsuranceService $insuranceService,
|
||||
private readonly BookingPriceCalculatorService $priceCalculatorService,
|
||||
private readonly InsuranceManager $insuranceService,
|
||||
private readonly BookingPriceCalculator $priceCalculatorService,
|
||||
private readonly ServiceMappingCollector $mappingCollector,
|
||||
private readonly ParticipantServiceProcessor $serviceProcessor,
|
||||
private readonly BookingPayloadBuilder $payloadBuilder,
|
||||
@@ -388,7 +388,7 @@ class BookingDataProcessor
|
||||
$participantPrices[$index] = $this->priceCalculatorService->calculateIndividualParticipantPriceExcludingInsurance($bookingDto, $index);
|
||||
}
|
||||
|
||||
// Use InsuranceService for proper type-based assignment with price tier matching
|
||||
// Use InsuranceManager for proper type-based assignment with price tier matching
|
||||
$assignments = $this->insuranceService->batchAssignInsuranceToParticipants(
|
||||
$selectableInsurances,
|
||||
$applicant->insurance,
|
||||
|
||||
@@ -5,7 +5,7 @@ declare(strict_types=1);
|
||||
namespace App\Command;
|
||||
|
||||
use App\BusProNet\XmlLoader\TravelLoader;
|
||||
use App\Service\TravelSnapshotService;
|
||||
use App\Service\TravelSnapshotManager;
|
||||
use Psr\Log\LoggerInterface;
|
||||
use Symfony\Component\Console\Attribute\AsCommand;
|
||||
use Symfony\Component\Console\Command\Command;
|
||||
@@ -30,7 +30,7 @@ class BpnRefreshTravelSnapshotCommand extends Command
|
||||
use LockableTrait;
|
||||
|
||||
public function __construct(
|
||||
private readonly TravelSnapshotService $snapshotService,
|
||||
private readonly TravelSnapshotManager $snapshotService,
|
||||
private readonly LoggerInterface $logger,
|
||||
private readonly TravelLoader $travelLoader,
|
||||
) {
|
||||
|
||||
@@ -6,8 +6,8 @@ namespace App\Command;
|
||||
|
||||
use App\BusProNet\Model\XmlExportInfo;
|
||||
use App\BusProNet\XmlLoader\TravelLoader;
|
||||
use App\Service\TravelDataService;
|
||||
use App\Service\TravelSnapshotService;
|
||||
use App\Service\TravelDataProvider;
|
||||
use App\Service\TravelSnapshotManager;
|
||||
use League\Flysystem\FilesystemException;
|
||||
use League\Flysystem\FilesystemOperator;
|
||||
use League\Flysystem\StorageAttributes;
|
||||
@@ -41,8 +41,8 @@ class BpnXmlSyncCommand extends Command
|
||||
private readonly CacheInterface $cache,
|
||||
private readonly LoggerInterface $logger,
|
||||
private readonly TravelLoader $travelLoader,
|
||||
private readonly TravelDataService $travelDataService,
|
||||
private readonly TravelSnapshotService $snapshotService,
|
||||
private readonly TravelDataProvider $travelDataService,
|
||||
private readonly TravelSnapshotManager $snapshotService,
|
||||
) {
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ namespace App\Command;
|
||||
|
||||
use App\BusProNet\Model\Booking;
|
||||
use App\Repository\BookingEditDraftRepository;
|
||||
use App\Service\BookingEditDataLoaderService;
|
||||
use App\Service\BookingEditDataLoader;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Symfony\Component\Console\Attribute\AsCommand;
|
||||
use Symfony\Component\Console\Command\Command;
|
||||
@@ -23,7 +23,7 @@ class DraftBackfillBookingNumberCommand extends Command
|
||||
{
|
||||
public function __construct(
|
||||
private readonly BookingEditDraftRepository $draftRepository,
|
||||
private readonly BookingEditDataLoaderService $dataLoader,
|
||||
private readonly BookingEditDataLoader $dataLoader,
|
||||
private readonly EntityManagerInterface $entityManager,
|
||||
) {
|
||||
parent::__construct();
|
||||
|
||||
@@ -13,10 +13,10 @@ use App\Exception\NewsletterProviderException;
|
||||
use App\Form\PersonalDataType;
|
||||
use App\Repository\NewsletterOptInConfirmationRepository;
|
||||
use App\Security\Crypt;
|
||||
use App\Service\BookingEditDataLoaderService;
|
||||
use App\Service\BookingEditDataLoader;
|
||||
use App\Service\ProfileCompletenessChecker;
|
||||
use App\Service\MailjetNewsletterService;
|
||||
use App\Service\NewsletterDoubleOptInService;
|
||||
use App\Service\MailjetApiClient;
|
||||
use App\Service\NewsletterManager;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Psr\Log\LoggerInterface;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
@@ -39,7 +39,7 @@ class PersonalDataController extends AbstractController
|
||||
/**
|
||||
* @param ApiClient $apiClient BusProNet API client for data operations
|
||||
* @param Crypt $crypt Encryption service for password handling
|
||||
* @param BookingEditDataLoaderService $dataLoader Data loader for cache invalidation
|
||||
* @param BookingEditDataLoader $dataLoader Data loader for cache invalidation
|
||||
* @param ProfileCompletenessChecker $completenessChecker Profile validation service
|
||||
* @param EntityManagerInterface $entityManager Entity manager for persisting user changes
|
||||
* @param LoggerInterface $logger Logger for audit trails and debugging
|
||||
@@ -47,11 +47,11 @@ class PersonalDataController extends AbstractController
|
||||
public function __construct(
|
||||
private readonly ApiClient $apiClient,
|
||||
private readonly Crypt $crypt,
|
||||
private readonly BookingEditDataLoaderService $dataLoader,
|
||||
private readonly BookingEditDataLoader $dataLoader,
|
||||
private readonly ProfileCompletenessChecker $completenessChecker,
|
||||
private readonly EntityManagerInterface $entityManager,
|
||||
private readonly MailjetNewsletterService $newsletterService,
|
||||
private readonly NewsletterDoubleOptInService $doubleOptInService,
|
||||
private readonly MailjetApiClient $newsletterService,
|
||||
private readonly NewsletterManager $doubleOptInService,
|
||||
private readonly NewsletterOptInConfirmationRepository $newsletterConfirmationRepository,
|
||||
private readonly LoggerInterface $logger,
|
||||
) {
|
||||
|
||||
@@ -7,7 +7,7 @@ namespace App\Controller\Admin;
|
||||
use App\Admin\Field\JsonDataField;
|
||||
use App\Entity\BookingEditDraft;
|
||||
use App\Entity\User;
|
||||
use App\Service\BookingExportService;
|
||||
use App\Service\BookingExporter;
|
||||
use EasyCorp\Bundle\EasyAdminBundle\Config\Action;
|
||||
use EasyCorp\Bundle\EasyAdminBundle\Config\Actions;
|
||||
use EasyCorp\Bundle\EasyAdminBundle\Config\Crud;
|
||||
@@ -22,7 +22,7 @@ use Symfony\Component\Routing\Attribute\Route;
|
||||
class BookingEditDraftCrudController extends AbstractCrudController
|
||||
{
|
||||
public function __construct(
|
||||
private readonly BookingExportService $exportService,
|
||||
private readonly BookingExporter $exportService,
|
||||
private readonly AdminUrlGenerator $adminUrlGenerator,
|
||||
) {
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@ namespace App\Controller\Admin;
|
||||
use App\Admin\Field\JsonDataField;
|
||||
use App\Entity\LogEntry;
|
||||
use App\Repository\LogEntryRepository;
|
||||
use App\Service\XmlDumpService;
|
||||
use App\Service\XmlDumpReader;
|
||||
use EasyCorp\Bundle\EasyAdminBundle\Config\Action;
|
||||
use EasyCorp\Bundle\EasyAdminBundle\Config\Actions;
|
||||
use EasyCorp\Bundle\EasyAdminBundle\Config\Crud;
|
||||
@@ -70,7 +70,7 @@ class LogEntryCrudController extends AbstractCrudController
|
||||
yield JsonDataField::new('extra', 'Extra')->onlyOnDetail();
|
||||
}
|
||||
|
||||
public function xmlDumps(Request $request, XmlDumpService $xmlDumpService): Response
|
||||
public function xmlDumps(Request $request, XmlDumpReader $xmlDumpService): Response
|
||||
{
|
||||
$entityId = $request->query->getInt('entityId');
|
||||
if ($entityId <= 0) {
|
||||
|
||||
@@ -5,7 +5,7 @@ declare(strict_types=1);
|
||||
namespace App\Controller\Admin;
|
||||
|
||||
use App\Repository\LogEntryRepository;
|
||||
use App\Service\XmlDumpService;
|
||||
use App\Service\XmlDumpReader;
|
||||
use League\Flysystem\FilesystemException;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
@@ -19,7 +19,7 @@ use Symfony\Component\Security\Http\Attribute\IsGranted;
|
||||
class XmlDumpController extends AbstractController
|
||||
{
|
||||
public function __construct(
|
||||
private readonly XmlDumpService $xmlDumpService,
|
||||
private readonly XmlDumpReader $xmlDumpService,
|
||||
private readonly LogEntryRepository $logEntryRepository,
|
||||
) {
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ use App\BusProNet\ApiClient;
|
||||
use App\BusProNet\Exception\ApiClientException;
|
||||
use App\BusProNet\Model\Travel;
|
||||
use App\BusProNet\Utility\DateCodeUtility;
|
||||
use App\Service\TravelDataService;
|
||||
use App\Service\TravelDataProvider;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\HttpFoundation\JsonResponse;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
@@ -21,7 +21,7 @@ class TravelController extends AbstractController
|
||||
{
|
||||
public function __construct(
|
||||
private readonly ApiClient $apiClient,
|
||||
private readonly TravelDataService $travelDataService,
|
||||
private readonly TravelDataProvider $travelDataService,
|
||||
) {
|
||||
}
|
||||
|
||||
|
||||
@@ -11,9 +11,9 @@ use App\Exception\NoRoomsAvailableException;
|
||||
use App\Exception\TravelNotFoundException;
|
||||
use App\Htmx\HxTrait;
|
||||
use App\Model\BookingQueryParams;
|
||||
use App\Service\BookingService;
|
||||
use App\Service\BookingSessionService;
|
||||
use App\Service\BookingSummaryDataService;
|
||||
use App\Service\BookingConfigurator;
|
||||
use App\Service\BookingSessionStore;
|
||||
use App\Service\BookingSummaryAssembler;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
@@ -32,10 +32,10 @@ class IndexController extends AbstractController
|
||||
use HxTrait;
|
||||
|
||||
public function __construct(
|
||||
private readonly BookingService $bookingService,
|
||||
private readonly BookingSessionService $bookingSessionService,
|
||||
private readonly BookingConfigurator $bookingService,
|
||||
private readonly BookingSessionStore $bookingSessionService,
|
||||
private readonly AgencyLoader $agencyLoader,
|
||||
private readonly BookingSummaryDataService $summaryDataService,
|
||||
private readonly BookingSummaryAssembler $summaryDataService,
|
||||
) {
|
||||
}
|
||||
|
||||
|
||||
@@ -10,8 +10,8 @@ use App\Form\BookingCreateStep1Type;
|
||||
use App\Form\Model\BookingDto;
|
||||
use App\Htmx\HxTrait;
|
||||
use App\Service\BookingCreateContextFactory;
|
||||
use App\Service\BookingService;
|
||||
use App\Service\BookingSessionService;
|
||||
use App\Service\BookingConfigurator;
|
||||
use App\Service\BookingSessionStore;
|
||||
use App\Service\RoomPricingCalculator;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
@@ -31,8 +31,8 @@ class Step1Controller extends AbstractController
|
||||
use HxTrait;
|
||||
|
||||
public function __construct(
|
||||
private readonly BookingService $bookingService,
|
||||
private readonly BookingSessionService $bookingSessionService,
|
||||
private readonly BookingConfigurator $bookingService,
|
||||
private readonly BookingSessionStore $bookingSessionService,
|
||||
private readonly BookingCreateContextFactory $createContextFactory,
|
||||
) {
|
||||
}
|
||||
|
||||
@@ -8,11 +8,11 @@ use App\Form\BookingParticipantType;
|
||||
use App\Form\Model\BookingDto;
|
||||
use App\Htmx\HxTrait;
|
||||
use App\Service\BookingCreateContextFactory;
|
||||
use App\Service\BookingService;
|
||||
use App\Service\BookingSessionService;
|
||||
use App\Service\ParticipantFormSupportService;
|
||||
use App\Service\ParticipantPrepopulationService;
|
||||
use App\Service\TravelDataService;
|
||||
use App\Service\BookingConfigurator;
|
||||
use App\Service\BookingSessionStore;
|
||||
use App\Service\ParticipantFormSupport;
|
||||
use App\Service\ParticipantDataPrefiller;
|
||||
use App\Service\TravelDataProvider;
|
||||
use App\Service\RoomPricingCalculator;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\Form\FormInterface;
|
||||
@@ -28,12 +28,12 @@ class Step2ParticipantController extends AbstractController
|
||||
use HxTrait;
|
||||
|
||||
public function __construct(
|
||||
private readonly BookingService $bookingService,
|
||||
private readonly BookingSessionService $bookingSessionService,
|
||||
private readonly BookingConfigurator $bookingService,
|
||||
private readonly BookingSessionStore $bookingSessionService,
|
||||
private readonly BookingCreateContextFactory $createContextFactory,
|
||||
private readonly TravelDataService $travelDataService,
|
||||
private readonly ParticipantPrepopulationService $prepopulationService,
|
||||
private readonly ParticipantFormSupportService $participantFormSupportService,
|
||||
private readonly TravelDataProvider $travelDataService,
|
||||
private readonly ParticipantDataPrefiller $prepopulationService,
|
||||
private readonly ParticipantFormSupport $participantFormSupportService,
|
||||
) {
|
||||
}
|
||||
|
||||
|
||||
@@ -14,10 +14,10 @@ use App\Form\BookingCreateStep3Type;
|
||||
use App\Form\Model\BookingDto;
|
||||
use App\Htmx\HxTrait;
|
||||
use App\Service\BookingCreateContextFactory;
|
||||
use App\Service\BookingPriceCalculatorService;
|
||||
use App\Service\BookingPriceMismatchDiagnosticsService;
|
||||
use App\Service\BookingService;
|
||||
use App\Service\BookingSessionService;
|
||||
use App\Service\BookingPriceCalculator;
|
||||
use App\Service\BookingPriceMismatchAnalyzer;
|
||||
use App\Service\BookingConfigurator;
|
||||
use App\Service\BookingSessionStore;
|
||||
use App\Service\RoomPricingCalculator;
|
||||
use Psr\Log\LoggerInterface;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
@@ -36,11 +36,11 @@ class Step3Controller extends AbstractController
|
||||
use HxTrait;
|
||||
|
||||
public function __construct(
|
||||
private readonly BookingService $bookingService,
|
||||
private readonly BookingSessionService $bookingSessionService,
|
||||
private readonly BookingConfigurator $bookingService,
|
||||
private readonly BookingSessionStore $bookingSessionService,
|
||||
private readonly BookingCreateContextFactory $createContextFactory,
|
||||
private readonly BookingPriceCalculatorService $priceCalculator,
|
||||
private readonly BookingPriceMismatchDiagnosticsService $priceMismatchDiagnostics,
|
||||
private readonly BookingPriceCalculator $priceCalculator,
|
||||
private readonly BookingPriceMismatchAnalyzer $priceMismatchDiagnostics,
|
||||
private readonly ApiClient $apiClient,
|
||||
private readonly LoggerInterface $logger,
|
||||
) {
|
||||
|
||||
@@ -15,11 +15,11 @@ use App\Form\Model\BookingDto;
|
||||
use App\Htmx\HxTrait;
|
||||
use App\Entity\User;
|
||||
use App\Service\BookingCreateContextFactory;
|
||||
use App\Service\BookingPriceCalculatorService;
|
||||
use App\Service\BookingService;
|
||||
use App\Service\BookingSessionService;
|
||||
use App\Service\MailjetNewsletterService;
|
||||
use App\Service\NewsletterDoubleOptInService;
|
||||
use App\Service\BookingPriceCalculator;
|
||||
use App\Service\BookingConfigurator;
|
||||
use App\Service\BookingSessionStore;
|
||||
use App\Service\MailjetApiClient;
|
||||
use App\Service\NewsletterManager;
|
||||
use Psr\Log\LoggerInterface;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\Form\FormInterface;
|
||||
@@ -38,14 +38,14 @@ class Step4Controller extends AbstractController
|
||||
use HxTrait;
|
||||
|
||||
public function __construct(
|
||||
private readonly BookingService $bookingService,
|
||||
private readonly BookingSessionService $bookingSessionService,
|
||||
private readonly BookingConfigurator $bookingService,
|
||||
private readonly BookingSessionStore $bookingSessionService,
|
||||
private readonly BookingCreateContextFactory $createContextFactory,
|
||||
private readonly BookingPriceCalculatorService $priceCalculator,
|
||||
private readonly BookingPriceCalculator $priceCalculator,
|
||||
private readonly ApiClient $apiClient,
|
||||
private readonly CacheInterface $cache,
|
||||
private readonly MailjetNewsletterService $newsletterService,
|
||||
private readonly NewsletterDoubleOptInService $doubleOptInService,
|
||||
private readonly MailjetApiClient $newsletterService,
|
||||
private readonly NewsletterManager $doubleOptInService,
|
||||
private readonly LoggerInterface $logger,
|
||||
) {
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace App\Controller\Booking\Create;
|
||||
|
||||
use App\Service\BookingSessionService;
|
||||
use App\Service\BookingSessionStore;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
@@ -16,7 +16,7 @@ use Symfony\Component\Routing\Attribute\Route;
|
||||
class SuccessController extends AbstractController
|
||||
{
|
||||
public function __construct(
|
||||
private readonly BookingSessionService $bookingSessionService,
|
||||
private readonly BookingSessionStore $bookingSessionService,
|
||||
) {
|
||||
}
|
||||
|
||||
|
||||
@@ -11,12 +11,12 @@ use App\Exception\TravelNotFoundException;
|
||||
use App\Form\BookingEditType;
|
||||
use App\Form\Model\BookingDto;
|
||||
use App\Htmx\HxTrait;
|
||||
use App\Service\BookingEditDataLoaderService;
|
||||
use App\Service\BookingEditDraftService;
|
||||
use App\Service\BookingEditDataLoader;
|
||||
use App\Service\BookingEditDraftManager;
|
||||
use App\Service\BookingEditContextFactory;
|
||||
use App\Service\BookingFingerprintService;
|
||||
use App\Service\BookingEditSubmitService;
|
||||
use App\Service\BookingSessionService;
|
||||
use App\Service\BookingChangeTracker;
|
||||
use App\Service\BookingEditSubmitter;
|
||||
use App\Service\BookingSessionStore;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
@@ -30,7 +30,7 @@ use Symfony\Component\Security\Http\Attribute\IsGranted;
|
||||
* - Card overview with lazy-loaded individual participant forms
|
||||
* - Handles canceled participants (status 'S')
|
||||
* - Applies mutability constraints via EditFieldStateProvider
|
||||
* - Final submission is delegated to BookingEditSubmitService
|
||||
* - Final submission is delegated to BookingEditSubmitter
|
||||
*/
|
||||
class IndexController extends AbstractController
|
||||
{
|
||||
@@ -38,12 +38,12 @@ class IndexController extends AbstractController
|
||||
use HxTrait;
|
||||
|
||||
public function __construct(
|
||||
private readonly BookingEditDataLoaderService $dataLoader,
|
||||
private readonly BookingEditDraftService $draftService,
|
||||
private readonly BookingSessionService $bookingSessionService,
|
||||
private readonly BookingFingerprintService $fingerprintService,
|
||||
private readonly BookingEditDataLoader $dataLoader,
|
||||
private readonly BookingEditDraftManager $draftService,
|
||||
private readonly BookingSessionStore $bookingSessionService,
|
||||
private readonly BookingChangeTracker $fingerprintService,
|
||||
private readonly BookingEditContextFactory $editContextFactory,
|
||||
private readonly BookingEditSubmitService $submitService,
|
||||
private readonly BookingEditSubmitter $submitService,
|
||||
) {
|
||||
}
|
||||
|
||||
|
||||
@@ -10,11 +10,11 @@ use App\Entity\User;
|
||||
use App\Form\BookingParticipantType;
|
||||
use App\Form\Model\BookingDto;
|
||||
use App\Htmx\HxTrait;
|
||||
use App\Service\BookingEditDataLoaderService;
|
||||
use App\Service\BookingEditDataLoader;
|
||||
use App\Service\BookingEditContextFactory;
|
||||
use App\Service\BookingEditDraftService;
|
||||
use App\Service\BookingSessionService;
|
||||
use App\Service\ParticipantFormSupportService;
|
||||
use App\Service\BookingEditDraftManager;
|
||||
use App\Service\BookingSessionStore;
|
||||
use App\Service\ParticipantFormSupport;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
@@ -29,11 +29,11 @@ class ParticipantController extends AbstractController
|
||||
use HxTrait;
|
||||
|
||||
public function __construct(
|
||||
private readonly BookingEditDataLoaderService $dataLoader,
|
||||
private readonly BookingEditDraftService $draftService,
|
||||
private readonly BookingEditDataLoader $dataLoader,
|
||||
private readonly BookingEditDraftManager $draftService,
|
||||
private readonly BookingEditContextFactory $editContextFactory,
|
||||
private readonly BookingSessionService $bookingSessionService,
|
||||
private readonly ParticipantFormSupportService $participantFormSupportService,
|
||||
private readonly BookingSessionStore $bookingSessionService,
|
||||
private readonly ParticipantFormSupport $participantFormSupportService,
|
||||
) {
|
||||
}
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ use App\Exception\HotelNotInTravelException;
|
||||
use App\Exception\NoRoomsAvailableException;
|
||||
use App\Exception\TravelNotFoundException;
|
||||
use App\Form\Model\BookingDto;
|
||||
use App\Service\BookingSessionService;
|
||||
use App\Service\BookingSessionStore;
|
||||
use Symfony\Component\HttpFoundation\RedirectResponse;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
@@ -29,7 +29,7 @@ trait BookingExceptionHandlerTrait
|
||||
* Handles all booking-related exceptions and provides appropriate user feedback
|
||||
* by redirecting to the error page with flash messages.
|
||||
*/
|
||||
protected function getOrCreateBookingCreateDto(BookingSessionService $bookingSessionService, Request $request): BookingDto|RedirectResponse
|
||||
protected function getOrCreateBookingCreateDto(BookingSessionStore $bookingSessionService, Request $request): BookingDto|RedirectResponse
|
||||
{
|
||||
try {
|
||||
return $bookingSessionService->getOrCreateBookingCreateDto($request);
|
||||
@@ -62,7 +62,7 @@ trait BookingExceptionHandlerTrait
|
||||
* Returns empty 400 responses for HTMX requests when exceptions occur,
|
||||
* allowing the frontend to handle errors appropriately.
|
||||
*/
|
||||
protected function getOrCreateBookingCreateDtoForHtmx(BookingSessionService $bookingSessionService, Request $request): mixed
|
||||
protected function getOrCreateBookingCreateDtoForHtmx(BookingSessionStore $bookingSessionService, Request $request): mixed
|
||||
{
|
||||
try {
|
||||
return $bookingSessionService->getOrCreateBookingCreateDto($request);
|
||||
|
||||
@@ -6,7 +6,7 @@ namespace App\Controller\Newsletter;
|
||||
|
||||
use App\Exception\NewsletterProviderException;
|
||||
use App\Model\NewsletterConfirmationResult;
|
||||
use App\Service\NewsletterDoubleOptInService;
|
||||
use App\Service\NewsletterManager;
|
||||
use Psr\Log\LoggerInterface;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
@@ -16,7 +16,7 @@ use Symfony\Component\Security\Http\Attribute\IsGranted;
|
||||
class ConfirmController extends AbstractController
|
||||
{
|
||||
public function __construct(
|
||||
private readonly NewsletterDoubleOptInService $doubleOptInService,
|
||||
private readonly NewsletterManager $doubleOptInService,
|
||||
private readonly LoggerInterface $logger,
|
||||
) {
|
||||
}
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
|
||||
namespace App\Controller;
|
||||
|
||||
use App\Service\BookingSessionService;
|
||||
use App\Service\BookingSummaryDataService;
|
||||
use App\Service\BookingSessionStore;
|
||||
use App\Service\BookingSummaryAssembler;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
@@ -18,11 +18,11 @@ class SecurityController extends AbstractController
|
||||
public function login(
|
||||
AuthenticationUtils $authenticationUtils,
|
||||
Request $request,
|
||||
BookingSessionService $bookingSessionService,
|
||||
BookingSummaryDataService $summaryDataService,
|
||||
BookingSessionStore $bookingSessionService,
|
||||
BookingSummaryAssembler $summaryDataService,
|
||||
): Response {
|
||||
// Check if this is a booking flow (BookingDto exists in session)
|
||||
$bookingDto = $bookingSessionService->getBookingDto($request, BookingSessionService::BOOKING_CREATE_KEY);
|
||||
$bookingDto = $bookingSessionService->getBookingDto($request, BookingSessionStore::BOOKING_CREATE_KEY);
|
||||
$isBookingFlow = null !== $bookingDto;
|
||||
|
||||
// If authenticated and in booking flow, proceed to Step 1
|
||||
|
||||
@@ -331,7 +331,7 @@ class BookingDto
|
||||
*
|
||||
* Replaces the full Travel object with just its integer ID. The Booking's
|
||||
* travelData reference is also removed since it points to the same object.
|
||||
* BookingService::hydrate() restores the Travel from cache after session read.
|
||||
* BookingConfigurator::hydrate() restores the Travel from cache after session read.
|
||||
*
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
@@ -356,7 +356,7 @@ class BookingDto
|
||||
/**
|
||||
* Restores the DTO from session data with a minimal Travel placeholder.
|
||||
*
|
||||
* Creates a Travel object containing only the ID. BookingService::hydrate()
|
||||
* Creates a Travel object containing only the ID. BookingConfigurator::hydrate()
|
||||
* replaces this with the full Travel from cache on every session read.
|
||||
*
|
||||
* @param array<string, mixed> $data
|
||||
|
||||
@@ -6,7 +6,7 @@ namespace App\Form\Service\Condition;
|
||||
|
||||
use App\Form\Model\BookingDto;
|
||||
use App\Form\Service\Contract\FieldConditionInterface;
|
||||
use App\Service\ParticipantEligibilityService;
|
||||
use App\Service\ParticipantEligibilityChecker;
|
||||
|
||||
/**
|
||||
* Condition that evaluates whether a participant is eligible for booking.
|
||||
@@ -26,7 +26,7 @@ use App\Service\ParticipantEligibilityService;
|
||||
class BookingEligibilityCondition implements FieldConditionInterface
|
||||
{
|
||||
public function __construct(
|
||||
private readonly ParticipantEligibilityService $participantEligibilityService,
|
||||
private readonly ParticipantEligibilityChecker $participantEligibilityService,
|
||||
) {
|
||||
}
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@ use App\Form\Service\Condition\ServiceSubTypeCondition;
|
||||
use App\Form\Service\Condition\SingleRoomTypeCondition;
|
||||
use App\Form\Service\Condition\SkiPassSelectionCondition;
|
||||
use App\Form\Service\Condition\TravelStartCutoffReachedCondition;
|
||||
use App\Service\ParticipantEligibilityService;
|
||||
use App\Service\ParticipantEligibilityChecker;
|
||||
|
||||
/**
|
||||
* Field state provider for the booking create workflow.
|
||||
@@ -44,7 +44,7 @@ use App\Service\ParticipantEligibilityService;
|
||||
class CreateFieldStateProvider extends AbstractFieldStateProvider
|
||||
{
|
||||
public function __construct(
|
||||
private readonly ParticipantEligibilityService $participantEligibilityService,
|
||||
private readonly ParticipantEligibilityChecker $participantEligibilityService,
|
||||
) {
|
||||
parent::__construct();
|
||||
}
|
||||
@@ -317,7 +317,7 @@ class CreateFieldStateProvider extends AbstractFieldStateProvider
|
||||
|
||||
// Room assignment field:
|
||||
// - Hidden until date of birth is provided (age determines room eligibility, e.g., Baby rooms)
|
||||
// - Rendered as static text when only one room type is selected (auto-assigned by RoomAssignmentService)
|
||||
// - Rendered as static text when only one room type is selected (auto-assigned by RoomAssigner)
|
||||
$this->fieldStateConditions['assignedRoomId'] = [
|
||||
'hidden' => CompositeCondition::not($dateOfBirthProvidedCondition),
|
||||
'static_text' => new SingleRoomTypeCondition(),
|
||||
|
||||
@@ -14,8 +14,8 @@ use App\BusProNet\Utility\DirectionMapper;
|
||||
use App\Form\Model\BookingDto;
|
||||
use App\Form\Model\RoomSelectionDto;
|
||||
use App\Form\Service\Abstract\AbstractFieldOptionsProvider;
|
||||
use App\Service\BookingPriceCalculatorService;
|
||||
use App\Service\InsuranceService;
|
||||
use App\Service\BookingPriceCalculator;
|
||||
use App\Service\InsuranceManager;
|
||||
use App\Service\ServiceLabelFormatter;
|
||||
use App\Service\ServiceAvailabilityCalculator;
|
||||
use Symfony\Contracts\Translation\TranslatorInterface;
|
||||
@@ -41,8 +41,8 @@ class ParticipantFieldOptionsProvider extends AbstractFieldOptionsProvider
|
||||
{
|
||||
public function __construct(
|
||||
private readonly ServiceAvailabilityCalculator $serviceAvailabilityCalculator,
|
||||
private readonly InsuranceService $insuranceService,
|
||||
private readonly BookingPriceCalculatorService $priceCalculatorService,
|
||||
private readonly InsuranceManager $insuranceService,
|
||||
private readonly BookingPriceCalculator $priceCalculatorService,
|
||||
private readonly ServiceLabelFormatter $serviceLabelFormatter,
|
||||
private readonly TranslatorInterface $translator,
|
||||
) {
|
||||
@@ -1112,14 +1112,14 @@ class ParticipantFieldOptionsProvider extends AbstractFieldOptionsProvider
|
||||
/**
|
||||
* Gets the rental insurance description for help text.
|
||||
*/
|
||||
private function getRentalInsuranceDescription(array $rentalInsuranceServices): ?string
|
||||
private function getRentalInsuranceDescription(array $rentalInsuranceManagers): ?string
|
||||
{
|
||||
if (empty($rentalInsuranceServices)) {
|
||||
if (empty($rentalInsuranceManagers)) {
|
||||
return null;
|
||||
}
|
||||
$rentalInsuranceService = reset($rentalInsuranceServices); // Get the first (and only) rental insurance service
|
||||
$rentalInsuranceManager = reset($rentalInsuranceManagers); // Get the first (and only) rental insurance service
|
||||
|
||||
return $rentalInsuranceService->description;
|
||||
return $rentalInsuranceManager->description;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -7,8 +7,8 @@ namespace App\Form\Service;
|
||||
use App\BusProNet\Model\Insurance;
|
||||
use App\Form\Model\BookingDto;
|
||||
use App\Form\Service\Abstract\AbstractParticipantFieldHandler;
|
||||
use App\Service\BookingPriceCalculatorService;
|
||||
use App\Service\InsuranceService;
|
||||
use App\Service\BookingPriceCalculator;
|
||||
use App\Service\InsuranceManager;
|
||||
|
||||
/**
|
||||
* Handles processing of the insurance field for booking participants.
|
||||
@@ -35,8 +35,8 @@ use App\Service\InsuranceService;
|
||||
class ParticipantInsuranceFieldHandler extends AbstractParticipantFieldHandler
|
||||
{
|
||||
public function __construct(
|
||||
private readonly InsuranceService $insuranceService,
|
||||
private readonly BookingPriceCalculatorService $priceCalculatorService,
|
||||
private readonly InsuranceManager $insuranceService,
|
||||
private readonly BookingPriceCalculator $priceCalculatorService,
|
||||
) {
|
||||
}
|
||||
|
||||
|
||||
@@ -6,8 +6,8 @@ namespace App\Form\Service;
|
||||
|
||||
use App\Form\Model\BookingDto;
|
||||
use App\Form\Service\Abstract\AbstractParticipantFieldHandler;
|
||||
use App\Service\BookingPriceCalculatorService;
|
||||
use App\Service\VoucherValidationService;
|
||||
use App\Service\BookingPriceCalculator;
|
||||
use App\Service\VoucherValidator;
|
||||
|
||||
/**
|
||||
* Handles promotional voucher code field processing.
|
||||
@@ -22,8 +22,8 @@ use App\Service\VoucherValidationService;
|
||||
class ParticipantPromoVoucherFieldHandler extends AbstractParticipantFieldHandler
|
||||
{
|
||||
public function __construct(
|
||||
private readonly VoucherValidationService $voucherValidationService,
|
||||
private readonly BookingPriceCalculatorService $priceCalculatorService,
|
||||
private readonly VoucherValidator $voucherValidationService,
|
||||
private readonly BookingPriceCalculator $priceCalculatorService,
|
||||
) {
|
||||
}
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ namespace App\Form\Service;
|
||||
|
||||
use App\Form\Model\BookingDto;
|
||||
use App\Form\Service\Abstract\AbstractParticipantFieldHandler;
|
||||
use App\Service\VoucherValidationService;
|
||||
use App\Service\VoucherValidator;
|
||||
|
||||
/**
|
||||
* Handles purchase voucher code field processing.
|
||||
@@ -20,7 +20,7 @@ use App\Service\VoucherValidationService;
|
||||
class ParticipantPurchaseVoucherFieldHandler extends AbstractParticipantFieldHandler
|
||||
{
|
||||
public function __construct(
|
||||
private readonly VoucherValidationService $voucherValidationService,
|
||||
private readonly VoucherValidator $voucherValidationService,
|
||||
) {
|
||||
}
|
||||
|
||||
|
||||
@@ -107,7 +107,7 @@ class ParticipantRentalInsuranceFieldHandler extends AbstractParticipantFieldHan
|
||||
|
||||
// Store service object based on checkbox state for pricing calculations
|
||||
if (true === $isRentalInsuranceSelected) {
|
||||
$participant->rentalInsurance = $this->findRentalInsuranceService($bookingDto, $participantIndex);
|
||||
$participant->rentalInsurance = $this->findRentalInsuranceManager($bookingDto, $participantIndex);
|
||||
} else {
|
||||
$participant->rentalInsurance = null;
|
||||
}
|
||||
@@ -124,20 +124,20 @@ class ParticipantRentalInsuranceFieldHandler extends AbstractParticipantFieldHan
|
||||
*
|
||||
* @return Service|null The rental insurance service object, or null if not found
|
||||
*/
|
||||
private function findRentalInsuranceService(BookingDto $bookingDto, int $participantIndex): ?Service
|
||||
private function findRentalInsuranceManager(BookingDto $bookingDto, int $participantIndex): ?Service
|
||||
{
|
||||
// Get available rental insurance services (includes booked insurance in edit mode)
|
||||
$rentalInsuranceServices = $this->getAvailableServicesWithBooked(
|
||||
$rentalInsuranceManagers = $this->getAvailableServicesWithBooked(
|
||||
$bookingDto,
|
||||
$participantIndex,
|
||||
Constants::TOKEN_RENTAL_INSURANCE,
|
||||
true
|
||||
);
|
||||
|
||||
if (empty($rentalInsuranceServices)) {
|
||||
if (empty($rentalInsuranceManagers)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return reset($rentalInsuranceServices); // Get the first (and typically only) rental insurance service
|
||||
return reset($rentalInsuranceManagers); // Get the first (and typically only) rental insurance service
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace App\Logger;
|
||||
|
||||
use App\Service\ErrorCodeService;
|
||||
use App\Service\ErrorCodeGenerator;
|
||||
use Monolog\Attribute\AsMonologProcessor;
|
||||
use Monolog\Level;
|
||||
use Monolog\LogRecord;
|
||||
@@ -20,7 +20,7 @@ use Monolog\LogRecord;
|
||||
class ErrorCodeProcessor
|
||||
{
|
||||
public function __construct(
|
||||
private readonly ErrorCodeService $errorCodeService,
|
||||
private readonly ErrorCodeGenerator $errorCodeService,
|
||||
) {
|
||||
}
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@ use App\Form\Model\ParticipantDto;
|
||||
* Used by EditController to determine if user modifications need to be saved.
|
||||
* Also provides data extraction for draft persistence.
|
||||
*/
|
||||
class BookingFingerprintService
|
||||
class BookingChangeTracker
|
||||
{
|
||||
/**
|
||||
* Generates a fingerprint (hash) of all mutable booking data.
|
||||
@@ -19,12 +19,12 @@ use Symfony\Component\DependencyInjection\Attribute\Autowire;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
||||
|
||||
class BookingService
|
||||
class BookingConfigurator
|
||||
{
|
||||
public function __construct(
|
||||
private readonly BookingSessionService $bookingSessionService,
|
||||
private readonly TravelDataService $travelDataService,
|
||||
private readonly ParticipantEligibilityService $participantEligibilityService,
|
||||
private readonly BookingSessionStore $bookingSessionService,
|
||||
private readonly TravelDataProvider $travelDataService,
|
||||
private readonly ParticipantEligibilityChecker $participantEligibilityService,
|
||||
private readonly BookingStatusRuleRegistry $bookingStatusRuleRegistry,
|
||||
private readonly AgencyLoader $agencyLoader,
|
||||
#[Autowire('%default_booking_status%')]
|
||||
@@ -16,9 +16,9 @@ use App\Form\Model\BookingMutabilityDto;
|
||||
class BookingEditContextFactory
|
||||
{
|
||||
public function __construct(
|
||||
private readonly ParticipantCardDataService $participantCardDataService,
|
||||
private readonly BookingSummaryDataService $summaryDataService,
|
||||
private readonly TravelDataService $travelDataService,
|
||||
private readonly ParticipantCardAssembler $participantCardDataService,
|
||||
private readonly BookingSummaryAssembler $summaryDataService,
|
||||
private readonly TravelDataProvider $travelDataService,
|
||||
) {
|
||||
}
|
||||
|
||||
|
||||
+5
-5
@@ -23,7 +23,7 @@ use Symfony\Contracts\Cache\TagAwareCacheInterface;
|
||||
* Encapsulates the logic for loading booking data from session or API,
|
||||
* refreshing availability data, and restoring drafts when available.
|
||||
*/
|
||||
class BookingEditDataLoaderService
|
||||
class BookingEditDataLoader
|
||||
{
|
||||
public const string CACHE_TAG_USER_PREFIX = 'user_bookings_';
|
||||
|
||||
@@ -32,10 +32,10 @@ class BookingEditDataLoaderService
|
||||
public function __construct(
|
||||
private readonly ApiClient $apiClient,
|
||||
private readonly BookingDataProcessor $bookingDataProcessor,
|
||||
private readonly BookingSessionService $bookingSessionService,
|
||||
private readonly BookingFingerprintService $fingerprintService,
|
||||
private readonly TravelDataService $travelDataService,
|
||||
private readonly BookingEditDraftService $draftService,
|
||||
private readonly BookingSessionStore $bookingSessionService,
|
||||
private readonly BookingChangeTracker $fingerprintService,
|
||||
private readonly TravelDataProvider $travelDataService,
|
||||
private readonly BookingEditDraftManager $draftService,
|
||||
private readonly AgencyLoader $agencyLoader,
|
||||
private readonly Crypt $crypt,
|
||||
private readonly TagAwareCacheInterface $bpnCache,
|
||||
+1
-1
@@ -20,7 +20,7 @@ use App\Form\Service\Condition\TravelStartCutoffReachedCondition;
|
||||
* immutable categories are reverted to the current booking state so update
|
||||
* payloads cannot include blocked changes.
|
||||
*/
|
||||
class BookingEditSubmitGuardService
|
||||
class BookingEditSubmitGuard
|
||||
{
|
||||
public function __construct(
|
||||
private readonly BookingDataProcessor $bookingDataProcessor,
|
||||
@@ -18,15 +18,15 @@ use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
|
||||
/**
|
||||
* Handles the final booking edit submission workflow.
|
||||
*/
|
||||
class BookingEditSubmitService
|
||||
class BookingEditSubmitter
|
||||
{
|
||||
public function __construct(
|
||||
private readonly ApiClient $apiClient,
|
||||
private readonly BookingEditDataLoaderService $dataLoader,
|
||||
private readonly BookingEditDraftService $draftService,
|
||||
private readonly TravelDataService $travelDataService,
|
||||
private readonly BookingEditSubmitGuardService $submitGuard,
|
||||
private readonly BookingSessionService $bookingSessionService,
|
||||
private readonly BookingEditDataLoader $dataLoader,
|
||||
private readonly BookingEditDraftManager $draftService,
|
||||
private readonly TravelDataProvider $travelDataService,
|
||||
private readonly BookingEditSubmitGuard $submitGuard,
|
||||
private readonly BookingSessionStore $bookingSessionService,
|
||||
private readonly UrlGeneratorInterface $urlGenerator,
|
||||
private readonly LoggerInterface $logger,
|
||||
) {
|
||||
@@ -16,7 +16,7 @@ use Symfony\Component\HttpFoundation\StreamedResponse;
|
||||
* converting all service, room, and pickup IDs to human-readable labels using
|
||||
* travel data loaded from XML files.
|
||||
*/
|
||||
class BookingExportService
|
||||
class BookingExporter
|
||||
{
|
||||
private const COLUMN_HEADERS = [
|
||||
'Vorname',
|
||||
@@ -54,7 +54,7 @@ class BookingExportService
|
||||
];
|
||||
|
||||
public function __construct(
|
||||
private readonly TravelDataService $travelDataService,
|
||||
private readonly TravelDataProvider $travelDataService,
|
||||
) {
|
||||
}
|
||||
|
||||
+3
-3
@@ -17,12 +17,12 @@ use App\Form\Model\ParticipantDto;
|
||||
* coordinating room and participant calculations and handling service aggregation directly.
|
||||
* Returns structured pricing data for display in forms and summaries.
|
||||
*/
|
||||
class BookingPriceCalculatorService
|
||||
class BookingPriceCalculator
|
||||
{
|
||||
public function __construct(
|
||||
private readonly RoomPricingCalculator $roomPricingCalculator,
|
||||
private readonly ParticipantEligibilityService $participantEligibilityService,
|
||||
private readonly InsuranceService $insuranceService,
|
||||
private readonly ParticipantEligibilityChecker $participantEligibilityService,
|
||||
private readonly InsuranceManager $insuranceService,
|
||||
private readonly ParticipantPricingCalculator $participantPricingCalculator,
|
||||
) {
|
||||
}
|
||||
+3
-3
@@ -12,10 +12,10 @@ use App\Form\Model\BookingDto;
|
||||
/**
|
||||
* Builds diagnostic payloads for booking price mismatches.
|
||||
*/
|
||||
class BookingPriceMismatchDiagnosticsService
|
||||
class BookingPriceMismatchAnalyzer
|
||||
{
|
||||
public function __construct(
|
||||
private readonly BookingPriceCalculatorService $priceCalculator,
|
||||
private readonly BookingPricingAssembler $pricingAssembler,
|
||||
) {
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@ class BookingPriceMismatchDiagnosticsService
|
||||
*/
|
||||
public function buildDiagnostics(BookingDto $bookingCreateDto, BookingResponse $response): array
|
||||
{
|
||||
$pricingBreakdown = $this->priceCalculator->getPricingBreakdown($bookingCreateDto);
|
||||
$pricingBreakdown = $this->pricingAssembler->getPricingBreakdown($bookingCreateDto);
|
||||
|
||||
$roomLines = $pricingBreakdown['rooms'] ?? [];
|
||||
$serviceGroups = $pricingBreakdown['services'] ?? [];
|
||||
@@ -15,7 +15,7 @@ use Symfony\Component\HttpFoundation\Request;
|
||||
* orchestration and pricing logic. It handles DTO persistence, baseline
|
||||
* room snapshots, and return URL storage for the booking create/edit flows.
|
||||
*/
|
||||
class BookingSessionService
|
||||
class BookingSessionStore
|
||||
{
|
||||
public const BOOKING_CREATE_KEY = 'booking_create';
|
||||
public const BOOKING_CREATE_BASELINE_KEY = 'booking_create_baseline_snapshot';
|
||||
@@ -24,7 +24,7 @@ class BookingSessionService
|
||||
public const DEFAULT_RETURN_URL = 'https://www.ep-reisen.de';
|
||||
|
||||
public function __construct(
|
||||
private readonly TravelDataService $travelDataService,
|
||||
private readonly TravelDataProvider $travelDataService,
|
||||
) {
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@ namespace App\Service;
|
||||
use Symfony\Contracts\HttpClient\Exception\ExceptionInterface;
|
||||
use Symfony\Contracts\HttpClient\HttpClientInterface;
|
||||
|
||||
class CmsDataService
|
||||
class CmsDataProvider
|
||||
{
|
||||
public function __construct(private readonly HttpClientInterface $httpClient, private readonly string $apiKey)
|
||||
{
|
||||
@@ -13,7 +13,7 @@ use Symfony\Component\HttpFoundation\RequestStack;
|
||||
* to report error codes to support staff who can then search logs by the code.
|
||||
* The code format is E-XXXXXXXX (8 uppercase alphanumeric characters in base36).
|
||||
*/
|
||||
class ErrorCodeService
|
||||
class ErrorCodeGenerator
|
||||
{
|
||||
private ?string $errorCode = null;
|
||||
private bool $hasError = false;
|
||||
@@ -18,7 +18,7 @@ use Carbon\Carbon;
|
||||
* Uses request-scoped instance-level caching to optimize performance for bookings with many participants.
|
||||
* This service is stateless and has no dependencies to avoid circular dependency issues.
|
||||
*/
|
||||
class InsuranceService
|
||||
class InsuranceManager
|
||||
{
|
||||
use SortByPriceTrait;
|
||||
|
||||
@@ -8,7 +8,7 @@ use App\Exception\NewsletterProviderException;
|
||||
use Psr\Log\LoggerInterface;
|
||||
use Symfony\Contracts\HttpClient\HttpClientInterface;
|
||||
|
||||
class MailjetNewsletterService
|
||||
class MailjetApiClient
|
||||
{
|
||||
private const DEFAULT_BASE_URL = 'https://api.mailjet.com/v3/REST';
|
||||
|
||||
@@ -12,12 +12,12 @@ use App\Repository\NewsletterOptInConfirmationRepository;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Psr\Log\LoggerInterface;
|
||||
|
||||
class NewsletterDoubleOptInService
|
||||
class NewsletterManager
|
||||
{
|
||||
public function __construct(
|
||||
private readonly NewsletterOptInConfirmationRepository $confirmationRepository,
|
||||
private readonly EntityManagerInterface $entityManager,
|
||||
private readonly MailjetNewsletterService $newsletterService,
|
||||
private readonly MailjetApiClient $newsletterService,
|
||||
private readonly Mailer $mailer,
|
||||
private readonly LoggerInterface $logger,
|
||||
private readonly int $newsletterConfirmationTtlHours,
|
||||
+2
-2
@@ -16,10 +16,10 @@ use Symfony\Component\Validator\Validator\ValidatorInterface;
|
||||
* Provides participant name, room assignment, and individual pricing for
|
||||
* display in the card overview UI.
|
||||
*/
|
||||
class ParticipantCardDataService
|
||||
class ParticipantCardAssembler
|
||||
{
|
||||
public function __construct(
|
||||
private readonly BookingPriceCalculatorService $priceCalculator,
|
||||
private readonly BookingPriceCalculator $priceCalculator,
|
||||
private readonly ValidatorInterface $validator,
|
||||
) {
|
||||
}
|
||||
+3
-3
@@ -21,7 +21,7 @@ use Psr\Log\LoggerInterface;
|
||||
* the booking process for authenticated users. All errors are handled gracefully
|
||||
* to ensure the booking flow is never interrupted.
|
||||
*/
|
||||
class ParticipantPrepopulationService
|
||||
class ParticipantDataPrefiller
|
||||
{
|
||||
public const TOKEN = '#KUN#';
|
||||
|
||||
@@ -45,7 +45,7 @@ class ParticipantPrepopulationService
|
||||
*
|
||||
* @return ParticipantDto The prepopulated participant (or unchanged if API fails)
|
||||
*/
|
||||
public function prepopulateApplicantFromUser(User $user, ParticipantDto $applicant): ParticipantDto
|
||||
public function prefillApplicantFromUser(User $user, ParticipantDto $applicant): ParticipantDto
|
||||
{
|
||||
try {
|
||||
// Decrypt user password for API authentication
|
||||
@@ -105,7 +105,7 @@ class ParticipantPrepopulationService
|
||||
*
|
||||
* Only prepopulates if the participant is fresh.
|
||||
*/
|
||||
public function shouldPrepopulateApplicant(ParticipantDto $applicant): bool
|
||||
public function shouldPrefillApplicant(ParticipantDto $applicant): bool
|
||||
{
|
||||
return null === $applicant->firstName || '' === $applicant->firstName;
|
||||
}
|
||||
+1
-1
@@ -20,7 +20,7 @@ use Carbon\CarbonImmutable;
|
||||
* Results are cached per request using instance-level arrays to avoid redundant calculations
|
||||
* when checking the same participant multiple times.
|
||||
*/
|
||||
class ParticipantEligibilityService
|
||||
class ParticipantEligibilityChecker
|
||||
{
|
||||
/** @var array<string, bool> Request-scoped cache for participant eligibility */
|
||||
private array $eligibilityCache = [];
|
||||
+1
-1
@@ -13,7 +13,7 @@ use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
|
||||
/**
|
||||
* Shared helpers for participant edit forms in create and edit booking flows.
|
||||
*/
|
||||
class ParticipantFormSupportService
|
||||
class ParticipantFormSupport
|
||||
{
|
||||
public function __construct(
|
||||
private readonly ParameterBagInterface $parameterBag,
|
||||
@@ -12,7 +12,7 @@ use App\Form\Model\BookingDto;
|
||||
* This service automatically assigns participants to selected rooms based on room capacity
|
||||
* and quantity, eliminating the need for manual room selection in the booking flow.
|
||||
*/
|
||||
class RoomAssignmentService
|
||||
class RoomAssigner
|
||||
{
|
||||
/**
|
||||
* Determines if automatic room assignment should be performed.
|
||||
@@ -27,10 +27,10 @@ use Symfony\Contracts\Cache\ItemInterface;
|
||||
* prefer snapshots for performance and refresh those snapshots from XML during sync. It handles
|
||||
* caching, error recovery, and data enrichment for both data sources.
|
||||
*
|
||||
* Mapping/lookup operations are delegated to TravelLookupService.
|
||||
* Travel enrichment (XML details, insurances) is delegated to TravelEnrichmentService.
|
||||
* Mapping/lookup operations are delegated to TravelIndex.
|
||||
* Travel enrichment (XML details, insurances) is delegated to TravelEnricher.
|
||||
*/
|
||||
class TravelDataService
|
||||
class TravelDataProvider
|
||||
{
|
||||
public const string SOURCE_LOCAL = 'local';
|
||||
public const string SOURCE_REMOTE = 'remote';
|
||||
@@ -42,9 +42,9 @@ class TravelDataService
|
||||
private readonly ApiClient $apiClient,
|
||||
private readonly CacheInterface $cache,
|
||||
private readonly LoggerInterface $logger,
|
||||
private readonly TravelSnapshotService $travelSnapshotService,
|
||||
private readonly TravelLookupService $travelLookupService,
|
||||
private readonly TravelEnrichmentService $travelEnrichmentService,
|
||||
private readonly TravelSnapshotManager $travelSnapshotService,
|
||||
private readonly TravelIndex $travelLookupService,
|
||||
private readonly TravelEnricher $travelEnrichmentService,
|
||||
private readonly bool $preferRemote = false,
|
||||
private readonly bool $enableFallback = true,
|
||||
) {
|
||||
@@ -18,7 +18,7 @@ use Psr\Log\LoggerInterface;
|
||||
* - Insurance patching applied to every local travel, replacing any stale snapshot data
|
||||
* with freshly parsed, fully-hydrated Insurance objects from the XML loader
|
||||
*/
|
||||
class TravelEnrichmentService
|
||||
class TravelEnricher
|
||||
{
|
||||
public function __construct(
|
||||
private readonly PickupLoader $pickupLoader,
|
||||
@@ -14,7 +14,7 @@ use Psr\Log\LoggerInterface;
|
||||
* Consolidates code/ID mapping, dateId→productId resolution, and the combined XML+snapshot
|
||||
* files map. All operations are read-only and never load full Travel objects.
|
||||
*/
|
||||
class TravelLookupService
|
||||
class TravelIndex
|
||||
{
|
||||
/** @var array<int, array<string, mixed>>|null */
|
||||
private ?array $filesMapCache = null;
|
||||
@@ -22,7 +22,7 @@ class TravelLookupService
|
||||
public function __construct(
|
||||
private readonly TravelLoader $travelLoader,
|
||||
private readonly HotelLoader $hotelLoader,
|
||||
private readonly TravelSnapshotService $travelSnapshotService,
|
||||
private readonly TravelSnapshotManager $travelSnapshotService,
|
||||
private readonly LoggerInterface $logger,
|
||||
) {
|
||||
}
|
||||
@@ -27,7 +27,7 @@ use Symfony\Component\Serializer\SerializerInterface;
|
||||
* - Enrich snapshots with extended availability data.
|
||||
* - Purge expired snapshot records.
|
||||
*/
|
||||
class TravelSnapshotService
|
||||
class TravelSnapshotManager
|
||||
{
|
||||
public function __construct(
|
||||
private readonly TravelSnapshotRepository $snapshotRepository,
|
||||
@@ -13,7 +13,7 @@ use Psr\Log\LoggerInterface;
|
||||
use Symfony\Contracts\Cache\CacheInterface;
|
||||
use Symfony\Contracts\Cache\ItemInterface;
|
||||
|
||||
class VoucherValidationService
|
||||
class VoucherValidator
|
||||
{
|
||||
private const CACHE_TTL = 900; // 15 minutes
|
||||
|
||||
@@ -14,7 +14,7 @@ use League\Flysystem\FilesystemOperator;
|
||||
* the request ID, sequence number, and type (request/response). This service
|
||||
* allows finding and reading dumps by request ID.
|
||||
*/
|
||||
class XmlDumpService
|
||||
class XmlDumpReader
|
||||
{
|
||||
public function __construct(
|
||||
private readonly FilesystemOperator $xmlDump,
|
||||
@@ -11,7 +11,7 @@ use App\Form\Service\Condition\TravelStartCutoffReachedCondition;
|
||||
use App\Form\Service\CreateFieldStateProvider;
|
||||
use App\Form\Service\EditFieldStateProvider;
|
||||
use App\Model\DomainConfig;
|
||||
use App\Service\ParticipantEligibilityService;
|
||||
use App\Service\ParticipantEligibilityChecker;
|
||||
use Symfony\Component\Form\FormView;
|
||||
use Symfony\Component\HttpFoundation\RequestStack;
|
||||
use Twig\Environment;
|
||||
@@ -30,7 +30,7 @@ class AppRuntime implements RuntimeExtensionInterface
|
||||
public function __construct(
|
||||
private readonly IntlExtension $intlExtension,
|
||||
private readonly CountryDataProvider $countryDataProvider,
|
||||
private readonly ParticipantEligibilityService $participantEligibilityService,
|
||||
private readonly ParticipantEligibilityChecker $participantEligibilityService,
|
||||
private readonly CreateFieldStateProvider $createFieldStateProvider,
|
||||
private readonly EditFieldStateProvider $editFieldStateProvider,
|
||||
private readonly RequestStack $requestStack,
|
||||
|
||||
@@ -4,14 +4,14 @@ declare(strict_types=1);
|
||||
|
||||
namespace App\Twig;
|
||||
|
||||
use App\Service\ErrorCodeService;
|
||||
use App\Service\ErrorCodeGenerator;
|
||||
use Twig\Extension\AbstractExtension;
|
||||
use Twig\TwigFunction;
|
||||
|
||||
class ErrorCodeExtension extends AbstractExtension
|
||||
{
|
||||
public function __construct(
|
||||
private readonly ErrorCodeService $errorCodeService,
|
||||
private readonly ErrorCodeGenerator $errorCodeService,
|
||||
) {
|
||||
}
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ use App\BusProNet\Constants;
|
||||
use App\BusProNet\Model\Service;
|
||||
use App\Form\Model\ParticipantEditDto;
|
||||
use App\Form\Service\ServiceAgeEvaluator;
|
||||
use App\Service\ParticipantEligibilityService;
|
||||
use App\Service\ParticipantEligibilityChecker;
|
||||
use Symfony\Component\Validator\Constraint;
|
||||
use Symfony\Component\Validator\ConstraintValidator;
|
||||
use Symfony\Component\Validator\Exception\UnexpectedTypeException;
|
||||
@@ -19,7 +19,7 @@ use Symfony\Component\Validator\Exception\UnexpectedTypeException;
|
||||
class MandatoryAdditionalServicesSelectedValidator extends ConstraintValidator
|
||||
{
|
||||
public function __construct(
|
||||
private readonly ParticipantEligibilityService $participantEligibilityService,
|
||||
private readonly ParticipantEligibilityChecker $participantEligibilityService,
|
||||
private readonly ServiceAgeEvaluator $serviceAgeEvaluator,
|
||||
) {
|
||||
}
|
||||
|
||||
@@ -5,8 +5,8 @@ declare(strict_types=1);
|
||||
namespace App\Validator\Constraints;
|
||||
|
||||
use App\Form\Model\ParticipantEditDto;
|
||||
use App\Service\BookingPriceCalculatorService;
|
||||
use App\Service\VoucherValidationService;
|
||||
use App\Service\BookingPriceCalculator;
|
||||
use App\Service\VoucherValidator;
|
||||
use Symfony\Component\Validator\Constraint;
|
||||
use Symfony\Component\Validator\ConstraintValidator;
|
||||
use Symfony\Component\Validator\Exception\UnexpectedTypeException;
|
||||
@@ -21,8 +21,8 @@ use Symfony\Component\Validator\Exception\UnexpectedTypeException;
|
||||
class PromoVoucherValidator extends ConstraintValidator
|
||||
{
|
||||
public function __construct(
|
||||
private readonly VoucherValidationService $voucherValidationService,
|
||||
private readonly BookingPriceCalculatorService $priceCalculatorService,
|
||||
private readonly VoucherValidator $voucherValidationService,
|
||||
private readonly BookingPriceCalculator $priceCalculatorService,
|
||||
) {
|
||||
}
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ declare(strict_types=1);
|
||||
namespace App\Validator\Constraints;
|
||||
|
||||
use App\Form\Model\ParticipantEditDto;
|
||||
use App\Service\VoucherValidationService;
|
||||
use App\Service\VoucherValidator;
|
||||
use Symfony\Component\Validator\Constraint;
|
||||
use Symfony\Component\Validator\ConstraintValidator;
|
||||
use Symfony\Component\Validator\Exception\UnexpectedTypeException;
|
||||
@@ -19,7 +19,7 @@ use Symfony\Component\Validator\Exception\UnexpectedTypeException;
|
||||
class PurchaseVoucherValidator extends ConstraintValidator
|
||||
{
|
||||
public function __construct(
|
||||
private readonly VoucherValidationService $voucherValidationService,
|
||||
private readonly VoucherValidator $voucherValidationService,
|
||||
) {
|
||||
}
|
||||
|
||||
|
||||
@@ -20,8 +20,8 @@ use App\BusProNet\Model\Service;
|
||||
use App\BusProNet\Model\Travel;
|
||||
use App\Form\Model\BookingDto;
|
||||
use App\Form\Model\ParticipantDto;
|
||||
use App\Service\BookingPriceCalculatorService;
|
||||
use App\Service\InsuranceService;
|
||||
use App\Service\BookingPriceCalculator;
|
||||
use App\Service\InsuranceManager;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Psr\Log\NullLogger;
|
||||
|
||||
@@ -37,9 +37,9 @@ class BookingDataProcessorTest extends TestCase
|
||||
|
||||
protected function setUp(): void
|
||||
{
|
||||
// Create a mock InsuranceService
|
||||
$insuranceService = $this->createMock(InsuranceService::class);
|
||||
$priceCalculatorService = $this->createMock(BookingPriceCalculatorService::class);
|
||||
// Create a mock InsuranceManager
|
||||
$insuranceService = $this->createMock(InsuranceManager::class);
|
||||
$priceCalculatorService = $this->createMock(BookingPriceCalculator::class);
|
||||
|
||||
// Mock getSelectableInsurances to return empty array (not used in these tests)
|
||||
$insuranceService->method('getSelectableInsurances')
|
||||
|
||||
@@ -6,8 +6,8 @@ namespace App\Tests\Command;
|
||||
|
||||
use App\BusProNet\XmlLoader\TravelLoader;
|
||||
use App\Command\BpnXmlSyncCommand;
|
||||
use App\Service\TravelDataService;
|
||||
use App\Service\TravelSnapshotService;
|
||||
use App\Service\TravelDataProvider;
|
||||
use App\Service\TravelSnapshotManager;
|
||||
use League\Flysystem\DirectoryListing;
|
||||
use League\Flysystem\FilesystemOperator;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
@@ -23,8 +23,8 @@ class BpnXmlSyncCommandTest extends TestCase
|
||||
private CacheInterface $cache;
|
||||
private LoggerInterface $logger;
|
||||
private TravelLoader $travelLoader;
|
||||
private TravelDataService $travelDataService;
|
||||
private TravelSnapshotService $travelSnapshotService;
|
||||
private TravelDataProvider $travelDataService;
|
||||
private TravelSnapshotManager $travelSnapshotService;
|
||||
private BpnXmlSyncCommand $command;
|
||||
|
||||
protected function tearDown(): void
|
||||
@@ -42,8 +42,8 @@ class BpnXmlSyncCommandTest extends TestCase
|
||||
$this->cache = $this->createMock(CacheInterface::class);
|
||||
$this->logger = $this->createMock(LoggerInterface::class);
|
||||
$this->travelLoader = $this->createMock(TravelLoader::class);
|
||||
$this->travelDataService = $this->createMock(TravelDataService::class);
|
||||
$this->travelSnapshotService = $this->createMock(TravelSnapshotService::class);
|
||||
$this->travelDataService = $this->createMock(TravelDataProvider::class);
|
||||
$this->travelSnapshotService = $this->createMock(TravelSnapshotManager::class);
|
||||
|
||||
$this->command = new BpnXmlSyncCommand(
|
||||
$this->xmlSource,
|
||||
|
||||
@@ -10,9 +10,9 @@ use App\Form\Model\BookingDto;
|
||||
use App\Form\Model\ParticipantDto;
|
||||
use App\Form\Model\ParticipantEditDto;
|
||||
use App\Form\Service\ServiceAgeEvaluator;
|
||||
use App\Service\BookingPriceCalculatorService;
|
||||
use App\Service\ParticipantEligibilityService;
|
||||
use App\Service\VoucherValidationService;
|
||||
use App\Service\BookingPriceCalculator;
|
||||
use App\Service\ParticipantEligibilityChecker;
|
||||
use App\Service\VoucherValidator;
|
||||
use App\Validator\Constraints\MandatoryAdditionalServicesSelectedValidator;
|
||||
use App\Validator\Constraints\PromoVoucherValidator;
|
||||
use App\Validator\Constraints\PurchaseVoucherValidator;
|
||||
@@ -39,22 +39,22 @@ class ParticipantEditDtoTest extends TestCase
|
||||
protected function setUp(): void
|
||||
{
|
||||
// Create mock services for validator dependencies
|
||||
$mockVoucherService = $this->createMock(VoucherValidationService::class);
|
||||
$mockPriceCalculatorService = $this->createMock(BookingPriceCalculatorService::class);
|
||||
$mockParticipantEligibilityService = $this->createMock(ParticipantEligibilityService::class);
|
||||
$mockVoucherService = $this->createMock(VoucherValidator::class);
|
||||
$mockPriceCalculatorService = $this->createMock(BookingPriceCalculator::class);
|
||||
$mockParticipantEligibilityChecker = $this->createMock(ParticipantEligibilityChecker::class);
|
||||
$mockServiceAgeEvaluator = $this->createMock(ServiceAgeEvaluator::class);
|
||||
|
||||
// Create custom validator factory that can inject dependencies
|
||||
$validatorFactory = new class(
|
||||
$mockVoucherService,
|
||||
$mockPriceCalculatorService,
|
||||
$mockParticipantEligibilityService,
|
||||
$mockParticipantEligibilityChecker,
|
||||
$mockServiceAgeEvaluator
|
||||
) implements ConstraintValidatorFactoryInterface {
|
||||
public function __construct(
|
||||
private readonly VoucherValidationService $voucherService,
|
||||
private readonly BookingPriceCalculatorService $priceCalculatorService,
|
||||
private readonly ParticipantEligibilityService $participantEligibilityService,
|
||||
private readonly VoucherValidator $voucherService,
|
||||
private readonly BookingPriceCalculator $priceCalculatorService,
|
||||
private readonly ParticipantEligibilityChecker $participantEligibilityService,
|
||||
private readonly ServiceAgeEvaluator $serviceAgeEvaluator,
|
||||
) {
|
||||
}
|
||||
|
||||
@@ -11,8 +11,8 @@ use App\BusProNet\Utility\DirectionMapper;
|
||||
use App\Form\Model\BookingDto;
|
||||
use App\Form\Model\ParticipantDto;
|
||||
use App\Form\Service\ParticipantFieldOptionsProvider;
|
||||
use App\Service\BookingPriceCalculatorService;
|
||||
use App\Service\InsuranceService;
|
||||
use App\Service\BookingPriceCalculator;
|
||||
use App\Service\InsuranceManager;
|
||||
use App\Service\ServiceLabelFormatter;
|
||||
use App\Service\ServiceAvailabilityCalculator;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
@@ -26,8 +26,8 @@ class ParticipantFieldOptionsProviderBabyTest extends TestCase
|
||||
protected function setUp(): void
|
||||
{
|
||||
$this->serviceAvailabilityCalculator = $this->createMock(ServiceAvailabilityCalculator::class);
|
||||
$insuranceService = $this->createMock(InsuranceService::class);
|
||||
$priceCalculatorService = $this->createMock(BookingPriceCalculatorService::class);
|
||||
$insuranceService = $this->createMock(InsuranceManager::class);
|
||||
$priceCalculatorService = $this->createMock(BookingPriceCalculator::class);
|
||||
$serviceLabelFormatter = new ServiceLabelFormatter();
|
||||
$translator = $this->createMock(TranslatorInterface::class);
|
||||
|
||||
|
||||
@@ -10,8 +10,8 @@ use App\BusProNet\Model\Travel;
|
||||
use App\Form\Model\BookingDto;
|
||||
use App\Form\Model\ParticipantDto;
|
||||
use App\Form\Service\ParticipantFieldOptionsProvider;
|
||||
use App\Service\BookingPriceCalculatorService;
|
||||
use App\Service\InsuranceService;
|
||||
use App\Service\BookingPriceCalculator;
|
||||
use App\Service\InsuranceManager;
|
||||
use App\Service\ServiceLabelFormatter;
|
||||
use App\Service\ServiceAvailabilityCalculator;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
@@ -29,8 +29,8 @@ class ParticipantFieldOptionsProviderMandatoryServiceTest extends TestCase
|
||||
protected function setUp(): void
|
||||
{
|
||||
$serviceAvailabilityCalculator = $this->createMock(ServiceAvailabilityCalculator::class);
|
||||
$insuranceService = $this->createMock(InsuranceService::class);
|
||||
$priceCalculatorService = $this->createMock(BookingPriceCalculatorService::class);
|
||||
$insuranceService = $this->createMock(InsuranceManager::class);
|
||||
$priceCalculatorService = $this->createMock(BookingPriceCalculator::class);
|
||||
$serviceLabelFormatter = new ServiceLabelFormatter();
|
||||
$translator = $this->createMock(TranslatorInterface::class);
|
||||
|
||||
|
||||
@@ -9,20 +9,20 @@ use App\BusProNet\Model\Travel;
|
||||
use App\Form\Model\BookingDto;
|
||||
use App\Form\Model\ParticipantDto;
|
||||
use App\Form\Service\ParticipantInsuranceFieldHandler;
|
||||
use App\Service\BookingPriceCalculatorService;
|
||||
use App\Service\InsuranceService;
|
||||
use App\Service\BookingPriceCalculator;
|
||||
use App\Service\InsuranceManager;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
class ParticipantInsuranceFieldHandlerTest extends TestCase
|
||||
{
|
||||
private ParticipantInsuranceFieldHandler $handler;
|
||||
private InsuranceService $insuranceService;
|
||||
private BookingPriceCalculatorService $priceCalculatorService;
|
||||
private InsuranceManager $insuranceService;
|
||||
private BookingPriceCalculator $priceCalculatorService;
|
||||
|
||||
protected function setUp(): void
|
||||
{
|
||||
$this->insuranceService = $this->createMock(InsuranceService::class);
|
||||
$this->priceCalculatorService = $this->createMock(BookingPriceCalculatorService::class);
|
||||
$this->insuranceService = $this->createMock(InsuranceManager::class);
|
||||
$this->priceCalculatorService = $this->createMock(BookingPriceCalculator::class);
|
||||
|
||||
// Mock getSelectableInsurances to return input array
|
||||
$this->insuranceService->method('getSelectableInsurances')
|
||||
|
||||
@@ -5,19 +5,19 @@ declare(strict_types=1);
|
||||
namespace App\Tests\Logger;
|
||||
|
||||
use App\Logger\ErrorCodeProcessor;
|
||||
use App\Service\ErrorCodeService;
|
||||
use App\Service\ErrorCodeGenerator;
|
||||
use Monolog\Level;
|
||||
use Monolog\LogRecord;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
class ErrorCodeProcessorTest extends TestCase
|
||||
{
|
||||
private ErrorCodeService $errorCodeService;
|
||||
private ErrorCodeGenerator $errorCodeService;
|
||||
private ErrorCodeProcessor $processor;
|
||||
|
||||
protected function setUp(): void
|
||||
{
|
||||
$this->errorCodeService = $this->createMock(ErrorCodeService::class);
|
||||
$this->errorCodeService = $this->createMock(ErrorCodeGenerator::class);
|
||||
$this->processor = new ErrorCodeProcessor($this->errorCodeService);
|
||||
}
|
||||
|
||||
|
||||
+11
-11
@@ -11,27 +11,27 @@ use App\BusProNet\Service\BookingStatusRuleRegistry;
|
||||
use App\BusProNet\XmlLoader\AgencyLoader;
|
||||
use App\Form\Model\BookingDto;
|
||||
use App\Form\Model\ParticipantDto;
|
||||
use App\Service\BookingService;
|
||||
use App\Service\BookingSessionService;
|
||||
use App\Service\ParticipantEligibilityService;
|
||||
use App\Service\TravelDataService;
|
||||
use App\Service\BookingConfigurator;
|
||||
use App\Service\BookingSessionStore;
|
||||
use App\Service\ParticipantEligibilityChecker;
|
||||
use App\Service\TravelDataProvider;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
class BookingServiceBabyTest extends TestCase
|
||||
class BookingConfiguratorBabyTest extends TestCase
|
||||
{
|
||||
private BookingService $bookingService;
|
||||
private ParticipantEligibilityService $participantEligibilityService;
|
||||
private BookingConfigurator $bookingService;
|
||||
private ParticipantEligibilityChecker $participantEligibilityService;
|
||||
|
||||
protected function setUp(): void
|
||||
{
|
||||
$travelDataService = $this->createMock(TravelDataService::class);
|
||||
$this->participantEligibilityService = $this->createMock(ParticipantEligibilityService::class);
|
||||
$travelDataService = $this->createMock(TravelDataProvider::class);
|
||||
$this->participantEligibilityService = $this->createMock(ParticipantEligibilityChecker::class);
|
||||
$bookingStatusRuleRegistry = $this->createMock(BookingStatusRuleRegistry::class);
|
||||
$bookingStatusRuleRegistry->method('evaluateStatus')->willReturn('F');
|
||||
$agencyLoader = $this->createMock(AgencyLoader::class);
|
||||
|
||||
$this->bookingService = new BookingService(
|
||||
$this->createMock(BookingSessionService::class),
|
||||
$this->bookingService = new BookingConfigurator(
|
||||
$this->createMock(BookingSessionStore::class),
|
||||
$travelDataService,
|
||||
$this->participantEligibilityService,
|
||||
$bookingStatusRuleRegistry,
|
||||
+17
-17
@@ -11,30 +11,30 @@ use App\BusProNet\Model\Travel;
|
||||
use App\BusProNet\Service\BookingStatusRuleRegistry;
|
||||
use App\BusProNet\XmlLoader\AgencyLoader;
|
||||
use App\Exception\NoRoomsAvailableException;
|
||||
use App\Service\BookingService;
|
||||
use App\Service\BookingSessionService;
|
||||
use App\Service\ParticipantEligibilityService;
|
||||
use App\Service\TravelDataService;
|
||||
use App\Service\BookingConfigurator;
|
||||
use App\Service\BookingSessionStore;
|
||||
use App\Service\ParticipantEligibilityChecker;
|
||||
use App\Service\TravelDataProvider;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Session\Session;
|
||||
use Symfony\Component\HttpFoundation\Session\Storage\MockArraySessionStorage;
|
||||
|
||||
class BookingServiceStatusTest extends TestCase
|
||||
class BookingConfiguratorStatusTest extends TestCase
|
||||
{
|
||||
private BookingService $bookingService;
|
||||
private TravelDataService $travelDataService;
|
||||
private BookingConfigurator $bookingService;
|
||||
private TravelDataProvider $travelDataService;
|
||||
|
||||
protected function setUp(): void
|
||||
{
|
||||
$bookingSessionService = $this->createMock(BookingSessionService::class);
|
||||
$this->travelDataService = $this->createMock(TravelDataService::class);
|
||||
$participantEligibility = $this->createMock(ParticipantEligibilityService::class);
|
||||
$bookingSessionService = $this->createMock(BookingSessionStore::class);
|
||||
$this->travelDataService = $this->createMock(TravelDataProvider::class);
|
||||
$participantEligibility = $this->createMock(ParticipantEligibilityChecker::class);
|
||||
$bookingStatusRuleRegistry = $this->createMock(BookingStatusRuleRegistry::class);
|
||||
$bookingStatusRuleRegistry->method('evaluateStatus')->willReturn('F');
|
||||
$agencyLoader = $this->createMock(AgencyLoader::class);
|
||||
|
||||
$this->bookingService = new BookingService(
|
||||
$this->bookingService = new BookingConfigurator(
|
||||
$bookingSessionService,
|
||||
$this->travelDataService,
|
||||
$participantEligibility,
|
||||
@@ -177,10 +177,10 @@ class BookingServiceStatusTest extends TestCase
|
||||
$bookingStatusRuleRegistry = $this->createMock(BookingStatusRuleRegistry::class);
|
||||
$bookingStatusRuleRegistry->method('evaluateStatus')->willReturn('O');
|
||||
|
||||
$bookingService = new BookingService(
|
||||
$this->createMock(BookingSessionService::class),
|
||||
$bookingService = new BookingConfigurator(
|
||||
$this->createMock(BookingSessionStore::class),
|
||||
$this->travelDataService,
|
||||
$this->createMock(ParticipantEligibilityService::class),
|
||||
$this->createMock(ParticipantEligibilityChecker::class),
|
||||
$bookingStatusRuleRegistry,
|
||||
$this->createMock(AgencyLoader::class),
|
||||
'F'
|
||||
@@ -208,10 +208,10 @@ class BookingServiceStatusTest extends TestCase
|
||||
$bookingStatusRuleRegistry = $this->createMock(BookingStatusRuleRegistry::class);
|
||||
$bookingStatusRuleRegistry->expects($this->never())->method('evaluateStatus');
|
||||
|
||||
$bookingService = new BookingService(
|
||||
$this->createMock(BookingSessionService::class),
|
||||
$bookingService = new BookingConfigurator(
|
||||
$this->createMock(BookingSessionStore::class),
|
||||
$this->travelDataService,
|
||||
$this->createMock(ParticipantEligibilityService::class),
|
||||
$this->createMock(ParticipantEligibilityChecker::class),
|
||||
$bookingStatusRuleRegistry,
|
||||
$this->createMock(AgencyLoader::class),
|
||||
'F'
|
||||
@@ -13,9 +13,9 @@ use App\Form\Model\BookingMutabilityDto;
|
||||
use App\Form\Model\BookingEditContext;
|
||||
use App\Form\Model\BookingSummaryDto;
|
||||
use App\Service\BookingEditContextFactory;
|
||||
use App\Service\BookingSummaryDataService;
|
||||
use App\Service\ParticipantCardDataService;
|
||||
use App\Service\TravelDataService;
|
||||
use App\Service\BookingSummaryAssembler;
|
||||
use App\Service\ParticipantCardAssembler;
|
||||
use App\Service\TravelDataProvider;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
class BookingEditContextFactoryTest extends TestCase
|
||||
@@ -27,14 +27,14 @@ class BookingEditContextFactoryTest extends TestCase
|
||||
$travel->dateTo = new \DateTimeImmutable('2030-01-06');
|
||||
$bookingDto = new BookingDto($travel, 157047);
|
||||
|
||||
$travelDataService = $this->createMock(TravelDataService::class);
|
||||
$travelDataService = $this->createMock(TravelDataProvider::class);
|
||||
$travelDataService->expects($this->once())
|
||||
->method('enrichWithFreshAvailabilities')
|
||||
->with($travel);
|
||||
|
||||
$service = new BookingEditContextFactory(
|
||||
$this->createMock(ParticipantCardDataService::class),
|
||||
$this->createMock(BookingSummaryDataService::class),
|
||||
$this->createMock(ParticipantCardAssembler::class),
|
||||
$this->createMock(BookingSummaryAssembler::class),
|
||||
$travelDataService,
|
||||
);
|
||||
|
||||
@@ -58,20 +58,20 @@ class BookingEditContextFactoryTest extends TestCase
|
||||
]);
|
||||
$summaryData = $this->createMock(BookingSummaryDto::class);
|
||||
|
||||
$summaryDataService = $this->createMock(BookingSummaryDataService::class);
|
||||
$summaryDataService = $this->createMock(BookingSummaryAssembler::class);
|
||||
$summaryDataService->expects($this->once())
|
||||
->method('getSummaryData')
|
||||
->with($bookingDto)
|
||||
->willReturn($summaryData);
|
||||
|
||||
$travelDataService = $this->createMock(TravelDataService::class);
|
||||
$travelDataService = $this->createMock(TravelDataProvider::class);
|
||||
$travelDataService->expects($this->once())
|
||||
->method('getMutabilityData')
|
||||
->with(1234)
|
||||
->willReturn($mutableData);
|
||||
|
||||
$service = new BookingEditContextFactory(
|
||||
$this->createMock(ParticipantCardDataService::class),
|
||||
$this->createMock(ParticipantCardAssembler::class),
|
||||
$summaryDataService,
|
||||
$travelDataService,
|
||||
);
|
||||
@@ -96,18 +96,18 @@ class BookingEditContextFactoryTest extends TestCase
|
||||
$bookingDto = new BookingDto($travel, 157047);
|
||||
$summaryData = $this->createMock(BookingSummaryDto::class);
|
||||
|
||||
$summaryDataService = $this->createMock(BookingSummaryDataService::class);
|
||||
$summaryDataService = $this->createMock(BookingSummaryAssembler::class);
|
||||
$summaryDataService->expects($this->once())
|
||||
->method('getSummaryData')
|
||||
->with($bookingDto)
|
||||
->willReturn($summaryData);
|
||||
|
||||
$travelDataService = $this->createMock(TravelDataService::class);
|
||||
$travelDataService = $this->createMock(TravelDataProvider::class);
|
||||
$travelDataService->expects($this->never())
|
||||
->method('getMutabilityData');
|
||||
|
||||
$service = new BookingEditContextFactory(
|
||||
$this->createMock(ParticipantCardDataService::class),
|
||||
$this->createMock(ParticipantCardAssembler::class),
|
||||
$summaryDataService,
|
||||
$travelDataService,
|
||||
);
|
||||
@@ -135,19 +135,19 @@ class BookingEditContextFactoryTest extends TestCase
|
||||
$summaryData = $this->createMock(BookingSummaryDto::class);
|
||||
$cardsData = [];
|
||||
|
||||
$participantCardDataService = $this->createMock(ParticipantCardDataService::class);
|
||||
$participantCardDataService = $this->createMock(ParticipantCardAssembler::class);
|
||||
$participantCardDataService->expects($this->once())
|
||||
->method('getAllCardsDataWithValidation')
|
||||
->with($bookingDto)
|
||||
->willReturn($cardsData);
|
||||
|
||||
$summaryDataService = $this->createMock(BookingSummaryDataService::class);
|
||||
$summaryDataService = $this->createMock(BookingSummaryAssembler::class);
|
||||
$summaryDataService->expects($this->once())
|
||||
->method('getSummaryData')
|
||||
->with($bookingDto)
|
||||
->willReturn($summaryData);
|
||||
|
||||
$travelDataService = $this->createMock(TravelDataService::class);
|
||||
$travelDataService = $this->createMock(TravelDataProvider::class);
|
||||
$travelDataService->expects($this->once())
|
||||
->method('getMutabilityData')
|
||||
->with(1234)
|
||||
|
||||
+5
-5
@@ -11,11 +11,11 @@ use App\BusProNet\Model\Service;
|
||||
use App\BusProNet\Model\Travel;
|
||||
use App\Form\Model\BookingDto;
|
||||
use App\Form\Model\ParticipantDto;
|
||||
use App\Service\BookingEditSubmitGuardService;
|
||||
use App\Service\BookingEditSubmitGuard;
|
||||
use Carbon\CarbonImmutable;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
class BookingEditSubmitGuardServiceTest extends TestCase
|
||||
class BookingEditSubmitGuardTest extends TestCase
|
||||
{
|
||||
protected function tearDown(): void
|
||||
{
|
||||
@@ -52,7 +52,7 @@ class BookingEditSubmitGuardServiceTest extends TestCase
|
||||
->method('createBookingDtoFromBooking')
|
||||
->willReturn($baselineDto);
|
||||
|
||||
$service = new BookingEditSubmitGuardService($processor);
|
||||
$service = new BookingEditSubmitGuard($processor);
|
||||
|
||||
$changed = $service->reconcileImmutableCategories($workingDto, new Booking());
|
||||
|
||||
@@ -88,7 +88,7 @@ class BookingEditSubmitGuardServiceTest extends TestCase
|
||||
->method('createBookingDtoFromBooking')
|
||||
->willReturn($baselineDto);
|
||||
|
||||
$service = new BookingEditSubmitGuardService($processor);
|
||||
$service = new BookingEditSubmitGuard($processor);
|
||||
|
||||
$changed = $service->reconcileImmutableCategories($workingDto, new Booking());
|
||||
|
||||
@@ -125,7 +125,7 @@ class BookingEditSubmitGuardServiceTest extends TestCase
|
||||
->method('createBookingDtoFromBooking')
|
||||
->willReturn($baselineDto);
|
||||
|
||||
$service = new BookingEditSubmitGuardService($processor);
|
||||
$service = new BookingEditSubmitGuard($processor);
|
||||
|
||||
$changed = $service->reconcileImmutableCategories($workingDto, new Booking());
|
||||
|
||||
+42
-42
@@ -12,12 +12,12 @@ use App\BusProNet\Model\Notification;
|
||||
use App\BusProNet\Model\Travel;
|
||||
use App\Entity\User;
|
||||
use App\Form\Model\BookingDto;
|
||||
use App\Service\BookingEditDataLoaderService;
|
||||
use App\Service\BookingEditDraftService;
|
||||
use App\Service\BookingEditSubmitGuardService;
|
||||
use App\Service\BookingEditSubmitService;
|
||||
use App\Service\BookingSessionService;
|
||||
use App\Service\TravelDataService;
|
||||
use App\Service\BookingEditDataLoader;
|
||||
use App\Service\BookingEditDraftManager;
|
||||
use App\Service\BookingEditSubmitGuard;
|
||||
use App\Service\BookingEditSubmitter;
|
||||
use App\Service\BookingSessionStore;
|
||||
use App\Service\TravelDataProvider;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Psr\Log\LoggerInterface;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
@@ -25,7 +25,7 @@ use Symfony\Component\HttpFoundation\Session\Session;
|
||||
use Symfony\Component\HttpFoundation\Session\Storage\MockArraySessionStorage;
|
||||
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
|
||||
|
||||
class BookingEditSubmitServiceTest extends TestCase
|
||||
class BookingEditSubmitterTest extends TestCase
|
||||
{
|
||||
public function testHandleSubmissionReturnsRedirectWhenFreshBookingDataCannotBeLoaded(): void
|
||||
{
|
||||
@@ -33,7 +33,7 @@ class BookingEditSubmitServiceTest extends TestCase
|
||||
$user = $this->createUser();
|
||||
$bookingDto = $this->createBookingDto();
|
||||
|
||||
$dataLoader = $this->createMock(BookingEditDataLoaderService::class);
|
||||
$dataLoader = $this->createMock(BookingEditDataLoader::class);
|
||||
$dataLoader->expects($this->once())
|
||||
->method('invalidateBookingCache')
|
||||
->with(42, $user);
|
||||
@@ -68,7 +68,7 @@ class BookingEditSubmitServiceTest extends TestCase
|
||||
$bookingDto = $this->createBookingDto();
|
||||
$freshBookingData = $this->createFreshBooking();
|
||||
|
||||
$dataLoader = $this->createMock(BookingEditDataLoaderService::class);
|
||||
$dataLoader = $this->createMock(BookingEditDataLoader::class);
|
||||
$dataLoader->expects($this->exactly(1))
|
||||
->method('invalidateBookingCache')
|
||||
->with(42, $user);
|
||||
@@ -77,7 +77,7 @@ class BookingEditSubmitServiceTest extends TestCase
|
||||
->with(42, $user)
|
||||
->willReturn($freshBookingData);
|
||||
|
||||
$travelDataService = $this->createMock(TravelDataService::class);
|
||||
$travelDataService = $this->createMock(TravelDataProvider::class);
|
||||
$travelDataService->expects($this->once())
|
||||
->method('getMutabilityData')
|
||||
->with(1234, true, true)
|
||||
@@ -85,7 +85,7 @@ class BookingEditSubmitServiceTest extends TestCase
|
||||
$travelDataService->expects($this->never())
|
||||
->method('patchMutability');
|
||||
|
||||
$submitGuard = $this->createMock(BookingEditSubmitGuardService::class);
|
||||
$submitGuard = $this->createMock(BookingEditSubmitGuard::class);
|
||||
$submitGuard->expects($this->once())
|
||||
->method('reconcileImmutableCategories')
|
||||
->with($bookingDto, $freshBookingData)
|
||||
@@ -117,7 +117,7 @@ class BookingEditSubmitServiceTest extends TestCase
|
||||
$bookingDto = $this->createBookingDto();
|
||||
$freshBookingData = $this->createFreshBooking();
|
||||
|
||||
$dataLoader = $this->createMock(BookingEditDataLoaderService::class);
|
||||
$dataLoader = $this->createMock(BookingEditDataLoader::class);
|
||||
$dataLoader->expects($this->once())
|
||||
->method('invalidateBookingCache')
|
||||
->with(42, $user);
|
||||
@@ -126,7 +126,7 @@ class BookingEditSubmitServiceTest extends TestCase
|
||||
->with(42, $user)
|
||||
->willReturn($freshBookingData);
|
||||
|
||||
$travelDataService = $this->createMock(TravelDataService::class);
|
||||
$travelDataService = $this->createMock(TravelDataProvider::class);
|
||||
$travelDataService->expects($this->once())
|
||||
->method('getMutabilityData')
|
||||
->with(1234, true, true)
|
||||
@@ -134,7 +134,7 @@ class BookingEditSubmitServiceTest extends TestCase
|
||||
$travelDataService->expects($this->never())
|
||||
->method('patchMutability');
|
||||
|
||||
$submitGuard = $this->createMock(BookingEditSubmitGuardService::class);
|
||||
$submitGuard = $this->createMock(BookingEditSubmitGuard::class);
|
||||
$submitGuard->expects($this->once())
|
||||
->method('reconcileImmutableCategories')
|
||||
->with($bookingDto, $freshBookingData)
|
||||
@@ -179,7 +179,7 @@ class BookingEditSubmitServiceTest extends TestCase
|
||||
$bookingDto = $this->createBookingDto();
|
||||
$freshBookingData = $this->createFreshBooking();
|
||||
|
||||
$dataLoader = $this->createMock(BookingEditDataLoaderService::class);
|
||||
$dataLoader = $this->createMock(BookingEditDataLoader::class);
|
||||
$dataLoader->expects($this->exactly(2))
|
||||
->method('invalidateBookingCache')
|
||||
->with(42, $user);
|
||||
@@ -188,7 +188,7 @@ class BookingEditSubmitServiceTest extends TestCase
|
||||
->with(42, $user)
|
||||
->willReturn($freshBookingData);
|
||||
|
||||
$travelDataService = $this->createMock(TravelDataService::class);
|
||||
$travelDataService = $this->createMock(TravelDataProvider::class);
|
||||
$travelDataService->expects($this->once())
|
||||
->method('getMutabilityData')
|
||||
->with(1234, true, true)
|
||||
@@ -196,7 +196,7 @@ class BookingEditSubmitServiceTest extends TestCase
|
||||
$travelDataService->expects($this->never())
|
||||
->method('patchMutability');
|
||||
|
||||
$submitGuard = $this->createMock(BookingEditSubmitGuardService::class);
|
||||
$submitGuard = $this->createMock(BookingEditSubmitGuard::class);
|
||||
$submitGuard->expects($this->once())
|
||||
->method('reconcileImmutableCategories')
|
||||
->with($bookingDto, $freshBookingData)
|
||||
@@ -210,14 +210,14 @@ class BookingEditSubmitServiceTest extends TestCase
|
||||
->with($bookingDto, true)
|
||||
->willReturn($bookingUpdate);
|
||||
|
||||
$bookingSessionService = $this->createMock(BookingSessionService::class);
|
||||
$bookingSessionService = $this->createMock(BookingSessionStore::class);
|
||||
$bookingSessionService->expects($this->once())
|
||||
->method('clearBookingDto')
|
||||
->with($request, BookingDto::MODE_EDIT);
|
||||
$bookingSessionService->expects($this->never())
|
||||
->method('saveBookingDto');
|
||||
|
||||
$draftService = $this->createMock(BookingEditDraftService::class);
|
||||
$draftService = $this->createMock(BookingEditDraftManager::class);
|
||||
$draftService->expects($this->once())
|
||||
->method('deleteDraft')
|
||||
->with($user, 42);
|
||||
@@ -245,7 +245,7 @@ class BookingEditSubmitServiceTest extends TestCase
|
||||
$bookingDto = $this->createBookingDto();
|
||||
$freshBookingData = $this->createFreshBooking();
|
||||
|
||||
$dataLoader = $this->createMock(BookingEditDataLoaderService::class);
|
||||
$dataLoader = $this->createMock(BookingEditDataLoader::class);
|
||||
$dataLoader->expects($this->exactly(2))
|
||||
->method('invalidateBookingCache')
|
||||
->with(42, $user);
|
||||
@@ -254,7 +254,7 @@ class BookingEditSubmitServiceTest extends TestCase
|
||||
->with(42, $user)
|
||||
->willReturn($freshBookingData);
|
||||
|
||||
$travelDataService = $this->createMock(TravelDataService::class);
|
||||
$travelDataService = $this->createMock(TravelDataProvider::class);
|
||||
$travelDataService->expects($this->once())
|
||||
->method('getMutabilityData')
|
||||
->with(1234, true, true)
|
||||
@@ -262,7 +262,7 @@ class BookingEditSubmitServiceTest extends TestCase
|
||||
$travelDataService->expects($this->never())
|
||||
->method('patchMutability');
|
||||
|
||||
$submitGuard = $this->createMock(BookingEditSubmitGuardService::class);
|
||||
$submitGuard = $this->createMock(BookingEditSubmitGuard::class);
|
||||
$submitGuard->expects($this->once())
|
||||
->method('reconcileImmutableCategories')
|
||||
->with($bookingDto, $freshBookingData)
|
||||
@@ -276,7 +276,7 @@ class BookingEditSubmitServiceTest extends TestCase
|
||||
->with($bookingDto, true)
|
||||
->willReturn($bookingUpdate);
|
||||
|
||||
$bookingSessionService = $this->createMock(BookingSessionService::class);
|
||||
$bookingSessionService = $this->createMock(BookingSessionStore::class);
|
||||
$bookingSessionService->expects($this->once())
|
||||
->method('saveBookingDto')
|
||||
->with($request, $bookingDto, BookingDto::MODE_EDIT);
|
||||
@@ -284,7 +284,7 @@ class BookingEditSubmitServiceTest extends TestCase
|
||||
->method('clearBookingDto')
|
||||
->with($request, BookingDto::MODE_EDIT);
|
||||
|
||||
$draftService = $this->createMock(BookingEditDraftService::class);
|
||||
$draftService = $this->createMock(BookingEditDraftManager::class);
|
||||
$draftService->expects($this->once())
|
||||
->method('deleteDraft')
|
||||
->with($user, 42);
|
||||
@@ -330,7 +330,7 @@ class BookingEditSubmitServiceTest extends TestCase
|
||||
$bookingDto = $this->createBookingDto();
|
||||
$freshBookingData = $this->createFreshBooking();
|
||||
|
||||
$dataLoader = $this->createMock(BookingEditDataLoaderService::class);
|
||||
$dataLoader = $this->createMock(BookingEditDataLoader::class);
|
||||
$dataLoader->expects($this->once())
|
||||
->method('invalidateBookingCache')
|
||||
->with(42, $user);
|
||||
@@ -339,7 +339,7 @@ class BookingEditSubmitServiceTest extends TestCase
|
||||
->with(42, $user)
|
||||
->willReturn($freshBookingData);
|
||||
|
||||
$travelDataService = $this->createMock(TravelDataService::class);
|
||||
$travelDataService = $this->createMock(TravelDataProvider::class);
|
||||
$travelDataService->expects($this->once())
|
||||
->method('getMutabilityData')
|
||||
->with(1234, true, true)
|
||||
@@ -347,7 +347,7 @@ class BookingEditSubmitServiceTest extends TestCase
|
||||
$travelDataService->expects($this->never())
|
||||
->method('patchMutability');
|
||||
|
||||
$submitGuard = $this->createMock(BookingEditSubmitGuardService::class);
|
||||
$submitGuard = $this->createMock(BookingEditSubmitGuard::class);
|
||||
$submitGuard->expects($this->once())
|
||||
->method('reconcileImmutableCategories')
|
||||
->with($bookingDto, $freshBookingData)
|
||||
@@ -379,7 +379,7 @@ class BookingEditSubmitServiceTest extends TestCase
|
||||
$bookingDto = $this->createBookingDto();
|
||||
$freshBookingData = $this->createFreshBooking();
|
||||
|
||||
$dataLoader = $this->createMock(BookingEditDataLoaderService::class);
|
||||
$dataLoader = $this->createMock(BookingEditDataLoader::class);
|
||||
$dataLoader->expects($this->once())
|
||||
->method('invalidateBookingCache')
|
||||
->with(42, $user);
|
||||
@@ -388,7 +388,7 @@ class BookingEditSubmitServiceTest extends TestCase
|
||||
->with(42, $user)
|
||||
->willReturn($freshBookingData);
|
||||
|
||||
$travelDataService = $this->createMock(TravelDataService::class);
|
||||
$travelDataService = $this->createMock(TravelDataProvider::class);
|
||||
$travelDataService->expects($this->once())
|
||||
->method('getMutabilityData')
|
||||
->with(1234, true, true)
|
||||
@@ -396,7 +396,7 @@ class BookingEditSubmitServiceTest extends TestCase
|
||||
$travelDataService->expects($this->never())
|
||||
->method('patchMutability');
|
||||
|
||||
$submitGuard = $this->createMock(BookingEditSubmitGuardService::class);
|
||||
$submitGuard = $this->createMock(BookingEditSubmitGuard::class);
|
||||
$submitGuard->expects($this->once())
|
||||
->method('reconcileImmutableCategories')
|
||||
->with($bookingDto, $freshBookingData)
|
||||
@@ -423,19 +423,19 @@ class BookingEditSubmitServiceTest extends TestCase
|
||||
|
||||
private function createService(
|
||||
?\App\BusProNet\ApiClient $apiClient = null,
|
||||
?BookingEditDataLoaderService $dataLoader = null,
|
||||
?BookingEditDraftService $draftService = null,
|
||||
?TravelDataService $travelDataService = null,
|
||||
?BookingEditSubmitGuardService $submitGuard = null,
|
||||
?BookingSessionService $bookingSessionService = null,
|
||||
): BookingEditSubmitService {
|
||||
return new BookingEditSubmitService(
|
||||
?BookingEditDataLoader $dataLoader = null,
|
||||
?BookingEditDraftManager $draftService = null,
|
||||
?TravelDataProvider $travelDataService = null,
|
||||
?BookingEditSubmitGuard $submitGuard = null,
|
||||
?BookingSessionStore $bookingSessionService = null,
|
||||
): BookingEditSubmitter {
|
||||
return new BookingEditSubmitter(
|
||||
$apiClient ?? $this->createMock(\App\BusProNet\ApiClient::class),
|
||||
$dataLoader ?? $this->createMock(BookingEditDataLoaderService::class),
|
||||
$draftService ?? $this->createMock(BookingEditDraftService::class),
|
||||
$travelDataService ?? $this->createMock(TravelDataService::class),
|
||||
$submitGuard ?? $this->createMock(BookingEditSubmitGuardService::class),
|
||||
$bookingSessionService ?? $this->createMock(BookingSessionService::class),
|
||||
$dataLoader ?? $this->createMock(BookingEditDataLoader::class),
|
||||
$draftService ?? $this->createMock(BookingEditDraftManager::class),
|
||||
$travelDataService ?? $this->createMock(TravelDataProvider::class),
|
||||
$submitGuard ?? $this->createMock(BookingEditSubmitGuard::class),
|
||||
$bookingSessionService ?? $this->createMock(BookingSessionStore::class),
|
||||
$this->createUrlGenerator(),
|
||||
$this->createMock(LoggerInterface::class),
|
||||
);
|
||||
+11
-11
@@ -11,23 +11,23 @@ use App\BusProNet\Model\Travel;
|
||||
use App\Form\Model\BookingDto;
|
||||
use App\Form\Model\ParticipantDto;
|
||||
use App\Form\Model\RoomSelectionDto;
|
||||
use App\Service\BookingPriceCalculatorService;
|
||||
use App\Service\InsuranceService;
|
||||
use App\Service\ParticipantEligibilityService;
|
||||
use App\Service\BookingPriceCalculator;
|
||||
use App\Service\InsuranceManager;
|
||||
use App\Service\ParticipantEligibilityChecker;
|
||||
use App\Service\ParticipantPricingCalculator;
|
||||
use App\Service\RoomPricingCalculator;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
class BookingPriceCalculatorServiceTest extends TestCase
|
||||
class BookingPriceCalculatorTest extends TestCase
|
||||
{
|
||||
private BookingPriceCalculatorService $service;
|
||||
private ParticipantEligibilityService $participantEligibilityService;
|
||||
private BookingPriceCalculator $service;
|
||||
private ParticipantEligibilityChecker $participantEligibilityService;
|
||||
private RoomPricingCalculator $roomPricingCalculator;
|
||||
private ParticipantPricingCalculator $participantPricingCalculator;
|
||||
|
||||
protected function setUp(): void
|
||||
{
|
||||
$this->participantEligibilityService = $this->createMock(ParticipantEligibilityService::class);
|
||||
$this->participantEligibilityService = $this->createMock(ParticipantEligibilityChecker::class);
|
||||
$this->participantEligibilityService->method('isParticipantEligible')->willReturn(true);
|
||||
|
||||
$this->roomPricingCalculator = new RoomPricingCalculator();
|
||||
@@ -595,7 +595,7 @@ class BookingPriceCalculatorServiceTest extends TestCase
|
||||
$bookingDto->participants = [$participant1, $participant2];
|
||||
|
||||
// Mock participant eligibility to mark second participant as ineligible
|
||||
$participantEligibilityService = $this->createMock(ParticipantEligibilityService::class);
|
||||
$participantEligibilityService = $this->createMock(ParticipantEligibilityChecker::class);
|
||||
$participantEligibilityService->method('isParticipantEligible')
|
||||
->willReturnCallback(fn ($booking, $index) => 0 === $index); // Only first participant eligible
|
||||
|
||||
@@ -695,12 +695,12 @@ class BookingPriceCalculatorServiceTest extends TestCase
|
||||
return $participant;
|
||||
}
|
||||
|
||||
private function createService(ParticipantEligibilityService $participantEligibilityService): BookingPriceCalculatorService
|
||||
private function createService(ParticipantEligibilityChecker $participantEligibilityService): BookingPriceCalculator
|
||||
{
|
||||
return new BookingPriceCalculatorService(
|
||||
return new BookingPriceCalculator(
|
||||
$this->roomPricingCalculator,
|
||||
$participantEligibilityService,
|
||||
new InsuranceService(),
|
||||
new InsuranceManager(),
|
||||
$this->participantPricingCalculator,
|
||||
);
|
||||
}
|
||||
+6
-6
@@ -11,16 +11,16 @@ use App\BusProNet\Model\Travel;
|
||||
use App\Form\Model\BookingDto;
|
||||
use App\Form\Model\ParticipantDto;
|
||||
use App\Form\Model\RoomSelectionDto;
|
||||
use App\Service\BookingPriceCalculatorService;
|
||||
use App\Service\BookingPriceMismatchDiagnosticsService;
|
||||
use App\Service\BookingPricingAssembler;
|
||||
use App\Service\BookingPriceMismatchAnalyzer;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
class BookingPriceMismatchDiagnosticsServiceTest extends TestCase
|
||||
class BookingPriceMismatchAnalyzerTest extends TestCase
|
||||
{
|
||||
public function testBuildDiagnosticsProvidesDeltaBreakdown(): void
|
||||
{
|
||||
$priceCalculator = $this->createMock(BookingPriceCalculatorService::class);
|
||||
$priceCalculator->method('getPricingBreakdown')->willReturn([
|
||||
$pricingAssembler = $this->createMock(BookingPricingAssembler::class);
|
||||
$pricingAssembler->method('getPricingBreakdown')->willReturn([
|
||||
'rooms' => [
|
||||
['roomId' => 74, 'totalPrice' => 444.0],
|
||||
],
|
||||
@@ -36,7 +36,7 @@ class BookingPriceMismatchDiagnosticsServiceTest extends TestCase
|
||||
'grandTotal' => 513.5,
|
||||
]);
|
||||
|
||||
$service = new BookingPriceMismatchDiagnosticsService($priceCalculator);
|
||||
$service = new BookingPriceMismatchAnalyzer($pricingAssembler);
|
||||
|
||||
$bookingDto = new BookingDto(new Travel(), 197136);
|
||||
$roomSelection = new RoomSelectionDto();
|
||||
+8
-8
@@ -8,22 +8,22 @@ use App\BusProNet\Model\Booking;
|
||||
use App\BusProNet\Model\Travel;
|
||||
use App\Form\Model\BookingDto;
|
||||
use App\Form\Model\RoomSelectionDto;
|
||||
use App\Service\BookingSessionService;
|
||||
use App\Service\TravelDataService;
|
||||
use App\Service\BookingSessionStore;
|
||||
use App\Service\TravelDataProvider;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Session\Session;
|
||||
use Symfony\Component\HttpFoundation\Session\Storage\MockArraySessionStorage;
|
||||
|
||||
class BookingSessionServiceTest extends TestCase
|
||||
class BookingSessionStoreTest extends TestCase
|
||||
{
|
||||
private TravelDataService $travelDataService;
|
||||
private BookingSessionService $service;
|
||||
private TravelDataProvider $travelDataService;
|
||||
private BookingSessionStore $service;
|
||||
|
||||
protected function setUp(): void
|
||||
{
|
||||
$this->travelDataService = $this->createMock(TravelDataService::class);
|
||||
$this->service = new BookingSessionService($this->travelDataService);
|
||||
$this->travelDataService = $this->createMock(TravelDataProvider::class);
|
||||
$this->service = new BookingSessionStore($this->travelDataService);
|
||||
}
|
||||
|
||||
public function testGetOrCreateBookingCreateDtoThrowsWhenSessionMissing(): void
|
||||
@@ -91,7 +91,7 @@ class BookingSessionServiceTest extends TestCase
|
||||
|
||||
$this->service->storeReturnUrl($request, 'javascript:alert(1)');
|
||||
|
||||
$this->assertSame(BookingSessionService::DEFAULT_RETURN_URL, $this->service->getReturnUrl($request));
|
||||
$this->assertSame(BookingSessionStore::DEFAULT_RETURN_URL, $this->service->getReturnUrl($request));
|
||||
}
|
||||
|
||||
public function testClearBookingSessionPreservesReturnUrl(): void
|
||||
@@ -4,20 +4,20 @@ declare(strict_types=1);
|
||||
|
||||
namespace App\Tests\Service;
|
||||
|
||||
use App\Service\ErrorCodeService;
|
||||
use App\Service\ErrorCodeGenerator;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\RequestStack;
|
||||
|
||||
class ErrorCodeServiceTest extends TestCase
|
||||
class ErrorCodeGeneratorTest extends TestCase
|
||||
{
|
||||
private RequestStack $requestStack;
|
||||
private ErrorCodeService $service;
|
||||
private ErrorCodeGenerator $service;
|
||||
|
||||
protected function setUp(): void
|
||||
{
|
||||
$this->requestStack = new RequestStack();
|
||||
$this->service = new ErrorCodeService($this->requestStack);
|
||||
$this->service = new ErrorCodeGenerator($this->requestStack);
|
||||
}
|
||||
|
||||
public function testReturnsNullWithoutRequest(): void
|
||||
@@ -67,7 +67,7 @@ class ErrorCodeServiceTest extends TestCase
|
||||
$request1->attributes->set('request_id', 'abc123');
|
||||
$this->requestStack->push($request1);
|
||||
|
||||
$service1 = new ErrorCodeService($this->requestStack);
|
||||
$service1 = new ErrorCodeGenerator($this->requestStack);
|
||||
$result1 = $service1->getErrorCode();
|
||||
|
||||
$this->requestStack->pop();
|
||||
@@ -76,7 +76,7 @@ class ErrorCodeServiceTest extends TestCase
|
||||
$request2->attributes->set('request_id', 'xyz789');
|
||||
$this->requestStack->push($request2);
|
||||
|
||||
$service2 = new ErrorCodeService($this->requestStack);
|
||||
$service2 = new ErrorCodeGenerator($this->requestStack);
|
||||
$result2 = $service2->getErrorCode();
|
||||
|
||||
$this->assertNotSame($result1, $result2);
|
||||
@@ -88,7 +88,7 @@ class ErrorCodeServiceTest extends TestCase
|
||||
$request1->attributes->set('request_id', 'abc123_1');
|
||||
$this->requestStack->push($request1);
|
||||
|
||||
$service1 = new ErrorCodeService($this->requestStack);
|
||||
$service1 = new ErrorCodeGenerator($this->requestStack);
|
||||
$result1 = $service1->getErrorCode();
|
||||
|
||||
$this->requestStack->pop();
|
||||
@@ -97,7 +97,7 @@ class ErrorCodeServiceTest extends TestCase
|
||||
$request2->attributes->set('request_id', 'abc123_2');
|
||||
$this->requestStack->push($request2);
|
||||
|
||||
$service2 = new ErrorCodeService($this->requestStack);
|
||||
$service2 = new ErrorCodeGenerator($this->requestStack);
|
||||
$result2 = $service2->getErrorCode();
|
||||
|
||||
$this->assertSame($result1, $result2);
|
||||
@@ -109,7 +109,7 @@ class ErrorCodeServiceTest extends TestCase
|
||||
$request1->attributes->set('request_id', 'abc123');
|
||||
$this->requestStack->push($request1);
|
||||
|
||||
$service1 = new ErrorCodeService($this->requestStack);
|
||||
$service1 = new ErrorCodeGenerator($this->requestStack);
|
||||
$result1 = $service1->getErrorCode();
|
||||
|
||||
$this->requestStack->pop();
|
||||
@@ -118,7 +118,7 @@ class ErrorCodeServiceTest extends TestCase
|
||||
$request2->attributes->set('request_id', 'abc123_5');
|
||||
$this->requestStack->push($request2);
|
||||
|
||||
$service2 = new ErrorCodeService($this->requestStack);
|
||||
$service2 = new ErrorCodeGenerator($this->requestStack);
|
||||
$result2 = $service2->getErrorCode();
|
||||
|
||||
$this->assertSame($result1, $result2);
|
||||
@@ -8,18 +8,18 @@ use App\BusProNet\Model\Insurance;
|
||||
use App\BusProNet\Model\Travel;
|
||||
use App\Form\Model\BookingDto;
|
||||
use App\Form\Model\ParticipantDto;
|
||||
use App\Service\InsuranceService;
|
||||
use App\Service\InsuranceManager;
|
||||
use Carbon\Carbon;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
class InsuranceServiceTest extends TestCase
|
||||
class InsuranceManagerTest extends TestCase
|
||||
{
|
||||
private InsuranceService $service;
|
||||
private InsuranceManager $service;
|
||||
|
||||
protected function setUp(): void
|
||||
{
|
||||
// InsuranceService is stateless and has no dependencies
|
||||
$this->service = new InsuranceService();
|
||||
// InsuranceManager is stateless and has no dependencies
|
||||
$this->service = new InsuranceManager();
|
||||
|
||||
// Set a fixed test date for consistent test results
|
||||
Carbon::setTestNow('2024-06-01 12:00:00');
|
||||
+7
-7
@@ -8,22 +8,22 @@ use App\BusProNet\Model\Room;
|
||||
use App\BusProNet\Model\Travel;
|
||||
use App\Form\Model\BookingDto;
|
||||
use App\Form\Model\ParticipantDto;
|
||||
use App\Service\BookingPriceCalculatorService;
|
||||
use App\Service\ParticipantCardDataService;
|
||||
use App\Service\BookingPriceCalculator;
|
||||
use App\Service\ParticipantCardAssembler;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Symfony\Component\Validator\Validator\ValidatorInterface;
|
||||
|
||||
class ParticipantCardDataServiceTest extends TestCase
|
||||
class ParticipantCardAssemblerTest extends TestCase
|
||||
{
|
||||
private ParticipantCardDataService $service;
|
||||
private BookingPriceCalculatorService $priceCalculator;
|
||||
private ParticipantCardAssembler $service;
|
||||
private BookingPriceCalculator $priceCalculator;
|
||||
private ValidatorInterface $validator;
|
||||
|
||||
protected function setUp(): void
|
||||
{
|
||||
$this->priceCalculator = $this->createMock(BookingPriceCalculatorService::class);
|
||||
$this->priceCalculator = $this->createMock(BookingPriceCalculator::class);
|
||||
$this->validator = $this->createMock(ValidatorInterface::class);
|
||||
$this->service = new ParticipantCardDataService(
|
||||
$this->service = new ParticipantCardAssembler(
|
||||
$this->priceCalculator,
|
||||
$this->validator
|
||||
);
|
||||
+13
-13
@@ -13,17 +13,17 @@ use App\Entity\User;
|
||||
use App\Form\Model\BookingDto;
|
||||
use App\Form\Model\ParticipantDto;
|
||||
use App\Security\Crypt;
|
||||
use App\Service\ParticipantPrepopulationService;
|
||||
use App\Service\ParticipantDataPrefiller;
|
||||
use Carbon\CarbonImmutable;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Psr\Log\LoggerInterface;
|
||||
|
||||
class ParticipantPrepopulationServiceTest extends TestCase
|
||||
class ParticipantDataPrefillerTest extends TestCase
|
||||
{
|
||||
private ApiClient $apiClient;
|
||||
private Crypt $crypt;
|
||||
private LoggerInterface $logger;
|
||||
private ParticipantPrepopulationService $service;
|
||||
private ParticipantDataPrefiller $service;
|
||||
|
||||
protected function setUp(): void
|
||||
{
|
||||
@@ -31,7 +31,7 @@ class ParticipantPrepopulationServiceTest extends TestCase
|
||||
$this->crypt = $this->createMock(Crypt::class);
|
||||
$this->logger = $this->createMock(LoggerInterface::class);
|
||||
|
||||
$this->service = new ParticipantPrepopulationService(
|
||||
$this->service = new ParticipantDataPrefiller(
|
||||
$this->apiClient,
|
||||
$this->crypt,
|
||||
$this->logger
|
||||
@@ -56,7 +56,7 @@ class ParticipantPrepopulationServiceTest extends TestCase
|
||||
->with('[email protected]', 'decrypted_password')
|
||||
->willReturn($personalData);
|
||||
|
||||
$result = $this->service->prepopulateApplicantFromUser($user, $applicant);
|
||||
$result = $this->service->prefillApplicantFromUser($user, $applicant);
|
||||
|
||||
// BPN API IDs for linking to existing records
|
||||
$this->assertSame(12345, $result->addressId);
|
||||
@@ -102,7 +102,7 @@ class ParticipantPrepopulationServiceTest extends TestCase
|
||||
->method('getPersonalData')
|
||||
->willReturn($personalData);
|
||||
|
||||
$result = $this->service->prepopulateApplicantFromUser($user, $applicant);
|
||||
$result = $this->service->prefillApplicantFromUser($user, $applicant);
|
||||
|
||||
// Required fields should be populated
|
||||
$this->assertSame('Jane', $result->firstName);
|
||||
@@ -148,7 +148,7 @@ class ParticipantPrepopulationServiceTest extends TestCase
|
||||
$this->logger->expects($this->never())
|
||||
->method('info');
|
||||
|
||||
$result = $this->service->prepopulateApplicantFromUser($user, $applicant);
|
||||
$result = $this->service->prefillApplicantFromUser($user, $applicant);
|
||||
|
||||
// Should return unchanged applicant
|
||||
$this->assertNull($result->firstName);
|
||||
@@ -176,7 +176,7 @@ class ParticipantPrepopulationServiceTest extends TestCase
|
||||
'email' => '[email protected]',
|
||||
]);
|
||||
|
||||
$result = $this->service->prepopulateApplicantFromUser($user, $applicant);
|
||||
$result = $this->service->prefillApplicantFromUser($user, $applicant);
|
||||
|
||||
// Should return unchanged applicant
|
||||
$this->assertNull($result->firstName);
|
||||
@@ -205,7 +205,7 @@ class ParticipantPrepopulationServiceTest extends TestCase
|
||||
'email' => '[email protected]',
|
||||
]);
|
||||
|
||||
$result = $this->service->prepopulateApplicantFromUser($user, $applicant);
|
||||
$result = $this->service->prefillApplicantFromUser($user, $applicant);
|
||||
|
||||
// Should return unchanged applicant
|
||||
$this->assertNull($result->firstName);
|
||||
@@ -231,7 +231,7 @@ class ParticipantPrepopulationServiceTest extends TestCase
|
||||
->method('getPersonalData')
|
||||
->willReturn($personalData);
|
||||
|
||||
$result = $this->service->prepopulateApplicantFromUser($user, $applicant);
|
||||
$result = $this->service->prefillApplicantFromUser($user, $applicant);
|
||||
|
||||
// Personal data should be updated
|
||||
$this->assertSame('John', $result->firstName);
|
||||
@@ -250,14 +250,14 @@ class ParticipantPrepopulationServiceTest extends TestCase
|
||||
$filled = new ParticipantDto();
|
||||
$filled->firstName = 'Already set';
|
||||
|
||||
$this->assertTrue($this->service->shouldPrepopulateApplicant($fresh));
|
||||
$this->assertFalse($this->service->shouldPrepopulateApplicant($filled));
|
||||
$this->assertTrue($this->service->shouldPrefillApplicant($fresh));
|
||||
$this->assertFalse($this->service->shouldPrefillApplicant($filled));
|
||||
}
|
||||
|
||||
public function testDummyTokenMatchesOnlyInCreateMode(): void
|
||||
{
|
||||
$participant = new ParticipantDto();
|
||||
$participant->lastName = ParticipantPrepopulationService::TOKEN;
|
||||
$participant->lastName = ParticipantDataPrefiller::TOKEN;
|
||||
|
||||
$this->assertTrue($this->service->isDummyDataFillRequested($participant, BookingDto::MODE_CREATE));
|
||||
$this->assertFalse($this->service->isDummyDataFillRequested($participant, BookingDto::MODE_EDIT));
|
||||
+4
-4
@@ -9,16 +9,16 @@ use App\BusProNet\Model\Service;
|
||||
use App\BusProNet\Model\Travel;
|
||||
use App\Form\Model\BookingDto;
|
||||
use App\Form\Model\ParticipantDto;
|
||||
use App\Service\ParticipantEligibilityService;
|
||||
use App\Service\ParticipantEligibilityChecker;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
class ParticipantEligibilityServiceTest extends TestCase
|
||||
class ParticipantEligibilityCheckerTest extends TestCase
|
||||
{
|
||||
private ParticipantEligibilityService $service;
|
||||
private ParticipantEligibilityChecker $service;
|
||||
|
||||
protected function setUp(): void
|
||||
{
|
||||
$this->service = new ParticipantEligibilityService();
|
||||
$this->service = new ParticipantEligibilityChecker();
|
||||
}
|
||||
|
||||
public function testBabyParticipantIsAlwaysEligible(): void
|
||||
+4
-4
@@ -9,11 +9,11 @@ use App\BusProNet\Model\Travel;
|
||||
use App\Exception\ParticipantNotFoundException;
|
||||
use App\Form\Model\BookingDto;
|
||||
use App\Form\Model\ParticipantDto;
|
||||
use App\Service\ParticipantFormSupportService;
|
||||
use App\Service\ParticipantFormSupport;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
|
||||
|
||||
class ParticipantFormSupportServiceTest extends TestCase
|
||||
class ParticipantFormSupportTest extends TestCase
|
||||
{
|
||||
public function testEnsureParticipantExistsThrowsForMissingIndex(): void
|
||||
{
|
||||
@@ -84,11 +84,11 @@ class ParticipantFormSupportServiceTest extends TestCase
|
||||
$this->assertFalse($options['validation_groups']);
|
||||
}
|
||||
|
||||
private function createService(?ParameterBagInterface $parameterBag = null): ParticipantFormSupportService
|
||||
private function createService(?ParameterBagInterface $parameterBag = null): ParticipantFormSupport
|
||||
{
|
||||
$parameterBag ??= $this->createMock(ParameterBagInterface::class);
|
||||
|
||||
return new ParticipantFormSupportService($parameterBag);
|
||||
return new ParticipantFormSupport($parameterBag);
|
||||
}
|
||||
|
||||
private function createBookingDto(): BookingDto
|
||||
@@ -10,19 +10,19 @@ use App\BusProNet\Model\Travel;
|
||||
use App\Form\Model\BookingDto;
|
||||
use App\Form\Model\ParticipantDto;
|
||||
use App\Form\Model\RoomSelectionDto;
|
||||
use App\Service\RoomAssignmentService;
|
||||
use App\Service\RoomAssigner;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
/**
|
||||
* Tests for RoomAssignmentService.
|
||||
* Tests for RoomAssigner.
|
||||
*/
|
||||
class RoomAssignmentServiceTest extends TestCase
|
||||
class RoomAssignerTest extends TestCase
|
||||
{
|
||||
private RoomAssignmentService $service;
|
||||
private RoomAssigner $service;
|
||||
|
||||
protected function setUp(): void
|
||||
{
|
||||
$this->service = new RoomAssignmentService();
|
||||
$this->service = new RoomAssigner();
|
||||
}
|
||||
|
||||
/**
|
||||
+13
-13
@@ -8,24 +8,24 @@ use App\BusProNet\ApiClient;
|
||||
use App\BusProNet\Model\Travel;
|
||||
use App\BusProNet\XmlLoader\TravelLoader;
|
||||
use App\Exception\TravelNotFoundException;
|
||||
use App\Service\TravelDataService;
|
||||
use App\Service\TravelEnrichmentService;
|
||||
use App\Service\TravelLookupService;
|
||||
use App\Service\TravelSnapshotService;
|
||||
use App\Service\TravelDataProvider;
|
||||
use App\Service\TravelEnricher;
|
||||
use App\Service\TravelIndex;
|
||||
use App\Service\TravelSnapshotManager;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Psr\Log\LoggerInterface;
|
||||
use Symfony\Contracts\Cache\CacheInterface;
|
||||
|
||||
class TravelDataServiceTest extends TestCase
|
||||
class TravelDataProviderTest extends TestCase
|
||||
{
|
||||
private TravelDataService $service;
|
||||
private TravelDataProvider $service;
|
||||
private TravelLoader $travelLoader;
|
||||
private ApiClient $apiClient;
|
||||
private CacheInterface $cache;
|
||||
private LoggerInterface $logger;
|
||||
private TravelSnapshotService $travelSnapshotService;
|
||||
private TravelLookupService $travelLookupService;
|
||||
private TravelEnrichmentService $travelEnrichmentService;
|
||||
private TravelSnapshotManager $travelSnapshotService;
|
||||
private TravelIndex $travelLookupService;
|
||||
private TravelEnricher $travelEnrichmentService;
|
||||
|
||||
protected function setUp(): void
|
||||
{
|
||||
@@ -33,11 +33,11 @@ class TravelDataServiceTest extends TestCase
|
||||
$this->apiClient = $this->createMock(ApiClient::class);
|
||||
$this->cache = $this->createMock(CacheInterface::class);
|
||||
$this->logger = $this->createMock(LoggerInterface::class);
|
||||
$this->travelSnapshotService = $this->createMock(TravelSnapshotService::class);
|
||||
$this->travelLookupService = $this->createMock(TravelLookupService::class);
|
||||
$this->travelEnrichmentService = $this->createMock(TravelEnrichmentService::class);
|
||||
$this->travelSnapshotService = $this->createMock(TravelSnapshotManager::class);
|
||||
$this->travelLookupService = $this->createMock(TravelIndex::class);
|
||||
$this->travelEnrichmentService = $this->createMock(TravelEnricher::class);
|
||||
|
||||
$this->service = new TravelDataService(
|
||||
$this->service = new TravelDataProvider(
|
||||
$this->travelLoader,
|
||||
$this->apiClient,
|
||||
$this->cache,
|
||||
+4
-4
@@ -9,13 +9,13 @@ use App\BusProNet\Model\Travel;
|
||||
use App\BusProNet\XmlLoader\HotelLoader;
|
||||
use App\BusProNet\XmlLoader\InsuranceLoader;
|
||||
use App\BusProNet\XmlLoader\PickupLoader;
|
||||
use App\Service\TravelEnrichmentService;
|
||||
use App\Service\TravelEnricher;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Psr\Log\LoggerInterface;
|
||||
|
||||
class TravelEnrichmentServiceTest extends TestCase
|
||||
class TravelEnricherTest extends TestCase
|
||||
{
|
||||
private TravelEnrichmentService $service;
|
||||
private TravelEnricher $service;
|
||||
private PickupLoader $pickupLoader;
|
||||
private HotelLoader $hotelLoader;
|
||||
private InsuranceLoader $insuranceLoader;
|
||||
@@ -28,7 +28,7 @@ class TravelEnrichmentServiceTest extends TestCase
|
||||
$this->insuranceLoader = $this->createMock(InsuranceLoader::class);
|
||||
$this->logger = $this->createMock(LoggerInterface::class);
|
||||
|
||||
$this->service = new TravelEnrichmentService(
|
||||
$this->service = new TravelEnricher(
|
||||
$this->pickupLoader,
|
||||
$this->hotelLoader,
|
||||
$this->insuranceLoader,
|
||||
@@ -6,27 +6,27 @@ namespace App\Tests\Service;
|
||||
|
||||
use App\BusProNet\XmlLoader\HotelLoader;
|
||||
use App\BusProNet\XmlLoader\TravelLoader;
|
||||
use App\Service\TravelLookupService;
|
||||
use App\Service\TravelSnapshotService;
|
||||
use App\Service\TravelIndex;
|
||||
use App\Service\TravelSnapshotManager;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Psr\Log\LoggerInterface;
|
||||
|
||||
class TravelLookupServiceTest extends TestCase
|
||||
class TravelIndexTest extends TestCase
|
||||
{
|
||||
private TravelLookupService $service;
|
||||
private TravelIndex $service;
|
||||
private TravelLoader $travelLoader;
|
||||
private HotelLoader $hotelLoader;
|
||||
private TravelSnapshotService $travelSnapshotService;
|
||||
private TravelSnapshotManager $travelSnapshotService;
|
||||
private LoggerInterface $logger;
|
||||
|
||||
protected function setUp(): void
|
||||
{
|
||||
$this->travelLoader = $this->createMock(TravelLoader::class);
|
||||
$this->hotelLoader = $this->createMock(HotelLoader::class);
|
||||
$this->travelSnapshotService = $this->createMock(TravelSnapshotService::class);
|
||||
$this->travelSnapshotService = $this->createMock(TravelSnapshotManager::class);
|
||||
$this->logger = $this->createMock(LoggerInterface::class);
|
||||
|
||||
$this->service = new TravelLookupService(
|
||||
$this->service = new TravelIndex(
|
||||
$this->travelLoader,
|
||||
$this->hotelLoader,
|
||||
$this->travelSnapshotService,
|
||||
+4
-4
@@ -11,20 +11,20 @@ use App\BusProNet\Model\Hotel;
|
||||
use App\BusProNet\Model\Travel;
|
||||
use App\Entity\TravelSnapshot;
|
||||
use App\Repository\TravelSnapshotRepository;
|
||||
use App\Service\TravelSnapshotService;
|
||||
use App\Service\TravelSnapshotManager;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Psr\Log\LoggerInterface;
|
||||
use Symfony\Component\Serializer\SerializerInterface;
|
||||
|
||||
class TravelSnapshotServiceTest extends TestCase
|
||||
class TravelSnapshotManagerTest extends TestCase
|
||||
{
|
||||
private TravelSnapshotRepository $snapshotRepository;
|
||||
private EntityManagerInterface $entityManager;
|
||||
private ApiClient $apiClient;
|
||||
private LoggerInterface $logger;
|
||||
private SerializerInterface $serializer;
|
||||
private TravelSnapshotService $service;
|
||||
private TravelSnapshotManager $service;
|
||||
|
||||
protected function setUp(): void
|
||||
{
|
||||
@@ -34,7 +34,7 @@ class TravelSnapshotServiceTest extends TestCase
|
||||
$this->logger = $this->createMock(LoggerInterface::class);
|
||||
$this->serializer = $this->createMock(SerializerInterface::class);
|
||||
|
||||
$this->service = new TravelSnapshotService(
|
||||
$this->service = new TravelSnapshotManager(
|
||||
$this->snapshotRepository,
|
||||
$this->entityManager,
|
||||
$this->apiClient,
|
||||
@@ -11,19 +11,19 @@ use App\Form\Model\BookingDto;
|
||||
use App\Form\Model\ParticipantDto;
|
||||
use App\Form\Model\ParticipantEditDto;
|
||||
use App\Form\Service\ServiceAgeEvaluator;
|
||||
use App\Service\ParticipantEligibilityService;
|
||||
use App\Service\ParticipantEligibilityChecker;
|
||||
use App\Validator\Constraints\MandatoryAdditionalServicesSelected;
|
||||
use App\Validator\Constraints\MandatoryAdditionalServicesSelectedValidator;
|
||||
use Symfony\Component\Validator\Test\ConstraintValidatorTestCase;
|
||||
|
||||
class MandatoryAdditionalServicesSelectedValidatorTest extends ConstraintValidatorTestCase
|
||||
{
|
||||
private ParticipantEligibilityService $participantEligibilityService;
|
||||
private ParticipantEligibilityChecker $participantEligibilityService;
|
||||
private bool $participantEligible = true;
|
||||
|
||||
protected function createValidator(): MandatoryAdditionalServicesSelectedValidator
|
||||
{
|
||||
$this->participantEligibilityService = $this->createMock(ParticipantEligibilityService::class);
|
||||
$this->participantEligibilityService = $this->createMock(ParticipantEligibilityChecker::class);
|
||||
$this->participantEligibilityService
|
||||
->method('isParticipantEligible')
|
||||
->willReturnCallback(fn (): bool => $this->participantEligible);
|
||||
|
||||
Reference in New Issue
Block a user