2012-07-31 20:56:11 +00:00
|
|
|
<?php
|
|
|
|
|
2016-08-31 17:18:12 +00:00
|
|
|
namespace PhpOffice\PhpSpreadsheetTests\Calculation;
|
2012-07-31 20:56:11 +00:00
|
|
|
|
2016-08-31 17:18:12 +00:00
|
|
|
use PhpOffice\PhpSpreadsheet\Calculation\Financial;
|
|
|
|
use PhpOffice\PhpSpreadsheet\Calculation\Functions;
|
2017-11-08 15:48:01 +00:00
|
|
|
use PHPUnit\Framework\TestCase;
|
2016-08-14 04:08:43 +00:00
|
|
|
|
2017-11-08 15:48:01 +00:00
|
|
|
class FinancialTest extends TestCase
|
2012-07-31 20:56:11 +00:00
|
|
|
{
|
|
|
|
public function setUp()
|
|
|
|
{
|
2016-08-14 04:08:43 +00:00
|
|
|
Functions::setCompatibilityMode(Functions::COMPATIBILITY_EXCEL);
|
2015-05-17 13:00:02 +00:00
|
|
|
}
|
2012-07-31 20:56:11 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @dataProvider providerACCRINT
|
2017-01-23 05:49:10 +00:00
|
|
|
*
|
|
|
|
* @param mixed $expectedResult
|
2012-07-31 20:56:11 +00:00
|
|
|
*/
|
2017-01-23 05:49:10 +00:00
|
|
|
public function testACCRINT($expectedResult, ...$args)
|
2015-05-17 13:00:02 +00:00
|
|
|
{
|
2017-01-23 05:49:10 +00:00
|
|
|
$result = Financial::ACCRINT(...$args);
|
2019-07-10 19:22:16 +00:00
|
|
|
self::assertEquals($expectedResult, $result, '', 1E-8);
|
2015-05-17 13:00:02 +00:00
|
|
|
}
|
2012-07-31 20:56:11 +00:00
|
|
|
|
|
|
|
public function providerACCRINT()
|
|
|
|
{
|
2016-08-16 12:00:19 +00:00
|
|
|
return require 'data/Calculation/Financial/ACCRINT.php';
|
2015-05-17 13:00:02 +00:00
|
|
|
}
|
2012-07-31 20:56:11 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @dataProvider providerACCRINTM
|
2017-01-23 05:49:10 +00:00
|
|
|
*
|
|
|
|
* @param mixed $expectedResult
|
2012-07-31 20:56:11 +00:00
|
|
|
*/
|
2017-01-23 05:49:10 +00:00
|
|
|
public function testACCRINTM($expectedResult, ...$args)
|
2015-05-17 13:00:02 +00:00
|
|
|
{
|
2017-01-23 05:49:10 +00:00
|
|
|
$result = Financial::ACCRINTM(...$args);
|
2019-07-10 19:22:16 +00:00
|
|
|
self::assertEquals($expectedResult, $result, '', 1E-8);
|
2015-05-17 13:00:02 +00:00
|
|
|
}
|
2012-07-31 20:56:11 +00:00
|
|
|
|
|
|
|
public function providerACCRINTM()
|
|
|
|
{
|
2016-08-16 12:00:19 +00:00
|
|
|
return require 'data/Calculation/Financial/ACCRINTM.php';
|
2015-05-17 13:00:02 +00:00
|
|
|
}
|
2012-07-31 20:56:11 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @dataProvider providerAMORDEGRC
|
2017-01-23 05:49:10 +00:00
|
|
|
*
|
|
|
|
* @param mixed $expectedResult
|
2012-07-31 20:56:11 +00:00
|
|
|
*/
|
2017-01-23 05:49:10 +00:00
|
|
|
public function testAMORDEGRC($expectedResult, ...$args)
|
2015-05-17 13:00:02 +00:00
|
|
|
{
|
2017-01-23 05:49:10 +00:00
|
|
|
$result = Financial::AMORDEGRC(...$args);
|
2019-07-10 19:22:16 +00:00
|
|
|
self::assertEquals($expectedResult, $result, '', 1E-8);
|
2015-05-17 13:00:02 +00:00
|
|
|
}
|
2012-07-31 20:56:11 +00:00
|
|
|
|
|
|
|
public function providerAMORDEGRC()
|
|
|
|
{
|
2016-08-16 12:00:19 +00:00
|
|
|
return require 'data/Calculation/Financial/AMORDEGRC.php';
|
2015-05-17 13:00:02 +00:00
|
|
|
}
|
2012-07-31 20:56:11 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @dataProvider providerAMORLINC
|
2017-01-23 05:49:10 +00:00
|
|
|
*
|
|
|
|
* @param mixed $expectedResult
|
2012-07-31 20:56:11 +00:00
|
|
|
*/
|
2017-01-23 05:49:10 +00:00
|
|
|
public function testAMORLINC($expectedResult, ...$args)
|
2015-05-17 13:00:02 +00:00
|
|
|
{
|
2017-01-23 05:49:10 +00:00
|
|
|
$result = Financial::AMORLINC(...$args);
|
2019-07-10 19:22:16 +00:00
|
|
|
self::assertEquals($expectedResult, $result, '', 1E-8);
|
2015-05-17 13:00:02 +00:00
|
|
|
}
|
2012-07-31 20:56:11 +00:00
|
|
|
|
|
|
|
public function providerAMORLINC()
|
|
|
|
{
|
2016-08-16 12:00:19 +00:00
|
|
|
return require 'data/Calculation/Financial/AMORLINC.php';
|
2015-05-17 13:00:02 +00:00
|
|
|
}
|
2012-07-31 20:56:11 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @dataProvider providerCOUPDAYBS
|
2017-01-23 05:49:10 +00:00
|
|
|
*
|
|
|
|
* @param mixed $expectedResult
|
2012-07-31 20:56:11 +00:00
|
|
|
*/
|
2017-01-23 05:49:10 +00:00
|
|
|
public function testCOUPDAYBS($expectedResult, ...$args)
|
2015-05-17 13:00:02 +00:00
|
|
|
{
|
2017-01-23 05:49:10 +00:00
|
|
|
$result = Financial::COUPDAYBS(...$args);
|
2019-07-10 19:22:16 +00:00
|
|
|
self::assertEquals($expectedResult, $result, '', 1E-8);
|
2015-05-17 13:00:02 +00:00
|
|
|
}
|
2012-07-31 20:56:11 +00:00
|
|
|
|
|
|
|
public function providerCOUPDAYBS()
|
|
|
|
{
|
2016-08-16 12:00:19 +00:00
|
|
|
return require 'data/Calculation/Financial/COUPDAYBS.php';
|
2015-05-17 13:00:02 +00:00
|
|
|
}
|
2012-07-31 20:56:11 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @dataProvider providerCOUPDAYS
|
2017-01-23 05:49:10 +00:00
|
|
|
*
|
|
|
|
* @param mixed $expectedResult
|
2012-07-31 20:56:11 +00:00
|
|
|
*/
|
2017-01-23 05:49:10 +00:00
|
|
|
public function testCOUPDAYS($expectedResult, ...$args)
|
2015-05-17 13:00:02 +00:00
|
|
|
{
|
2017-01-23 05:49:10 +00:00
|
|
|
$result = Financial::COUPDAYS(...$args);
|
2019-07-10 19:22:16 +00:00
|
|
|
self::assertEquals($expectedResult, $result, '', 1E-8);
|
2015-05-17 13:00:02 +00:00
|
|
|
}
|
2012-07-31 20:56:11 +00:00
|
|
|
|
|
|
|
public function providerCOUPDAYS()
|
|
|
|
{
|
2016-08-16 12:00:19 +00:00
|
|
|
return require 'data/Calculation/Financial/COUPDAYS.php';
|
2015-05-17 13:00:02 +00:00
|
|
|
}
|
2012-07-31 20:56:11 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @dataProvider providerCOUPDAYSNC
|
2017-01-23 05:49:10 +00:00
|
|
|
*
|
|
|
|
* @param mixed $expectedResult
|
2012-07-31 20:56:11 +00:00
|
|
|
*/
|
2017-01-23 05:49:10 +00:00
|
|
|
public function testCOUPDAYSNC($expectedResult, ...$args)
|
2015-05-17 13:00:02 +00:00
|
|
|
{
|
2017-01-23 05:49:10 +00:00
|
|
|
$result = Financial::COUPDAYSNC(...$args);
|
2019-07-10 19:22:16 +00:00
|
|
|
self::assertEquals($expectedResult, $result, '', 1E-8);
|
2015-05-17 13:00:02 +00:00
|
|
|
}
|
2012-07-31 20:56:11 +00:00
|
|
|
|
|
|
|
public function providerCOUPDAYSNC()
|
|
|
|
{
|
2016-08-16 12:00:19 +00:00
|
|
|
return require 'data/Calculation/Financial/COUPDAYSNC.php';
|
2015-05-17 13:00:02 +00:00
|
|
|
}
|
2012-07-31 20:56:11 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @dataProvider providerCOUPNCD
|
2017-01-23 05:49:10 +00:00
|
|
|
*
|
|
|
|
* @param mixed $expectedResult
|
2012-07-31 20:56:11 +00:00
|
|
|
*/
|
2017-01-23 05:49:10 +00:00
|
|
|
public function testCOUPNCD($expectedResult, ...$args)
|
2015-05-17 13:00:02 +00:00
|
|
|
{
|
2017-01-23 05:49:10 +00:00
|
|
|
$result = Financial::COUPNCD(...$args);
|
2019-07-10 19:22:16 +00:00
|
|
|
self::assertEquals($expectedResult, $result, '', 1E-8);
|
2015-05-17 13:00:02 +00:00
|
|
|
}
|
2012-07-31 20:56:11 +00:00
|
|
|
|
|
|
|
public function providerCOUPNCD()
|
|
|
|
{
|
2016-08-16 12:00:19 +00:00
|
|
|
return require 'data/Calculation/Financial/COUPNCD.php';
|
2015-05-17 13:00:02 +00:00
|
|
|
}
|
2012-07-31 20:56:11 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @dataProvider providerCOUPNUM
|
2017-01-23 05:49:10 +00:00
|
|
|
*
|
|
|
|
* @param mixed $expectedResult
|
2012-07-31 20:56:11 +00:00
|
|
|
*/
|
2017-01-23 05:49:10 +00:00
|
|
|
public function testCOUPNUM($expectedResult, ...$args)
|
2015-05-17 13:00:02 +00:00
|
|
|
{
|
2017-01-23 05:49:10 +00:00
|
|
|
$result = Financial::COUPNUM(...$args);
|
2019-07-10 19:22:16 +00:00
|
|
|
self::assertEquals($expectedResult, $result, '', 1E-8);
|
2015-05-17 13:00:02 +00:00
|
|
|
}
|
2012-07-31 20:56:11 +00:00
|
|
|
|
|
|
|
public function providerCOUPNUM()
|
|
|
|
{
|
2016-08-16 12:00:19 +00:00
|
|
|
return require 'data/Calculation/Financial/COUPNUM.php';
|
2015-05-17 13:00:02 +00:00
|
|
|
}
|
2012-07-31 20:56:11 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @dataProvider providerCOUPPCD
|
2017-01-23 05:49:10 +00:00
|
|
|
*
|
|
|
|
* @param mixed $expectedResult
|
2012-07-31 20:56:11 +00:00
|
|
|
*/
|
2017-01-23 05:49:10 +00:00
|
|
|
public function testCOUPPCD($expectedResult, ...$args)
|
2015-05-17 13:00:02 +00:00
|
|
|
{
|
2017-01-23 05:49:10 +00:00
|
|
|
$result = Financial::COUPPCD(...$args);
|
2019-07-10 19:22:16 +00:00
|
|
|
self::assertEquals($expectedResult, $result, '', 1E-8);
|
2015-05-17 13:00:02 +00:00
|
|
|
}
|
2012-07-31 20:56:11 +00:00
|
|
|
|
|
|
|
public function providerCOUPPCD()
|
|
|
|
{
|
2016-08-16 12:00:19 +00:00
|
|
|
return require 'data/Calculation/Financial/COUPPCD.php';
|
2015-05-17 13:00:02 +00:00
|
|
|
}
|
2012-07-31 20:56:11 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @dataProvider providerCUMIPMT
|
2017-01-23 05:49:10 +00:00
|
|
|
*
|
|
|
|
* @param mixed $expectedResult
|
2012-07-31 20:56:11 +00:00
|
|
|
*/
|
2017-01-23 05:49:10 +00:00
|
|
|
public function testCUMIPMT($expectedResult, ...$args)
|
2015-05-17 13:00:02 +00:00
|
|
|
{
|
2017-01-23 05:49:10 +00:00
|
|
|
$result = Financial::CUMIPMT(...$args);
|
2019-07-10 19:22:16 +00:00
|
|
|
self::assertEquals($expectedResult, $result, '', 1E-8);
|
2015-05-17 13:00:02 +00:00
|
|
|
}
|
2012-07-31 20:56:11 +00:00
|
|
|
|
|
|
|
public function providerCUMIPMT()
|
|
|
|
{
|
2016-08-16 12:00:19 +00:00
|
|
|
return require 'data/Calculation/Financial/CUMIPMT.php';
|
2015-05-17 13:00:02 +00:00
|
|
|
}
|
2012-07-31 20:56:11 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @dataProvider providerCUMPRINC
|
2017-01-23 05:49:10 +00:00
|
|
|
*
|
|
|
|
* @param mixed $expectedResult
|
2012-07-31 20:56:11 +00:00
|
|
|
*/
|
2017-01-23 05:49:10 +00:00
|
|
|
public function testCUMPRINC($expectedResult, ...$args)
|
2015-05-17 13:00:02 +00:00
|
|
|
{
|
2017-01-23 05:49:10 +00:00
|
|
|
$result = Financial::CUMPRINC(...$args);
|
2019-07-10 19:22:16 +00:00
|
|
|
self::assertEquals($expectedResult, $result, '', 1E-8);
|
2015-05-17 13:00:02 +00:00
|
|
|
}
|
2012-07-31 20:56:11 +00:00
|
|
|
|
|
|
|
public function providerCUMPRINC()
|
|
|
|
{
|
2016-08-16 12:00:19 +00:00
|
|
|
return require 'data/Calculation/Financial/CUMPRINC.php';
|
2015-05-17 13:00:02 +00:00
|
|
|
}
|
2012-07-31 20:56:11 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @dataProvider providerDB
|
2017-01-23 05:49:10 +00:00
|
|
|
*
|
|
|
|
* @param mixed $expectedResult
|
2012-07-31 20:56:11 +00:00
|
|
|
*/
|
2017-01-23 05:49:10 +00:00
|
|
|
public function testDB($expectedResult, ...$args)
|
2015-05-17 13:00:02 +00:00
|
|
|
{
|
2017-01-23 05:49:10 +00:00
|
|
|
$result = Financial::DB(...$args);
|
2019-07-10 19:22:16 +00:00
|
|
|
self::assertEquals($expectedResult, $result, '', 1E-8);
|
2015-05-17 13:00:02 +00:00
|
|
|
}
|
2012-07-31 20:56:11 +00:00
|
|
|
|
|
|
|
public function providerDB()
|
|
|
|
{
|
2016-08-16 12:00:19 +00:00
|
|
|
return require 'data/Calculation/Financial/DB.php';
|
2015-05-17 13:00:02 +00:00
|
|
|
}
|
2012-07-31 20:56:11 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @dataProvider providerDDB
|
2017-01-23 05:49:10 +00:00
|
|
|
*
|
|
|
|
* @param mixed $expectedResult
|
2012-07-31 20:56:11 +00:00
|
|
|
*/
|
2017-01-23 05:49:10 +00:00
|
|
|
public function testDDB($expectedResult, ...$args)
|
2015-05-17 13:00:02 +00:00
|
|
|
{
|
2017-01-23 05:49:10 +00:00
|
|
|
$result = Financial::DDB(...$args);
|
2019-07-10 19:22:16 +00:00
|
|
|
self::assertEquals($expectedResult, $result, '', 1E-8);
|
2015-05-17 13:00:02 +00:00
|
|
|
}
|
2012-07-31 20:56:11 +00:00
|
|
|
|
|
|
|
public function providerDDB()
|
|
|
|
{
|
2016-08-16 12:00:19 +00:00
|
|
|
return require 'data/Calculation/Financial/DDB.php';
|
2015-05-17 13:00:02 +00:00
|
|
|
}
|
2012-07-31 20:56:11 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @dataProvider providerDISC
|
2017-01-23 05:49:10 +00:00
|
|
|
*
|
|
|
|
* @param mixed $expectedResult
|
2012-07-31 20:56:11 +00:00
|
|
|
*/
|
2017-01-23 05:49:10 +00:00
|
|
|
public function testDISC($expectedResult, ...$args)
|
2015-05-17 13:00:02 +00:00
|
|
|
{
|
2017-01-23 05:49:10 +00:00
|
|
|
$result = Financial::DISC(...$args);
|
2019-07-10 19:22:16 +00:00
|
|
|
self::assertEquals($expectedResult, $result, '', 1E-8);
|
2015-05-17 13:00:02 +00:00
|
|
|
}
|
2012-07-31 20:56:11 +00:00
|
|
|
|
|
|
|
public function providerDISC()
|
|
|
|
{
|
2016-08-16 12:00:19 +00:00
|
|
|
return require 'data/Calculation/Financial/DISC.php';
|
2015-05-17 13:00:02 +00:00
|
|
|
}
|
2012-07-31 20:56:11 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @dataProvider providerDOLLARDE
|
2017-01-23 05:49:10 +00:00
|
|
|
*
|
|
|
|
* @param mixed $expectedResult
|
2012-07-31 20:56:11 +00:00
|
|
|
*/
|
2017-01-23 05:49:10 +00:00
|
|
|
public function testDOLLARDE($expectedResult, ...$args)
|
2015-05-17 13:00:02 +00:00
|
|
|
{
|
2017-01-23 05:49:10 +00:00
|
|
|
$result = Financial::DOLLARDE(...$args);
|
2019-07-10 19:22:16 +00:00
|
|
|
self::assertEquals($expectedResult, $result, '', 1E-8);
|
2015-05-17 13:00:02 +00:00
|
|
|
}
|
2012-07-31 20:56:11 +00:00
|
|
|
|
|
|
|
public function providerDOLLARDE()
|
|
|
|
{
|
2016-08-16 12:00:19 +00:00
|
|
|
return require 'data/Calculation/Financial/DOLLARDE.php';
|
2015-05-17 13:00:02 +00:00
|
|
|
}
|
2012-07-31 20:56:11 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @dataProvider providerDOLLARFR
|
2017-01-23 05:49:10 +00:00
|
|
|
*
|
|
|
|
* @param mixed $expectedResult
|
2012-07-31 20:56:11 +00:00
|
|
|
*/
|
2017-01-23 05:49:10 +00:00
|
|
|
public function testDOLLARFR($expectedResult, ...$args)
|
2015-05-17 13:00:02 +00:00
|
|
|
{
|
2017-01-23 05:49:10 +00:00
|
|
|
$result = Financial::DOLLARFR(...$args);
|
2019-07-10 19:22:16 +00:00
|
|
|
self::assertEquals($expectedResult, $result, '', 1E-8);
|
2015-05-17 13:00:02 +00:00
|
|
|
}
|
2012-07-31 20:56:11 +00:00
|
|
|
|
|
|
|
public function providerDOLLARFR()
|
|
|
|
{
|
2016-08-16 12:00:19 +00:00
|
|
|
return require 'data/Calculation/Financial/DOLLARFR.php';
|
2015-05-17 13:00:02 +00:00
|
|
|
}
|
2012-07-31 20:56:11 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @dataProvider providerEFFECT
|
2017-01-23 05:49:10 +00:00
|
|
|
*
|
|
|
|
* @param mixed $expectedResult
|
2012-07-31 20:56:11 +00:00
|
|
|
*/
|
2017-01-23 05:49:10 +00:00
|
|
|
public function testEFFECT($expectedResult, ...$args)
|
2015-05-17 13:00:02 +00:00
|
|
|
{
|
2017-01-23 05:49:10 +00:00
|
|
|
$result = Financial::EFFECT(...$args);
|
2019-07-10 19:22:16 +00:00
|
|
|
self::assertEquals($expectedResult, $result, '', 1E-8);
|
2015-05-17 13:00:02 +00:00
|
|
|
}
|
2012-07-31 20:56:11 +00:00
|
|
|
|
|
|
|
public function providerEFFECT()
|
|
|
|
{
|
2016-08-16 12:00:19 +00:00
|
|
|
return require 'data/Calculation/Financial/EFFECT.php';
|
2015-05-17 13:00:02 +00:00
|
|
|
}
|
2012-07-31 20:56:11 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @dataProvider providerFV
|
2017-01-23 05:49:10 +00:00
|
|
|
*
|
|
|
|
* @param mixed $expectedResult
|
2012-07-31 20:56:11 +00:00
|
|
|
*/
|
2017-01-23 05:49:10 +00:00
|
|
|
public function testFV($expectedResult, ...$args)
|
2015-05-17 13:00:02 +00:00
|
|
|
{
|
2017-01-23 05:49:10 +00:00
|
|
|
$result = Financial::FV(...$args);
|
2019-07-10 19:22:16 +00:00
|
|
|
self::assertEquals($expectedResult, $result, '', 1E-8);
|
2015-05-17 13:00:02 +00:00
|
|
|
}
|
2012-07-31 20:56:11 +00:00
|
|
|
|
|
|
|
public function providerFV()
|
|
|
|
{
|
2016-08-16 12:00:19 +00:00
|
|
|
return require 'data/Calculation/Financial/FV.php';
|
2015-05-17 13:00:02 +00:00
|
|
|
}
|
2012-07-31 20:56:11 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @dataProvider providerFVSCHEDULE
|
2017-01-23 05:49:10 +00:00
|
|
|
*
|
|
|
|
* @param mixed $expectedResult
|
2012-07-31 20:56:11 +00:00
|
|
|
*/
|
2017-01-23 05:49:10 +00:00
|
|
|
public function testFVSCHEDULE($expectedResult, ...$args)
|
2015-05-17 13:00:02 +00:00
|
|
|
{
|
2017-01-23 05:49:10 +00:00
|
|
|
$result = Financial::FVSCHEDULE(...$args);
|
2019-07-10 19:22:16 +00:00
|
|
|
self::assertEquals($expectedResult, $result, '', 1E-8);
|
2015-05-17 13:00:02 +00:00
|
|
|
}
|
2012-07-31 20:56:11 +00:00
|
|
|
|
|
|
|
public function providerFVSCHEDULE()
|
|
|
|
{
|
2016-08-16 12:00:19 +00:00
|
|
|
return require 'data/Calculation/Financial/FVSCHEDULE.php';
|
2015-05-17 13:00:02 +00:00
|
|
|
}
|
2012-07-31 20:56:11 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @dataProvider providerINTRATE
|
2017-01-23 05:49:10 +00:00
|
|
|
*
|
|
|
|
* @param mixed $expectedResult
|
2012-07-31 20:56:11 +00:00
|
|
|
*/
|
2017-01-23 05:49:10 +00:00
|
|
|
public function testINTRATE($expectedResult, ...$args)
|
2015-05-17 13:00:02 +00:00
|
|
|
{
|
2017-01-23 05:49:10 +00:00
|
|
|
$result = Financial::INTRATE(...$args);
|
2019-07-10 19:22:16 +00:00
|
|
|
self::assertEquals($expectedResult, $result, '', 1E-8);
|
2015-05-17 13:00:02 +00:00
|
|
|
}
|
2012-07-31 20:56:11 +00:00
|
|
|
|
|
|
|
public function providerINTRATE()
|
|
|
|
{
|
2016-08-16 12:00:19 +00:00
|
|
|
return require 'data/Calculation/Financial/INTRATE.php';
|
2015-05-17 13:00:02 +00:00
|
|
|
}
|
2012-07-31 20:56:11 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @dataProvider providerIPMT
|
2017-01-23 05:49:10 +00:00
|
|
|
*
|
|
|
|
* @param mixed $expectedResult
|
2012-07-31 20:56:11 +00:00
|
|
|
*/
|
2017-01-23 05:49:10 +00:00
|
|
|
public function testIPMT($expectedResult, ...$args)
|
2015-05-17 13:00:02 +00:00
|
|
|
{
|
2017-01-23 05:49:10 +00:00
|
|
|
$result = Financial::IPMT(...$args);
|
2019-07-10 19:22:16 +00:00
|
|
|
self::assertEquals($expectedResult, $result, '', 1E-8);
|
2015-05-17 13:00:02 +00:00
|
|
|
}
|
2012-07-31 20:56:11 +00:00
|
|
|
|
|
|
|
public function providerIPMT()
|
|
|
|
{
|
2016-08-16 12:00:19 +00:00
|
|
|
return require 'data/Calculation/Financial/IPMT.php';
|
2015-05-17 13:00:02 +00:00
|
|
|
}
|
2012-07-31 20:56:11 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @dataProvider providerIRR
|
2017-01-23 05:49:10 +00:00
|
|
|
*
|
|
|
|
* @param mixed $expectedResult
|
2012-07-31 20:56:11 +00:00
|
|
|
*/
|
2017-01-23 05:49:10 +00:00
|
|
|
public function testIRR($expectedResult, ...$args)
|
2015-05-17 13:00:02 +00:00
|
|
|
{
|
2017-01-23 05:49:10 +00:00
|
|
|
$result = Financial::IRR(...$args);
|
2019-07-10 19:22:16 +00:00
|
|
|
self::assertEquals($expectedResult, $result, '', 1E-8);
|
2015-05-17 13:00:02 +00:00
|
|
|
}
|
2012-07-31 20:56:11 +00:00
|
|
|
|
|
|
|
public function providerIRR()
|
|
|
|
{
|
2016-08-16 12:00:19 +00:00
|
|
|
return require 'data/Calculation/Financial/IRR.php';
|
2015-05-17 13:00:02 +00:00
|
|
|
}
|
2012-07-31 20:56:11 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @dataProvider providerISPMT
|
2017-01-23 05:49:10 +00:00
|
|
|
*
|
|
|
|
* @param mixed $expectedResult
|
2012-07-31 20:56:11 +00:00
|
|
|
*/
|
2017-01-23 05:49:10 +00:00
|
|
|
public function testISPMT($expectedResult, ...$args)
|
2015-05-17 13:00:02 +00:00
|
|
|
{
|
2017-01-23 05:49:10 +00:00
|
|
|
$result = Financial::ISPMT(...$args);
|
2019-07-10 19:22:16 +00:00
|
|
|
self::assertEquals($expectedResult, $result, '', 1E-8);
|
2015-05-17 13:00:02 +00:00
|
|
|
}
|
2012-07-31 20:56:11 +00:00
|
|
|
|
|
|
|
public function providerISPMT()
|
|
|
|
{
|
2016-08-16 12:00:19 +00:00
|
|
|
return require 'data/Calculation/Financial/ISPMT.php';
|
2015-05-17 13:00:02 +00:00
|
|
|
}
|
2012-07-31 20:56:11 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @dataProvider providerMIRR
|
2017-01-23 05:49:10 +00:00
|
|
|
*
|
|
|
|
* @param mixed $expectedResult
|
2012-07-31 20:56:11 +00:00
|
|
|
*/
|
2017-01-23 05:49:10 +00:00
|
|
|
public function testMIRR($expectedResult, ...$args)
|
2015-05-17 13:00:02 +00:00
|
|
|
{
|
2017-01-23 05:49:10 +00:00
|
|
|
$result = Financial::MIRR(...$args);
|
2019-07-10 19:22:16 +00:00
|
|
|
self::assertEquals($expectedResult, $result, '', 1E-8);
|
2015-05-17 13:00:02 +00:00
|
|
|
}
|
2012-07-31 20:56:11 +00:00
|
|
|
|
|
|
|
public function providerMIRR()
|
|
|
|
{
|
2016-08-16 12:00:19 +00:00
|
|
|
return require 'data/Calculation/Financial/MIRR.php';
|
2015-05-17 13:00:02 +00:00
|
|
|
}
|
2012-07-31 20:56:11 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @dataProvider providerNOMINAL
|
2017-01-23 05:49:10 +00:00
|
|
|
*
|
|
|
|
* @param mixed $expectedResult
|
2012-07-31 20:56:11 +00:00
|
|
|
*/
|
2017-01-23 05:49:10 +00:00
|
|
|
public function testNOMINAL($expectedResult, ...$args)
|
2015-05-17 13:00:02 +00:00
|
|
|
{
|
2017-01-23 05:49:10 +00:00
|
|
|
$result = Financial::NOMINAL(...$args);
|
2019-07-10 19:22:16 +00:00
|
|
|
self::assertEquals($expectedResult, $result, '', 1E-8);
|
2015-05-17 13:00:02 +00:00
|
|
|
}
|
2012-07-31 20:56:11 +00:00
|
|
|
|
|
|
|
public function providerNOMINAL()
|
|
|
|
{
|
2016-08-16 12:00:19 +00:00
|
|
|
return require 'data/Calculation/Financial/NOMINAL.php';
|
2015-05-17 13:00:02 +00:00
|
|
|
}
|
2012-07-31 20:56:11 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @dataProvider providerNPER
|
2017-01-23 05:49:10 +00:00
|
|
|
*
|
|
|
|
* @param mixed $expectedResult
|
2012-07-31 20:56:11 +00:00
|
|
|
*/
|
2017-01-23 05:49:10 +00:00
|
|
|
public function testNPER($expectedResult, ...$args)
|
2015-05-17 13:00:02 +00:00
|
|
|
{
|
2017-01-23 05:49:10 +00:00
|
|
|
$result = Financial::NPER(...$args);
|
2019-07-10 19:22:16 +00:00
|
|
|
self::assertEquals($expectedResult, $result, '', 1E-8);
|
2015-05-17 13:00:02 +00:00
|
|
|
}
|
2012-07-31 20:56:11 +00:00
|
|
|
|
|
|
|
public function providerNPER()
|
|
|
|
{
|
2016-08-16 12:00:19 +00:00
|
|
|
return require 'data/Calculation/Financial/NPER.php';
|
2015-05-17 13:00:02 +00:00
|
|
|
}
|
2012-07-31 20:56:11 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @dataProvider providerNPV
|
2017-01-23 05:49:10 +00:00
|
|
|
*
|
|
|
|
* @param mixed $expectedResult
|
2012-07-31 20:56:11 +00:00
|
|
|
*/
|
2017-01-23 05:49:10 +00:00
|
|
|
public function testNPV($expectedResult, ...$args)
|
2015-05-17 13:00:02 +00:00
|
|
|
{
|
2017-01-23 05:49:10 +00:00
|
|
|
$result = Financial::NPV(...$args);
|
2019-07-10 19:22:16 +00:00
|
|
|
self::assertEquals($expectedResult, $result, '', 1E-8);
|
2015-05-17 13:00:02 +00:00
|
|
|
}
|
2012-07-31 20:56:11 +00:00
|
|
|
|
|
|
|
public function providerNPV()
|
|
|
|
{
|
2016-08-16 12:00:19 +00:00
|
|
|
return require 'data/Calculation/Financial/NPV.php';
|
2015-05-17 13:00:02 +00:00
|
|
|
}
|
2012-07-31 20:56:11 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @dataProvider providerPRICE
|
2017-01-23 05:49:10 +00:00
|
|
|
*
|
|
|
|
* @param mixed $expectedResult
|
2012-07-31 20:56:11 +00:00
|
|
|
*/
|
2017-01-23 05:49:10 +00:00
|
|
|
public function testPRICE($expectedResult, ...$args)
|
2015-05-17 13:00:02 +00:00
|
|
|
{
|
2016-08-14 04:32:43 +00:00
|
|
|
$this->markTestIncomplete('TODO: This test should be fixed');
|
|
|
|
|
2017-01-23 05:49:10 +00:00
|
|
|
$result = Financial::PRICE(...$args);
|
2019-07-10 19:22:16 +00:00
|
|
|
self::assertEquals($expectedResult, $result, '', 1E-8);
|
2015-05-17 13:00:02 +00:00
|
|
|
}
|
2012-07-31 20:56:11 +00:00
|
|
|
|
|
|
|
public function providerPRICE()
|
|
|
|
{
|
2016-08-16 12:00:19 +00:00
|
|
|
return require 'data/Calculation/Financial/PRICE.php';
|
2015-05-17 13:00:02 +00:00
|
|
|
}
|
2012-07-31 20:56:11 +00:00
|
|
|
|
2018-07-22 18:17:04 +00:00
|
|
|
/**
|
|
|
|
* @dataProvider providerPRICEDISC
|
|
|
|
*
|
|
|
|
* @param mixed $expectedResult
|
|
|
|
*/
|
|
|
|
public function testPRICEDISC($expectedResult, array $args)
|
|
|
|
{
|
|
|
|
$result = Financial::PRICEDISC(...$args);
|
2019-07-10 19:22:16 +00:00
|
|
|
self::assertEquals($expectedResult, $result, '', 1E-8);
|
2018-07-22 18:17:04 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public function providerPRICEDISC()
|
|
|
|
{
|
|
|
|
return require 'data/Calculation/Financial/PRICEDISC.php';
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @dataProvider providerPV
|
|
|
|
*
|
|
|
|
* @param mixed $expectedResult
|
|
|
|
*/
|
|
|
|
public function testPV($expectedResult, array $args)
|
|
|
|
{
|
|
|
|
$result = Financial::PV(...$args);
|
2019-07-10 19:22:16 +00:00
|
|
|
self::assertEquals($expectedResult, $result, '', 1E-8);
|
2018-07-22 18:17:04 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public function providerPV()
|
|
|
|
{
|
|
|
|
return require 'data/Calculation/Financial/PV.php';
|
|
|
|
}
|
|
|
|
|
2012-07-31 20:56:11 +00:00
|
|
|
/**
|
|
|
|
* @dataProvider providerRATE
|
2017-01-23 05:49:10 +00:00
|
|
|
*
|
|
|
|
* @param mixed $expectedResult
|
2012-07-31 20:56:11 +00:00
|
|
|
*/
|
2017-01-23 05:49:10 +00:00
|
|
|
public function testRATE($expectedResult, ...$args)
|
2015-05-17 13:00:02 +00:00
|
|
|
{
|
2016-08-14 04:32:43 +00:00
|
|
|
$this->markTestIncomplete('TODO: This test should be fixed');
|
|
|
|
|
2017-01-23 05:49:10 +00:00
|
|
|
$result = Financial::RATE(...$args);
|
2019-07-10 19:22:16 +00:00
|
|
|
self::assertEquals($expectedResult, $result, '', 1E-8);
|
2015-05-17 13:00:02 +00:00
|
|
|
}
|
2012-07-31 20:56:11 +00:00
|
|
|
|
|
|
|
public function providerRATE()
|
|
|
|
{
|
2016-08-16 12:00:19 +00:00
|
|
|
return require 'data/Calculation/Financial/RATE.php';
|
2015-05-17 13:00:02 +00:00
|
|
|
}
|
2012-07-31 20:56:11 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @dataProvider providerXIRR
|
2017-01-23 05:49:10 +00:00
|
|
|
*
|
|
|
|
* @param mixed $expectedResult
|
2012-07-31 20:56:11 +00:00
|
|
|
*/
|
2017-01-23 05:49:10 +00:00
|
|
|
public function testXIRR($expectedResult, ...$args)
|
2015-05-17 13:00:02 +00:00
|
|
|
{
|
2016-08-14 04:32:43 +00:00
|
|
|
$this->markTestIncomplete('TODO: This test should be fixed');
|
|
|
|
|
2017-01-23 05:49:10 +00:00
|
|
|
$result = Financial::XIRR(...$args);
|
2019-07-10 19:22:16 +00:00
|
|
|
self::assertEquals($expectedResult, $result, '', 1E-8);
|
2015-05-17 13:00:02 +00:00
|
|
|
}
|
2012-07-31 20:56:11 +00:00
|
|
|
|
|
|
|
public function providerXIRR()
|
|
|
|
{
|
2016-08-16 12:00:19 +00:00
|
|
|
return require 'data/Calculation/Financial/XIRR.php';
|
2015-05-17 13:00:02 +00:00
|
|
|
}
|
2018-07-22 18:17:04 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @dataProvider providerPDURATION
|
|
|
|
*
|
|
|
|
* @param mixed $expectedResult
|
|
|
|
*/
|
|
|
|
public function testPDURATION($expectedResult, array $args)
|
|
|
|
{
|
|
|
|
$result = Financial::PDURATION(...$args);
|
2019-07-10 19:22:16 +00:00
|
|
|
self::assertEquals($expectedResult, $result, '', 1E-8);
|
2018-07-22 18:17:04 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public function providerPDURATION()
|
|
|
|
{
|
|
|
|
return require 'data/Calculation/Financial/PDURATION.php';
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @dataProvider providerRRI
|
|
|
|
*
|
|
|
|
* @param mixed $expectedResult
|
|
|
|
*/
|
|
|
|
public function testRRI($expectedResult, array $args)
|
|
|
|
{
|
|
|
|
$result = Financial::RRI(...$args);
|
2019-07-10 19:22:16 +00:00
|
|
|
self::assertEquals($expectedResult, $result, '', 1E-8);
|
2018-07-22 18:17:04 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public function providerRRI()
|
|
|
|
{
|
|
|
|
return require 'data/Calculation/Financial/RRI.php';
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @dataProvider providerSLN
|
|
|
|
*
|
|
|
|
* @param mixed $expectedResult
|
|
|
|
*/
|
|
|
|
public function testSLN($expectedResult, array $args)
|
|
|
|
{
|
|
|
|
$result = Financial::SLN(...$args);
|
2019-07-10 19:22:16 +00:00
|
|
|
self::assertEquals($expectedResult, $result, '', 1E-8);
|
2018-07-22 18:17:04 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public function providerSLN()
|
|
|
|
{
|
|
|
|
return require 'data/Calculation/Financial/SLN.php';
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @dataProvider providerSYD
|
|
|
|
*
|
|
|
|
* @param mixed $expectedResult
|
|
|
|
*/
|
|
|
|
public function testSYD($expectedResult, array $args)
|
|
|
|
{
|
|
|
|
$result = Financial::SYD(...$args);
|
2019-07-10 19:22:16 +00:00
|
|
|
self::assertEquals($expectedResult, $result, '', 1E-8);
|
2018-07-22 18:17:04 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public function providerSYD()
|
|
|
|
{
|
|
|
|
return require 'data/Calculation/Financial/SYD.php';
|
|
|
|
}
|
2012-07-31 20:56:11 +00:00
|
|
|
}
|