Conditions | 1 |
Paths | 1 |
Total Lines | 23 |
Code Lines | 15 |
Lines | 23 |
Ratio | 100 % |
Changes | 0 |
1 | <?php |
||
13 | View Code Duplication | public function testFreezePane() |
|
|
|||
14 | { |
||
15 | $filename = tempnam(File::sysGetTempDir(), 'phpspreadsheet'); |
||
16 | |||
17 | $cellSplit = 'B2'; |
||
18 | $topLeftCell = 'E5'; |
||
19 | |||
20 | $spreadsheet = new Spreadsheet(); |
||
21 | $active = $spreadsheet->getActiveSheet(); |
||
22 | $active->freezePane($cellSplit, $topLeftCell); |
||
23 | |||
24 | $writer = new WriterXls($spreadsheet); |
||
25 | $writer->save($filename); |
||
26 | |||
27 | // Read written file |
||
28 | $reader = new ReaderXls(); |
||
29 | $reloadedSpreadsheet = $reader->load($filename); |
||
30 | $reloadedActive = $reloadedSpreadsheet->getActiveSheet(); |
||
31 | $actualCellSplit = $reloadedActive->getFreezePane(); |
||
32 | $actualTopLeftCell = $reloadedActive->getTopLeftCell(); |
||
33 | |||
34 | self::assertSame($cellSplit, $actualCellSplit, 'should be able to set freeze pane'); |
||
35 | self::assertSame($topLeftCell, $actualTopLeftCell, 'should be able to set the top left cell'); |
||
36 | } |
||
38 |
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.