MdeTermTest.php 1.0 KB

123456789101112131415161718192021222324252627282930313233
  1. <?php
  2. namespace PhpOffice\PhpSpreadsheetTests\Calculation\Functions\MathTrig;
  3. class MdeTermTest extends AllSetupTeardown
  4. {
  5. /**
  6. * @dataProvider providerMDETERM
  7. *
  8. * @param mixed $expectedResult
  9. * @param mixed $matrix expect a matrix
  10. */
  11. public function testMDETERM2($expectedResult, $matrix): void
  12. {
  13. $this->mightHaveException($expectedResult);
  14. $sheet = $this->getSheet();
  15. if (is_array($matrix)) {
  16. $sheet->fromArray($matrix, null, 'A1', true);
  17. $maxCol = $sheet->getHighestColumn();
  18. $maxRow = $sheet->getHighestRow();
  19. $sheet->getCell('Z1')->setValue("=MDETERM(A1:$maxCol$maxRow)");
  20. } else {
  21. $sheet->getCell('Z1')->setValue("=MDETERM($matrix)");
  22. }
  23. $result = $sheet->getCell('Z1')->getCalculatedValue();
  24. self::assertEqualsWithDelta($expectedResult, $result, 1E-12);
  25. }
  26. public function providerMDETERM(): array
  27. {
  28. return require 'tests/data/Calculation/MathTrig/MDETERM.php';
  29. }
  30. }