feat: refactored accommodation booking status model

This commit is contained in:
Björn Fromme
2026-08-19 11:46:52 +02:00
parent e8accbb3ed
commit 5a3957e143
42 changed files with 1190 additions and 277 deletions
@@ -94,10 +94,13 @@ class OfferControllerTest extends TestCase
self::assertSame('groups/booking/offer_unavailable.html.twig', $controller->renderedView);
}
public function testAccessRendersUnavailableForDraft(): void
/**
* @dataProvider statusesTheCustomerMustNotSee
*/
public function testAccessRendersUnavailableForABookingThatIsNotOfferedYet(AccommodationBookingStatus $status): void
{
$booking = new AccommodationBooking();
$booking->setStatus(AccommodationBookingStatus::Draft);
$booking->setStatus($status);
$bookingRepository = $this->createMock(AccommodationBookingRepository::class);
$bookingRepository->method('findOneBy')->willReturn($booking);
@@ -119,6 +122,18 @@ class OfferControllerTest extends TestCase
self::assertSame('groups/booking/offer_unavailable.html.twig', $controller->renderedView);
}
/**
* @return iterable<string, array{AccommodationBookingStatus}>
*/
public static function statusesTheCustomerMustNotSee(): iterable
{
// A scratch record and an inquiry the office has not worked through yet are both
// unfinished; a discarded one is over. All three behave like an expired link.
yield 'draft' => [AccommodationBookingStatus::Draft];
yield 'requested' => [AccommodationBookingStatus::Requested];
yield 'discarded' => [AccommodationBookingStatus::Discarded];
}
public function testViewRendersUnavailableForDiscardedBooking(): void
{
$booking = new AccommodationBooking();