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.
Passed
Branch master (18840e)
by Jason
05:36
created

OptionsTest::testOptionsMethod()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 19
Code Lines 12

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 19
rs 9.4285
cc 1
eloc 12
nc 1
nop 0
1
<?php
2
3
namespace JDesrosiers\Silex\Provider\Test;
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