From c0cc183c5959e60ef412fac87d1bd1b0cd672524 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Fromme?= Date: Thu, 16 Apr 2026 13:33:17 +0200 Subject: [PATCH] feat: rename BookingSessionStore to BookingSessionManager --- src/Controller/Booking/Create/IndexController.php | 4 ++-- src/Controller/Booking/Create/Step1Controller.php | 6 +++--- src/Controller/Booking/Create/Step2Controller.php | 8 ++++---- .../Booking/Create/Step2ParticipantController.php | 10 +++++----- src/Controller/Booking/Create/Step3Controller.php | 6 +++--- src/Controller/Booking/Create/Step4Controller.php | 8 ++++---- src/Controller/Booking/Create/SuccessController.php | 4 ++-- src/Controller/Booking/Edit/IndexController.php | 8 ++++---- .../Booking/Edit/ParticipantController.php | 6 +++--- .../Booking/Traits/BookingExceptionHandlerTrait.php | 6 +++--- src/Controller/SecurityController.php | 7 ++++--- src/Service/BookingConfigurator.php | 2 +- src/Service/BookingEditDataLoader.php | 2 +- src/Service/BookingEditSubmitter.php | 4 ++-- ...ngSessionStore.php => BookingSessionManager.php} | 2 +- tests/Service/BookingConfiguratorBabyTest.php | 4 ++-- tests/Service/BookingConfiguratorStatusTest.php | 8 ++++---- tests/Service/BookingEditSubmitterTest.php | 8 ++++---- ...nStoreTest.php => BookingSessionManagerTest.php} | 13 +++++++------ 19 files changed, 59 insertions(+), 57 deletions(-) rename src/Service/{BookingSessionStore.php => BookingSessionManager.php} (99%) rename tests/Service/{BookingSessionStoreTest.php => BookingSessionManagerTest.php} (88%) diff --git a/src/Controller/Booking/Create/IndexController.php b/src/Controller/Booking/Create/IndexController.php index be7f915..e34155e 100644 --- a/src/Controller/Booking/Create/IndexController.php +++ b/src/Controller/Booking/Create/IndexController.php @@ -12,7 +12,7 @@ use App\Exception\TravelNotFoundException; use App\Htmx\HxTrait; use App\Model\BookingQueryParams; use App\Service\BookingConfigurator; -use App\Service\BookingSessionStore; +use App\Service\BookingSessionManager; use App\Service\BookingSummaryAssembler; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Component\HttpFoundation\Request; @@ -33,7 +33,7 @@ class IndexController extends AbstractController public function __construct( private readonly BookingConfigurator $bookingService, - private readonly BookingSessionStore $bookingSessionService, + private readonly BookingSessionManager $bookingSessionService, private readonly AgencyLoader $agencyLoader, private readonly BookingSummaryAssembler $summaryDataService, ) { diff --git a/src/Controller/Booking/Create/Step1Controller.php b/src/Controller/Booking/Create/Step1Controller.php index 95c047e..d22d2f3 100644 --- a/src/Controller/Booking/Create/Step1Controller.php +++ b/src/Controller/Booking/Create/Step1Controller.php @@ -9,9 +9,9 @@ use App\Controller\Booking\Traits\BookingExceptionHandlerTrait; use App\Form\BookingCreateStep1Type; use App\Form\Model\BookingDto; use App\Htmx\HxTrait; -use App\Service\BookingCreateContextFactory; use App\Service\BookingConfigurator; -use App\Service\BookingSessionStore; +use App\Service\BookingCreateContextFactory; +use App\Service\BookingSessionManager; use App\Service\RoomPricingCalculator; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Component\HttpFoundation\Request; @@ -32,7 +32,7 @@ class Step1Controller extends AbstractController public function __construct( private readonly BookingConfigurator $bookingService, - private readonly BookingSessionStore $bookingSessionService, + private readonly BookingSessionManager $bookingSessionService, private readonly BookingCreateContextFactory $createContextFactory, ) { } diff --git a/src/Controller/Booking/Create/Step2Controller.php b/src/Controller/Booking/Create/Step2Controller.php index ea3b990..2774e5c 100644 --- a/src/Controller/Booking/Create/Step2Controller.php +++ b/src/Controller/Booking/Create/Step2Controller.php @@ -5,15 +5,15 @@ declare(strict_types=1); namespace App\Controller\Booking\Create; use App\BusProNet\Model\Travel; -use App\Entity\User; use App\Controller\Booking\Traits\BookingCreateTrait; use App\Controller\Booking\Traits\BookingExceptionHandlerTrait; +use App\Entity\User; use App\Form\BookingCreateStep2Type; use App\Form\Model\BookingDto; use App\Form\Model\ParticipantDto; -use App\Service\BookingCreateContextFactory; use App\Service\BookingConfigurator; -use App\Service\BookingSessionStore; +use App\Service\BookingCreateContextFactory; +use App\Service\BookingSessionManager; use App\Service\ParticipantDataPrefiller; use App\Service\RoomAssigner; use App\Service\TravelDataProvider; @@ -35,7 +35,7 @@ class Step2Controller extends AbstractController public function __construct( private readonly BookingConfigurator $bookingService, - private readonly BookingSessionStore $bookingSessionService, + private readonly BookingSessionManager $bookingSessionService, private readonly BookingCreateContextFactory $createContextFactory, private readonly TravelDataProvider $travelDataService, private readonly RoomAssigner $roomAssignmentService, diff --git a/src/Controller/Booking/Create/Step2ParticipantController.php b/src/Controller/Booking/Create/Step2ParticipantController.php index af76c7d..c98a41e 100644 --- a/src/Controller/Booking/Create/Step2ParticipantController.php +++ b/src/Controller/Booking/Create/Step2ParticipantController.php @@ -7,13 +7,13 @@ namespace App\Controller\Booking\Create; use App\Form\BookingParticipantType; use App\Form\Model\BookingDto; use App\Htmx\HxTrait; -use App\Service\BookingCreateContextFactory; use App\Service\BookingConfigurator; -use App\Service\BookingSessionStore; -use App\Service\ParticipantFormSupport; +use App\Service\BookingCreateContextFactory; +use App\Service\BookingSessionManager; use App\Service\ParticipantDataPrefiller; -use App\Service\TravelDataProvider; +use App\Service\ParticipantFormSupport; use App\Service\RoomPricingCalculator; +use App\Service\TravelDataProvider; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Component\Form\FormInterface; use Symfony\Component\HttpFoundation\Request; @@ -29,7 +29,7 @@ class Step2ParticipantController extends AbstractController public function __construct( private readonly BookingConfigurator $bookingService, - private readonly BookingSessionStore $bookingSessionService, + private readonly BookingSessionManager $bookingSessionService, private readonly BookingCreateContextFactory $createContextFactory, private readonly TravelDataProvider $travelDataService, private readonly ParticipantDataPrefiller $prepopulationService, diff --git a/src/Controller/Booking/Create/Step3Controller.php b/src/Controller/Booking/Create/Step3Controller.php index 56c0822..16dec89 100644 --- a/src/Controller/Booking/Create/Step3Controller.php +++ b/src/Controller/Booking/Create/Step3Controller.php @@ -13,11 +13,11 @@ use App\Controller\Booking\Traits\BookingExceptionHandlerTrait; use App\Form\BookingCreateStep3Type; use App\Form\Model\BookingDto; use App\Htmx\HxTrait; +use App\Service\BookingConfigurator; use App\Service\BookingCreateContextFactory; use App\Service\BookingPriceCalculator; use App\Service\BookingPriceMismatchAnalyzer; -use App\Service\BookingConfigurator; -use App\Service\BookingSessionStore; +use App\Service\BookingSessionManager; use App\Service\RoomPricingCalculator; use Psr\Log\LoggerInterface; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; @@ -37,7 +37,7 @@ class Step3Controller extends AbstractController public function __construct( private readonly BookingConfigurator $bookingService, - private readonly BookingSessionStore $bookingSessionService, + private readonly BookingSessionManager $bookingSessionService, private readonly BookingCreateContextFactory $createContextFactory, private readonly BookingPriceCalculator $priceCalculator, private readonly BookingPriceMismatchAnalyzer $priceMismatchDiagnostics, diff --git a/src/Controller/Booking/Create/Step4Controller.php b/src/Controller/Booking/Create/Step4Controller.php index 4fd7185..a233a12 100644 --- a/src/Controller/Booking/Create/Step4Controller.php +++ b/src/Controller/Booking/Create/Step4Controller.php @@ -9,14 +9,14 @@ use App\BusProNet\Exception\TimeoutException; use App\BusProNet\Model\Notification; use App\Controller\Booking\Traits\BookingCreateTrait; use App\Controller\Booking\Traits\BookingExceptionHandlerTrait; +use App\Entity\User; use App\Exception\NewsletterProviderException; use App\Form\BookingCreateStep4Type; use App\Form\Model\BookingDto; use App\Htmx\HxTrait; -use App\Entity\User; -use App\Service\BookingCreateContextFactory; use App\Service\BookingConfigurator; -use App\Service\BookingSessionStore; +use App\Service\BookingCreateContextFactory; +use App\Service\BookingSessionManager; use App\Service\MailjetApiClient; use App\Service\NewsletterManager; use Psr\Log\LoggerInterface; @@ -38,7 +38,7 @@ class Step4Controller extends AbstractController public function __construct( private readonly BookingConfigurator $bookingService, - private readonly BookingSessionStore $bookingSessionService, + private readonly BookingSessionManager $bookingSessionService, private readonly BookingCreateContextFactory $createContextFactory, private readonly ApiClient $apiClient, private readonly CacheInterface $cache, diff --git a/src/Controller/Booking/Create/SuccessController.php b/src/Controller/Booking/Create/SuccessController.php index 264762a..a520f06 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\BookingSessionStore; +use App\Service\BookingSessionManager; 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 BookingSessionStore $bookingSessionService, + private readonly BookingSessionManager $bookingSessionService, ) { } diff --git a/src/Controller/Booking/Edit/IndexController.php b/src/Controller/Booking/Edit/IndexController.php index 1e8ebad..45b1ce2 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\BookingChangeTracker; +use App\Service\BookingEditContextFactory; use App\Service\BookingEditDataLoader; use App\Service\BookingEditDraftManager; -use App\Service\BookingEditContextFactory; -use App\Service\BookingChangeTracker; use App\Service\BookingEditSubmitter; -use App\Service\BookingSessionStore; +use App\Service\BookingSessionManager; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; @@ -40,7 +40,7 @@ class IndexController extends AbstractController public function __construct( private readonly BookingEditDataLoader $dataLoader, private readonly BookingEditDraftManager $draftService, - private readonly BookingSessionStore $bookingSessionService, + private readonly BookingSessionManager $bookingSessionService, private readonly BookingChangeTracker $fingerprintService, private readonly BookingEditContextFactory $editContextFactory, private readonly BookingEditSubmitter $submitService, diff --git a/src/Controller/Booking/Edit/ParticipantController.php b/src/Controller/Booking/Edit/ParticipantController.php index bd12897..a2f7095 100644 --- a/src/Controller/Booking/Edit/ParticipantController.php +++ b/src/Controller/Booking/Edit/ParticipantController.php @@ -10,10 +10,10 @@ use App\Entity\User; use App\Form\BookingParticipantType; use App\Form\Model\BookingDto; use App\Htmx\HxTrait; -use App\Service\BookingEditDataLoader; use App\Service\BookingEditContextFactory; +use App\Service\BookingEditDataLoader; use App\Service\BookingEditDraftManager; -use App\Service\BookingSessionStore; +use App\Service\BookingSessionManager; use App\Service\ParticipantFormSupport; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Component\HttpFoundation\Request; @@ -32,7 +32,7 @@ class ParticipantController extends AbstractController private readonly BookingEditDataLoader $dataLoader, private readonly BookingEditDraftManager $draftService, private readonly BookingEditContextFactory $editContextFactory, - private readonly BookingSessionStore $bookingSessionService, + private readonly BookingSessionManager $bookingSessionService, private readonly ParticipantFormSupport $participantFormSupportService, ) { } diff --git a/src/Controller/Booking/Traits/BookingExceptionHandlerTrait.php b/src/Controller/Booking/Traits/BookingExceptionHandlerTrait.php index baffe85..9861c0e 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\BookingSessionStore; +use App\Service\BookingSessionManager; 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(BookingSessionStore $bookingSessionService, Request $request): BookingDto|RedirectResponse + protected function getOrCreateBookingCreateDto(BookingSessionManager $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(BookingSessionStore $bookingSessionService, Request $request): mixed + protected function getOrCreateBookingCreateDtoForHtmx(BookingSessionManager $bookingSessionService, Request $request): mixed { try { return $bookingSessionService->getOrCreateBookingCreateDto($request); diff --git a/src/Controller/SecurityController.php b/src/Controller/SecurityController.php index f4fae02..e6b85d2 100644 --- a/src/Controller/SecurityController.php +++ b/src/Controller/SecurityController.php @@ -2,7 +2,8 @@ namespace App\Controller; -use App\Service\BookingSessionStore; +use App\Form\Model\BookingDto; +use App\Service\BookingSessionManager; use App\Service\BookingSummaryAssembler; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Component\HttpFoundation\Request; @@ -18,11 +19,11 @@ class SecurityController extends AbstractController public function login( AuthenticationUtils $authenticationUtils, Request $request, - BookingSessionStore $bookingSessionService, + BookingSessionManager $bookingSessionService, BookingSummaryAssembler $summaryDataService, ): Response { // Check if this is a booking flow (BookingDto exists in session) - $bookingDto = $bookingSessionService->getBookingDto($request, BookingSessionStore::BOOKING_CREATE_KEY); + $bookingDto = $bookingSessionService->getBookingDto($request, BookingDto::MODE_CREATE); $isBookingFlow = null !== $bookingDto; // If authenticated and in booking flow, proceed to Step 1 diff --git a/src/Service/BookingConfigurator.php b/src/Service/BookingConfigurator.php index 99811c2..1de6687 100644 --- a/src/Service/BookingConfigurator.php +++ b/src/Service/BookingConfigurator.php @@ -22,7 +22,7 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; class BookingConfigurator { public function __construct( - private readonly BookingSessionStore $bookingSessionService, + private readonly BookingSessionManager $bookingSessionService, private readonly TravelDataProvider $travelDataService, private readonly ParticipantEligibilityChecker $participantEligibilityService, private readonly BookingStatusRuleRegistry $bookingStatusRuleRegistry, diff --git a/src/Service/BookingEditDataLoader.php b/src/Service/BookingEditDataLoader.php index bb3a9bd..e1a4711 100644 --- a/src/Service/BookingEditDataLoader.php +++ b/src/Service/BookingEditDataLoader.php @@ -32,7 +32,7 @@ class BookingEditDataLoader public function __construct( private readonly ApiClient $apiClient, private readonly BookingDataProcessor $bookingDataProcessor, - private readonly BookingSessionStore $bookingSessionService, + private readonly BookingSessionManager $bookingSessionService, private readonly BookingChangeTracker $fingerprintService, private readonly TravelDataProvider $travelDataService, private readonly BookingEditDraftManager $draftService, diff --git a/src/Service/BookingEditSubmitter.php b/src/Service/BookingEditSubmitter.php index 4f8786c..e2489b2 100644 --- a/src/Service/BookingEditSubmitter.php +++ b/src/Service/BookingEditSubmitter.php @@ -11,8 +11,8 @@ use App\BusProNet\Model\Notification; use App\Entity\User; use App\Form\Model\BookingDto; use Psr\Log\LoggerInterface; -use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\RedirectResponse; +use Symfony\Component\HttpFoundation\Request; use Symfony\Component\Routing\Generator\UrlGeneratorInterface; /** @@ -26,7 +26,7 @@ class BookingEditSubmitter private readonly BookingEditDraftManager $draftService, private readonly TravelDataProvider $travelDataService, private readonly BookingEditSubmitGuard $submitGuard, - private readonly BookingSessionStore $bookingSessionService, + private readonly BookingSessionManager $bookingSessionService, private readonly UrlGeneratorInterface $urlGenerator, private readonly LoggerInterface $logger, ) { diff --git a/src/Service/BookingSessionStore.php b/src/Service/BookingSessionManager.php similarity index 99% rename from src/Service/BookingSessionStore.php rename to src/Service/BookingSessionManager.php index a66570b..79046dd 100644 --- a/src/Service/BookingSessionStore.php +++ b/src/Service/BookingSessionManager.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 BookingSessionStore +class BookingSessionManager { public const BOOKING_CREATE_KEY = 'booking_create'; public const BOOKING_CREATE_BASELINE_KEY = 'booking_create_baseline_snapshot'; diff --git a/tests/Service/BookingConfiguratorBabyTest.php b/tests/Service/BookingConfiguratorBabyTest.php index e260096..8d52269 100644 --- a/tests/Service/BookingConfiguratorBabyTest.php +++ b/tests/Service/BookingConfiguratorBabyTest.php @@ -12,7 +12,7 @@ use App\BusProNet\XmlLoader\AgencyLoader; use App\Form\Model\BookingDto; use App\Form\Model\ParticipantDto; use App\Service\BookingConfigurator; -use App\Service\BookingSessionStore; +use App\Service\BookingSessionManager; use App\Service\ParticipantEligibilityChecker; use App\Service\TravelDataProvider; use PHPUnit\Framework\TestCase; @@ -31,7 +31,7 @@ class BookingConfiguratorBabyTest extends TestCase $agencyLoader = $this->createMock(AgencyLoader::class); $this->bookingService = new BookingConfigurator( - $this->createMock(BookingSessionStore::class), + $this->createMock(BookingSessionManager::class), $travelDataService, $this->participantEligibilityService, $bookingStatusRuleRegistry, diff --git a/tests/Service/BookingConfiguratorStatusTest.php b/tests/Service/BookingConfiguratorStatusTest.php index 64deff3..3fb0820 100644 --- a/tests/Service/BookingConfiguratorStatusTest.php +++ b/tests/Service/BookingConfiguratorStatusTest.php @@ -12,7 +12,7 @@ use App\BusProNet\Service\BookingStatusRuleRegistry; use App\BusProNet\XmlLoader\AgencyLoader; use App\Exception\NoRoomsAvailableException; use App\Service\BookingConfigurator; -use App\Service\BookingSessionStore; +use App\Service\BookingSessionManager; use App\Service\ParticipantEligibilityChecker; use App\Service\TravelDataProvider; use PHPUnit\Framework\TestCase; @@ -27,7 +27,7 @@ class BookingConfiguratorStatusTest extends TestCase protected function setUp(): void { - $bookingSessionService = $this->createMock(BookingSessionStore::class); + $bookingSessionService = $this->createMock(BookingSessionManager::class); $this->travelDataService = $this->createMock(TravelDataProvider::class); $participantEligibility = $this->createMock(ParticipantEligibilityChecker::class); $bookingStatusRuleRegistry = $this->createMock(BookingStatusRuleRegistry::class); @@ -178,7 +178,7 @@ class BookingConfiguratorStatusTest extends TestCase $bookingStatusRuleRegistry->method('evaluateStatus')->willReturn('O'); $bookingService = new BookingConfigurator( - $this->createMock(BookingSessionStore::class), + $this->createMock(BookingSessionManager::class), $this->travelDataService, $this->createMock(ParticipantEligibilityChecker::class), $bookingStatusRuleRegistry, @@ -209,7 +209,7 @@ class BookingConfiguratorStatusTest extends TestCase $bookingStatusRuleRegistry->expects($this->never())->method('evaluateStatus'); $bookingService = new BookingConfigurator( - $this->createMock(BookingSessionStore::class), + $this->createMock(BookingSessionManager::class), $this->travelDataService, $this->createMock(ParticipantEligibilityChecker::class), $bookingStatusRuleRegistry, diff --git a/tests/Service/BookingEditSubmitterTest.php b/tests/Service/BookingEditSubmitterTest.php index 1e03412..6120ccc 100644 --- a/tests/Service/BookingEditSubmitterTest.php +++ b/tests/Service/BookingEditSubmitterTest.php @@ -16,7 +16,7 @@ use App\Service\BookingEditDataLoader; use App\Service\BookingEditDraftManager; use App\Service\BookingEditSubmitGuard; use App\Service\BookingEditSubmitter; -use App\Service\BookingSessionStore; +use App\Service\BookingSessionManager; use App\Service\TravelDataProvider; use PHPUnit\Framework\TestCase; use Psr\Log\LoggerInterface; @@ -210,7 +210,7 @@ class BookingEditSubmitterTest extends TestCase ->with($bookingDto, true) ->willReturn($bookingUpdate); - $bookingSessionService = $this->createMock(BookingSessionStore::class); + $bookingSessionService = $this->createMock(BookingSessionManager::class); $bookingSessionService->expects($this->once()) ->method('clearBookingDto') ->with($request, BookingDto::MODE_EDIT); @@ -276,7 +276,7 @@ class BookingEditSubmitterTest extends TestCase ->with($bookingDto, true) ->willReturn($bookingUpdate); - $bookingSessionService = $this->createMock(BookingSessionStore::class); + $bookingSessionService = $this->createMock(BookingSessionManager::class); $bookingSessionService->expects($this->once()) ->method('saveBookingDto') ->with($request, $bookingDto, BookingDto::MODE_EDIT); @@ -435,7 +435,7 @@ class BookingEditSubmitterTest extends TestCase $draftService ?? $this->createMock(BookingEditDraftManager::class), $travelDataService ?? $this->createMock(TravelDataProvider::class), $submitGuard ?? $this->createMock(BookingEditSubmitGuard::class), - $bookingSessionService ?? $this->createMock(BookingSessionStore::class), + $bookingSessionService ?? $this->createMock(BookingSessionManager::class), $this->createUrlGenerator(), $this->createMock(LoggerInterface::class), ); diff --git a/tests/Service/BookingSessionStoreTest.php b/tests/Service/BookingSessionManagerTest.php similarity index 88% rename from tests/Service/BookingSessionStoreTest.php rename to tests/Service/BookingSessionManagerTest.php index 4c51bf1..03b88e8 100644 --- a/tests/Service/BookingSessionStoreTest.php +++ b/tests/Service/BookingSessionManagerTest.php @@ -6,31 +6,32 @@ namespace App\Tests\Service; use App\BusProNet\Model\Booking; use App\BusProNet\Model\Travel; +use App\Exception\BookingSessionNotFoundException; use App\Form\Model\BookingDto; use App\Form\Model\RoomSelectionDto; -use App\Service\BookingSessionStore; +use App\Service\BookingSessionManager; 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 BookingSessionStoreTest extends TestCase +class BookingSessionManagerTest extends TestCase { private TravelDataProvider $travelDataService; - private BookingSessionStore $service; + private BookingSessionManager $service; protected function setUp(): void { $this->travelDataService = $this->createMock(TravelDataProvider::class); - $this->service = new BookingSessionStore($this->travelDataService); + $this->service = new BookingSessionManager($this->travelDataService); } public function testGetOrCreateBookingCreateDtoThrowsWhenSessionMissing(): void { $request = $this->createRequestWithSession(); - $this->expectException(\App\Exception\BookingSessionNotFoundException::class); + $this->expectException(BookingSessionNotFoundException::class); $this->service->getOrCreateBookingCreateDto($request); } @@ -91,7 +92,7 @@ class BookingSessionStoreTest extends TestCase $this->service->storeReturnUrl($request, 'javascript:alert(1)'); - $this->assertSame(BookingSessionStore::DEFAULT_RETURN_URL, $this->service->getReturnUrl($request)); + $this->assertSame(BookingSessionManager::DEFAULT_RETURN_URL, $this->service->getReturnUrl($request)); } public function testClearBookingSessionPreservesReturnUrl(): void