feat: reload the page with a flash when an htmx request fails
This commit is contained in:
1 parent
0be3c2ccde
commit
a2e4035889
14 files changed
+205
-210
No files matched your search
@@ -155,12 +155,6 @@ class BookingControllerTest extends WebTestCase
|
||||
self::assertNull($this->em->getRepository(Booking::class)->findOneBy(['resource' => $desk]));
|
||||
}
|
||||
|
||||
/**
|
||||
* Note the status is 200, not 403: HtmxExceptionListener deliberately converts every
|
||||
* exception on an htmx request -- access denied included -- into a visible error modal,
|
||||
* because htmx discards a 4xx body and the click would otherwise do nothing at all.
|
||||
* What matters here is that the booking survives.
|
||||
*/
|
||||
public function testReleasingAnotherPersonsBookingIsRefused(): void
|
||||
{
|
||||
$booking = new Booking($this->user('[email protected]'), $this->resource('D1'), new \DateTimeImmutable('2026-10-01'));
|
||||
@@ -170,8 +164,7 @@ class BookingControllerTest extends WebTestCase
|
||||
$this->client->loginUser($this->user('[email protected]'));
|
||||
$this->client->request('POST', \sprintf('/bookings/%d/release', $booking->getId()), server: ['HTTP_HX-Request' => 'true']);
|
||||
|
||||
$response = $this->client->getResponse();
|
||||
self::assertSame('body', $response->headers->get('HX-Retarget'));
|
||||
self::assertResponseStatusCodeSame(Response::HTTP_FORBIDDEN);
|
||||
self::assertNotNull($this->em->getRepository(Booking::class)->find($booking->getId()));
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user