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

MdeTermTest::testMDETERM2()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 14
Code Lines 11

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
eloc 11
c 0
b 0
f 0
nc 2
nop 2
dl 0
loc 14
rs 9.9
1
<?php
2
3
namespace PhpOffice\PhpSpreadsheetTests\Calculation\Functions\MathTrig;
4
5
class MdeTermTest extends AllSetupTeardown
6
{
7
    /**
8
     * @dataProvider providerMDETERM
9
     *
10
     * @param mixed $expectedResult
11
     * @param mixed $matrix expect a matrix
12
     */
13
    public function testMDETERM2($expectedResult, $matrix): void
14
    {
15
        $this->mightHaveException($expectedResult);
16
        $sheet = $this->sheet;
17
        if (is_array($matrix)) {
18
            $sheet->fromArray($matrix, null, 'A1', true);
19
            $maxCol = $sheet->getHighestColumn();
20
            $maxRow = $sheet->getHighestRow();
21
            $sheet->getCell('Z1')->setValue("=MDETERM(A1:$maxCol$maxRow)");
22
        } else {
23
            $sheet->getCell('Z1')->setValue("=MDETERM($matrix)");
24
        }
25
        $result = $sheet->getCell('Z1')->getCalculatedValue();
26
        self::assertEqualsWithDelta($expectedResult, $result, 1E-12);
27
    }
28
29
    public function providerMDETERM()
30
    {
31
        return require 'tests/data/Calculation/MathTrig/MDETERM.php';
32
    }
33
}
34