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
Pull Request — 2.2 (#98)
by Simone
07:13 queued 03:46
created

DijkstraTest::testFindShortestPath()   B

Complexity

Conditions 1
Paths 1

Size

Total Lines 42
Code Lines 25

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 25
nc 1
nop 0
dl 0
loc 42
rs 8.8571
c 0
b 0
f 0
1
<?php
2
3
use Mado\QueryBundle\Component\Meta\Dijkstra;
4
use PHPUnit\Framework\TestCase as TestCase;
5
6
class DijkstraTest extends TestCase
7
{
8
    public function testFindShortestPath()
9
    {
10
        $this->samepleJson = [
11
            "AppBundle\\Entity\\a" => [
12
                "relations" => [
13
                    "item" => "AppBundle\\Entity\\Fizz",
14
                ]
15
            ],
16
            "AppBundle\\Entity\\mood" => [
17
                "relations" => [
18
                    "item" => "AppBundle\\Entity\\b",
19
                ]
20
            ],
21
            "AppBundle\\Entity\\Fizz" => [
22
                "relations" => [
23
                    "item" => "AppBundle\\Entity\\mood",
24
                    "item" => "AppBundle\\Entity\\b",
25
                ]
26
            ],
27
            "AppBundle\\Entity\\b" => [
28
                "relations" => [
29
                    "item" => "AppBundle\\Entity\\Fizz",
30
                    "icdsatem" => "AppBundle\\Entity\\a",
31
                ]
32
            ],
33
        ];
34
35
        $dijkstra = new Dijkstra();
36
        $dijkstra->setMap($this->samepleJson);
37
38
        $paths = $dijkstra->shortestPaths(
39
            'AppBundle\\Entity\\a',
40
            'AppBundle\\Entity\\b'
41
        );
42
43
        $this->assertEquals(
44
            [[
45
                'AppBundle\\Entity\\a',
46
                'AppBundle\\Entity\\Fizz',
47
                'AppBundle\\Entity\\b',
48
            ]],
49
            $paths
50
        );
51
    }
52
53
    public function testFindAlternativePaths()
54
    {
55
        $this->samepleJson = [
56
            "AppBundle\\Entity\\a" => [
57
                "relations" => [
58
                    "item" => "AppBundle\\Entity\\Fizz",
59
                ]
60
            ],
61
            "AppBundle\\Entity\\mood" => [
62
                "relations" => [
63
                    "item" => "AppBundle\\Entity\\b",
64
                ]
65
            ],
66
            "AppBundle\\Entity\\Fizz" => [
67
                "relations" => [
68
                    "item" => "AppBundle\\Entity\\mood",
69
                    "item" => "AppBundle\\Entity\\b",
70
                ]
71
            ],
72
            "AppBundle\\Entity\\b" => [
73
                "relations" => [
74
                    "item" => "AppBundle\\Entity\\Fizz",
75
                    "icdsatem" => "AppBundle\\Entity\\a",
76
                ]
77
            ],
78
        ];
79
80
        $dijkstra = new Dijkstra();
81
        $dijkstra->setMap($this->samepleJson);
82
83
        $paths = $dijkstra->shortestPaths(
84
            'AppBundle\\Entity\\a',
85
            'AppBundle\\Entity\\b',
86
            $excluded = [
87
                'AppBundle\\Entity\\mood',
88
            ]
89
        );
90
91
        $this->assertEquals(
92
            [
93
                'AppBundle\\Entity\\a',
94
                'AppBundle\\Entity\\Fizz',
95
                'AppBundle\\Entity\\b',
96
            ],
97
            $paths[0]
98
        );
99
    }
100
}
101