mirror of
https://github.com/shlinkio/shlink.git
synced 2024-11-26 19:00:15 -06:00
Added new API test for Options requests
This commit is contained in:
parent
24e708b7e1
commit
97a362617d
@ -8,7 +8,7 @@ use ShlinkioTest\Shlink\Common\ApiTest\ApiTestCase;
|
|||||||
class ListShortUrlsTest extends ApiTestCase
|
class ListShortUrlsTest extends ApiTestCase
|
||||||
{
|
{
|
||||||
/** @test */
|
/** @test */
|
||||||
public function shortUrlsAreProperlyListed()
|
public function shortUrlsAreProperlyListed(): void
|
||||||
{
|
{
|
||||||
$resp = $this->callApiWithKey(self::METHOD_GET, '/short-urls');
|
$resp = $this->callApiWithKey(self::METHOD_GET, '/short-urls');
|
||||||
$respPayload = $this->getJsonResponsePayload($resp);
|
$respPayload = $this->getJsonResponsePayload($resp);
|
||||||
|
31
module/Rest/test-api/Action/OptionsRequestTest.php
Normal file
31
module/Rest/test-api/Action/OptionsRequestTest.php
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
<?php
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace ShlinkioApiTest\Shlink\Rest\Action;
|
||||||
|
|
||||||
|
use ShlinkioTest\Shlink\Common\ApiTest\ApiTestCase;
|
||||||
|
use function explode;
|
||||||
|
|
||||||
|
class OptionsRequestTest extends ApiTestCase
|
||||||
|
{
|
||||||
|
/** @test */
|
||||||
|
public function optionsRequestsReturnEmptyResponse(): void
|
||||||
|
{
|
||||||
|
$resp = $this->callApi(self::METHOD_OPTIONS, '/short-urls');
|
||||||
|
|
||||||
|
$this->assertEquals(self::STATUS_NO_CONTENT, $resp->getStatusCode());
|
||||||
|
$this->assertEmpty((string) $resp->getBody());
|
||||||
|
}
|
||||||
|
|
||||||
|
/** @test */
|
||||||
|
public function optionsRequestsReturnAllowedMethodsForEndpoint(): void
|
||||||
|
{
|
||||||
|
$resp = $this->callApi(self::METHOD_OPTIONS, '/short-urls');
|
||||||
|
$allowedMethods = $resp->getHeaderLine('Allow');
|
||||||
|
|
||||||
|
$this->assertEquals([
|
||||||
|
self::METHOD_GET,
|
||||||
|
self::METHOD_POST,
|
||||||
|
], explode(',', $allowedMethods));
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user