MultinomialTest.php 984 B

12345678910111213141516171819202122232425262728293031323334
  1. <?php
  2. namespace PhpOffice\PhpSpreadsheetTests\Calculation\Functions\MathTrig;
  3. class MultinomialTest extends AllSetupTeardown
  4. {
  5. /**
  6. * @dataProvider providerMULTINOMIAL
  7. *
  8. * @param mixed $expectedResult
  9. */
  10. public function testMULTINOMIAL($expectedResult, ...$args): void
  11. {
  12. $this->mightHaveException($expectedResult);
  13. $sheet = $this->getSheet();
  14. $row = 0;
  15. $excelArg = '';
  16. foreach ($args as $arg) {
  17. ++$row;
  18. $excelArg = "A1:A$row";
  19. if ($arg !== null) {
  20. $sheet->getCell("A$row")->setValue($arg);
  21. }
  22. }
  23. $sheet->getCell('B1')->setValue("=MULTINOMIAL($excelArg)");
  24. $result = $sheet->getCell('B1')->getCalculatedValue();
  25. self::assertEqualsWithDelta($expectedResult, $result, 1E-12);
  26. }
  27. public function providerMULTINOMIAL(): array
  28. {
  29. return require 'tests/data/Calculation/MathTrig/MULTINOMIAL.php';
  30. }
  31. }