Completed
Pull Request — master (#457)
by Alejandro
06:50
created

optionsRequestsReturnAllowedMethodsForEndpoint()   A

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