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

MMultTest::setUp()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 3
rs 10
1
<?php
2
3
namespace PhpOffice\PhpSpreadsheetTests\Calculation\Functions\MathTrig;
4
5
use PhpOffice\PhpSpreadsheet\Calculation\MathTrig;
6
7
class MMultTest extends AllSetupTeardown
8
{
9
    /**
10
     * @dataProvider providerMMULT
11
     *
12
     * @param mixed $expectedResult
13
     */
14
    public function testMMULT($expectedResult, ...$args): void
15
    {
16
        $result = MathTrig::MMULT(...$args);
17
        self::assertEqualsWithDelta($expectedResult, $result, 1E-8);
18
    }
19
20
    public function providerMMULT()
21
    {
22
        return require 'tests/data/Calculation/MathTrig/MMULT.php';
23
    }
24
25
    public function testOnSpreadsheet(): void
26
    {
27
        // very limited ability to test this in the absence of dynamic arrays
28
        $sheet = $this->sheet;
29
        $sheet->getCell('A1')->setValue('=MMULT({1,2,3}, {1,2,3})'); // incompatible dimensions
30
        self::assertSame('#VALUE!', $sheet->getCell('A1')->getCalculatedValue());
31
    }
32
}
33