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 |
||
9 | class ReplayProtection extends atoum\test |
||
10 | { |
||
11 | public function test_lifetime_attribute_should_be_a_numeric() |
||
20 | |||
21 | /** |
||
22 | * @dataProvider dummyCases |
||
23 | */ |
||
24 | View Code Duplication | public function test_disabled_state_should_accept_all_signatureTime($lifetime, $signatureTime, $currentTime) |
|
38 | |||
39 | public function dummyCases() |
||
47 | |||
48 | /** |
||
49 | * @dataProvider goodCases |
||
50 | */ |
||
51 | View Code Duplication | public function test_it_should_accept_signatureTime_still_valid($lifetime, $signatureTime, $currentTime) |
|
65 | |||
66 | public function goodCases() |
||
75 | |||
76 | /** |
||
77 | * @dataProvider wrongCases |
||
78 | */ |
||
79 | View Code Duplication | public function test_it_should_not_accept_signatureTime_expired($lifetime, $signatureTime, $currentTime) |
|
93 | |||
94 | public function wrongCases() |
||
102 | } |
||
103 |
This check marks calls to methods that do not seem to exist on an object.
This is most likely the result of a method being renamed without all references to it being renamed likewise.