Completed
Push — master ( d08653...6fb3d8 )
by
unknown
27s queued 21s
created

ConditionalTest   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
eloc 11
c 1
b 0
f 1
dl 0
loc 20
rs 10
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A testConditionalNotContainsText() 0 15 1
1
<?php
2
3
namespace PhpOffice\PhpSpreadsheetTests\Reader\Xlsx;
4
5
use PhpOffice\PhpSpreadsheet\IOFactory;
6
use PhpOffice\PhpSpreadsheet\Style\Conditional;
7
use PhpOffice\PhpSpreadsheetTests\Functional\AbstractFunctional;
8
9
class ConditionalTest extends AbstractFunctional
10
{
11
    /**
12
     * Test check if conditional style with type 'notContainsText' works on xlsx.
13
     */
14
    public function testConditionalNotContainsText(): void
15
    {
16
        $filename = 'tests/data/Reader/XLSX/conditionalFormatting3Test.xlsx';
17
        $reader = IOFactory::createReader('Xlsx');
18
        $spreadsheet = $reader->load($filename);
19
        $worksheet = $spreadsheet->getActiveSheet();
20
        $styles = $worksheet->getConditionalStyles('A1:A5');
21
22
        self::assertCount(1, $styles);
23
24
        /** @var Conditional $notContainsTextStyle */
25
        $notContainsTextStyle = $styles[0];
26
        self::assertEquals('A', $notContainsTextStyle->getText());
27
        self::assertEquals(Conditional::CONDITION_NOTCONTAINSTEXT, $notContainsTextStyle->getConditionType());
28
        self::assertEquals(Conditional::OPERATOR_NOTCONTAINS, $notContainsTextStyle->getOperatorType());
29
    }
30
}
31