Failed Conditions
Push — develop ( eb5856...11b055 )
by Adrien
31:22
created

XlsTest::testFreezePane()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 23
Code Lines 15

Duplication

Lines 23
Ratio 100 %

Importance

Changes 0
Metric Value
cc 1
eloc 15
c 0
b 0
f 0
nc 1
nop 0
dl 23
loc 23
rs 9.0856
1
<?php
2
3
namespace PhpOffice\PhpSpreadsheetTests\Reader;
4
5
use PhpOffice\PhpSpreadsheet\Reader\Xls as ReaderXls;
6
use PhpOffice\PhpSpreadsheet\Shared\File;
7
use PhpOffice\PhpSpreadsheet\Spreadsheet;
8
use PhpOffice\PhpSpreadsheet\Writer\Xls as WriterXls;
9
use PHPUnit_Framework_TestCase;
10
11
class XlsTest extends PHPUnit_Framework_TestCase
12
{
13 View Code Duplication
    public function testFreezePane()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

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.

Loading history...
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