2019-08-11 15:21:35 +03:00
|
|
|
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
|
2019-08-11 17:30:46 +03:00
|
|
|
namespace ShlinkioApiTest\Shlink\Rest\Middleware;
|
2019-08-11 15:21:35 +03:00
|
|
|
|
2019-08-11 17:30:46 +03:00
|
|
|
use Shlinkio\Shlink\TestUtils\ApiTest\ApiTestCase;
|
2019-08-11 15:29:22 +03:00
|
|
|
|
2019-08-11 15:21:35 +03:00
|
|
|
use function explode;
|
|
|
|
|
2019-08-11 17:30:46 +03:00
|
|
|
class ImplicitOptionsTest extends ApiTestCase
|
2019-08-11 15:21:35 +03:00
|
|
|
{
|
|
|
|
/** @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));
|
|
|
|
}
|
|
|
|
}
|