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

MdeTermTest::testMDETERM()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 2
c 1
b 0
f 0
nc 1
nop 2
dl 0
loc 4
rs 10
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