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 namespace Modules\Setting\Tests; |
||
3 | class SettingsTest extends BaseSettingTest |
||
4 | { |
||
5 | /** |
||
6 | * @var \Modules\Setting\Support\Settings |
||
7 | */ |
||
8 | protected $setting; |
||
9 | |||
10 | public function setUp() |
||
15 | |||
16 | /** @test */ |
||
17 | View Code Duplication | public function it_gets_a_setting_without_locale() |
|
36 | |||
37 | /** @test */ |
||
38 | View Code Duplication | public function it_gets_setting_in_given_locale() |
|
57 | |||
58 | /** @test */ |
||
59 | public function it_returns_a_default_value_if_no_setting_found() |
||
67 | } |
||
68 |