mirror of
https://github.com/PHPOffice/PhpSpreadsheet.git
synced 2026-09-24 09:09:22 +00:00
1b05dfab8b
And quite a bit more manual changes. The idea is that typing of our tests can be a bit more loose, so we assume PHPDoc is mostly correct. If that happens to be wrong, it should be caught by the tests themselves.
40 lines
1.2 KiB
PHP
40 lines
1.2 KiB
PHP
<?php
|
|
|
|
namespace PhpOffice\PhpSpreadsheetTests\Calculation\Functions\MathTrig;
|
|
|
|
use PhpOffice\PhpSpreadsheet\Calculation\Functions;
|
|
|
|
class SumX2PY2Test extends AllSetupTeardown
|
|
{
|
|
/**
|
|
* @dataProvider providerSUMX2PY2
|
|
*/
|
|
public function testSUMX2PY2(mixed $expectedResult, array $matrixData1, array $matrixData2): void
|
|
{
|
|
$this->mightHaveException($expectedResult);
|
|
$sheet = $this->getSheet();
|
|
$maxRow = 0;
|
|
$funcArg1 = '';
|
|
foreach (Functions::flattenArray($matrixData1) as $arg) {
|
|
++$maxRow;
|
|
$funcArg1 = "A1:A$maxRow";
|
|
$this->setCell("A$maxRow", $arg);
|
|
}
|
|
$maxRow = 0;
|
|
$funcArg2 = '';
|
|
foreach (Functions::flattenArray($matrixData2) as $arg) {
|
|
++$maxRow;
|
|
$funcArg2 = "C1:C$maxRow";
|
|
$this->setCell("C$maxRow", $arg);
|
|
}
|
|
$sheet->getCell('B1')->setValue("=SUMX2PY2($funcArg1, $funcArg2)");
|
|
$result = $sheet->getCell('B1')->getCalculatedValue();
|
|
self::assertEqualsWithDelta($expectedResult, $result, 1E-12);
|
|
}
|
|
|
|
public static function providerSUMX2PY2(): array
|
|
{
|
|
return require 'tests/data/Calculation/MathTrig/SUMX2PY2.php';
|
|
}
|
|
}
|