Conditions | 1 |
Paths | 1 |
Total Lines | 91 |
Code Lines | 59 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.
For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.
Commonly applied refactorings include:
If many parameters/temporary variables are present:
1 | <?php |
||
90 | public function gridProvider() |
||
91 | { |
||
92 | return [ |
||
93 | 'Magento cart grid' => [ |
||
94 | [ |
||
95 | 'gridParameters' => [ |
||
96 | 'gridName' => 'magento-cart-grid', |
||
97 | 'magento-cart-grid[_sort_by][originId]' => 'ASC', |
||
98 | ], |
||
99 | 'gridFilters' => [], |
||
100 | 'asserts' => [ |
||
101 | [ |
||
102 | 'channelName' => 'Magento channel', |
||
103 | 'firstName' => 'John', |
||
104 | 'lastName' => 'Doe', |
||
105 | 'email' => '[email protected]', |
||
106 | 'regionName' => 'Arizona' |
||
107 | ], |
||
108 | [ |
||
109 | 'channelName' => 'Magento channel', |
||
110 | 'firstName' => 'Guest Jack', |
||
111 | 'lastName' => 'Guest White', |
||
112 | 'email' => '[email protected]', |
||
113 | 'regionName' => 'Arizona' |
||
114 | ] |
||
115 | ], |
||
116 | 'expectedResultCount' => 2 |
||
117 | ], |
||
118 | ], |
||
119 | 'Magento cart grid with filters' => [ |
||
120 | [ |
||
121 | 'gridParameters' => [ |
||
122 | 'gridName' => 'magento-cart-grid' |
||
123 | ], |
||
124 | 'gridFilters' => [ |
||
125 | 'magento-cart-grid[_filter][lastName][value]' => 'Doe', |
||
126 | 'magento-cart-grid[_filter][firstName][value]' => 'John' |
||
127 | ], |
||
128 | 'assert' => [ |
||
129 | 'channelName' => 'Magento channel', |
||
130 | 'firstName' => 'John', |
||
131 | 'lastName' => 'Doe', |
||
132 | 'email' => '[email protected]', |
||
133 | 'regionName' => 'Arizona' |
||
134 | ], |
||
135 | 'expectedResultCount' => 1 |
||
136 | ], |
||
137 | ], |
||
138 | 'Magento cart grid with filters without result' => [ |
||
139 | [ |
||
140 | 'gridParameters' => [ |
||
141 | 'gridName' => 'magento-cart-grid' |
||
142 | ], |
||
143 | 'gridFilters' => [ |
||
144 | 'magento-cart-grid[_filter][lastName][value]' => 'Doe', |
||
145 | 'magento-cart-grid[_filter][firstName][value]' => 'Doe' |
||
146 | ], |
||
147 | 'assert' => [], |
||
148 | 'expectedResultCount' => 0 |
||
149 | ] |
||
150 | ], |
||
151 | 'Cart item grid' => [ |
||
152 | [ |
||
153 | 'gridParameters' => [ |
||
154 | 'gridName' => 'magento-cartitem-active-grid', |
||
155 | 'id' => 'id', |
||
156 | ], |
||
157 | 'gridFilters' => [], |
||
158 | 'assert' => [ |
||
159 | 'sku' => 'sku', |
||
160 | 'qty' => 0, |
||
161 | 'rowTotal' => 'USD 100.00', |
||
162 | 'taxAmount' => 'USD 10.00', |
||
163 | 'discountAmount' => 'USD 0.00' |
||
164 | ], |
||
165 | 'expectedResultCount' => 1 |
||
166 | ], |
||
167 | ], |
||
168 | 'Cart item grid removed' => [ |
||
169 | [ |
||
170 | 'gridParameters' => [ |
||
171 | 'gridName' => 'magento-cartitem-removed-grid', |
||
172 | 'id' => 'id', |
||
173 | ], |
||
174 | 'gridFilters' => [], |
||
175 | 'assert' => [], |
||
176 | 'expectedResultCount' => 0 |
||
177 | ], |
||
178 | ], |
||
179 | ]; |
||
180 | } |
||
181 | } |
||
182 |