feat: stop booking flow when BusPro is unreachable
This commit is contained in:
1 parent
ac23baf625
commit
55378b2bbc
9 files changed
+249
-43
No files matched your search
@@ -13,6 +13,7 @@ use App\BusProNet\Model\Travel;
|
||||
use App\BusProNet\Service\BookingStatusRuleRegistry;
|
||||
use App\BusProNet\Service\StatusRule\Selection1473StatusRule;
|
||||
use App\BusProNet\XmlLoader\AgencyLoader;
|
||||
use App\Exception\BookingBackendUnavailableException;
|
||||
use App\Exception\NoRoomsAvailableException;
|
||||
use App\Form\Model\BookingDto;
|
||||
use App\Form\Model\ParticipantDto;
|
||||
@@ -69,6 +70,28 @@ class BookingConfiguratorStatusTest extends TestCase
|
||||
$this->assertCount(1, $bookingDto->roomSelections);
|
||||
}
|
||||
|
||||
public function testStartFreshBookingRequiresAReachableBusPro(): void
|
||||
{
|
||||
$travel = $this->createTravelWithRooms([
|
||||
['status' => Constants::STATUS_AVAILABLE, 'available' => 5],
|
||||
]);
|
||||
|
||||
$this->travelDataService
|
||||
->method('getTravelData')
|
||||
->willReturn($travel);
|
||||
$this->travelDataService
|
||||
->method('getAvailabilityData')
|
||||
->willReturnCallback(function (int $dateId, bool $cached = false, bool $forceRefresh = false, bool $requireReachable = false): never {
|
||||
$this->assertTrue($requireReachable, 'Starting a booking must not fall back to export data silently');
|
||||
|
||||
throw new BookingBackendUnavailableException();
|
||||
});
|
||||
|
||||
$this->expectException(BookingBackendUnavailableException::class);
|
||||
|
||||
$this->bookingService->startFreshBooking($this->createRequestWithSession(), 123, 456);
|
||||
}
|
||||
|
||||
public function testStartFreshBookingWithFreiRoomsAndNoAvailabilityThrowsException(): void
|
||||
{
|
||||
$travel = $this->createTravelWithRooms([
|
||||
|
||||
Reference in new issue
Block a user