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 |
||
11 | class PaginatedKnpLabsRepoFacadeTest extends \PHPUnit_Framework_TestCase |
||
12 | { |
||
13 | private $facade; |
||
14 | |||
15 | public function setUp() |
||
24 | |||
25 | /** |
||
26 | * @group GithubIntegration |
||
27 | * @group Live |
||
28 | */ |
||
29 | public function testFetchRepoDetails() |
||
35 | |||
36 | /** |
||
37 | * @group GithubIntegration |
||
38 | * @group Live |
||
39 | */ |
||
40 | public function testFetchBranch() |
||
46 | |||
47 | /** |
||
48 | * @group GithubIntegration |
||
49 | * @group Live |
||
50 | */ |
||
51 | public function testFetchAllBranches() |
||
55 | |||
56 | /** |
||
57 | * @group GithubIntegration |
||
58 | * @group Live |
||
59 | */ |
||
60 | public function testFetchAllBranchNames() |
||
64 | |||
65 | /** |
||
66 | * @group GithubIntegration |
||
67 | * @group Live |
||
68 | */ |
||
69 | public function testFetchAllTags() |
||
70 | { |
||
71 | self::assertCount(1, $this->facade->fetchAllTags()); |
||
72 | } |
||
73 | |||
74 | /** |
||
75 | * @group GithubIntegration |
||
76 | * @group Live |
||
77 | */ |
||
78 | public function testFetchAllTagNames() |
||
82 | |||
83 | /** |
||
84 | * @group GithubIntegration |
||
85 | * @group Live |
||
86 | */ |
||
87 | public function testFetchCommit() |
||
93 | |||
94 | /** |
||
95 | * @group GithubIntegration |
||
96 | * @group Live |
||
97 | */ |
||
98 | public function testFetchCommitStatuses() |
||
99 | { |
||
100 | self::assertCount(27, $this->facade->fetchCommitStatuses('db911bd3a3dd8bb2ad9eccbcb0a396595a51491d')); |
||
101 | } |
||
102 | |||
103 | /** |
||
104 | * @group GithubIntegration |
||
105 | * @group Live |
||
106 | */ |
||
107 | public function testFetchCommitStatus() |
||
108 | { |
||
109 | $result = $this->facade->fetchCommitStatus('db911bd3a3dd8bb2ad9eccbcb0a396595a51491d'); |
||
110 | self::assertSame( |
||
111 | 'https://api.github.com/repos/devboard/test-hitman/commits/db911bd3a3dd8bb2ad9eccbcb0a396595a51491d', |
||
112 | $result['commit_url'] |
||
113 | ); |
||
114 | } |
||
115 | |||
116 | /** |
||
117 | * @group GithubIntegration |
||
118 | * @group Live |
||
119 | */ |
||
120 | public function testFetchAllPullRequests() |
||
124 | |||
125 | /** |
||
126 | * @group GithubIntegration |
||
127 | * @group Live |
||
128 | */ |
||
129 | public function testFetchAllMilestones() |
||
133 | |||
134 | /** |
||
135 | * @group GithubIntegration |
||
136 | * @group Live |
||
137 | */ |
||
138 | public function testFetchAllIssues() |
||
142 | |||
143 | /** |
||
144 | * @group GithubIntegration |
||
145 | * @group Live |
||
146 | */ |
||
147 | public function testFetchAllIssuesAndPullRequests() |
||
151 | |||
152 | /** |
||
153 | * @return \Github\Client |
||
154 | */ |
||
155 | private function getTokenAuthenticatedApiClient() |
||
161 | |||
162 | /** |
||
163 | * @return \DevBoardLib\GithubCore\Repo\GithubRepo |
||
164 | */ |
||
165 | View Code Duplication | private function provideTestRepo() |
|
174 | |||
175 | /** |
||
176 | * @return \DevBoardLib\GithubApiFacade\Auth\GithubAccessToken |
||
177 | */ |
||
178 | private function provideTestUser() |
||
185 | } |
||
186 |
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.
This is most likely a typographical error or the method has been renamed.