Completed
Pull Request — master (#456)
by Alejandro
14:16
created

optionsRequestsReturnAllowedMethodsForEndpoint()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 9
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

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