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.
Completed
Push — master ( 8d0471...86ad7b )
by Glenn
02:27
created

JsonParserTest::testValidJsonFromFile()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 19
Code Lines 11

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 11
nc 1
nop 0
1
<?php
2
3
namespace Glenn\Config\Test\Parser;
4
5
use PHPUnit_Framework_TestCase;
6
7
use Glenn\Config\Parser\JsonParser;
8
use Glenn\Config\Parser\ParseException;
9
10
class JsonParserTest extends PHPUnit_Framework_TestCase
11
{
12
    /**
13
     * Test valid json input.
14
     *
15
     * @author Glenn McEwan <[email protected]>
16
     */
17
    public function testValidJsonFromFile()
18
    {
19
        $parser = new JsonParser;
20
21
        $expected = [
22
            'name' => 'Glenn',
23
            'age' => 18,
24
            'languages' => [
25
                'English',
26
                'French',
27
            ],
28
        ];
29
30
        $data = file_get_contents(__DIR__ . '/../../fixtures/parser/valid.json');
31
32
        $json = $parser->parse($data);
33
34
        $this->assertSame($expected, $json);
35
    }
36
37
    /**
38
     * Test invalid json due to single quotes enclosing strings.
39
     *
40
     * @author Glenn McEwan <[email protected]>
41
     */
42 View Code Duplication
    public function testInvalidJsonSingleQuotes()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
43
    {
44
        $this->setExpectedException(ParseException::class);
45
46
        $parser = new JsonParser;
47
48
        $data = file_get_contents(__DIR__ . '/../../fixtures/parser/invalid_single-quotes.json');
49
50
        $parser->parse($data);
51
    }
52
53
    /**
54
     * Test invalid json due to trailing commas.
55
     *
56
     * @author Glenn McEwan <[email protected]>
57
     */
58 View Code Duplication
    public function testInvalidJsonTrailingComma()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
59
    {
60
        $this->setExpectedException(ParseException::class);
61
62
        $parser = new JsonParser;
63
64
        $data = file_get_contents(__DIR__ . '/../../fixtures/parser/invalid_trailing-comma.json');
65
66
        $parser->parse($data);
67
    }
68
}
69