Passed
Pull Request — master (#4264)
by Owen
18:41 queued 08:04
created

testSaveAndLoadHyperlinks()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 35
Code Lines 30

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 30
dl 0
loc 35
rs 9.44
c 1
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace PhpOffice\PhpSpreadsheetTests\Reader\Ods;
6
7
use PhpOffice\PhpSpreadsheet\Spreadsheet;
8
use PhpOffice\PhpSpreadsheetTests\Functional\AbstractFunctional;
9
10
class RepeatEmptyCellsAndRowsTest extends AbstractFunctional
11
{
12
    public function testSaveAndLoadHyperlinks(): void
13
    {
14
        $spreadsheetOld = new Spreadsheet();
15
        $oldSheet = $spreadsheetOld->getActiveSheet();
16
        $oldSheet->setCellValue('C1', 'xx');
17
        $oldSheet->setCellValue('G1', 'aa');
18
        $oldSheet->setCellValue('BB1', 'bb');
19
        $oldSheet->setCellValue('A6', 'aaa');
20
        $oldSheet->setCellValue('B7', 'bbb');
21
        $oldSheet->getRowDimension(10)->setRowHeight(12);
22
        $oldSheet->setCellValue('A12', 'this is A12');
23
        $style = $oldSheet->getStyle('B14:D14');
24
        $style->getFont()->setBold(true);
25
        $oldSheet->getCell('E15')->setValue('X');
26
        $oldSheet->mergeCells('E15:G16');
27
        $oldSheet->getCell('J15')->setValue('j15');
28
        $oldSheet->getCell('J16')->setValue('j16');
29
        $oldSheet->getCell('A19')->setValue('lastrow');
30
        $spreadsheet = $this->writeAndReload($spreadsheetOld, 'Ods');
31
        $spreadsheetOld->disconnectWorksheets();
32
33
        $sheet = $spreadsheet->getActiveSheet();
34
        self::assertSame('xx', $sheet->getCell('C1')->getValue());
35
        self::assertSame('aa', $sheet->getCell('G1')->getValue());
36
        self::assertSame('bb', $sheet->getCell('BB1')->getValue());
37
        self::assertSame('aaa', $sheet->getCell('A6')->getValue());
38
        self::assertSame('bbb', $sheet->getCell('B7')->getValue());
39
        self::assertSame('this is A12', $sheet->getCell('A12')->getValue());
40
        // Read styles, including row height, not yet implemented for ODS
41
        self::assertSame('j15', $sheet->getCell('J15')->getValue());
42
        self::assertSame('j16', $sheet->getCell('J16')->getValue());
43
        self::assertSame(['E15:G16' => 'E15:G16'], $sheet->getMergeCells());
44
        self::assertSame('lastrow', $sheet->getCell('A19')->getValue());
45
46
        $spreadsheet->disconnectWorksheets();
47
    }
48
}
49