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

MdeTermTest   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 13
c 1
b 0
f 0
dl 0
loc 27
rs 10
wmc 3

2 Methods

Rating   Name   Duplication   Size   Complexity  
A testMDETERM2() 0 14 2
A providerMDETERM() 0 3 1
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