Conditions | 1 |
Paths | 1 |
Total Lines | 54 |
Code Lines | 46 |
Lines | 0 |
Ratio | 0 % |
Changes | 2 | ||
Bugs | 0 | Features | 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 |
||
185 | public function testSheetProperties($format) |
||
186 | { |
||
187 | $document = $this->getDocument('sheetProperties', $format); |
||
188 | $sheet = $document->getSheetByName('Test'); |
||
189 | $columnDimension = $sheet->getColumnDimension('D'); |
||
190 | $pageSetup = $sheet->getPageSetup(); |
||
191 | |||
192 | static::assertEquals(1, $columnDimension->getOutlineLevel(), 'Unexpected value in outlineLevel'); |
||
193 | static::assertEquals(200, $columnDimension->getWidth(), 'Unexpected value in width'); |
||
194 | |||
195 | $pageMargins = $sheet->getPageMargins(); |
||
196 | static::assertNotNull($pageMargins, 'PageMargins does not exist'); |
||
197 | static::assertEquals(1, $pageMargins->getTop(), 'Unexpected value in top'); |
||
198 | static::assertEquals(1, $pageMargins->getBottom(), 'Unexpected value in bottom'); |
||
199 | static::assertEquals(0.75, $pageMargins->getLeft(), 'Unexpected value in left'); |
||
200 | static::assertEquals(0.75, $pageMargins->getRight(), 'Unexpected value in right'); |
||
201 | static::assertEquals(0.5, $pageMargins->getHeader(), 'Unexpected value in header'); |
||
202 | static::assertEquals(0.5, $pageMargins->getFooter(), 'Unexpected value in footer'); |
||
203 | |||
204 | static::assertEquals('landscape', $pageSetup->getOrientation(), 'Unexpected value in orientation'); |
||
205 | static::assertEquals(9, $pageSetup->getPaperSize(), 'Unexpected value in paperSize'); |
||
206 | static::assertEquals('A1:B1', $pageSetup->getPrintArea(), 'Unexpected value in printArea'); |
||
207 | |||
208 | $protection = $sheet->getProtection(); |
||
209 | static::assertTrue($protection->getAutoFilter(), 'Unexpected value in autoFilter'); |
||
210 | static::assertNotNull($protection, 'Protection does not exist'); |
||
211 | static::assertTrue($protection->getDeleteColumns(), 'Unexpected value in deleteColumns'); |
||
212 | static::assertTrue($protection->getDeleteRows(), 'Unexpected value in deleteRows'); |
||
213 | static::assertTrue($protection->getFormatCells(), 'Unexpected value in formatCells'); |
||
214 | static::assertTrue($protection->getFormatColumns(), 'Unexpected value in formatColumns'); |
||
215 | static::assertTrue($protection->getFormatRows(), 'Unexpected value in formatRows'); |
||
216 | static::assertTrue($protection->getInsertColumns(), 'Unexpected value in insertColumns'); |
||
217 | static::assertTrue($protection->getInsertHyperlinks(), 'Unexpected value in insertHyperlinks'); |
||
218 | static::assertTrue($protection->getInsertRows(), 'Unexpected value in insertRows'); |
||
219 | static::assertTrue($protection->getObjects(), 'Unexpected value in objects'); |
||
220 | static::assertEquals(\PHPExcel_Shared_PasswordHasher::hashPassword('testpassword'), $protection->getPassword(), 'Unexpected value in password'); |
||
221 | static::assertTrue($protection->getPivotTables(), 'Unexpected value in pivotTables'); |
||
222 | static::assertTrue($protection->getScenarios(), 'Unexpected value in scenarios'); |
||
223 | static::assertTrue($protection->getSelectLockedCells(), 'Unexpected value in selectLockedCells'); |
||
224 | static::assertTrue($protection->getSelectUnlockedCells(), 'Unexpected value in selectUnlockedCells'); |
||
225 | static::assertTrue($protection->getSheet(), 'Unexpected value in sheet'); |
||
226 | static::assertTrue($protection->getSort(), 'Unexpected value in sort'); |
||
227 | |||
228 | static::assertTrue($sheet->getPrintGridlines(), 'Unexpected value in printGridlines'); |
||
229 | static::assertTrue($sheet->getRightToLeft(), 'Unexpected value in rightToLeft'); |
||
230 | static::assertEquals('c0c0c0', strtolower($sheet->getTabColor()->getRGB()), 'Unexpected value in tabColor'); |
||
231 | static::assertEquals(75, $sheet->getSheetView()->getZoomScale(), 'Unexpected value in zoomScale'); |
||
232 | |||
233 | $rowDimension = $sheet->getRowDimension(2); |
||
234 | static::assertNotNull($rowDimension, 'RowDimension does not exist'); |
||
235 | static::assertEquals(1, $rowDimension->getOutlineLevel(), 'Unexpected value in outlineLevel'); |
||
236 | static::assertEquals(30, $rowDimension->getRowHeight(), 'Unexpected value in rowHeight'); |
||
237 | static::assertEquals(0, $rowDimension->getXfIndex(), 'Unexpected value in xfIndex'); |
||
238 | } |
||
239 | } |
||
240 |