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

MMultTest   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Importance

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

3 Methods

Rating   Name   Duplication   Size   Complexity  
A providerMMULT() 0 3 1
A testOnSpreadsheet() 0 6 1
A testMMULT() 0 4 1
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