diff --git a/config/services.yaml b/config/services.yaml index 82f738e..53b95eb 100644 --- a/config/services.yaml +++ b/config/services.yaml @@ -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%' diff --git a/src/BusProNet/DataProcessor/BookingDataProcessor.php b/src/BusProNet/DataProcessor/BookingDataProcessor.php index 2c8d1fe..0351c3c 100644 --- a/src/BusProNet/DataProcessor/BookingDataProcessor.php +++ b/src/BusProNet/DataProcessor/BookingDataProcessor.php @@ -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, diff --git a/src/Command/BpnRefreshTravelSnapshotCommand.php b/src/Command/BpnRefreshTravelSnapshotCommand.php index 3d72b6e..e6dfc40 100644 --- a/src/Command/BpnRefreshTravelSnapshotCommand.php +++ b/src/Command/BpnRefreshTravelSnapshotCommand.php @@ -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, ) { diff --git a/src/Command/BpnXmlSyncCommand.php b/src/Command/BpnXmlSyncCommand.php index 3b257be..e1db483 100644 --- a/src/Command/BpnXmlSyncCommand.php +++ b/src/Command/BpnXmlSyncCommand.php @@ -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(); } diff --git a/src/Command/DraftBackfillBookingNumberCommand.php b/src/Command/DraftBackfillBookingNumberCommand.php index 2f75bc0..4ec14e6 100644 --- a/src/Command/DraftBackfillBookingNumberCommand.php +++ b/src/Command/DraftBackfillBookingNumberCommand.php @@ -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(); diff --git a/src/Controller/Account/PersonalDataController.php b/src/Controller/Account/PersonalDataController.php index 8c4f7ff..6efadf5 100644 --- a/src/Controller/Account/PersonalDataController.php +++ b/src/Controller/Account/PersonalDataController.php @@ -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, ) { diff --git a/src/Controller/Admin/BookingEditDraftCrudController.php b/src/Controller/Admin/BookingEditDraftCrudController.php index e1c5337..e294280 100644 --- a/src/Controller/Admin/BookingEditDraftCrudController.php +++ b/src/Controller/Admin/BookingEditDraftCrudController.php @@ -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, ) { } diff --git a/src/Controller/Admin/LogEntryCrudController.php b/src/Controller/Admin/LogEntryCrudController.php index 2ba2928..fda1bd3 100644 --- a/src/Controller/Admin/LogEntryCrudController.php +++ b/src/Controller/Admin/LogEntryCrudController.php @@ -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) { diff --git a/src/Controller/Admin/XmlDumpController.php b/src/Controller/Admin/XmlDumpController.php index 25347f9..1f61030 100644 --- a/src/Controller/Admin/XmlDumpController.php +++ b/src/Controller/Admin/XmlDumpController.php @@ -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, ) { } diff --git a/src/Controller/Api/TravelController.php b/src/Controller/Api/TravelController.php index a8873ac..9649e40 100644 --- a/src/Controller/Api/TravelController.php +++ b/src/Controller/Api/TravelController.php @@ -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, ) { } diff --git a/src/Controller/Booking/Create/IndexController.php b/src/Controller/Booking/Create/IndexController.php index 4bec2e2..be7f915 100644 --- a/src/Controller/Booking/Create/IndexController.php +++ b/src/Controller/Booking/Create/IndexController.php @@ -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, ) { } diff --git a/src/Controller/Booking/Create/Step1Controller.php b/src/Controller/Booking/Create/Step1Controller.php index b0ab360..95c047e 100644 --- a/src/Controller/Booking/Create/Step1Controller.php +++ b/src/Controller/Booking/Create/Step1Controller.php @@ -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, ) { } diff --git a/src/Controller/Booking/Create/Step2ParticipantController.php b/src/Controller/Booking/Create/Step2ParticipantController.php index 7bd492d..af76c7d 100644 --- a/src/Controller/Booking/Create/Step2ParticipantController.php +++ b/src/Controller/Booking/Create/Step2ParticipantController.php @@ -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, ) { } diff --git a/src/Controller/Booking/Create/Step3Controller.php b/src/Controller/Booking/Create/Step3Controller.php index 025924e..0f107e5 100644 --- a/src/Controller/Booking/Create/Step3Controller.php +++ b/src/Controller/Booking/Create/Step3Controller.php @@ -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, ) { diff --git a/src/Controller/Booking/Create/Step4Controller.php b/src/Controller/Booking/Create/Step4Controller.php index 37694c2..50f117a 100644 --- a/src/Controller/Booking/Create/Step4Controller.php +++ b/src/Controller/Booking/Create/Step4Controller.php @@ -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, ) { } diff --git a/src/Controller/Booking/Create/SuccessController.php b/src/Controller/Booking/Create/SuccessController.php index 8ccfef5..264762a 100644 --- a/src/Controller/Booking/Create/SuccessController.php +++ b/src/Controller/Booking/Create/SuccessController.php @@ -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, ) { } diff --git a/src/Controller/Booking/Edit/IndexController.php b/src/Controller/Booking/Edit/IndexController.php index 5b846ab..1e8ebad 100644 --- a/src/Controller/Booking/Edit/IndexController.php +++ b/src/Controller/Booking/Edit/IndexController.php @@ -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, ) { } diff --git a/src/Controller/Booking/Edit/ParticipantController.php b/src/Controller/Booking/Edit/ParticipantController.php index 0723275..bd12897 100644 --- a/src/Controller/Booking/Edit/ParticipantController.php +++ b/src/Controller/Booking/Edit/ParticipantController.php @@ -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, ) { } diff --git a/src/Controller/Booking/Traits/BookingExceptionHandlerTrait.php b/src/Controller/Booking/Traits/BookingExceptionHandlerTrait.php index 3a85503..baffe85 100644 --- a/src/Controller/Booking/Traits/BookingExceptionHandlerTrait.php +++ b/src/Controller/Booking/Traits/BookingExceptionHandlerTrait.php @@ -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); diff --git a/src/Controller/Newsletter/ConfirmController.php b/src/Controller/Newsletter/ConfirmController.php index ed1ab1b..907f5d3 100644 --- a/src/Controller/Newsletter/ConfirmController.php +++ b/src/Controller/Newsletter/ConfirmController.php @@ -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, ) { } diff --git a/src/Controller/SecurityController.php b/src/Controller/SecurityController.php index e24bb58..f4fae02 100644 --- a/src/Controller/SecurityController.php +++ b/src/Controller/SecurityController.php @@ -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 diff --git a/src/Form/Model/BookingDto.php b/src/Form/Model/BookingDto.php index aa5fe9a..c231598 100644 --- a/src/Form/Model/BookingDto.php +++ b/src/Form/Model/BookingDto.php @@ -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 */ @@ -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 $data diff --git a/src/Form/Service/Condition/BookingEligibilityCondition.php b/src/Form/Service/Condition/BookingEligibilityCondition.php index a2f9de0..919cc9d 100644 --- a/src/Form/Service/Condition/BookingEligibilityCondition.php +++ b/src/Form/Service/Condition/BookingEligibilityCondition.php @@ -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, ) { } diff --git a/src/Form/Service/CreateFieldStateProvider.php b/src/Form/Service/CreateFieldStateProvider.php index 13b8269..1898bb0 100644 --- a/src/Form/Service/CreateFieldStateProvider.php +++ b/src/Form/Service/CreateFieldStateProvider.php @@ -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(), diff --git a/src/Form/Service/ParticipantFieldOptionsProvider.php b/src/Form/Service/ParticipantFieldOptionsProvider.php index 42512e7..918bb5f 100644 --- a/src/Form/Service/ParticipantFieldOptionsProvider.php +++ b/src/Form/Service/ParticipantFieldOptionsProvider.php @@ -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; } /** diff --git a/src/Form/Service/ParticipantInsuranceFieldHandler.php b/src/Form/Service/ParticipantInsuranceFieldHandler.php index 58f1a0a..afe9573 100644 --- a/src/Form/Service/ParticipantInsuranceFieldHandler.php +++ b/src/Form/Service/ParticipantInsuranceFieldHandler.php @@ -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, ) { } diff --git a/src/Form/Service/ParticipantPromoVoucherFieldHandler.php b/src/Form/Service/ParticipantPromoVoucherFieldHandler.php index 3b9b87d..5c55c21 100644 --- a/src/Form/Service/ParticipantPromoVoucherFieldHandler.php +++ b/src/Form/Service/ParticipantPromoVoucherFieldHandler.php @@ -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, ) { } diff --git a/src/Form/Service/ParticipantPurchaseVoucherFieldHandler.php b/src/Form/Service/ParticipantPurchaseVoucherFieldHandler.php index 7235eb7..5168664 100644 --- a/src/Form/Service/ParticipantPurchaseVoucherFieldHandler.php +++ b/src/Form/Service/ParticipantPurchaseVoucherFieldHandler.php @@ -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, ) { } diff --git a/src/Form/Service/ParticipantRentalInsuranceFieldHandler.php b/src/Form/Service/ParticipantRentalInsuranceFieldHandler.php index 090bbcd..f33452a 100644 --- a/src/Form/Service/ParticipantRentalInsuranceFieldHandler.php +++ b/src/Form/Service/ParticipantRentalInsuranceFieldHandler.php @@ -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 } } diff --git a/src/Logger/ErrorCodeProcessor.php b/src/Logger/ErrorCodeProcessor.php index 794ae13..5a923f7 100644 --- a/src/Logger/ErrorCodeProcessor.php +++ b/src/Logger/ErrorCodeProcessor.php @@ -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, ) { } diff --git a/src/Service/BookingFingerprintService.php b/src/Service/BookingChangeTracker.php similarity index 99% rename from src/Service/BookingFingerprintService.php rename to src/Service/BookingChangeTracker.php index 1257e12..f75c520 100644 --- a/src/Service/BookingFingerprintService.php +++ b/src/Service/BookingChangeTracker.php @@ -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. diff --git a/src/Service/BookingService.php b/src/Service/BookingConfigurator.php similarity index 99% rename from src/Service/BookingService.php rename to src/Service/BookingConfigurator.php index 64bd40b..99811c2 100644 --- a/src/Service/BookingService.php +++ b/src/Service/BookingConfigurator.php @@ -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%')] diff --git a/src/Service/BookingEditContextFactory.php b/src/Service/BookingEditContextFactory.php index 00d6761..199f43a 100644 --- a/src/Service/BookingEditContextFactory.php +++ b/src/Service/BookingEditContextFactory.php @@ -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, ) { } diff --git a/src/Service/BookingEditDataLoaderService.php b/src/Service/BookingEditDataLoader.php similarity index 96% rename from src/Service/BookingEditDataLoaderService.php rename to src/Service/BookingEditDataLoader.php index 8b2a655..bb3a9bd 100644 --- a/src/Service/BookingEditDataLoaderService.php +++ b/src/Service/BookingEditDataLoader.php @@ -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, diff --git a/src/Service/BookingEditSubmitGuardService.php b/src/Service/BookingEditSubmitGuard.php similarity index 99% rename from src/Service/BookingEditSubmitGuardService.php rename to src/Service/BookingEditSubmitGuard.php index a52b133..bbe79a3 100644 --- a/src/Service/BookingEditSubmitGuardService.php +++ b/src/Service/BookingEditSubmitGuard.php @@ -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, diff --git a/src/Service/BookingEditSubmitService.php b/src/Service/BookingEditSubmitter.php similarity index 93% rename from src/Service/BookingEditSubmitService.php rename to src/Service/BookingEditSubmitter.php index be7684f..4f8786c 100644 --- a/src/Service/BookingEditSubmitService.php +++ b/src/Service/BookingEditSubmitter.php @@ -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, ) { diff --git a/src/Service/BookingExportService.php b/src/Service/BookingExporter.php similarity index 99% rename from src/Service/BookingExportService.php rename to src/Service/BookingExporter.php index 0f407a3..e02f1b0 100644 --- a/src/Service/BookingExportService.php +++ b/src/Service/BookingExporter.php @@ -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, ) { } diff --git a/src/Service/BookingPriceCalculatorService.php b/src/Service/BookingPriceCalculator.php similarity index 99% rename from src/Service/BookingPriceCalculatorService.php rename to src/Service/BookingPriceCalculator.php index 0447568..1d4114c 100644 --- a/src/Service/BookingPriceCalculatorService.php +++ b/src/Service/BookingPriceCalculator.php @@ -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, ) { } diff --git a/src/Service/BookingPriceMismatchDiagnosticsService.php b/src/Service/BookingPriceMismatchAnalyzer.php similarity index 96% rename from src/Service/BookingPriceMismatchDiagnosticsService.php rename to src/Service/BookingPriceMismatchAnalyzer.php index 2819480..8003c54 100644 --- a/src/Service/BookingPriceMismatchDiagnosticsService.php +++ b/src/Service/BookingPriceMismatchAnalyzer.php @@ -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'] ?? []; diff --git a/src/Service/BookingSessionService.php b/src/Service/BookingSessionStore.php similarity index 98% rename from src/Service/BookingSessionService.php rename to src/Service/BookingSessionStore.php index e0d1690..a66570b 100644 --- a/src/Service/BookingSessionService.php +++ b/src/Service/BookingSessionStore.php @@ -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, ) { } diff --git a/src/Service/CmsDataService.php b/src/Service/CmsDataProvider.php similarity index 98% rename from src/Service/CmsDataService.php rename to src/Service/CmsDataProvider.php index 10c4adb..2a211dc 100644 --- a/src/Service/CmsDataService.php +++ b/src/Service/CmsDataProvider.php @@ -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) { diff --git a/src/Service/ErrorCodeService.php b/src/Service/ErrorCodeGenerator.php similarity index 99% rename from src/Service/ErrorCodeService.php rename to src/Service/ErrorCodeGenerator.php index 203863a..7cbcf0c 100644 --- a/src/Service/ErrorCodeService.php +++ b/src/Service/ErrorCodeGenerator.php @@ -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; diff --git a/src/Service/InsuranceService.php b/src/Service/InsuranceManager.php similarity index 99% rename from src/Service/InsuranceService.php rename to src/Service/InsuranceManager.php index efd0d8d..d744cf6 100644 --- a/src/Service/InsuranceService.php +++ b/src/Service/InsuranceManager.php @@ -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; diff --git a/src/Service/MailjetNewsletterService.php b/src/Service/MailjetApiClient.php similarity index 99% rename from src/Service/MailjetNewsletterService.php rename to src/Service/MailjetApiClient.php index 9ff4f7e..61f46b5 100644 --- a/src/Service/MailjetNewsletterService.php +++ b/src/Service/MailjetApiClient.php @@ -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'; diff --git a/src/Service/NewsletterDoubleOptInService.php b/src/Service/NewsletterManager.php similarity index 98% rename from src/Service/NewsletterDoubleOptInService.php rename to src/Service/NewsletterManager.php index d98c88a..090f579 100644 --- a/src/Service/NewsletterDoubleOptInService.php +++ b/src/Service/NewsletterManager.php @@ -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, diff --git a/src/Service/ParticipantCardDataService.php b/src/Service/ParticipantCardAssembler.php similarity index 98% rename from src/Service/ParticipantCardDataService.php rename to src/Service/ParticipantCardAssembler.php index c0ec7bf..32d09b1 100644 --- a/src/Service/ParticipantCardDataService.php +++ b/src/Service/ParticipantCardAssembler.php @@ -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, ) { } diff --git a/src/Service/ParticipantPrepopulationService.php b/src/Service/ParticipantDataPrefiller.php similarity index 96% rename from src/Service/ParticipantPrepopulationService.php rename to src/Service/ParticipantDataPrefiller.php index ede6c9d..c6a45cf 100644 --- a/src/Service/ParticipantPrepopulationService.php +++ b/src/Service/ParticipantDataPrefiller.php @@ -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; } diff --git a/src/Service/ParticipantEligibilityService.php b/src/Service/ParticipantEligibilityChecker.php similarity index 99% rename from src/Service/ParticipantEligibilityService.php rename to src/Service/ParticipantEligibilityChecker.php index dbd28f0..9ea7e26 100644 --- a/src/Service/ParticipantEligibilityService.php +++ b/src/Service/ParticipantEligibilityChecker.php @@ -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 Request-scoped cache for participant eligibility */ private array $eligibilityCache = []; diff --git a/src/Service/ParticipantFormSupportService.php b/src/Service/ParticipantFormSupport.php similarity index 98% rename from src/Service/ParticipantFormSupportService.php rename to src/Service/ParticipantFormSupport.php index 365fed8..e1c18cb 100644 --- a/src/Service/ParticipantFormSupportService.php +++ b/src/Service/ParticipantFormSupport.php @@ -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, diff --git a/src/Service/RoomAssignmentService.php b/src/Service/RoomAssigner.php similarity index 99% rename from src/Service/RoomAssignmentService.php rename to src/Service/RoomAssigner.php index 64ccbd8..9c4cf04 100644 --- a/src/Service/RoomAssignmentService.php +++ b/src/Service/RoomAssigner.php @@ -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. diff --git a/src/Service/TravelDataService.php b/src/Service/TravelDataProvider.php similarity index 98% rename from src/Service/TravelDataService.php rename to src/Service/TravelDataProvider.php index 46eb216..c05bafe 100644 --- a/src/Service/TravelDataService.php +++ b/src/Service/TravelDataProvider.php @@ -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, ) { diff --git a/src/Service/TravelEnrichmentService.php b/src/Service/TravelEnricher.php similarity index 98% rename from src/Service/TravelEnrichmentService.php rename to src/Service/TravelEnricher.php index ebbd35d..01a8836 100644 --- a/src/Service/TravelEnrichmentService.php +++ b/src/Service/TravelEnricher.php @@ -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, diff --git a/src/Service/TravelLookupService.php b/src/Service/TravelIndex.php similarity index 98% rename from src/Service/TravelLookupService.php rename to src/Service/TravelIndex.php index a17dd78..eeaf1ac 100644 --- a/src/Service/TravelLookupService.php +++ b/src/Service/TravelIndex.php @@ -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>|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, ) { } diff --git a/src/Service/TravelSnapshotService.php b/src/Service/TravelSnapshotManager.php similarity index 99% rename from src/Service/TravelSnapshotService.php rename to src/Service/TravelSnapshotManager.php index 4f5ef51..9085c92 100644 --- a/src/Service/TravelSnapshotService.php +++ b/src/Service/TravelSnapshotManager.php @@ -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, diff --git a/src/Service/VoucherValidationService.php b/src/Service/VoucherValidator.php similarity index 99% rename from src/Service/VoucherValidationService.php rename to src/Service/VoucherValidator.php index 7240744..7f5578b 100644 --- a/src/Service/VoucherValidationService.php +++ b/src/Service/VoucherValidator.php @@ -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 diff --git a/src/Service/XmlDumpService.php b/src/Service/XmlDumpReader.php similarity index 99% rename from src/Service/XmlDumpService.php rename to src/Service/XmlDumpReader.php index 9c4f31e..2c6854b 100644 --- a/src/Service/XmlDumpService.php +++ b/src/Service/XmlDumpReader.php @@ -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, diff --git a/src/Twig/AppRuntime.php b/src/Twig/AppRuntime.php index 21540e6..57eac10 100644 --- a/src/Twig/AppRuntime.php +++ b/src/Twig/AppRuntime.php @@ -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, diff --git a/src/Twig/ErrorCodeExtension.php b/src/Twig/ErrorCodeExtension.php index e321748..d721773 100644 --- a/src/Twig/ErrorCodeExtension.php +++ b/src/Twig/ErrorCodeExtension.php @@ -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, ) { } diff --git a/src/Validator/Constraints/MandatoryAdditionalServicesSelectedValidator.php b/src/Validator/Constraints/MandatoryAdditionalServicesSelectedValidator.php index 9c3e30e..c42d31d 100644 --- a/src/Validator/Constraints/MandatoryAdditionalServicesSelectedValidator.php +++ b/src/Validator/Constraints/MandatoryAdditionalServicesSelectedValidator.php @@ -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, ) { } diff --git a/src/Validator/Constraints/PromoVoucherValidator.php b/src/Validator/Constraints/PromoVoucherValidator.php index 1daf5e9..5e97a0f 100644 --- a/src/Validator/Constraints/PromoVoucherValidator.php +++ b/src/Validator/Constraints/PromoVoucherValidator.php @@ -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, ) { } diff --git a/src/Validator/Constraints/PurchaseVoucherValidator.php b/src/Validator/Constraints/PurchaseVoucherValidator.php index b644a47..d29de6d 100644 --- a/src/Validator/Constraints/PurchaseVoucherValidator.php +++ b/src/Validator/Constraints/PurchaseVoucherValidator.php @@ -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, ) { } diff --git a/tests/BusProNet/DataProcessor/BookingDataProcessorTest.php b/tests/BusProNet/DataProcessor/BookingDataProcessorTest.php index b7b5f97..08efcf3 100644 --- a/tests/BusProNet/DataProcessor/BookingDataProcessorTest.php +++ b/tests/BusProNet/DataProcessor/BookingDataProcessorTest.php @@ -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') diff --git a/tests/Command/BpnXmlSyncCommandTest.php b/tests/Command/BpnXmlSyncCommandTest.php index 2b13930..1c40529 100644 --- a/tests/Command/BpnXmlSyncCommandTest.php +++ b/tests/Command/BpnXmlSyncCommandTest.php @@ -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, diff --git a/tests/Form/Model/ParticipantEditDtoTest.php b/tests/Form/Model/ParticipantEditDtoTest.php index f24d588..c9f58c6 100644 --- a/tests/Form/Model/ParticipantEditDtoTest.php +++ b/tests/Form/Model/ParticipantEditDtoTest.php @@ -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, ) { } diff --git a/tests/Form/Service/ParticipantFieldOptionsProviderBabyTest.php b/tests/Form/Service/ParticipantFieldOptionsProviderBabyTest.php index a89589f..be2538f 100644 --- a/tests/Form/Service/ParticipantFieldOptionsProviderBabyTest.php +++ b/tests/Form/Service/ParticipantFieldOptionsProviderBabyTest.php @@ -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); diff --git a/tests/Form/Service/ParticipantFieldOptionsProviderMandatoryServiceTest.php b/tests/Form/Service/ParticipantFieldOptionsProviderMandatoryServiceTest.php index 4fc22f5..ee2a8e9 100644 --- a/tests/Form/Service/ParticipantFieldOptionsProviderMandatoryServiceTest.php +++ b/tests/Form/Service/ParticipantFieldOptionsProviderMandatoryServiceTest.php @@ -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); diff --git a/tests/Form/Service/ParticipantInsuranceFieldHandlerTest.php b/tests/Form/Service/ParticipantInsuranceFieldHandlerTest.php index 78d5d97..7e69376 100644 --- a/tests/Form/Service/ParticipantInsuranceFieldHandlerTest.php +++ b/tests/Form/Service/ParticipantInsuranceFieldHandlerTest.php @@ -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') diff --git a/tests/Logger/ErrorCodeProcessorTest.php b/tests/Logger/ErrorCodeProcessorTest.php index 0e32898..3bbad85 100644 --- a/tests/Logger/ErrorCodeProcessorTest.php +++ b/tests/Logger/ErrorCodeProcessorTest.php @@ -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); } diff --git a/tests/Service/BookingServiceBabyTest.php b/tests/Service/BookingConfiguratorBabyTest.php similarity index 98% rename from tests/Service/BookingServiceBabyTest.php rename to tests/Service/BookingConfiguratorBabyTest.php index 9c06ee2..e260096 100644 --- a/tests/Service/BookingServiceBabyTest.php +++ b/tests/Service/BookingConfiguratorBabyTest.php @@ -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, diff --git a/tests/Service/BookingServiceStatusTest.php b/tests/Service/BookingConfiguratorStatusTest.php similarity index 91% rename from tests/Service/BookingServiceStatusTest.php rename to tests/Service/BookingConfiguratorStatusTest.php index c06c11a..64deff3 100644 --- a/tests/Service/BookingServiceStatusTest.php +++ b/tests/Service/BookingConfiguratorStatusTest.php @@ -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' diff --git a/tests/Service/BookingEditContextFactoryTest.php b/tests/Service/BookingEditContextFactoryTest.php index c59f218..8c005d6 100644 --- a/tests/Service/BookingEditContextFactoryTest.php +++ b/tests/Service/BookingEditContextFactoryTest.php @@ -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) diff --git a/tests/Service/BookingEditSubmitGuardServiceTest.php b/tests/Service/BookingEditSubmitGuardTest.php similarity index 94% rename from tests/Service/BookingEditSubmitGuardServiceTest.php rename to tests/Service/BookingEditSubmitGuardTest.php index 47577a4..aecdcce 100644 --- a/tests/Service/BookingEditSubmitGuardServiceTest.php +++ b/tests/Service/BookingEditSubmitGuardTest.php @@ -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()); diff --git a/tests/Service/BookingEditSubmitServiceTest.php b/tests/Service/BookingEditSubmitterTest.php similarity index 86% rename from tests/Service/BookingEditSubmitServiceTest.php rename to tests/Service/BookingEditSubmitterTest.php index 7762fe8..1e03412 100644 --- a/tests/Service/BookingEditSubmitServiceTest.php +++ b/tests/Service/BookingEditSubmitterTest.php @@ -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), ); diff --git a/tests/Service/BookingPriceCalculatorServiceTest.php b/tests/Service/BookingPriceCalculatorTest.php similarity index 97% rename from tests/Service/BookingPriceCalculatorServiceTest.php rename to tests/Service/BookingPriceCalculatorTest.php index fb18668..14171f0 100644 --- a/tests/Service/BookingPriceCalculatorServiceTest.php +++ b/tests/Service/BookingPriceCalculatorTest.php @@ -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, ); } diff --git a/tests/Service/BookingPriceMismatchDiagnosticsServiceTest.php b/tests/Service/BookingPriceMismatchAnalyzerTest.php similarity index 86% rename from tests/Service/BookingPriceMismatchDiagnosticsServiceTest.php rename to tests/Service/BookingPriceMismatchAnalyzerTest.php index 5c76c9b..ab76948 100644 --- a/tests/Service/BookingPriceMismatchDiagnosticsServiceTest.php +++ b/tests/Service/BookingPriceMismatchAnalyzerTest.php @@ -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(); diff --git a/tests/Service/BookingSessionServiceTest.php b/tests/Service/BookingSessionStoreTest.php similarity index 87% rename from tests/Service/BookingSessionServiceTest.php rename to tests/Service/BookingSessionStoreTest.php index b1aaa8d..4c51bf1 100644 --- a/tests/Service/BookingSessionServiceTest.php +++ b/tests/Service/BookingSessionStoreTest.php @@ -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 diff --git a/tests/Service/ErrorCodeServiceTest.php b/tests/Service/ErrorCodeGeneratorTest.php similarity index 86% rename from tests/Service/ErrorCodeServiceTest.php rename to tests/Service/ErrorCodeGeneratorTest.php index 551bc72..25a2fe4 100644 --- a/tests/Service/ErrorCodeServiceTest.php +++ b/tests/Service/ErrorCodeGeneratorTest.php @@ -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); diff --git a/tests/Service/InsuranceServiceTest.php b/tests/Service/InsuranceManagerTest.php similarity index 98% rename from tests/Service/InsuranceServiceTest.php rename to tests/Service/InsuranceManagerTest.php index 5cf9c7d..95d0ab3 100644 --- a/tests/Service/InsuranceServiceTest.php +++ b/tests/Service/InsuranceManagerTest.php @@ -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'); diff --git a/tests/Service/ParticipantCardDataServiceTest.php b/tests/Service/ParticipantCardAssemblerTest.php similarity index 97% rename from tests/Service/ParticipantCardDataServiceTest.php rename to tests/Service/ParticipantCardAssemblerTest.php index 4054731..80b9b24 100644 --- a/tests/Service/ParticipantCardDataServiceTest.php +++ b/tests/Service/ParticipantCardAssemblerTest.php @@ -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 ); diff --git a/tests/Service/ParticipantPrepopulationServiceTest.php b/tests/Service/ParticipantDataPrefillerTest.php similarity index 92% rename from tests/Service/ParticipantPrepopulationServiceTest.php rename to tests/Service/ParticipantDataPrefillerTest.php index 6757298..6bd2c04 100644 --- a/tests/Service/ParticipantPrepopulationServiceTest.php +++ b/tests/Service/ParticipantDataPrefillerTest.php @@ -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('test@example.com', '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' => 'test@example.com', ]); - $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' => 'test@example.com', ]); - $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)); diff --git a/tests/Service/ParticipantEligibilityServiceTest.php b/tests/Service/ParticipantEligibilityCheckerTest.php similarity index 96% rename from tests/Service/ParticipantEligibilityServiceTest.php rename to tests/Service/ParticipantEligibilityCheckerTest.php index a59521c..657cce2 100644 --- a/tests/Service/ParticipantEligibilityServiceTest.php +++ b/tests/Service/ParticipantEligibilityCheckerTest.php @@ -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 diff --git a/tests/Service/ParticipantFormSupportServiceTest.php b/tests/Service/ParticipantFormSupportTest.php similarity index 94% rename from tests/Service/ParticipantFormSupportServiceTest.php rename to tests/Service/ParticipantFormSupportTest.php index 65575ea..3f70923 100644 --- a/tests/Service/ParticipantFormSupportServiceTest.php +++ b/tests/Service/ParticipantFormSupportTest.php @@ -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 diff --git a/tests/Service/RoomAssignmentServiceTest.php b/tests/Service/RoomAssignerTest.php similarity index 97% rename from tests/Service/RoomAssignmentServiceTest.php rename to tests/Service/RoomAssignerTest.php index 5a2839d..5ff09c2 100644 --- a/tests/Service/RoomAssignmentServiceTest.php +++ b/tests/Service/RoomAssignerTest.php @@ -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(); } /** diff --git a/tests/Service/TravelDataServiceTest.php b/tests/Service/TravelDataProviderTest.php similarity index 95% rename from tests/Service/TravelDataServiceTest.php rename to tests/Service/TravelDataProviderTest.php index cf1f48a..91cc4d5 100644 --- a/tests/Service/TravelDataServiceTest.php +++ b/tests/Service/TravelDataProviderTest.php @@ -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, diff --git a/tests/Service/TravelEnrichmentServiceTest.php b/tests/Service/TravelEnricherTest.php similarity index 96% rename from tests/Service/TravelEnrichmentServiceTest.php rename to tests/Service/TravelEnricherTest.php index fa1573a..aad669d 100644 --- a/tests/Service/TravelEnrichmentServiceTest.php +++ b/tests/Service/TravelEnricherTest.php @@ -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, diff --git a/tests/Service/TravelLookupServiceTest.php b/tests/Service/TravelIndexTest.php similarity index 97% rename from tests/Service/TravelLookupServiceTest.php rename to tests/Service/TravelIndexTest.php index 0df37f4..6a49b3c 100644 --- a/tests/Service/TravelLookupServiceTest.php +++ b/tests/Service/TravelIndexTest.php @@ -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, diff --git a/tests/Service/TravelSnapshotServiceTest.php b/tests/Service/TravelSnapshotManagerTest.php similarity index 98% rename from tests/Service/TravelSnapshotServiceTest.php rename to tests/Service/TravelSnapshotManagerTest.php index 230e822..9098b8d 100644 --- a/tests/Service/TravelSnapshotServiceTest.php +++ b/tests/Service/TravelSnapshotManagerTest.php @@ -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, diff --git a/tests/Validator/Constraints/MandatoryAdditionalServicesSelectedValidatorTest.php b/tests/Validator/Constraints/MandatoryAdditionalServicesSelectedValidatorTest.php index d186d65..e1d5c70 100644 --- a/tests/Validator/Constraints/MandatoryAdditionalServicesSelectedValidatorTest.php +++ b/tests/Validator/Constraints/MandatoryAdditionalServicesSelectedValidatorTest.php @@ -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);