mirror of
https://github.com/shlinkio/shlink.git
synced 2024-11-22 00:47:25 -06:00
Add API test to verify QR codes return a 404 for disabled short URLs
This commit is contained in:
parent
0f0301ae5c
commit
e12bda3f42
27
module/Core/test-api/Action/QrCodeTest.php
Normal file
27
module/Core/test-api/Action/QrCodeTest.php
Normal file
@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace ShlinkioApiTest\Shlink\Core\Action;
|
||||
|
||||
use PHPUnit\Framework\Attributes\Test;
|
||||
use Shlinkio\Shlink\TestUtils\ApiTest\ApiTestCase;
|
||||
|
||||
class QrCodeTest extends ApiTestCase
|
||||
{
|
||||
#[Test]
|
||||
public function returnsNotFoundWhenShortUrlIsNotEnabled(): void
|
||||
{
|
||||
// The QR code successfully resolves at first
|
||||
$response = $this->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());
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user