From e12bda3f42987ebe28954defdc24c42c0c57ecba Mon Sep 17 00:00:00 2001 From: Alejandro Celaya Date: Sun, 24 Dec 2023 10:37:09 +0100 Subject: [PATCH] Add API test to verify QR codes return a 404 for disabled short URLs --- module/Core/test-api/Action/QrCodeTest.php | 27 ++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 module/Core/test-api/Action/QrCodeTest.php diff --git a/module/Core/test-api/Action/QrCodeTest.php b/module/Core/test-api/Action/QrCodeTest.php new file mode 100644 index 00000000..955e6c7e --- /dev/null +++ b/module/Core/test-api/Action/QrCodeTest.php @@ -0,0 +1,27 @@ +callShortUrl('custom/qr-code'); + self::assertEquals(200, $response->getStatusCode()); + + // This short URL allow max 2 visits + $this->callShortUrl('custom'); + $this->callShortUrl('custom'); + + // After 2 visits, the QR code should return a 404 + $response = $this->callShortUrl('custom/qr-code'); + self::assertEquals(404, $response->getStatusCode()); + } +}