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 |
||
| 13 | class MultipleValuedTest extends BaseTest |
||
| 14 | { |
||
| 15 | /** |
||
| 16 | * @dataProvider matchingConfigProvider |
||
| 17 | * @covers \eZ\Publish\Core\MVC\Symfony\Matcher\ContentBased\MultipleValued::setMatchingConfig |
||
| 18 | * @covers \eZ\Publish\Core\MVC\Symfony\Matcher\ContentBased\MultipleValued::getValues |
||
| 19 | */ |
||
| 20 | View Code Duplication | public function testSetMatchingConfig($matchingConfig) |
|
| 32 | |||
| 33 | /** |
||
| 34 | * Returns a set of matching values, either single or multiple. |
||
| 35 | * |
||
| 36 | * @return array |
||
| 37 | */ |
||
| 38 | View Code Duplication | public function matchingConfigProvider() |
|
| 49 | |||
| 50 | /** |
||
| 51 | * @covers \eZ\Publish\Core\MVC\RepositoryAware::setRepository |
||
| 52 | * @covers \eZ\Publish\Core\MVC\Symfony\Matcher\ContentBased\MultipleValued::getRepository |
||
| 53 | */ |
||
| 54 | public function testInjectRepository() |
||
| 60 | |||
| 61 | private function getMultipleValuedMatcherMock() |
||
| 65 | } |
||
| 66 |