Total Complexity | 7 |
Total Lines | 38 |
Duplicated Lines | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
7 | class SeriesSumTest extends AllSetupTeardown |
||
8 | { |
||
9 | /** |
||
10 | * @dataProvider providerSERIESSUM |
||
11 | * |
||
12 | * @param mixed $expectedResult |
||
13 | * @param mixed $arg1 |
||
14 | * @param mixed $arg2 |
||
15 | * @param mixed $arg3 |
||
16 | */ |
||
17 | public function testSERIESSUM($expectedResult, $arg1, $arg2, $arg3, ...$args): void |
||
18 | { |
||
19 | $sheet = $this->sheet; |
||
20 | if ($arg1 !== null) { |
||
21 | $sheet->getCell('C1')->setValue($arg1); |
||
22 | } |
||
23 | if ($arg2 !== null) { |
||
24 | $sheet->getCell('C2')->setValue($arg2); |
||
25 | } |
||
26 | if ($arg3 !== null) { |
||
27 | $sheet->getCell('C3')->setValue($arg3); |
||
28 | } |
||
29 | $row = 0; |
||
30 | $aArgs = Functions::flattenArray($args); |
||
31 | foreach ($aArgs as $arg) { |
||
32 | ++$row; |
||
33 | if ($arg !== null) { |
||
34 | $sheet->getCell("A$row")->setValue($arg); |
||
35 | } |
||
36 | } |
||
37 | $sheet->getCell('B1')->setValue("=SERIESSUM(C1, C2, C3, A1:A$row)"); |
||
38 | $result = $sheet->getCell('B1')->getCalculatedValue(); |
||
39 | self::assertEqualsWithDelta($expectedResult, $result, 1E-12); |
||
40 | } |
||
41 | |||
42 | public function providerSERIESSUM() |
||
45 | } |
||
46 | } |
||
47 |