Passed
Push — develop ( 3028c6...9b44cf )
by Mark
29:23
created

LogicalTest::testAND()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 2
dl 0
loc 4
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace PhpOffice\PhpSpreadsheetTests\Calculation;
4
5
use PhpOffice\PhpSpreadsheet\Calculation\Functions;
6
use PhpOffice\PhpSpreadsheet\Calculation\Logical;
7
use PHPUnit\Framework\TestCase;
8
9
class LogicalTest extends TestCase
10
{
11
    public function setUp()
12
    {
13
        Functions::setCompatibilityMode(Functions::COMPATIBILITY_EXCEL);
14
    }
15
16
    public function testTRUE()
17
    {
18
        $result = Logical::TRUE();
19
        self::assertTrue($result);
20
    }
21
22
    public function testFALSE()
23
    {
24
        $result = Logical::FALSE();
25
        self::assertFalse($result);
26
    }
27
28
    /**
29
     * @dataProvider providerAND
30
     *
31
     * @param mixed $expectedResult
32
     */
33
    public function testAND($expectedResult, ...$args)
34
    {
35
        $result = Logical::logicalAnd(...$args);
36
        self::assertEquals($expectedResult, $result);
37
    }
38
39
    public function providerAND()
40
    {
41
        return require 'data/Calculation/Logical/AND.php';
42
    }
43
44
    /**
45
     * @dataProvider providerOR
46
     *
47
     * @param mixed $expectedResult
48
     */
49
    public function testOR($expectedResult, ...$args)
50
    {
51
        $result = Logical::logicalOr(...$args);
52
        self::assertEquals($expectedResult, $result);
53
    }
54
55
    public function providerOR()
56
    {
57
        return require 'data/Calculation/Logical/OR.php';
58
    }
59
60
    /**
61
     * @dataProvider providerXOR
62
     *
63
     * @param mixed $expectedResult
64
     */
65
    public function testXOR($expectedResult, ...$args)
66
    {
67
        $result = Logical::logicalXor(...$args);
68
        self::assertEquals($expectedResult, $result);
69
    }
70
71
    public function providerXOR()
72
    {
73
        return require 'data/Calculation/Logical/XOR.php';
74
    }
75
76
    /**
77
     * @dataProvider providerNOT
78
     *
79
     * @param mixed $expectedResult
80
     */
81
    public function testNOT($expectedResult, ...$args)
82
    {
83
        $result = Logical::NOT(...$args);
1 ignored issue
show
Bug introduced by
$args is expanded, but the parameter $logical of PhpOffice\PhpSpreadsheet...culation\Logical::NOT() does not expect variable arguments. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

83
        $result = Logical::NOT(/** @scrutinizer ignore-type */ ...$args);
Loading history...
84
        self::assertEquals($expectedResult, $result);
85
    }
86
87
    public function providerNOT()
88
    {
89
        return require 'data/Calculation/Logical/NOT.php';
90
    }
91
92
    /**
93
     * @dataProvider providerIF
94
     *
95
     * @param mixed $expectedResult
96
     */
97
    public function testIF($expectedResult, ...$args)
98
    {
99
        $result = Logical::statementIf(...$args);
1 ignored issue
show
Bug introduced by
$args is expanded, but the parameter $condition of PhpOffice\PhpSpreadsheet...\Logical::statementIf() does not expect variable arguments. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

99
        $result = Logical::statementIf(/** @scrutinizer ignore-type */ ...$args);
Loading history...
100
        self::assertEquals($expectedResult, $result);
101
    }
102
103
    public function providerIF()
104
    {
105
        return require 'data/Calculation/Logical/IF.php';
106
    }
107
108
    /**
109
     * @dataProvider providerIFERROR
110
     *
111
     * @param mixed $expectedResult
112
     */
113
    public function testIFERROR($expectedResult, ...$args)
114
    {
115
        $result = Logical::IFERROR(...$args);
1 ignored issue
show
Bug introduced by
$args is expanded, but the parameter $testValue of PhpOffice\PhpSpreadsheet...tion\Logical::IFERROR() does not expect variable arguments. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

115
        $result = Logical::IFERROR(/** @scrutinizer ignore-type */ ...$args);
Loading history...
116
        self::assertEquals($expectedResult, $result);
117
    }
118
119
    public function providerIFERROR()
120
    {
121
        return require 'data/Calculation/Logical/IFERROR.php';
122
    }
123
}
124