Passed
Pull Request — master (#4277)
by Owen
13:33
created

Biff8CoverTest::testBiff8Coverage()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 25
Code Lines 19

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 19
c 1
b 0
f 0
dl 0
loc 25
rs 9.6333
cc 1
nc 1
nop 0
1
<?php
2
3
namespace PhpOffice\PhpSpreadsheetTests\Reader\Xls;
4
5
use PhpOffice\PhpSpreadsheet\Reader\Xls;
6
use PhpOffice\PhpSpreadsheet\Shared\Date;
7
use PHPUnit\Framework\TestCase;
8
9
class Biff8CoverTest extends TestCase
10
{
11
    protected function tearDown(): void
12
    {
13
        Date::setExcelCalendar(Date::CALENDAR_WINDOWS_1900);
14
    }
15
16
    public function testBiff8Coverage(): void
17
    {
18
        $filename = 'tests/data/Reader/XLS/biff8cover.xls';
19
        $reader = new Xls();
20
        $spreadsheet = $reader->load($filename);
21
        $sheet = $spreadsheet->getActiveSheet();
22
        self::assertSame('=SUM({1;2;3;4;5})', $sheet->getCell('A1')->getValue());
23
        self::assertSame(15, $sheet->getCell('A1')->getCalculatedValue());
24
        self::assertSame(
25
            '=VLOOKUP("hello",'
26
            . '{"what",1;"why",TRUE;"hello","there";"when",FALSE}'
27
            . ',2,FALSE)',
28
            $sheet->getCell('C1')->getValue()
29
        );
30
        self::assertSame('there', $sheet->getCell('C1')->getCalculatedValue());
31
        self::assertSame(2, $sheet->getCell('A3')->getValue());
32
        self::assertTrue(
33
            $sheet->getStyle('A3')->getFont()->getSuperscript()
34
        );
35
        self::assertSame('n', $sheet->getCell('B3')->getValue());
36
        self::assertTrue(
37
            $sheet->getStyle('B3')->getFont()->getSubscript()
38
        );
39
40
        $spreadsheet->disconnectWorksheets();
41
    }
42
}
43