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 |
||
19 | class BookmarkListTest extends ValueObjectVisitorBaseTest |
||
20 | { |
||
21 | /** |
||
22 | * @var \eZ\Publish\Core\REST\Server\Values\BookmarkList |
||
23 | */ |
||
24 | private $data; |
||
|
|||
25 | |||
26 | protected function setUp() |
||
34 | |||
35 | View Code Duplication | public function testVisit(): string |
|
54 | |||
55 | /** |
||
56 | * @depends testVisit |
||
57 | */ |
||
58 | public function testResultContainsBookmarkListElement(string $result): void |
||
71 | |||
72 | /** |
||
73 | * @depends testVisit |
||
74 | */ |
||
75 | public function testResultContainsCountElement(string $result): void |
||
85 | |||
86 | /** |
||
87 | * @depends testVisit |
||
88 | */ |
||
89 | public function testResultContainsBookmarkElement(string $result): void |
||
99 | |||
100 | /** |
||
101 | * {@inheritdoc} |
||
102 | */ |
||
103 | protected function internalGetVisitor() |
||
107 | } |
||
108 |