| 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 |
||
| 83 | public function gridProvider() |
||
| 84 | { |
||
| 85 | return [ |
||
| 86 | 'Magento cart grid' => [ |
||
| 87 | [ |
||
| 88 | 'gridParameters' => [ |
||
| 89 | 'gridName' => 'magento-cart-grid', |
||
| 90 | 'magento-cart-grid[_sort_by][originId]' => 'ASC', |
||
| 91 | ], |
||
| 92 | 'gridFilters' => [], |
||
| 93 | 'asserts' => [ |
||
| 94 | [ |
||
| 95 | 'channelName' => 'Magento channel', |
||
| 96 | 'firstName' => 'John', |
||
| 97 | 'lastName' => 'Doe', |
||
| 98 | 'email' => '[email protected]', |
||
| 99 | 'regionName' => 'Arizona' |
||
| 100 | ], |
||
| 101 | [ |
||
| 102 | 'channelName' => 'Magento channel', |
||
| 103 | 'firstName' => 'Guest Jack', |
||
| 104 | 'lastName' => 'Guest White', |
||
| 105 | 'email' => '[email protected]', |
||
| 106 | 'regionName' => 'Arizona' |
||
| 107 | ] |
||
| 108 | ], |
||
| 109 | 'expectedResultCount' => 2 |
||
| 110 | ], |
||
| 111 | ], |
||
| 112 | 'Magento cart grid with filters' => [ |
||
| 113 | [ |
||
| 114 | 'gridParameters' => [ |
||
| 115 | 'gridName' => 'magento-cart-grid' |
||
| 116 | ], |
||
| 117 | 'gridFilters' => [ |
||
| 118 | 'magento-cart-grid[_filter][lastName][value]' => 'Doe', |
||
| 119 | 'magento-cart-grid[_filter][firstName][value]' => 'John' |
||
| 120 | ], |
||
| 121 | 'assert' => [ |
||
| 122 | 'channelName' => 'Magento channel', |
||
| 123 | 'firstName' => 'John', |
||
| 124 | 'lastName' => 'Doe', |
||
| 125 | 'email' => '[email protected]', |
||
| 126 | 'regionName' => 'Arizona' |
||
| 127 | ], |
||
| 128 | 'expectedResultCount' => 1 |
||
| 129 | ], |
||
| 130 | ], |
||
| 131 | 'Magento cart grid with filters without result' => [ |
||
| 132 | [ |
||
| 133 | 'gridParameters' => [ |
||
| 134 | 'gridName' => 'magento-cart-grid' |
||
| 135 | ], |
||
| 136 | 'gridFilters' => [ |
||
| 137 | 'magento-cart-grid[_filter][lastName][value]' => 'Doe', |
||
| 138 | 'magento-cart-grid[_filter][firstName][value]' => 'Doe' |
||
| 139 | ], |
||
| 140 | 'assert' => [], |
||
| 141 | 'expectedResultCount' => 0 |
||
| 142 | ] |
||
| 143 | ], |
||
| 144 | 'Cart item grid' => [ |
||
| 145 | [ |
||
| 146 | 'gridParameters' => [ |
||
| 147 | 'gridName' => 'magento-cartitem-active-grid', |
||
| 148 | 'id' => 'id', |
||
| 149 | ], |
||
| 150 | 'gridFilters' => [], |
||
| 151 | 'assert' => [ |
||
| 152 | 'sku' => 'sku', |
||
| 153 | 'qty' => 0, |
||
| 154 | 'rowTotal' => 'USD 100.00', |
||
| 155 | 'taxAmount' => 'USD 10.00', |
||
| 156 | 'discountAmount' => 'USD 0.00' |
||
| 157 | ], |
||
| 158 | 'expectedResultCount' => 1 |
||
| 159 | ], |
||
| 160 | ], |
||
| 161 | 'Cart item grid removed' => [ |
||
| 162 | [ |
||
| 163 | 'gridParameters' => [ |
||
| 164 | 'gridName' => 'magento-cartitem-removed-grid', |
||
| 165 | 'id' => 'id', |
||
| 166 | ], |
||
| 167 | 'gridFilters' => [], |
||
| 168 | 'assert' => [], |
||
| 169 | 'expectedResultCount' => 0 |
||
| 170 | ], |
||
| 171 | ], |
||
| 172 | ]; |
||
| 173 | } |
||
| 174 | } |
||
| 175 |