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 |
||
19 | class AccessTest extends TestCase |
||
20 | { |
||
21 | /** @var ClassLoader */ |
||
22 | private $loader; |
||
23 | |||
24 | private $userNameQuery = 'query { user { name } }'; |
||
25 | |||
26 | private $userRolesQuery = 'query { user { roles } }'; |
||
27 | |||
28 | private $userIsEnabledQuery = 'query { user { isEnabled } }'; |
||
|
|||
29 | |||
30 | private $userFriendsQuery = <<<'EOF' |
||
31 | query { |
||
32 | user { |
||
33 | friends(first: 2) { |
||
34 | edges { |
||
35 | node { |
||
36 | name |
||
37 | } |
||
38 | } |
||
39 | } |
||
40 | } |
||
41 | } |
||
42 | EOF; |
||
43 | |||
44 | private $simpleMutationWithThunkQuery = <<<'EOF' |
||
45 | mutation M { |
||
46 | simpleMutationWithThunkFields(input: {inputData: %d, clientMutationId: "bac"}) { |
||
47 | result |
||
48 | clientMutationId |
||
49 | } |
||
50 | } |
||
51 | EOF; |
||
52 | |||
53 | public function setUp() |
||
54 | { |
||
55 | parent::setUp(); |
||
56 | // load types |
||
57 | /** @var ClassLoader $loader */ |
||
58 | $loader = new ClassLoader(); |
||
59 | $loader->addPsr4( |
||
60 | 'Overblog\\GraphQLBundle\\Access\\__DEFINITIONS__\\', |
||
61 | '/tmp/OverblogGraphQLBundle/'.Kernel::VERSION.'/access/cache/overbloggraphbundletestaccess/overblog/graphql-bundle/__definitions__' |
||
62 | ); |
||
63 | $loader->register(); |
||
64 | $this->loader = $loader; |
||
65 | } |
||
66 | |||
67 | /** |
||
68 | * @expectedException \RuntimeException |
||
69 | * @expectedExceptionMessage Type class "Overblog\\GraphQLBundle\\Access\\__DEFINITIONS__\\PageInfoType" not found. If you are using your own classLoader verify the path and the namespace please. |
||
70 | */ |
||
71 | public function testCustomClassLoaderNotRegister() |
||
72 | { |
||
73 | $this->loader->unregister(); |
||
74 | $this->assertResponse($this->userNameQuery, [], static::ANONYMOUS_USER, 'access'); |
||
75 | } |
||
76 | |||
77 | View Code Duplication | public function testNotAuthenticatedUserAccessToUserName() |
|
98 | |||
99 | public function testFullyAuthenticatedUserAccessToUserName() |
||
111 | |||
112 | public function testNotAuthenticatedUserAccessToUserRoles() |
||
116 | |||
117 | public function testAuthenticatedUserAccessToUserRolesWithoutEnoughRights() |
||
121 | |||
122 | public function testUserWithCorrectRightsAccessToUserRoles() |
||
134 | |||
135 | View Code Duplication | public function testUserForbiddenField() |
|
167 | |||
168 | public function testUserAccessToUserFriends() |
||
185 | |||
186 | public function testMutationAllowedUser() |
||
202 | |||
203 | public function testMutationAllowedButNoRightsToDisplayPayload() |
||
231 | |||
232 | public function testMutationNotAllowedUser() |
||
255 | |||
256 | private function expectedFailedUserRoles() |
||
266 | } |
||
267 |
This check marks private properties in classes that are never used. Those properties can be removed.