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 |
||
17 | class TranslatableControllerTest extends RestTestCase |
||
18 | { |
||
19 | |||
20 | /** |
||
21 | * load fixtures |
||
22 | * |
||
23 | * @return void |
||
24 | */ |
||
25 | public function setUp() |
||
36 | |||
37 | /** |
||
38 | * check that translatable record return correct CORS headers |
||
39 | * |
||
40 | * @return void |
||
41 | */ |
||
42 | View Code Duplication | public function testOptionsHasCors() |
|
51 | |||
52 | /** |
||
53 | * validate linking of objects |
||
54 | * |
||
55 | * @return void |
||
56 | */ |
||
57 | View Code Duplication | public function testContainsReference() |
|
66 | |||
67 | /** |
||
68 | * validate linking of objects in item |
||
69 | * |
||
70 | * @return void |
||
71 | */ |
||
72 | View Code Duplication | public function testItemContainsReference() |
|
81 | |||
82 | /** |
||
83 | * validate creating new translatables |
||
84 | * |
||
85 | * @return void |
||
86 | */ |
||
87 | public function testCreateTranslatableWithReference() |
||
110 | } |
||
111 |