GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

testOptionsMethodWithRequirements404()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 13

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 13
rs 9.8333
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
namespace JDesrosiers\Silex\Provider\Tests;
4
5
use JDesrosiers\Silex\Provider\CorsServiceProvider;
6
use Silex\Application;
7
use Symfony\Component\HttpKernel\Client;
8
9
class OptionsTest extends \PHPUnit_Framework_TestCase
10
{
11
    protected $app;
12
13
    public function setUp()
14
    {
15
        $this->app = new Application();
16
        $this->app["debug"] = true;
17
        $this->app->register(new CorsServiceProvider());
18
19
        $this->app["options"]($this->app);
20
    }
21
22
    public function testOptionsMethod()
23
    {
24
        $this->app->get("/foo", function () {
25
            return "foo";
26
        });
27
        $this->app->post("/foo", function () {
28
            return "foo";
29
        });
30
31
        $client = new Client($this->app);
32
        $client->request("OPTIONS", "/foo");
33
34
        $response = $client->getResponse();
35
36
        $this->assertEquals("204", $response->getStatusCode());
37
        $this->assertFalse($response->headers->has("Content-Type"));
38
        $this->assertEquals("GET,POST", $response->headers->get("Allow"));
39
        $this->assertEquals("", $response->getContent());
40
    }
41
42
    public function testOptionsMethodWithRequirements()
43
    {
44
        $this->app->get("/foo/{foo}", function () {
45
            return "foo";
46
        })->assert("foo", "\d+");
47
48
        $client = new Client($this->app);
49
        $client->request("OPTIONS", "/foo/23");
50
51
        $response = $client->getResponse();
52
53
        $this->assertEquals("204", $response->getStatusCode());
54
        $this->assertFalse($response->headers->has("Content-Type"));
55
        $this->assertEquals("GET", $response->headers->get("Allow"));
56
        $this->assertEquals("", $response->getContent());
57
    }
58
59
    public function testOptionsMethodWithRequirements404()
60
    {
61
        $this->app->get("/foo/{foo}", function () {
62
            return "foo";
63
        })->assert("foo", "\d+");
64
65
        $client = new Client($this->app);
66
        $client->request("OPTIONS", "/foo/asdf");
67
68
        $response = $client->getResponse();
69
70
        $this->assertEquals("404", $response->getStatusCode());
71
    }
72
}
73