Passed
Push — master ( c380b2...9239b3 )
by Adrien
10:06
created

BaseTest::testBASE()   B

Complexity

Conditions 7
Paths 32

Size

Total Lines 24
Code Lines 18

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 7
eloc 18
c 1
b 0
f 0
nc 32
nop 4
dl 0
loc 24
rs 8.8333
1
<?php
2
3
namespace PhpOffice\PhpSpreadsheetTests\Calculation\Functions\MathTrig;
4
5
class BaseTest extends AllSetupTeardown
6
{
7
    /**
8
     * @dataProvider providerBASE
9
     *
10
     * @param mixed $expectedResult
11
     * @param mixed $arg1
12
     * @param mixed $arg2
13
     * @param mixed $arg3
14
     */
15
    public function testBASE($expectedResult, $arg1 = 'omitted', $arg2 = 'omitted', $arg3 = 'omitted'): void
16
    {
17
        $this->mightHaveException($expectedResult);
18
        $sheet = $this->sheet;
19
        if ($arg1 !== null) {
20
            $sheet->getCell('A1')->setValue($arg1);
21
        }
22
        if ($arg2 !== null) {
23
            $sheet->getCell('A2')->setValue($arg2);
24
        }
25
        if ($arg3 !== null) {
26
            $sheet->getCell('A3')->setValue($arg3);
27
        }
28
        if ($arg1 === 'omitted') {
29
            $sheet->getCell('B1')->setValue('=BASE()');
30
        } elseif ($arg2 === 'omitted') {
31
            $sheet->getCell('B1')->setValue('=BASE(A1)');
32
        } elseif ($arg3 === 'omitted') {
33
            $sheet->getCell('B1')->setValue('=BASE(A1, A2)');
34
        } else {
35
            $sheet->getCell('B1')->setValue('=BASE(A1, A2, A3)');
36
        }
37
        $result = $sheet->getCell('B1')->getCalculatedValue();
38
        self::assertEquals($expectedResult, $result);
39
    }
40
41
    public function providerBASE()
42
    {
43
        return require 'tests/data/Calculation/MathTrig/BASE.php';
44
    }
45
}
46