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 |
||
11 | class SimpleBasicAuthTest extends TestCase |
||
|
|||
12 | { |
||
13 | protected function getEnvironmentSetUp($app) |
||
22 | |||
23 | /** @test */ |
||
24 | View Code Duplication | public function it_should_return_access_denied_on_empty_credentials() |
|
35 | |||
36 | /** @test */ |
||
37 | View Code Duplication | public function it_should_return_access_denied_on_wrong_credentials() |
|
48 | |||
49 | /** @test */ |
||
50 | View Code Duplication | public function it_should_return_ok_on_disabled_auth() |
|
62 | |||
63 | /** @test */ |
||
64 | View Code Duplication | public function it_should_return_ok_with_credentials() |
|
75 | |||
76 | } |
||
77 |