We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.
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 |
||
8 | class CrudPanelTabsTest extends BaseDBCrudPanelTest |
||
9 | { |
||
10 | private $horizontalTabsType = 'horizontal'; |
||
11 | private $verticalTabsType = 'vertical'; |
||
12 | |||
13 | private $threeTextFieldsArray = [ |
||
14 | [ |
||
15 | 'name' => 'field1', |
||
16 | 'label' => 'Field1', |
||
17 | ], |
||
18 | [ |
||
19 | 'name' => 'field2', |
||
20 | 'label' => 'Field2', |
||
21 | 'tab' => 'First Tab', |
||
22 | ], |
||
23 | [ |
||
24 | 'name' => 'field3', |
||
25 | 'label' => 'Field3', |
||
26 | 'tab' => 'First Tab', |
||
27 | 'type' => 'email', |
||
28 | ], |
||
29 | [ |
||
30 | 'name' => 'field4', |
||
31 | 'label' => 'Field4', |
||
32 | 'tab' => 'Second Tab', |
||
33 | ], |
||
34 | [ |
||
35 | 'name' => 'field5', |
||
36 | 'label' => 'Field5', |
||
37 | 'tab' => 'Third Tab', |
||
38 | ], |
||
39 | ]; |
||
40 | |||
41 | private $expectedTabNames = ['First Tab', 'Second Tab', 'Third Tab']; |
||
42 | |||
43 | private $expectedFieldsInFirstTab = [ |
||
44 | 'field2' => [ |
||
45 | 'name' => 'field2', |
||
46 | 'label' => 'Field2', |
||
47 | 'tab' => 'First Tab', |
||
48 | 'type' => 'text', |
||
49 | ], |
||
50 | 'field3' => [ |
||
51 | 'name' => 'field3', |
||
52 | 'label' => 'Field3', |
||
53 | 'tab' => 'First Tab', |
||
54 | 'type' => 'email', |
||
55 | ], |
||
56 | ]; |
||
57 | |||
58 | private $expectedFieldsInSecondTab = [ |
||
59 | 'field2' => [ |
||
60 | 'name' => 'field4', |
||
61 | 'label' => 'Field4', |
||
62 | 'tab' => 'Second Tab', |
||
63 | 'type' => 'text', |
||
64 | ], |
||
65 | ]; |
||
66 | |||
67 | private $expectedFieldsInThirdTab = [ |
||
68 | 'field2' => [ |
||
69 | 'name' => 'field5', |
||
70 | 'label' => 'Field5', |
||
71 | 'tab' => 'Third Tab', |
||
72 | 'type' => 'text', |
||
73 | 1 | ], |
|
74 | ]; |
||
75 | 1 | ||
76 | public function testEnableTabs() |
||
82 | 1 | ||
83 | public function testDisableTabs() |
||
89 | 1 | ||
90 | public function testTabsEnabled() |
||
96 | |||
97 | 1 | public function testTabsDisabled() |
|
103 | |||
104 | 1 | public function testSetTabsType() |
|
110 | 1 | ||
111 | 1 | public function testGetTabsType() |
|
117 | 1 | ||
118 | public function testEnableVerticalTabs() |
||
124 | |||
125 | public function testDisableVerticalTabs() |
||
131 | |||
132 | public function testEnableHorizontalTabs() |
||
138 | |||
139 | 1 | public function testDisableHorizontalTabs() |
|
145 | |||
146 | 1 | public function testTabExists() |
|
154 | |||
155 | 1 | public function testTabExistsUnknownLabel() |
|
163 | |||
164 | 1 | public function testGetLastTab() |
|
172 | |||
173 | public function testGetLastTabNoTabs() |
||
179 | |||
180 | public function testIsLastTab() |
||
192 | |||
193 | public function testIsLastTabUnknownLabel() |
||
201 | |||
202 | public function testGetTabFields() |
||
218 | |||
219 | public function testGetTabFieldsUnknownLabel() |
||
225 | |||
226 | public function testGetTabs() |
||
234 | |||
235 | View Code Duplication | public function testGetTabsEntryExists() |
|
249 | } |
||
250 |
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.
You can also find more detailed suggestions in the “Code” section of your repository.