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 |
||
3 | class OrderDetailTest extends SapphireTest |
||
4 | { |
||
5 | /** |
||
6 | * @var string |
||
7 | */ |
||
8 | protected static $fixture_file = 'foxystripe/tests/FoxyStripeTest.yml'; |
||
9 | |||
10 | /** |
||
11 | * |
||
12 | */ |
||
13 | public function testGetCMSFields() |
||
25 | |||
26 | /** |
||
27 | * |
||
28 | */ |
||
29 | View Code Duplication | public function testCanView() |
|
37 | |||
38 | /** |
||
39 | * |
||
40 | */ |
||
41 | View Code Duplication | public function testCanEdit() |
|
49 | |||
50 | /** |
||
51 | * |
||
52 | */ |
||
53 | View Code Duplication | public function testCanDelete() |
|
61 | |||
62 | /** |
||
63 | * |
||
64 | */ |
||
65 | View Code Duplication | public function testCanCreate() |
|
73 | } |
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.