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 |
||
| 20 | class ISBNTest extends PHPUnit_Framework_TestCase |
||
| 21 | { |
||
| 22 | /** |
||
| 23 | * @var \eZ\Publish\Core\Persistence\Legacy\Content\FieldValue\Converter\ISBNConverter |
||
| 24 | */ |
||
| 25 | protected $converter; |
||
| 26 | |||
| 27 | protected function setUp() |
||
| 31 | |||
| 32 | /** |
||
| 33 | * @dataProvider providerForTestToFieldDefinition |
||
| 34 | * |
||
| 35 | * @covers \eZ\Publish\Core\Persistence\Legacy\Content\FieldValue\Converter\ISBNConverter::toFieldDefinition |
||
| 36 | */ |
||
| 37 | public function testToFieldDefinition($dataInt, $excpectedIsbn13Value) |
||
| 50 | |||
| 51 | View Code Duplication | public function providerForTestToFieldDefinition() |
|
| 59 | } |
||
| 60 |