| Conditions | 1 |
| Paths | 1 |
| Total Lines | 81 |
| Code Lines | 53 |
| 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 |
||
| 55 | public function gridProvider() |
||
| 56 | { |
||
| 57 | return [ |
||
| 58 | 'Magento order grid' => [ |
||
| 59 | [ |
||
| 60 | 'gridParameters' => [ |
||
| 61 | 'gridName' => 'magento-order-grid' |
||
| 62 | ], |
||
| 63 | 'gridFilters' => [], |
||
| 64 | 'asserts' => [ |
||
| 65 | [ |
||
| 66 | 'channelName' => 'Magento channel', |
||
| 67 | 'firstName' => 'John', |
||
| 68 | 'lastName' => 'Doe', |
||
| 69 | 'status' => 'open', |
||
| 70 | 'subTotal' => '$0.00', |
||
| 71 | ], |
||
| 72 | [ |
||
| 73 | 'channelName' => 'Magento channel', |
||
| 74 | 'firstName' => 'Guest Jack', |
||
| 75 | 'lastName' => 'Guest White', |
||
| 76 | 'status' => 'open', |
||
| 77 | 'subTotal' => '$0.00', |
||
| 78 | ] |
||
| 79 | ], |
||
| 80 | 'expectedResultCount' => 2 |
||
| 81 | ], |
||
| 82 | ], |
||
| 83 | 'Magento order grid with filters' => [ |
||
| 84 | [ |
||
| 85 | 'gridParameters' => [ |
||
| 86 | 'gridName' => 'magento-order-grid' |
||
| 87 | ], |
||
| 88 | 'gridFilters' => [ |
||
| 89 | 'magento-order-grid[_filter][lastName][value]' => 'Doe', |
||
| 90 | 'magento-order-grid[_filter][firstName][value]' => 'John', |
||
| 91 | 'magento-order-grid[_filter][status][value]' => 'open', |
||
| 92 | ], |
||
| 93 | 'assert' => [ |
||
| 94 | 'channelName' => 'Magento channel', |
||
| 95 | 'firstName' => 'John', |
||
| 96 | 'lastName' => 'Doe', |
||
| 97 | 'status' => 'open', |
||
| 98 | 'subTotal' => '$0.00', |
||
| 99 | ], |
||
| 100 | 'expectedResultCount' => 1 |
||
| 101 | ], |
||
| 102 | ], |
||
| 103 | 'Magento order grid with filters without result' => [ |
||
| 104 | [ |
||
| 105 | 'gridParameters' => [ |
||
| 106 | 'gridName' => 'magento-order-grid' |
||
| 107 | ], |
||
| 108 | 'gridFilters' => [ |
||
| 109 | 'magento-order-grid[_filter][lastName][value]' => 'Doe', |
||
| 110 | 'magento-order-grid[_filter][firstName][value]' => 'John', |
||
| 111 | 'magento-order-grid[_filter][status][value]' => 'close', |
||
| 112 | ], |
||
| 113 | 'assert' => [], |
||
| 114 | 'expectedResultCount' => 0 |
||
| 115 | ], |
||
| 116 | ], |
||
| 117 | 'Magento order item grid' => [ |
||
| 118 | [ |
||
| 119 | 'gridParameters' => [ |
||
| 120 | 'gridName' => 'magento-orderitem-grid', |
||
| 121 | 'id' => 'id', |
||
| 122 | ], |
||
| 123 | 'gridFilters' => [], |
||
| 124 | 'assert' => [ |
||
| 125 | 'sku' => 'some sku', |
||
| 126 | 'qty' => 1, |
||
| 127 | 'rowTotal' => '$234.00', |
||
| 128 | 'taxAmount' => '$1.50', |
||
| 129 | 'discountAmount' => '$0.00' |
||
| 130 | ], |
||
| 131 | 'expectedResultCount' => 1 |
||
| 132 | ], |
||
| 133 | ], |
||
| 134 | ]; |
||
| 135 | } |
||
| 136 | } |
||
| 137 |