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:32
created

DijkstraTest   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 92
Duplicated Lines 96.74 %

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 89
loc 92
rs 10
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
B testFindShortestPath() 42 42 1
B testFindAlternativePaths() 45 45 1

How to fix   Duplicated Code   

Duplicated Code

Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.

Common duplication problems, and corresponding solutions are:

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 View Code Duplication
    public function testFindShortestPath()
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...
9
    {
10
        $this->samepleJson = [
0 ignored issues
show
Bug Best Practice introduced by
The property samepleJson does not exist. Although not strictly required by PHP, it is generally a best practice to declare properties explicitly.
Loading history...
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 View Code Duplication
    public function testFindAlternativePaths()
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...
54
    {
55
        $this->samepleJson = [
0 ignored issues
show
Bug Best Practice introduced by
The property samepleJson does not exist. Although not strictly required by PHP, it is generally a best practice to declare properties explicitly.
Loading history...
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