Completed
Push — develop ( 4635d3...bf2dbb )
by Adrien
27:59
created

LookupRefTest::testROWS()   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\LookupRef;
7
use PHPUnit\Framework\TestCase;
8
9
/**
10
 * Class LookupRefTest.
11
 */
12
class LookupRefTest extends TestCase
13
{
14
    public function setUp()
15
    {
16
        Functions::setCompatibilityMode(Functions::COMPATIBILITY_EXCEL);
17
    }
18
19
    /**
20
     * @dataProvider providerHLOOKUP
21
     *
22
     * @param mixed $expectedResult
23
     */
24
    public function testHLOOKUP($expectedResult, ...$args)
25
    {
26
        $result = LookupRef::HLOOKUP(...$args);
1 ignored issue
show
Bug introduced by
The call to PhpOffice\PhpSpreadsheet...on\LookupRef::HLOOKUP() has too few arguments starting with lookup_array. ( Ignorable by Annotation )

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

26
        /** @scrutinizer ignore-call */ 
27
        $result = LookupRef::HLOOKUP(...$args);

This check compares calls to functions or methods with their respective definitions. If the call has less arguments than are defined, it raises an issue.

If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress. Please note the @ignore annotation hint above.

Loading history...
Bug introduced by
$args is expanded, but the parameter $lookup_value of PhpOffice\PhpSpreadsheet...on\LookupRef::HLOOKUP() 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

26
        $result = LookupRef::HLOOKUP(/** @scrutinizer ignore-type */ ...$args);
Loading history...
27
        self::assertEquals($expectedResult, $result);
28
    }
29
30
    public function providerHLOOKUP()
31
    {
32
        return require 'data/Calculation/LookupRef/HLOOKUP.php';
33
    }
34
35
    /**
36
     * @dataProvider providerVLOOKUP
37
     *
38
     * @param mixed $expectedResult
39
     */
40
    public function testVLOOKUP($expectedResult, ...$args)
41
    {
42
        $result = LookupRef::VLOOKUP(...$args);
1 ignored issue
show
Bug introduced by
$args is expanded, but the parameter $lookup_value of PhpOffice\PhpSpreadsheet...on\LookupRef::VLOOKUP() 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

42
        $result = LookupRef::VLOOKUP(/** @scrutinizer ignore-type */ ...$args);
Loading history...
Bug introduced by
The call to PhpOffice\PhpSpreadsheet...on\LookupRef::VLOOKUP() has too few arguments starting with lookup_array. ( Ignorable by Annotation )

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

42
        /** @scrutinizer ignore-call */ 
43
        $result = LookupRef::VLOOKUP(...$args);

This check compares calls to functions or methods with their respective definitions. If the call has less arguments than are defined, it raises an issue.

If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress. Please note the @ignore annotation hint above.

Loading history...
43
        self::assertEquals($expectedResult, $result);
44
    }
45
46
    public function providerVLOOKUP()
47
    {
48
        return require 'data/Calculation/LookupRef/VLOOKUP.php';
49
    }
50
51
    /**
52
     * @dataProvider providerMATCH
53
     *
54
     * @param mixed $expectedResult
55
     */
56
    public function testMATCH($expectedResult, ...$args)
57
    {
58
        $result = LookupRef::MATCH(...$args);
1 ignored issue
show
Bug introduced by
$args is expanded, but the parameter $lookupValue of PhpOffice\PhpSpreadsheet...tion\LookupRef::MATCH() 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

58
        $result = LookupRef::MATCH(/** @scrutinizer ignore-type */ ...$args);
Loading history...
Bug introduced by
The call to PhpOffice\PhpSpreadsheet...tion\LookupRef::MATCH() has too few arguments starting with lookupArray. ( Ignorable by Annotation )

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

58
        /** @scrutinizer ignore-call */ 
59
        $result = LookupRef::MATCH(...$args);

This check compares calls to functions or methods with their respective definitions. If the call has less arguments than are defined, it raises an issue.

If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress. Please note the @ignore annotation hint above.

Loading history...
59
        self::assertEquals($expectedResult, $result);
60
    }
61
62
    public function providerMATCH()
63
    {
64
        return require 'data/Calculation/LookupRef/MATCH.php';
65
    }
66
67
    /**
68
     * @dataProvider providerINDEX
69
     *
70
     * @param mixed $expectedResult
71
     */
72
    public function testINDEX($expectedResult, ...$args)
73
    {
74
        $result = LookupRef::INDEX(...$args);
1 ignored issue
show
Bug introduced by
$args is expanded, but the parameter $arrayValues of PhpOffice\PhpSpreadsheet...tion\LookupRef::INDEX() 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

74
        $result = LookupRef::INDEX(/** @scrutinizer ignore-type */ ...$args);
Loading history...
75
        self::assertEquals($expectedResult, $result);
76
    }
77
78
    public function providerINDEX()
79
    {
80
        return require 'data/Calculation/LookupRef/INDEX.php';
81
    }
82
83
    /**
84
     * @dataProvider providerCOLUMNS
85
     *
86
     * @param mixed $expectedResult
87
     */
88
    public function testCOLUMNS($expectedResult, ...$args)
89
    {
90
        $result = LookupRef::COLUMNS(...$args);
1 ignored issue
show
Bug introduced by
$args is expanded, but the parameter $cellAddress of PhpOffice\PhpSpreadsheet...on\LookupRef::COLUMNS() 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

90
        $result = LookupRef::COLUMNS(/** @scrutinizer ignore-type */ ...$args);
Loading history...
91
        self::assertEquals($expectedResult, $result);
92
    }
93
94
    public function providerCOLUMNS()
95
    {
96
        return require 'data/Calculation/LookupRef/COLUMNS.php';
97
    }
98
99
    /**
100
     * @dataProvider providerROWS
101
     *
102
     * @param mixed $expectedResult
103
     */
104
    public function testROWS($expectedResult, ...$args)
105
    {
106
        $result = LookupRef::ROWS(...$args);
1 ignored issue
show
Bug introduced by
$args is expanded, but the parameter $cellAddress of PhpOffice\PhpSpreadsheet...ation\LookupRef::ROWS() 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

106
        $result = LookupRef::ROWS(/** @scrutinizer ignore-type */ ...$args);
Loading history...
107
        self::assertEquals($expectedResult, $result);
108
    }
109
110
    public function providerROWS()
111
    {
112
        return require 'data/Calculation/LookupRef/ROWS.php';
113
    }
114
}
115