We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.
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 |
||
16 | class GraphControllerTest extends TestCase |
||
17 | { |
||
18 | private $expectedData = [ |
||
19 | 'user' => [ |
||
20 | 'friends' => [ |
||
21 | 'totalCount' => 4, |
||
22 | 'edges' => [ |
||
23 | [ |
||
24 | 'friendshipTime' => 'Yesterday', |
||
25 | 'node' => [ |
||
26 | 'name' => 'Nick', |
||
27 | ], |
||
28 | ], |
||
29 | [ |
||
30 | 'friendshipTime' => 'Yesterday', |
||
31 | 'node' => [ |
||
32 | 'name' => 'Lee', |
||
33 | ], |
||
34 | ], |
||
35 | ], |
||
36 | ], |
||
37 | ], |
||
38 | ]; |
||
39 | |||
40 | View Code Duplication | public function testEndpointAction() |
|
63 | |||
64 | /** |
||
65 | * @expectedException \Symfony\Component\HttpKernel\Exception\BadRequestHttpException |
||
66 | * @expectedExceptionMessage Must provide query parameter |
||
67 | */ |
||
68 | public function testEndpointWithEmptyQuery() |
||
74 | |||
75 | /** |
||
76 | * @expectedException \Symfony\Component\HttpKernel\Exception\BadRequestHttpException |
||
77 | * @expectedExceptionMessage POST body sent invalid JSON [Syntax error] |
||
78 | */ |
||
79 | public function testEndpointWithInvalidBodyQuery() |
||
85 | |||
86 | View Code Duplication | public function testEndpointActionWithVariables() |
|
110 | |||
111 | /** |
||
112 | * @expectedException \Symfony\Component\HttpKernel\Exception\BadRequestHttpException |
||
113 | * @expectedExceptionMessage Variables are invalid JSON |
||
114 | */ |
||
115 | View Code Duplication | public function testEndpointActionWithInvalidVariables() |
|
129 | |||
130 | View Code Duplication | public function testEndpointActionWithOperationName() |
|
162 | } |
||
163 |
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.