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 |
||
| 15 | class XDynamicKeyTest extends \PHPUnit_Framework_TestCase |
||
| 16 | { |
||
| 17 | |||
| 18 | /** |
||
| 19 | * test if it does resolve |
||
| 20 | * |
||
| 21 | * @return void |
||
| 22 | */ |
||
| 23 | View Code Duplication | public function testResolveRef() |
|
| 45 | |||
| 46 | /** |
||
| 47 | * test only one field in method variable |
||
| 48 | * |
||
| 49 | * @return void |
||
| 50 | */ |
||
| 51 | public function testResolveRefOne() |
||
| 67 | |||
| 68 | /** |
||
| 69 | * test empty vars |
||
| 70 | * |
||
| 71 | * @return void |
||
| 72 | */ |
||
| 73 | public function testResolveRefMethodEmptyVars() |
||
| 77 | |||
| 78 | /** |
||
| 79 | * test if it behaves correctly if the methods don't exist |
||
| 80 | * |
||
| 81 | * @expectedException Graviton\ExceptionBundle\Exception\XDynamicKeyException |
||
| 82 | * @return void |
||
| 83 | */ |
||
| 84 | View Code Duplication | public function testResolveRefNotExistingFields() |
|
| 106 | } |
||
| 107 |