MirrTest.php 781 B

12345678910111213141516171819202122232425262728293031
  1. <?php
  2. namespace PhpOffice\PhpSpreadsheetTests\Calculation\Functions\Financial;
  3. use PhpOffice\PhpSpreadsheet\Calculation\Financial;
  4. use PhpOffice\PhpSpreadsheet\Calculation\Functions;
  5. use PHPUnit\Framework\TestCase;
  6. class MirrTest extends TestCase
  7. {
  8. protected function setUp(): void
  9. {
  10. Functions::setCompatibilityMode(Functions::COMPATIBILITY_EXCEL);
  11. }
  12. /**
  13. * @dataProvider providerMIRR
  14. *
  15. * @param mixed $expectedResult
  16. */
  17. public function testMIRR($expectedResult, ...$args): void
  18. {
  19. $result = Financial::MIRR(...$args);
  20. self::assertEqualsWithDelta($expectedResult, $result, 1E-8);
  21. }
  22. public function providerMIRR(): array
  23. {
  24. return require 'tests/data/Calculation/Financial/MIRR.php';
  25. }
  26. }