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;
|
2016-08-14 04:08:43 +00:00
|
|
|
|
2016-03-22 14:35:50 +00:00
|
|
|
class FinancialTest extends \PHPUnit_Framework_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
|
2016-05-19 10:31:40 +00:00
|
|
|
* @group fail19
|
2012-07-31 20:56:11 +00:00
|
|
|
*/
|
2015-05-17 13:00:02 +00:00
|
|
|
public function testACCRINT()
|
|
|
|
{
|
|
|
|
$args = func_get_args();
|
|
|
|
$expectedResult = array_pop($args);
|
2016-08-16 15:33:57 +00:00
|
|
|
$result = call_user_func_array([Financial::class, 'ACCRINT'], $args);
|
2015-05-17 13:00:02 +00:00
|
|
|
$this->assertEquals($expectedResult, $result, null, 1E-8);
|
|
|
|
}
|
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
|
|
|
|
*/
|
2015-05-17 13:00:02 +00:00
|
|
|
public function testACCRINTM()
|
|
|
|
{
|
|
|
|
$args = func_get_args();
|
|
|
|
$expectedResult = array_pop($args);
|
2016-08-16 15:33:57 +00:00
|
|
|
$result = call_user_func_array([Financial::class, 'ACCRINTM'], $args);
|
2015-05-17 13:00:02 +00:00
|
|
|
$this->assertEquals($expectedResult, $result, null, 1E-8);
|
|
|
|
}
|
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
|
|
|
|
*/
|
2015-05-17 13:00:02 +00:00
|
|
|
public function testAMORDEGRC()
|
|
|
|
{
|
|
|
|
$args = func_get_args();
|
|
|
|
$expectedResult = array_pop($args);
|
2016-08-16 15:33:57 +00:00
|
|
|
$result = call_user_func_array([Financial::class, 'AMORDEGRC'], $args);
|
2015-05-17 13:00:02 +00:00
|
|
|
$this->assertEquals($expectedResult, $result, null, 1E-8);
|
|
|
|
}
|
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
|
|
|
|
*/
|
2015-05-17 13:00:02 +00:00
|
|
|
public function testAMORLINC()
|
|
|
|
{
|
|
|
|
$args = func_get_args();
|
|
|
|
$expectedResult = array_pop($args);
|
2016-08-16 15:33:57 +00:00
|
|
|
$result = call_user_func_array([Financial::class, 'AMORLINC'], $args);
|
2015-05-17 13:00:02 +00:00
|
|
|
$this->assertEquals($expectedResult, $result, null, 1E-8);
|
|
|
|
}
|
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
|
|
|
|
*/
|
2015-05-17 13:00:02 +00:00
|
|
|
public function testCOUPDAYBS()
|
|
|
|
{
|
|
|
|
$args = func_get_args();
|
|
|
|
$expectedResult = array_pop($args);
|
2016-08-16 15:33:57 +00:00
|
|
|
$result = call_user_func_array([Financial::class, 'COUPDAYBS'], $args);
|
2015-05-17 13:00:02 +00:00
|
|
|
$this->assertEquals($expectedResult, $result, null, 1E-8);
|
|
|
|
}
|
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
|
|
|
|
*/
|
2015-05-17 13:00:02 +00:00
|
|
|
public function testCOUPDAYS()
|
|
|
|
{
|
|
|
|
$args = func_get_args();
|
|
|
|
$expectedResult = array_pop($args);
|
2016-08-16 15:33:57 +00:00
|
|
|
$result = call_user_func_array([Financial::class, 'COUPDAYS'], $args);
|
2015-05-17 13:00:02 +00:00
|
|
|
$this->assertEquals($expectedResult, $result, null, 1E-8);
|
|
|
|
}
|
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
|
|
|
|
*/
|
2015-05-17 13:00:02 +00:00
|
|
|
public function testCOUPDAYSNC()
|
|
|
|
{
|
|
|
|
$args = func_get_args();
|
|
|
|
$expectedResult = array_pop($args);
|
2016-08-16 15:33:57 +00:00
|
|
|
$result = call_user_func_array([Financial::class, 'COUPDAYSNC'], $args);
|
2015-05-17 13:00:02 +00:00
|
|
|
$this->assertEquals($expectedResult, $result, null, 1E-8);
|
|
|
|
}
|
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
|
|
|
|
*/
|
2015-05-17 13:00:02 +00:00
|
|
|
public function testCOUPNCD()
|
|
|
|
{
|
|
|
|
$args = func_get_args();
|
|
|
|
$expectedResult = array_pop($args);
|
2016-08-16 15:33:57 +00:00
|
|
|
$result = call_user_func_array([Financial::class, 'COUPNCD'], $args);
|
2015-05-17 13:00:02 +00:00
|
|
|
$this->assertEquals($expectedResult, $result, null, 1E-8);
|
|
|
|
}
|
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
|
|
|
|
*/
|
2015-05-17 13:00:02 +00:00
|
|
|
public function testCOUPNUM()
|
|
|
|
{
|
|
|
|
$args = func_get_args();
|
|
|
|
$expectedResult = array_pop($args);
|
2016-08-16 15:33:57 +00:00
|
|
|
$result = call_user_func_array([Financial::class, 'COUPNUM'], $args);
|
2015-05-17 13:00:02 +00:00
|
|
|
$this->assertEquals($expectedResult, $result, null, 1E-8);
|
|
|
|
}
|
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
|
|
|
|
*/
|
2015-05-17 13:00:02 +00:00
|
|
|
public function testCOUPPCD()
|
|
|
|
{
|
|
|
|
$args = func_get_args();
|
|
|
|
$expectedResult = array_pop($args);
|
2016-08-16 15:33:57 +00:00
|
|
|
$result = call_user_func_array([Financial::class, 'COUPPCD'], $args);
|
2015-05-17 13:00:02 +00:00
|
|
|
$this->assertEquals($expectedResult, $result, null, 1E-8);
|
|
|
|
}
|
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
|
|
|
|
*/
|
2015-05-17 13:00:02 +00:00
|
|
|
public function testCUMIPMT()
|
|
|
|
{
|
|
|
|
$args = func_get_args();
|
|
|
|
$expectedResult = array_pop($args);
|
2016-08-16 15:33:57 +00:00
|
|
|
$result = call_user_func_array([Financial::class, 'CUMIPMT'], $args);
|
2015-05-17 13:00:02 +00:00
|
|
|
$this->assertEquals($expectedResult, $result, null, 1E-8);
|
|
|
|
}
|
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
|
|
|
|
*/
|
2015-05-17 13:00:02 +00:00
|
|
|
public function testCUMPRINC()
|
|
|
|
{
|
|
|
|
$args = func_get_args();
|
|
|
|
$expectedResult = array_pop($args);
|
2016-08-16 15:33:57 +00:00
|
|
|
$result = call_user_func_array([Financial::class, 'CUMPRINC'], $args);
|
2015-05-17 13:00:02 +00:00
|
|
|
$this->assertEquals($expectedResult, $result, null, 1E-8);
|
|
|
|
}
|
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
|
|
|
|
*/
|
2015-05-17 13:00:02 +00:00
|
|
|
public function testDB()
|
|
|
|
{
|
|
|
|
$args = func_get_args();
|
|
|
|
$expectedResult = array_pop($args);
|
2016-08-16 15:33:57 +00:00
|
|
|
$result = call_user_func_array([Financial::class, 'DB'], $args);
|
2015-05-17 13:00:02 +00:00
|
|
|
$this->assertEquals($expectedResult, $result, null, 1E-8);
|
|
|
|
}
|
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
|
|
|
|
*/
|
2015-05-17 13:00:02 +00:00
|
|
|
public function testDDB()
|
|
|
|
{
|
|
|
|
$args = func_get_args();
|
|
|
|
$expectedResult = array_pop($args);
|
2016-08-16 15:33:57 +00:00
|
|
|
$result = call_user_func_array([Financial::class, 'DDB'], $args);
|
2015-05-17 13:00:02 +00:00
|
|
|
$this->assertEquals($expectedResult, $result, null, 1E-8);
|
|
|
|
}
|
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
|
|
|
|
*/
|
2015-05-17 13:00:02 +00:00
|
|
|
public function testDISC()
|
|
|
|
{
|
|
|
|
$args = func_get_args();
|
|
|
|
$expectedResult = array_pop($args);
|
2016-08-16 15:33:57 +00:00
|
|
|
$result = call_user_func_array([Financial::class, 'DISC'], $args);
|
2015-05-17 13:00:02 +00:00
|
|
|
$this->assertEquals($expectedResult, $result, null, 1E-8);
|
|
|
|
}
|
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
|
|
|
|
*/
|
2015-05-17 13:00:02 +00:00
|
|
|
public function testDOLLARDE()
|
|
|
|
{
|
|
|
|
$args = func_get_args();
|
|
|
|
$expectedResult = array_pop($args);
|
2016-08-16 15:33:57 +00:00
|
|
|
$result = call_user_func_array([Financial::class, 'DOLLARDE'], $args);
|
2015-05-17 13:00:02 +00:00
|
|
|
$this->assertEquals($expectedResult, $result, null, 1E-8);
|
|
|
|
}
|
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
|
|
|
|
*/
|
2015-05-17 13:00:02 +00:00
|
|
|
public function testDOLLARFR()
|
|
|
|
{
|
|
|
|
$args = func_get_args();
|
|
|
|
$expectedResult = array_pop($args);
|
2016-08-16 15:33:57 +00:00
|
|
|
$result = call_user_func_array([Financial::class, 'DOLLARFR'], $args);
|
2015-05-17 13:00:02 +00:00
|
|
|
$this->assertEquals($expectedResult, $result, null, 1E-8);
|
|
|
|
}
|
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
|
|
|
|
*/
|
2015-05-17 13:00:02 +00:00
|
|
|
public function testEFFECT()
|
|
|
|
{
|
|
|
|
$args = func_get_args();
|
|
|
|
$expectedResult = array_pop($args);
|
2016-08-16 15:33:57 +00:00
|
|
|
$result = call_user_func_array([Financial::class, 'EFFECT'], $args);
|
2015-05-17 13:00:02 +00:00
|
|
|
$this->assertEquals($expectedResult, $result, null, 1E-8);
|
|
|
|
}
|
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
|
|
|
|
*/
|
2015-05-17 13:00:02 +00:00
|
|
|
public function testFV()
|
|
|
|
{
|
|
|
|
$args = func_get_args();
|
|
|
|
$expectedResult = array_pop($args);
|
2016-08-16 15:33:57 +00:00
|
|
|
$result = call_user_func_array([Financial::class, 'FV'], $args);
|
2015-05-17 13:00:02 +00:00
|
|
|
$this->assertEquals($expectedResult, $result, null, 1E-8);
|
|
|
|
}
|
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
|
|
|
|
*/
|
2015-05-17 13:00:02 +00:00
|
|
|
public function testFVSCHEDULE()
|
|
|
|
{
|
|
|
|
$args = func_get_args();
|
|
|
|
$expectedResult = array_pop($args);
|
2016-08-16 15:33:57 +00:00
|
|
|
$result = call_user_func_array([Financial::class, 'FVSCHEDULE'], $args);
|
2015-05-17 13:00:02 +00:00
|
|
|
$this->assertEquals($expectedResult, $result, null, 1E-8);
|
|
|
|
}
|
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
|
|
|
|
*/
|
2015-05-17 13:00:02 +00:00
|
|
|
public function testINTRATE()
|
|
|
|
{
|
|
|
|
$args = func_get_args();
|
|
|
|
$expectedResult = array_pop($args);
|
2016-08-16 15:33:57 +00:00
|
|
|
$result = call_user_func_array([Financial::class, 'INTRATE'], $args);
|
2015-05-17 13:00:02 +00:00
|
|
|
$this->assertEquals($expectedResult, $result, null, 1E-8);
|
|
|
|
}
|
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
|
|
|
|
*/
|
2015-05-17 13:00:02 +00:00
|
|
|
public function testIPMT()
|
|
|
|
{
|
|
|
|
$args = func_get_args();
|
|
|
|
$expectedResult = array_pop($args);
|
2016-08-16 15:33:57 +00:00
|
|
|
$result = call_user_func_array([Financial::class, 'IPMT'], $args);
|
2015-05-17 13:00:02 +00:00
|
|
|
$this->assertEquals($expectedResult, $result, null, 1E-8);
|
|
|
|
}
|
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
|
|
|
|
*/
|
2015-05-17 13:00:02 +00:00
|
|
|
public function testIRR()
|
|
|
|
{
|
|
|
|
$args = func_get_args();
|
|
|
|
$expectedResult = array_pop($args);
|
2016-08-16 15:33:57 +00:00
|
|
|
$result = call_user_func_array([Financial::class, 'IRR'], $args);
|
2015-05-17 13:00:02 +00:00
|
|
|
$this->assertEquals($expectedResult, $result, null, 1E-8);
|
|
|
|
}
|
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
|
|
|
|
*/
|
2015-05-17 13:00:02 +00:00
|
|
|
public function testISPMT()
|
|
|
|
{
|
|
|
|
$args = func_get_args();
|
|
|
|
$expectedResult = array_pop($args);
|
2016-08-16 15:33:57 +00:00
|
|
|
$result = call_user_func_array([Financial::class, 'ISPMT'], $args);
|
2015-05-17 13:00:02 +00:00
|
|
|
$this->assertEquals($expectedResult, $result, null, 1E-8);
|
|
|
|
}
|
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
|
|
|
|
*/
|
2015-05-17 13:00:02 +00:00
|
|
|
public function testMIRR()
|
|
|
|
{
|
|
|
|
$args = func_get_args();
|
|
|
|
$expectedResult = array_pop($args);
|
2016-08-16 15:33:57 +00:00
|
|
|
$result = call_user_func_array([Financial::class, 'MIRR'], $args);
|
2015-05-17 13:00:02 +00:00
|
|
|
$this->assertEquals($expectedResult, $result, null, 1E-8);
|
|
|
|
}
|
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
|
|
|
|
*/
|
2015-05-17 13:00:02 +00:00
|
|
|
public function testNOMINAL()
|
|
|
|
{
|
|
|
|
$args = func_get_args();
|
|
|
|
$expectedResult = array_pop($args);
|
2016-08-16 15:33:57 +00:00
|
|
|
$result = call_user_func_array([Financial::class, 'NOMINAL'], $args);
|
2015-05-17 13:00:02 +00:00
|
|
|
$this->assertEquals($expectedResult, $result, null, 1E-8);
|
|
|
|
}
|
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
|
|
|
|
*/
|
2015-05-17 13:00:02 +00:00
|
|
|
public function testNPER()
|
|
|
|
{
|
|
|
|
$args = func_get_args();
|
|
|
|
$expectedResult = array_pop($args);
|
2016-08-16 15:33:57 +00:00
|
|
|
$result = call_user_func_array([Financial::class, 'NPER'], $args);
|
2015-05-17 13:00:02 +00:00
|
|
|
$this->assertEquals($expectedResult, $result, null, 1E-8);
|
|
|
|
}
|
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
|
|
|
|
*/
|
2015-05-17 13:00:02 +00:00
|
|
|
public function testNPV()
|
|
|
|
{
|
|
|
|
$args = func_get_args();
|
|
|
|
$expectedResult = array_pop($args);
|
2016-08-16 15:33:57 +00:00
|
|
|
$result = call_user_func_array([Financial::class, 'NPV'], $args);
|
2015-05-17 13:00:02 +00:00
|
|
|
$this->assertEquals($expectedResult, $result, null, 1E-8);
|
|
|
|
}
|
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
|
2016-05-19 10:31:40 +00:00
|
|
|
* @group fail19
|
2012-07-31 20:56:11 +00:00
|
|
|
*/
|
2015-05-17 13:00:02 +00:00
|
|
|
public function testPRICE()
|
|
|
|
{
|
2016-08-14 04:32:43 +00:00
|
|
|
$this->markTestIncomplete('TODO: This test should be fixed');
|
|
|
|
|
2015-05-17 13:00:02 +00:00
|
|
|
$args = func_get_args();
|
|
|
|
$expectedResult = array_pop($args);
|
2016-08-16 15:33:57 +00:00
|
|
|
$result = call_user_func_array([Financial::class, 'PRICE'], $args);
|
2015-05-17 13:00:02 +00:00
|
|
|
$this->assertEquals($expectedResult, $result, null, 1E-8);
|
|
|
|
}
|
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
|
|
|
|
|
|
|
/**
|
|
|
|
* @dataProvider providerRATE
|
2016-05-19 10:31:40 +00:00
|
|
|
* @group fail19
|
2012-07-31 20:56:11 +00:00
|
|
|
*/
|
2015-05-17 13:00:02 +00:00
|
|
|
public function testRATE()
|
|
|
|
{
|
2016-08-14 04:32:43 +00:00
|
|
|
$this->markTestIncomplete('TODO: This test should be fixed');
|
|
|
|
|
2015-05-17 13:00:02 +00:00
|
|
|
$args = func_get_args();
|
|
|
|
$expectedResult = array_pop($args);
|
2016-08-16 15:33:57 +00:00
|
|
|
$result = call_user_func_array([Financial::class, 'RATE'], $args);
|
2015-05-17 13:00:02 +00:00
|
|
|
$this->assertEquals($expectedResult, $result, null, 1E-8);
|
|
|
|
}
|
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
|
2016-05-19 10:31:40 +00:00
|
|
|
* @group fail19
|
2012-07-31 20:56:11 +00:00
|
|
|
*/
|
2015-05-17 13:00:02 +00:00
|
|
|
public function testXIRR()
|
|
|
|
{
|
2016-08-14 04:32:43 +00:00
|
|
|
$this->markTestIncomplete('TODO: This test should be fixed');
|
|
|
|
|
2015-05-17 13:00:02 +00:00
|
|
|
$args = func_get_args();
|
|
|
|
$expectedResult = array_pop($args);
|
2016-08-16 15:33:57 +00:00
|
|
|
$result = call_user_func_array([Financial::class, 'XIRR'], $args);
|
2015-05-17 13:00:02 +00:00
|
|
|
$this->assertEquals($expectedResult, $result, null, 1E-8);
|
|
|
|
}
|
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
|
|
|
}
|
2012-07-31 20:56:11 +00:00
|
|
|
}
|