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 RunTest extends \PHPUnit_Framework_TestCase |
||
18 | { |
||
19 | /** |
||
20 | * Tests Run::run |
||
21 | */ |
||
22 | public function testExecute() |
||
23 | { |
||
24 | $run = new Run(); |
||
25 | $output = new DummyOutput(); |
||
26 | $input = new ArrayInput( |
||
27 | [ |
||
28 | 'hook' => 'pre-push', |
||
29 | '--configuration' => HMU_PATH_FILES . '/config/valid.json', |
||
30 | '--message' => HMU_PATH_FILES . '/git/message/valid.txt' |
||
31 | ] |
||
32 | ); |
||
33 | |||
34 | $run->setIO(new NullIO()); |
||
35 | $run->run($input, $output); |
||
36 | } |
||
37 | } |
||
38 |