Failed Conditions
Push — develop ( 11b055...32a55a )
by Adrien
30:13
created

FreezePane   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
dl 0
loc 32
rs 10
c 0
b 0
f 0
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A providerFormats() 0 5 1
A testFreezePane() 0 17 1
1
<?php
2
3
namespace PhpOffice\PhpSpreadsheetTests\Functional;
4
5
use PhpOffice\PhpSpreadsheet\Spreadsheet;
6
7
class FreezePane extends AbstractFunctional
8
{
9
    public function providerFormats()
10
    {
11
        return [
12
            ['Xls'],
13
            ['Xlsx'],
14
        ];
15
    }
16
17
    /**
18
     * @dataProvider providerFormats
19
     *
20
     * @param string $format
21
     */
22
    public function testFreezePane($format)
23
    {
24
        $cellSplit = 'B2';
25
        $topLeftCell = 'E5';
26
27
        $spreadsheet = new Spreadsheet();
28
        $spreadsheet->getActiveSheet()->freezePane($cellSplit, $topLeftCell);
29
30
        $reloadedSpreadsheet = $this->writeAndReload($spreadsheet, $format);
31
32
        // Read written file
33
        $reloadedActive = $reloadedSpreadsheet->getActiveSheet();
34
        $actualCellSplit = $reloadedActive->getFreezePane();
35
        $actualTopLeftCell = $reloadedActive->getTopLeftCell();
36
37
        self::assertSame($cellSplit, $actualCellSplit, 'should be able to set freeze pane');
38
        self::assertSame($topLeftCell, $actualTopLeftCell, 'should be able to set the top left cell');
39
    }
40
}
41