Code Duplication    Length = 24-24 lines in 2 locations

tests/PhpSpreadsheetTests/Reader/XlsTest.php 1 location

@@ 13-36 (lines=24) @@
10
11
class XlsTest extends PHPUnit_Framework_TestCase
12
{
13
    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
    }
37
}
38

tests/PhpSpreadsheetTests/Reader/XlsxTest.php 1 location

@@ 23-46 (lines=24) @@
20
        $reader->load($filename);
21
    }
22
23
    public function testFreezePane()
24
    {
25
        $filename = tempnam(File::sysGetTempDir(), 'phpspreadsheet');
26
27
        $cellSplit = 'B2';
28
        $topLeftCell = 'E5';
29
30
        $spreadsheet = new Spreadsheet();
31
        $active = $spreadsheet->getActiveSheet();
32
        $active->freezePane($cellSplit, $topLeftCell);
33
34
        $writer = new WriterXlsx($spreadsheet);
35
        $writer->save($filename);
36
37
        // Read written file
38
        $reader = new ReaderXlsx();
39
        $reloadedSpreadsheet = $reader->load($filename);
40
        $reloadedActive = $reloadedSpreadsheet->getActiveSheet();
41
        $actualCellSplit = $reloadedActive->getFreezePane();
42
        $actualTopLeftCell = $reloadedActive->getTopLeftCell();
43
44
        self::assertSame($cellSplit, $actualCellSplit, 'should be able to set freeze pane');
45
        self::assertSame($topLeftCell, $actualTopLeftCell, 'should be able to set the top left cell');
46
    }
47
}
48