EffectTest.php 862 B

123456789101112131415161718192021222324252627282930313233
  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 EffectTest extends TestCase
  7. {
  8. protected function setUp(): void
  9. {
  10. Functions::setCompatibilityMode(Functions::COMPATIBILITY_EXCEL);
  11. }
  12. /**
  13. * @dataProvider providerEFFECT
  14. *
  15. * @param mixed $expectedResult
  16. * @param mixed $rate
  17. * @param mixed $periods
  18. */
  19. public function testEFFECT($expectedResult, $rate, $periods): void
  20. {
  21. $result = Financial::EFFECT($rate, $periods);
  22. self::assertEqualsWithDelta($expectedResult, $result, 1E-8);
  23. }
  24. public function providerEFFECT(): array
  25. {
  26. return require 'tests/data/Calculation/Financial/EFFECT.php';
  27. }
  28. }