Failed Conditions
Push — master ( 02f37d...f95322 )
by Adrien
09:26
created

ImSumTest   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Importance

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

3 Methods

Rating   Name   Duplication   Size   Complexity  
A setUp() 0 4 1
A providerIMSUM() 0 3 1
A testIMSUM() 0 6 1
1
<?php
2
3
namespace PhpOffice\PhpSpreadsheetTests\Calculation\Functions\Engineering;
4
5
use PhpOffice\PhpSpreadsheet\Calculation\Engineering;
6
use PhpOffice\PhpSpreadsheet\Calculation\Functions;
7
use PhpOffice\PhpSpreadsheetTests\Custom\ComplexAssert;
8
use PHPUnit\Framework\TestCase;
9
10
class ImSumTest extends TestCase
11
{
12
    const COMPLEX_PRECISION = 1E-8;
13
14
    /**
15
     * @var ComplexAssert
16
     */
17
    protected $complexAssert;
18
19
    protected function setUp(): void
20
    {
21
        Functions::setCompatibilityMode(Functions::COMPATIBILITY_EXCEL);
22
        $this->complexAssert = new ComplexAssert();
23
    }
24
25
    /**
26
     * @dataProvider providerIMSUM
27
     *
28
     * @param mixed $expectedResult
29
     */
30
    public function testIMSUM($expectedResult, ...$args): void
31
    {
32
        $result = Engineering::IMSUM(...$args);
33
        self::assertTrue(
34
            $this->complexAssert->assertComplexEquals($expectedResult, $result, self::COMPLEX_PRECISION),
35
            $this->complexAssert->getErrorMessage()
36
        );
37
    }
38
39
    public function providerIMSUM()
40
    {
41
        return require 'tests/data/Calculation/Engineering/IMSUM.php';
42
    }
43
}
44