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

SumTest::testSUM()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 11
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 2
eloc 8
c 1
b 0
f 0
nc 2
nop 2
dl 0
loc 11
rs 10
1
<?php
2
3
namespace PhpOffice\PhpSpreadsheetTests\Calculation\Functions\MathTrig;
4
5
class SumTest extends AllSetupTeardown
6
{
7
    /**
8
     * @dataProvider providerSUM
9
     *
10
     * @param mixed $expectedResult
11
     */
12
    public function testSUM($expectedResult, ...$args): void
13
    {
14
        $sheet = $this->sheet;
15
        $row = 0;
16
        foreach ($args as $arg) {
17
            ++$row;
18
            $sheet->getCell("A$row")->setValue($arg);
19
        }
20
        $sheet->getCell('B1')->setValue("=SUM(A1:A$row)");
21
        $result = $sheet->getCell('B1')->getCalculatedValue();
22
        self::assertEqualsWithDelta($expectedResult, $result, 1E-12);
23
    }
24
25
    public function providerSUM()
26
    {
27
        return require 'tests/data/Calculation/MathTrig/SUM.php';
28
    }
29
}
30