PhpSpreadsheet/tests/PhpSpreadsheetTests/Calculation/FinancialTest.php

581 lines
14 KiB
PHP
Raw Normal View History

2012-07-31 20:56:11 +00:00
<?php
namespace PhpOffice\PhpSpreadsheetTests\Calculation;
2012-07-31 20:56:11 +00:00
use PhpOffice\PhpSpreadsheet\Calculation\Financial;
use PhpOffice\PhpSpreadsheet\Calculation\Functions;
use PHPUnit\Framework\TestCase;
class FinancialTest extends TestCase
2012-07-31 20:56:11 +00:00
{
2020-04-27 10:28:36 +00:00
protected function setUp(): void
2012-07-31 20:56:11 +00:00
{
Functions::setCompatibilityMode(Functions::COMPATIBILITY_EXCEL);
2015-05-17 13:00:02 +00:00
}
2012-07-31 20:56:11 +00:00
/**
* @dataProvider providerAMORDEGRC
*
* @param mixed $expectedResult
2012-07-31 20:56:11 +00:00
*/
public function testAMORDEGRC($expectedResult, ...$args)
2015-05-17 13:00:02 +00:00
{
$result = Financial::AMORDEGRC(...$args);
2020-04-27 10:28:36 +00:00
self::assertEqualsWithDelta($expectedResult, $result, 1E-8);
2015-05-17 13:00:02 +00:00
}
2012-07-31 20:56:11 +00:00
public function providerAMORDEGRC()
{
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
*
* @param mixed $expectedResult
2012-07-31 20:56:11 +00:00
*/
public function testAMORLINC($expectedResult, ...$args)
2015-05-17 13:00:02 +00:00
{
$result = Financial::AMORLINC(...$args);
2020-04-27 10:28:36 +00:00
self::assertEqualsWithDelta($expectedResult, $result, 1E-8);
2015-05-17 13:00:02 +00:00
}
2012-07-31 20:56:11 +00:00
public function providerAMORLINC()
{
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
*
* @param mixed $expectedResult
2012-07-31 20:56:11 +00:00
*/
public function testCOUPDAYBS($expectedResult, ...$args)
2015-05-17 13:00:02 +00:00
{
$result = Financial::COUPDAYBS(...$args);
2020-04-27 10:28:36 +00:00
self::assertEqualsWithDelta($expectedResult, $result, 1E-8);
2015-05-17 13:00:02 +00:00
}
2012-07-31 20:56:11 +00:00
public function providerCOUPDAYBS()
{
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
*
* @param mixed $expectedResult
2012-07-31 20:56:11 +00:00
*/
public function testCOUPDAYS($expectedResult, ...$args)
2015-05-17 13:00:02 +00:00
{
$result = Financial::COUPDAYS(...$args);
2020-04-27 10:28:36 +00:00
self::assertEqualsWithDelta($expectedResult, $result, 1E-8);
2015-05-17 13:00:02 +00:00
}
2012-07-31 20:56:11 +00:00
public function providerCOUPDAYS()
{
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
*
* @param mixed $expectedResult
2012-07-31 20:56:11 +00:00
*/
public function testCOUPDAYSNC($expectedResult, ...$args)
2015-05-17 13:00:02 +00:00
{
$result = Financial::COUPDAYSNC(...$args);
2020-04-27 10:28:36 +00:00
self::assertEqualsWithDelta($expectedResult, $result, 1E-8);
2015-05-17 13:00:02 +00:00
}
2012-07-31 20:56:11 +00:00
public function providerCOUPDAYSNC()
{
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
*
* @param mixed $expectedResult
2012-07-31 20:56:11 +00:00
*/
public function testCOUPNCD($expectedResult, ...$args)
2015-05-17 13:00:02 +00:00
{
$result = Financial::COUPNCD(...$args);
2020-04-27 10:28:36 +00:00
self::assertEqualsWithDelta($expectedResult, $result, 1E-8);
2015-05-17 13:00:02 +00:00
}
2012-07-31 20:56:11 +00:00
public function providerCOUPNCD()
{
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
*
* @param mixed $expectedResult
2012-07-31 20:56:11 +00:00
*/
public function testCOUPNUM($expectedResult, ...$args)
2015-05-17 13:00:02 +00:00
{
$result = Financial::COUPNUM(...$args);
2020-04-27 10:28:36 +00:00
self::assertEqualsWithDelta($expectedResult, $result, 1E-8);
2015-05-17 13:00:02 +00:00
}
2012-07-31 20:56:11 +00:00
public function providerCOUPNUM()
{
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
*
* @param mixed $expectedResult
2012-07-31 20:56:11 +00:00
*/
public function testCOUPPCD($expectedResult, ...$args)
2015-05-17 13:00:02 +00:00
{
$result = Financial::COUPPCD(...$args);
2020-04-27 10:28:36 +00:00
self::assertEqualsWithDelta($expectedResult, $result, 1E-8);
2015-05-17 13:00:02 +00:00
}
2012-07-31 20:56:11 +00:00
public function providerCOUPPCD()
{
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
*
* @param mixed $expectedResult
2012-07-31 20:56:11 +00:00
*/
public function testCUMIPMT($expectedResult, ...$args)
2015-05-17 13:00:02 +00:00
{
$result = Financial::CUMIPMT(...$args);
2020-04-27 10:28:36 +00:00
self::assertEqualsWithDelta($expectedResult, $result, 1E-8);
2015-05-17 13:00:02 +00:00
}
2012-07-31 20:56:11 +00:00
public function providerCUMIPMT()
{
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
*
* @param mixed $expectedResult
2012-07-31 20:56:11 +00:00
*/
public function testCUMPRINC($expectedResult, ...$args)
2015-05-17 13:00:02 +00:00
{
$result = Financial::CUMPRINC(...$args);
2020-04-27 10:28:36 +00:00
self::assertEqualsWithDelta($expectedResult, $result, 1E-8);
2015-05-17 13:00:02 +00:00
}
2012-07-31 20:56:11 +00:00
public function providerCUMPRINC()
{
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
*
* @param mixed $expectedResult
2012-07-31 20:56:11 +00:00
*/
public function testDB($expectedResult, ...$args)
2015-05-17 13:00:02 +00:00
{
$result = Financial::DB(...$args);
2020-04-27 10:28:36 +00:00
self::assertEqualsWithDelta($expectedResult, $result, 1E-8);
2015-05-17 13:00:02 +00:00
}
2012-07-31 20:56:11 +00:00
public function providerDB()
{
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
*
* @param mixed $expectedResult
2012-07-31 20:56:11 +00:00
*/
public function testDDB($expectedResult, ...$args)
2015-05-17 13:00:02 +00:00
{
$result = Financial::DDB(...$args);
2020-04-27 10:28:36 +00:00
self::assertEqualsWithDelta($expectedResult, $result, 1E-8);
2015-05-17 13:00:02 +00:00
}
2012-07-31 20:56:11 +00:00
public function providerDDB()
{
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
*
* @param mixed $expectedResult
2012-07-31 20:56:11 +00:00
*/
public function testDISC($expectedResult, ...$args)
2015-05-17 13:00:02 +00:00
{
$result = Financial::DISC(...$args);
2020-04-27 10:28:36 +00:00
self::assertEqualsWithDelta($expectedResult, $result, 1E-8);
2015-05-17 13:00:02 +00:00
}
2012-07-31 20:56:11 +00:00
public function providerDISC()
{
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
*
* @param mixed $expectedResult
2012-07-31 20:56:11 +00:00
*/
public function testDOLLARDE($expectedResult, ...$args)
2015-05-17 13:00:02 +00:00
{
$result = Financial::DOLLARDE(...$args);
2020-04-27 10:28:36 +00:00
self::assertEqualsWithDelta($expectedResult, $result, 1E-8);
2015-05-17 13:00:02 +00:00
}
2012-07-31 20:56:11 +00:00
public function providerDOLLARDE()
{
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
*
* @param mixed $expectedResult
2012-07-31 20:56:11 +00:00
*/
public function testDOLLARFR($expectedResult, ...$args)
2015-05-17 13:00:02 +00:00
{
$result = Financial::DOLLARFR(...$args);
2020-04-27 10:28:36 +00:00
self::assertEqualsWithDelta($expectedResult, $result, 1E-8);
2015-05-17 13:00:02 +00:00
}
2012-07-31 20:56:11 +00:00
public function providerDOLLARFR()
{
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
*
* @param mixed $expectedResult
2012-07-31 20:56:11 +00:00
*/
public function testEFFECT($expectedResult, ...$args)
2015-05-17 13:00:02 +00:00
{
$result = Financial::EFFECT(...$args);
2020-04-27 10:28:36 +00:00
self::assertEqualsWithDelta($expectedResult, $result, 1E-8);
2015-05-17 13:00:02 +00:00
}
2012-07-31 20:56:11 +00:00
public function providerEFFECT()
{
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
*
* @param mixed $expectedResult
2012-07-31 20:56:11 +00:00
*/
public function testFV($expectedResult, ...$args)
2015-05-17 13:00:02 +00:00
{
$result = Financial::FV(...$args);
2020-04-27 10:28:36 +00:00
self::assertEqualsWithDelta($expectedResult, $result, 1E-8);
2015-05-17 13:00:02 +00:00
}
2012-07-31 20:56:11 +00:00
public function providerFV()
{
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
*
* @param mixed $expectedResult
2012-07-31 20:56:11 +00:00
*/
public function testFVSCHEDULE($expectedResult, ...$args)
2015-05-17 13:00:02 +00:00
{
$result = Financial::FVSCHEDULE(...$args);
2020-04-27 10:28:36 +00:00
self::assertEqualsWithDelta($expectedResult, $result, 1E-8);
2015-05-17 13:00:02 +00:00
}
2012-07-31 20:56:11 +00:00
public function providerFVSCHEDULE()
{
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
*
* @param mixed $expectedResult
2012-07-31 20:56:11 +00:00
*/
public function testINTRATE($expectedResult, ...$args)
2015-05-17 13:00:02 +00:00
{
$result = Financial::INTRATE(...$args);
2020-04-27 10:28:36 +00:00
self::assertEqualsWithDelta($expectedResult, $result, 1E-8);
2015-05-17 13:00:02 +00:00
}
2012-07-31 20:56:11 +00:00
public function providerINTRATE()
{
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
*
* @param mixed $expectedResult
2012-07-31 20:56:11 +00:00
*/
public function testIPMT($expectedResult, ...$args)
2015-05-17 13:00:02 +00:00
{
$result = Financial::IPMT(...$args);
2020-04-27 10:28:36 +00:00
self::assertEqualsWithDelta($expectedResult, $result, 1E-8);
2015-05-17 13:00:02 +00:00
}
2012-07-31 20:56:11 +00:00
public function providerIPMT()
{
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
*
* @param mixed $expectedResult
2012-07-31 20:56:11 +00:00
*/
public function testIRR($expectedResult, ...$args)
2015-05-17 13:00:02 +00:00
{
$result = Financial::IRR(...$args);
2020-04-27 10:28:36 +00:00
self::assertEqualsWithDelta($expectedResult, $result, 1E-8);
2015-05-17 13:00:02 +00:00
}
2012-07-31 20:56:11 +00:00
public function providerIRR()
{
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
*
* @param mixed $expectedResult
2012-07-31 20:56:11 +00:00
*/
public function testISPMT($expectedResult, ...$args)
2015-05-17 13:00:02 +00:00
{
$result = Financial::ISPMT(...$args);
2020-04-27 10:28:36 +00:00
self::assertEqualsWithDelta($expectedResult, $result, 1E-8);
2015-05-17 13:00:02 +00:00
}
2012-07-31 20:56:11 +00:00
public function providerISPMT()
{
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
*
* @param mixed $expectedResult
2012-07-31 20:56:11 +00:00
*/
public function testMIRR($expectedResult, ...$args)
2015-05-17 13:00:02 +00:00
{
$result = Financial::MIRR(...$args);
2020-04-27 10:28:36 +00:00
self::assertEqualsWithDelta($expectedResult, $result, 1E-8);
2015-05-17 13:00:02 +00:00
}
2012-07-31 20:56:11 +00:00
public function providerMIRR()
{
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
*
* @param mixed $expectedResult
2012-07-31 20:56:11 +00:00
*/
public function testNOMINAL($expectedResult, ...$args)
2015-05-17 13:00:02 +00:00
{
$result = Financial::NOMINAL(...$args);
2020-04-27 10:28:36 +00:00
self::assertEqualsWithDelta($expectedResult, $result, 1E-8);
2015-05-17 13:00:02 +00:00
}
2012-07-31 20:56:11 +00:00
public function providerNOMINAL()
{
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
*
* @param mixed $expectedResult
2012-07-31 20:56:11 +00:00
*/
public function testNPER($expectedResult, ...$args)
2015-05-17 13:00:02 +00:00
{
$result = Financial::NPER(...$args);
2020-04-27 10:28:36 +00:00
self::assertEqualsWithDelta($expectedResult, $result, 1E-8);
2015-05-17 13:00:02 +00:00
}
2012-07-31 20:56:11 +00:00
public function providerNPER()
{
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
*
* @param mixed $expectedResult
2012-07-31 20:56:11 +00:00
*/
public function testNPV($expectedResult, ...$args)
2015-05-17 13:00:02 +00:00
{
$result = Financial::NPV(...$args);
2020-04-27 10:28:36 +00:00
self::assertEqualsWithDelta($expectedResult, $result, 1E-8);
2015-05-17 13:00:02 +00:00
}
2012-07-31 20:56:11 +00:00
public function providerNPV()
{
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
*
* @param mixed $expectedResult
2012-07-31 20:56:11 +00:00
*/
public function testPRICE($expectedResult, ...$args)
2015-05-17 13:00:02 +00:00
{
$this->markTestIncomplete('TODO: This test should be fixed');
$result = Financial::PRICE(...$args);
2020-04-27 10:28:36 +00:00
self::assertEqualsWithDelta($expectedResult, $result, 1E-8);
2015-05-17 13:00:02 +00:00
}
2012-07-31 20:56:11 +00:00
public function providerPRICE()
{
return require 'data/Calculation/Financial/PRICE.php';
2015-05-17 13:00:02 +00:00
}
2012-07-31 20:56:11 +00:00
Add further new Functions introduced in MS Excel 2013 and 2016 (#608) - Fix ISFORMULA() function to work with a cell reference to another worksheet - Added calculation engine support for the new functions that were added in MS Excel 2013 and MS Excel 2016 - Text Functions - CONCAT() Synonym for CONCATENATE() - NUMBERVALUE() Converts text to a number, in a locale-independent way - UNICHAR() Synonym for CHAR() in PHPSpreadsheet, which has always used UTF-8 internally - UNIORD() Synonym for ORD() in PHPSpreadsheet, which has always used UTF-8 internally - TEXTJOIN() Joins together two or more text strings, separated by a delimiter - Logical Functions - XOR() Returns a logical Exclusive Or of all arguments - Date/Time Functions - ISOWEEKNUM() Returns the ISO 8601 week number of the year for a given date - Lookup and Reference Functions - FORMULATEXT() Returns a formula as a string - Engineering Functions - ERF.PRECISE() Returns the error function integrated between 0 and a supplied limit - ERFC.PRECISE() Synonym for ERFC - Math and Trig Functions - SEC() Returns the secant of an angle - SECH() Returns the hyperbolic secant of an angle - CSC() Returns the cosecant of an angle - CSCH() Returns the hyperbolic cosecant of an angle - COT() Returns the cotangent of an angle - COTH() Returns the hyperbolic cotangent of an angle - ACOT() Returns the cotangent of an angle - ACOTH() Returns the hyperbolic cotangent of an angle - Financial Functions - PDURATION() Calculates the number of periods required for an investment to reach a specified value - RRI() Calculates the interest rate required for an investment to grow to a specified future value
2018-07-22 18:17:04 +00:00
/**
* @dataProvider providerPRICEDISC
*
* @param mixed $expectedResult
*/
public function testPRICEDISC($expectedResult, array $args)
{
$result = Financial::PRICEDISC(...$args);
2020-04-27 10:28:36 +00:00
self::assertEqualsWithDelta($expectedResult, $result, 1E-8);
Add further new Functions introduced in MS Excel 2013 and 2016 (#608) - Fix ISFORMULA() function to work with a cell reference to another worksheet - Added calculation engine support for the new functions that were added in MS Excel 2013 and MS Excel 2016 - Text Functions - CONCAT() Synonym for CONCATENATE() - NUMBERVALUE() Converts text to a number, in a locale-independent way - UNICHAR() Synonym for CHAR() in PHPSpreadsheet, which has always used UTF-8 internally - UNIORD() Synonym for ORD() in PHPSpreadsheet, which has always used UTF-8 internally - TEXTJOIN() Joins together two or more text strings, separated by a delimiter - Logical Functions - XOR() Returns a logical Exclusive Or of all arguments - Date/Time Functions - ISOWEEKNUM() Returns the ISO 8601 week number of the year for a given date - Lookup and Reference Functions - FORMULATEXT() Returns a formula as a string - Engineering Functions - ERF.PRECISE() Returns the error function integrated between 0 and a supplied limit - ERFC.PRECISE() Synonym for ERFC - Math and Trig Functions - SEC() Returns the secant of an angle - SECH() Returns the hyperbolic secant of an angle - CSC() Returns the cosecant of an angle - CSCH() Returns the hyperbolic cosecant of an angle - COT() Returns the cotangent of an angle - COTH() Returns the hyperbolic cotangent of an angle - ACOT() Returns the cotangent of an angle - ACOTH() Returns the hyperbolic cotangent of an angle - Financial Functions - PDURATION() Calculates the number of periods required for an investment to reach a specified value - RRI() Calculates the interest rate required for an investment to grow to a specified future value
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);
2020-04-27 10:28:36 +00:00
self::assertEqualsWithDelta($expectedResult, $result, 1E-8);
Add further new Functions introduced in MS Excel 2013 and 2016 (#608) - Fix ISFORMULA() function to work with a cell reference to another worksheet - Added calculation engine support for the new functions that were added in MS Excel 2013 and MS Excel 2016 - Text Functions - CONCAT() Synonym for CONCATENATE() - NUMBERVALUE() Converts text to a number, in a locale-independent way - UNICHAR() Synonym for CHAR() in PHPSpreadsheet, which has always used UTF-8 internally - UNIORD() Synonym for ORD() in PHPSpreadsheet, which has always used UTF-8 internally - TEXTJOIN() Joins together two or more text strings, separated by a delimiter - Logical Functions - XOR() Returns a logical Exclusive Or of all arguments - Date/Time Functions - ISOWEEKNUM() Returns the ISO 8601 week number of the year for a given date - Lookup and Reference Functions - FORMULATEXT() Returns a formula as a string - Engineering Functions - ERF.PRECISE() Returns the error function integrated between 0 and a supplied limit - ERFC.PRECISE() Synonym for ERFC - Math and Trig Functions - SEC() Returns the secant of an angle - SECH() Returns the hyperbolic secant of an angle - CSC() Returns the cosecant of an angle - CSCH() Returns the hyperbolic cosecant of an angle - COT() Returns the cotangent of an angle - COTH() Returns the hyperbolic cotangent of an angle - ACOT() Returns the cotangent of an angle - ACOTH() Returns the hyperbolic cotangent of an angle - Financial Functions - PDURATION() Calculates the number of periods required for an investment to reach a specified value - RRI() Calculates the interest rate required for an investment to grow to a specified future value
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
*
* @param mixed $expectedResult
2012-07-31 20:56:11 +00:00
*/
public function testRATE($expectedResult, ...$args)
2015-05-17 13:00:02 +00:00
{
$this->markTestIncomplete('TODO: This test should be fixed');
$result = Financial::RATE(...$args);
2020-04-27 10:28:36 +00:00
self::assertEqualsWithDelta($expectedResult, $result, 1E-8);
2015-05-17 13:00:02 +00:00
}
2012-07-31 20:56:11 +00:00
public function providerRATE()
{
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
*
* @param mixed $expectedResult
* @param mixed $message
2012-07-31 20:56:11 +00:00
*/
public function testXIRR($expectedResult, $message, ...$args)
2015-05-17 13:00:02 +00:00
{
$result = Financial::XIRR(...$args);
2020-04-27 10:28:36 +00:00
self::assertEqualsWithDelta($expectedResult, $result, Financial::FINANCIAL_PRECISION, $message);
2015-05-17 13:00:02 +00:00
}
2012-07-31 20:56:11 +00:00
public function providerXIRR()
{
return require 'data/Calculation/Financial/XIRR.php';
2015-05-17 13:00:02 +00:00
}
Add further new Functions introduced in MS Excel 2013 and 2016 (#608) - Fix ISFORMULA() function to work with a cell reference to another worksheet - Added calculation engine support for the new functions that were added in MS Excel 2013 and MS Excel 2016 - Text Functions - CONCAT() Synonym for CONCATENATE() - NUMBERVALUE() Converts text to a number, in a locale-independent way - UNICHAR() Synonym for CHAR() in PHPSpreadsheet, which has always used UTF-8 internally - UNIORD() Synonym for ORD() in PHPSpreadsheet, which has always used UTF-8 internally - TEXTJOIN() Joins together two or more text strings, separated by a delimiter - Logical Functions - XOR() Returns a logical Exclusive Or of all arguments - Date/Time Functions - ISOWEEKNUM() Returns the ISO 8601 week number of the year for a given date - Lookup and Reference Functions - FORMULATEXT() Returns a formula as a string - Engineering Functions - ERF.PRECISE() Returns the error function integrated between 0 and a supplied limit - ERFC.PRECISE() Synonym for ERFC - Math and Trig Functions - SEC() Returns the secant of an angle - SECH() Returns the hyperbolic secant of an angle - CSC() Returns the cosecant of an angle - CSCH() Returns the hyperbolic cosecant of an angle - COT() Returns the cotangent of an angle - COTH() Returns the hyperbolic cotangent of an angle - ACOT() Returns the cotangent of an angle - ACOTH() Returns the hyperbolic cotangent of an angle - Financial Functions - PDURATION() Calculates the number of periods required for an investment to reach a specified value - RRI() Calculates the interest rate required for an investment to grow to a specified future value
2018-07-22 18:17:04 +00:00
/**
* @dataProvider providerPDURATION
*
* @param mixed $expectedResult
*/
public function testPDURATION($expectedResult, array $args)
{
$result = Financial::PDURATION(...$args);
2020-04-27 10:28:36 +00:00
self::assertEqualsWithDelta($expectedResult, $result, 1E-8);
Add further new Functions introduced in MS Excel 2013 and 2016 (#608) - Fix ISFORMULA() function to work with a cell reference to another worksheet - Added calculation engine support for the new functions that were added in MS Excel 2013 and MS Excel 2016 - Text Functions - CONCAT() Synonym for CONCATENATE() - NUMBERVALUE() Converts text to a number, in a locale-independent way - UNICHAR() Synonym for CHAR() in PHPSpreadsheet, which has always used UTF-8 internally - UNIORD() Synonym for ORD() in PHPSpreadsheet, which has always used UTF-8 internally - TEXTJOIN() Joins together two or more text strings, separated by a delimiter - Logical Functions - XOR() Returns a logical Exclusive Or of all arguments - Date/Time Functions - ISOWEEKNUM() Returns the ISO 8601 week number of the year for a given date - Lookup and Reference Functions - FORMULATEXT() Returns a formula as a string - Engineering Functions - ERF.PRECISE() Returns the error function integrated between 0 and a supplied limit - ERFC.PRECISE() Synonym for ERFC - Math and Trig Functions - SEC() Returns the secant of an angle - SECH() Returns the hyperbolic secant of an angle - CSC() Returns the cosecant of an angle - CSCH() Returns the hyperbolic cosecant of an angle - COT() Returns the cotangent of an angle - COTH() Returns the hyperbolic cotangent of an angle - ACOT() Returns the cotangent of an angle - ACOTH() Returns the hyperbolic cotangent of an angle - Financial Functions - PDURATION() Calculates the number of periods required for an investment to reach a specified value - RRI() Calculates the interest rate required for an investment to grow to a specified future value
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);
2020-04-27 10:28:36 +00:00
self::assertEqualsWithDelta($expectedResult, $result, 1E-8);
Add further new Functions introduced in MS Excel 2013 and 2016 (#608) - Fix ISFORMULA() function to work with a cell reference to another worksheet - Added calculation engine support for the new functions that were added in MS Excel 2013 and MS Excel 2016 - Text Functions - CONCAT() Synonym for CONCATENATE() - NUMBERVALUE() Converts text to a number, in a locale-independent way - UNICHAR() Synonym for CHAR() in PHPSpreadsheet, which has always used UTF-8 internally - UNIORD() Synonym for ORD() in PHPSpreadsheet, which has always used UTF-8 internally - TEXTJOIN() Joins together two or more text strings, separated by a delimiter - Logical Functions - XOR() Returns a logical Exclusive Or of all arguments - Date/Time Functions - ISOWEEKNUM() Returns the ISO 8601 week number of the year for a given date - Lookup and Reference Functions - FORMULATEXT() Returns a formula as a string - Engineering Functions - ERF.PRECISE() Returns the error function integrated between 0 and a supplied limit - ERFC.PRECISE() Synonym for ERFC - Math and Trig Functions - SEC() Returns the secant of an angle - SECH() Returns the hyperbolic secant of an angle - CSC() Returns the cosecant of an angle - CSCH() Returns the hyperbolic cosecant of an angle - COT() Returns the cotangent of an angle - COTH() Returns the hyperbolic cotangent of an angle - ACOT() Returns the cotangent of an angle - ACOTH() Returns the hyperbolic cotangent of an angle - Financial Functions - PDURATION() Calculates the number of periods required for an investment to reach a specified value - RRI() Calculates the interest rate required for an investment to grow to a specified future value
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);
2020-04-27 10:28:36 +00:00
self::assertEqualsWithDelta($expectedResult, $result, 1E-8);
Add further new Functions introduced in MS Excel 2013 and 2016 (#608) - Fix ISFORMULA() function to work with a cell reference to another worksheet - Added calculation engine support for the new functions that were added in MS Excel 2013 and MS Excel 2016 - Text Functions - CONCAT() Synonym for CONCATENATE() - NUMBERVALUE() Converts text to a number, in a locale-independent way - UNICHAR() Synonym for CHAR() in PHPSpreadsheet, which has always used UTF-8 internally - UNIORD() Synonym for ORD() in PHPSpreadsheet, which has always used UTF-8 internally - TEXTJOIN() Joins together two or more text strings, separated by a delimiter - Logical Functions - XOR() Returns a logical Exclusive Or of all arguments - Date/Time Functions - ISOWEEKNUM() Returns the ISO 8601 week number of the year for a given date - Lookup and Reference Functions - FORMULATEXT() Returns a formula as a string - Engineering Functions - ERF.PRECISE() Returns the error function integrated between 0 and a supplied limit - ERFC.PRECISE() Synonym for ERFC - Math and Trig Functions - SEC() Returns the secant of an angle - SECH() Returns the hyperbolic secant of an angle - CSC() Returns the cosecant of an angle - CSCH() Returns the hyperbolic cosecant of an angle - COT() Returns the cotangent of an angle - COTH() Returns the hyperbolic cotangent of an angle - ACOT() Returns the cotangent of an angle - ACOTH() Returns the hyperbolic cotangent of an angle - Financial Functions - PDURATION() Calculates the number of periods required for an investment to reach a specified value - RRI() Calculates the interest rate required for an investment to grow to a specified future value
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);
2020-04-27 10:28:36 +00:00
self::assertEqualsWithDelta($expectedResult, $result, 1E-8);
Add further new Functions introduced in MS Excel 2013 and 2016 (#608) - Fix ISFORMULA() function to work with a cell reference to another worksheet - Added calculation engine support for the new functions that were added in MS Excel 2013 and MS Excel 2016 - Text Functions - CONCAT() Synonym for CONCATENATE() - NUMBERVALUE() Converts text to a number, in a locale-independent way - UNICHAR() Synonym for CHAR() in PHPSpreadsheet, which has always used UTF-8 internally - UNIORD() Synonym for ORD() in PHPSpreadsheet, which has always used UTF-8 internally - TEXTJOIN() Joins together two or more text strings, separated by a delimiter - Logical Functions - XOR() Returns a logical Exclusive Or of all arguments - Date/Time Functions - ISOWEEKNUM() Returns the ISO 8601 week number of the year for a given date - Lookup and Reference Functions - FORMULATEXT() Returns a formula as a string - Engineering Functions - ERF.PRECISE() Returns the error function integrated between 0 and a supplied limit - ERFC.PRECISE() Synonym for ERFC - Math and Trig Functions - SEC() Returns the secant of an angle - SECH() Returns the hyperbolic secant of an angle - CSC() Returns the cosecant of an angle - CSCH() Returns the hyperbolic cosecant of an angle - COT() Returns the cotangent of an angle - COTH() Returns the hyperbolic cotangent of an angle - ACOT() Returns the cotangent of an angle - ACOTH() Returns the hyperbolic cotangent of an angle - Financial Functions - PDURATION() Calculates the number of periods required for an investment to reach a specified value - RRI() Calculates the interest rate required for an investment to grow to a specified future value
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
}