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 |
||
| 18 | class OrbitaleCmsExtensionTest extends \PHPUnit_Framework_TestCase |
||
| 19 | { |
||
| 20 | /** |
||
| 21 | * @dataProvider provideConfiguration |
||
| 22 | * |
||
| 23 | * @param $config |
||
| 24 | * @param $expected |
||
| 25 | */ |
||
| 26 | View Code Duplication | public function testConfiguration($config, $expected) |
|
| 36 | |||
| 37 | /** |
||
| 38 | * @dataProvider provideConfiguration |
||
| 39 | * |
||
| 40 | * @param $config |
||
| 41 | * @param $expected |
||
| 42 | */ |
||
| 43 | View Code Duplication | public function testConfigurationSymfony2($config, $expected) |
|
| 53 | |||
| 54 | public function provideConfiguration() |
||
| 74 | } |
||
| 75 |