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 FieldValueConverterRegistryTest extends TestCase |
||
19 | { |
||
20 | /** |
||
21 | * @covers \eZ\Publish\Core\Persistence\Legacy\Content\FieldValue\ConverterRegistry::register |
||
22 | */ |
||
23 | public function testRegister(): void |
||
36 | |||
37 | /** |
||
38 | * @covers \eZ\Publish\Core\Persistence\Legacy\Content\FieldValue\ConverterRegistry::getConverter |
||
39 | */ |
||
40 | public function testGetStorage(): void |
||
52 | |||
53 | /** |
||
54 | * @covers \eZ\Publish\Core\Persistence\Legacy\Content\FieldValue\ConverterRegistry::getConverter |
||
55 | * @covers \eZ\Publish\Core\Persistence\Legacy\Content\FieldValue\Converter\Exception\NotFound |
||
56 | * @expectedException \eZ\Publish\Core\Persistence\Legacy\Content\FieldValue\Converter\Exception\NotFound |
||
57 | */ |
||
58 | public function testGetNotFound(): void |
||
64 | |||
65 | /** |
||
66 | * @covers \eZ\Publish\Core\Persistence\Legacy\Content\FieldValue\ConverterRegistry::hasConverter |
||
67 | */ |
||
68 | View Code Duplication | public function testHasStorage(): void |
|
77 | |||
78 | /** |
||
79 | * @covers \eZ\Publish\Core\Persistence\Legacy\Content\FieldValue\ConverterRegistry::hasConverter |
||
80 | */ |
||
81 | View Code Duplication | public function testHasNoStorage(): void |
|
90 | |||
91 | /** |
||
92 | * @return \eZ\Publish\Core\Persistence\Legacy\Content\FieldValue\Converter|\PHPUnit\Framework\MockObject\MockObject |
||
93 | */ |
||
94 | protected function getFieldValueConverterMock() |
||
98 | } |
||
99 |
This method has been deprecated. The supplier of the class has supplied an explanatory message.
The explanatory message should give you some clue as to whether and when the method will be removed from the class and what other method or class to use instead.