Passed
Pull Request — master (#4436)
by Owen
11:04
created

Issue4435Test::testNoHeaderFooterStyle()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 16
Code Lines 12

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 12
dl 0
loc 16
rs 9.8666
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\Reader\Ods as OdsReader;
8
use PHPUnit\Framework\TestCase;
9
10
class Issue4435Test extends TestCase
11
{
12
    private string $file = 'tests/data/Reader/Ods/issue.4435b.ods';
13
14
    public function testNoHeaderFooterStyle(): void
15
    {
16
        // had been throwing exception when cell didn't have value-type
17
        $zipFile = 'zip://' . $this->file . '#content.xml';
18
        $contents = (string) file_get_contents($zipFile);
19
        self::assertStringContainsString(
20
            '<table:table-cell table:style-name="ce1">' . "\n"
21
            . '<text:p/>' . "\n"
22
            . '</table:table-cell>',
23
            $contents
24
        );
25
        $reader = new OdsReader();
26
        $spreadsheet = $reader->load($this->file);
27
        $sheet = $spreadsheet->getActiveSheet();
28
        self::assertNull($sheet->getCell('B1')->getValue());
29
        $spreadsheet->disconnectWorksheets();
30
    }
31
}
32