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 — master (#62)
by Simone
02:21
created

DijkstraWalkerTest   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 72
Duplicated Lines 0 %

Importance

Changes 3
Bugs 1 Features 1
Metric Value
c 3
b 1
f 1
dl 0
loc 72
rs 10
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A testThrownAnExceptionWheneverPathIsRequestedBeforeBuild() 0 18 1
A testBuildPathUsingDijkstra() 0 47 1
1
<?php
2
3
use Mado\QueryBundle\Component\Meta\DijkstraWalker;
4
use PHPUnit\Framework\TestCase as TestCase;
5
6
class DijkstraWalkerTest extends TestCase
7
{
8
    /**
9
     * @expectedException \RuntimeException
10
     */
11
    public function testThrownAnExceptionWheneverPathIsRequestedBeforeBuild()
12
    {
13
        $this->mapper = $this
0 ignored issues
show
Bug Best Practice introduced by
The property mapper does not exist. Although not strictly required by PHP, it is generally a best practice to declare properties explicitly.
Loading history...
14
            ->getMockBuilder('Mado\QueryBundle\Component\Meta\DataMapper')
15
            ->disableOriginalConstructor()
16
            ->getMock();
17
18
        $this->dijkstra = $this
0 ignored issues
show
Bug Best Practice introduced by
The property dijkstra does not exist. Although not strictly required by PHP, it is generally a best practice to declare properties explicitly.
Loading history...
19
            ->getMockBuilder('Mado\QueryBundle\Component\Meta\Dijkstra')
20
            ->disableOriginalConstructor()
21
            ->getMock();
22
23
        $this->walker = new DijkstraWalker(
0 ignored issues
show
Bug Best Practice introduced by
The property walker does not exist. Although not strictly required by PHP, it is generally a best practice to declare properties explicitly.
Loading history...
24
            $this->mapper,
25
            $this->dijkstra
26
        );
27
28
        $this->walker->getPath();
29
    }
30
31
    public function testBuildPathUsingDijkstra()
32
    {
33
        $this->mapper = $this
0 ignored issues
show
Bug Best Practice introduced by
The property mapper does not exist. Although not strictly required by PHP, it is generally a best practice to declare properties explicitly.
Loading history...
34
            ->getMockBuilder('Mado\QueryBundle\Component\Meta\DataMapper')
35
            ->disableOriginalConstructor()
36
            ->getMock();
37
        $this->mapper->expects($this->once())
38
            ->method('getMap')
39
            ->will($this->returnValue($laMappa = [
40
                'start' => [
41
                    'relations' => [
42
                        'fine' => 'end',
43
                    ]
44
                ],
45
                'end' => [
46
                    'relations' => [
47
                        'inizio' => 'start',
48
                    ]
49
                ]
50
            ]));
51
52
        $this->dijkstra = $this
0 ignored issues
show
Bug Best Practice introduced by
The property dijkstra does not exist. Although not strictly required by PHP, it is generally a best practice to declare properties explicitly.
Loading history...
53
            ->getMockBuilder('Mado\QueryBundle\Component\Meta\Dijkstra')
54
            ->disableOriginalConstructor()
55
            ->getMock();
56
        $this->dijkstra->expects($this->once())
57
            ->method('setMap')
58
            ->with($laMappa);
59
        $this->dijkstra->expects($this->once())
60
            ->method('shortestPaths')
61
            ->will($this->returnValue([[
62
                'start',
63
                'end'
64
            ]]));
65
66
        $this->walker = new DijkstraWalker(
0 ignored issues
show
Bug Best Practice introduced by
The property walker does not exist. Although not strictly required by PHP, it is generally a best practice to declare properties explicitly.
Loading history...
67
            $this->mapper,
68
            $this->dijkstra
69
        );
70
71
        $this->walker->buildPathBetween('start', 'end');
72
73
        $pathFound = $this->walker->getPath();
74
75
        $this->assertEquals(
76
            '_embedded.fine',
77
            $pathFound
78
        );
79
    }
80
}
81