feat: rename BookingSessionStore to BookingSessionManager
This commit is contained in:
@@ -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,
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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),
|
||||
);
|
||||
|
||||
+7
-6
@@ -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
|
||||
Reference in New Issue
Block a user