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.

JsonErrorHandlerTest::testHandleError()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 19

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 19
rs 9.6333
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
namespace JDesrosiers\Resourceful\JsonErrorHandler\Test;
4
5
use JDesrosiers\Resourceful\JsonErrorHandler\JsonErrorHandler;
6
use PHPUnit_Framework_TestCase;
7
use Silex\Application;
8
use Symfony\Component\HttpFoundation\Response;
9
use Symfony\Component\HttpKernel\Client;
10
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
11
12
class JsonErrorHandlerTest extends PHPUnit_Framework_TestCase
13
{
14
    protected $app;
15
    protected $client;
16
17
    public function setUp()
18
    {
19
        $this->app = new Application();
20
        $this->app["debug"] = true;
21
22
        $this->app->error(new JsonErrorHandler($this->app));
23
24
        $this->client = new Client($this->app);
25
    }
26
27
    public function testHandleError()
28
    {
29
        $this->app->get("/foo", function () {
30
            throw new NotFoundHttpException("Not Found", null, 4);
31
        });
32
33
        $headers = [
34
            "HTTP_ACCEPT" => "application/json",
35
        ];
36
        $this->client->request("GET", "/foo", [], [], $headers);
37
        $response = $this->client->getResponse();
38
        $content = json_decode($response->getContent());
39
40
        $this->assertEquals(Response::HTTP_NOT_FOUND, $response->getStatusCode());
41
        $this->assertEquals("application/json", $response->headers->get("Content-Type"));
42
        $this->assertEquals(4, $content->code);
43
        $this->assertEquals("Not Found", $content->message);
44
        $this->assertInternalType("string", $content->trace);
45
    }
46
}
47