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 |
||
| 8 | class MenuTest extends BaseTestCase |
||
|
|
|||
| 9 | { |
||
| 10 | /** |
||
| 11 | * @var Menu |
||
| 12 | */ |
||
| 13 | private $menu; |
||
| 14 | |||
| 15 | public function setUp() |
||
| 20 | /** @test */ |
||
| 21 | View Code Duplication | public function it_generates_an_empty_menu() |
|
| 36 | |||
| 37 | /** @test */ |
||
| 38 | View Code Duplication | public function it_makes_is_an_alias_for_create() |
|
| 53 | |||
| 54 | /** @test */ |
||
| 55 | View Code Duplication | public function it_render_is_an_alias_of_get() |
|
| 70 | |||
| 71 | /** @test */ |
||
| 72 | public function it_can_get_the_instance_of_a_menu() |
||
| 79 | |||
| 80 | /** @test */ |
||
| 81 | public function it_can_modify_a_menu_instance() |
||
| 92 | |||
| 93 | /** @test */ |
||
| 94 | public function it_gets_a_partial_for_dropdown_styles() |
||
| 101 | |||
| 102 | /** @test */ |
||
| 103 | public function it_can_get_all_menus() |
||
| 112 | |||
| 113 | /** @test */ |
||
| 114 | public function it_can_count_menus() |
||
| 123 | |||
| 124 | /** @test */ |
||
| 125 | public function it_can_destroy_all_menus() |
||
| 136 | } |
||
| 137 |