optionsRequestsReturnAllowedMethodsForEndpoint()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 9
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 6
dl 0
loc 9
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace ShlinkioApiTest\Shlink\Rest\Middleware;
6
7
use Shlinkio\Shlink\TestUtils\ApiTest\ApiTestCase;
8
9
use function explode;
10
11
class ImplicitOptionsTest extends ApiTestCase
12
{
13
    /** @test */
14
    public function optionsRequestsReturnEmptyResponse(): void
15
    {
16
        $resp = $this->callApi(self::METHOD_OPTIONS, '/short-urls');
17
18
        self::assertEquals(self::STATUS_NO_CONTENT, $resp->getStatusCode());
19
        self::assertEmpty((string) $resp->getBody());
20
    }
21
22
    /** @test */
23
    public function optionsRequestsReturnAllowedMethodsForEndpoint(): void
24
    {
25
        $resp = $this->callApi(self::METHOD_OPTIONS, '/short-urls');
26
        $allowedMethods = $resp->getHeaderLine('Allow');
27
28
        self::assertEquals([
29
            self::METHOD_GET,
30
            self::METHOD_POST,
31
        ], explode(',', $allowedMethods));
32
    }
33
}
34