2023-12-24 03:37:09 -06:00
|
|
|
<?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]
|
2024-02-12 13:29:40 -06:00
|
|
|
public function returnsQrCodeEvenIfShortUrlIsNotEnabled(): void
|
2023-12-24 03:37:09 -06:00
|
|
|
{
|
|
|
|
// 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');
|
|
|
|
|
2024-02-12 13:29:40 -06:00
|
|
|
// After 2 visits, the short URL returns a 404, but the QR code should still work
|
|
|
|
self::assertEquals(404, $this->callShortUrl('custom')->getStatusCode());
|
|
|
|
self::assertEquals(200, $this->callShortUrl('custom/qr-code')->getStatusCode());
|
2023-12-24 03:37:09 -06:00
|
|
|
}
|
|
|
|
}
|