From 342ffb629b89de0e8827d8e03880bd023fe4d378 Mon Sep 17 00:00:00 2001 From: Mark Baker Date: Tue, 23 Jul 2019 00:50:30 +0200 Subject: [PATCH] Refactoring of math trig tests (#1102) * Merge branch 'master' of C:\Projects\PHPOffice\PHPSpreadsheet\develop with conflicts. * First pass at moving MathTrig tests into individual test files * Appeasement to the great goddess PHPCS * Appeasement to the great goddess PHPCS * Minor scrutinizer issue resolved * More refactoring of tests into individual test files fr each math/trig function * More work on the math/trig test refactoring, plus a bit of tidyup of date/time tests as well * Fix test * Fix docblock in test * Finish refactoring Math/Trig tests into separate files * Fix SubTotal Test * Import additional classes for SubTotal test --- .../Functions/DateTime/DateDifTest.php | 7 +- .../Functions/DateTime/DateTest.php | 7 +- .../Functions/DateTime/DateValueTest.php | 5 +- .../Functions/DateTime/DayTest.php | 7 +- .../Functions/DateTime/Days360Test.php | 7 +- .../Functions/DateTime/DaysTest.php | 6 +- .../Functions/DateTime/EDateTest.php | 6 +- .../Functions/DateTime/EoMonthTest.php | 6 +- .../Functions/MathTrig/AcotTest.php | 32 + .../Functions/MathTrig/AcothTest.php | 32 + .../Functions/MathTrig/Atan2Test.php | 33 + .../Functions/MathTrig/CeilingTest.php | 31 + .../Functions/MathTrig/CombinTest.php | 31 + .../Functions/MathTrig/CotTest.php | 32 + .../Functions/MathTrig/CothTest.php | 32 + .../Functions/MathTrig/CscTest.php | 32 + .../Functions/MathTrig/CschTest.php | 32 + .../Functions/MathTrig/EvenTest.php | 31 + .../Functions/MathTrig/FactDoubleTest.php | 31 + .../Functions/MathTrig/FactTest.php | 31 + .../Functions/MathTrig/FloorTest.php | 31 + .../Functions/MathTrig/GcdTest.php | 31 + .../Functions/MathTrig/IntTest.php | 31 + .../Functions/MathTrig/LcmTest.php | 31 + .../Functions/MathTrig/LogTest.php | 31 + .../Functions/MathTrig/MInverseTest.php | 31 + .../Functions/MathTrig/MMultTest.php | 31 + .../Functions/MathTrig/MRoundTest.php | 31 + .../Functions/MathTrig/MdeTermTest.php | 31 + .../Functions/MathTrig/ModTest.php | 31 + .../Functions/MathTrig/MultinomialTest.php | 31 + .../Functions/MathTrig/OddTest.php | 31 + .../Functions/MathTrig/PowerTest.php | 31 + .../Functions/MathTrig/ProductTest.php | 31 + .../Functions/MathTrig/QuotientTest.php | 31 + .../Functions/MathTrig/RomanTest.php | 31 + .../Functions/MathTrig/RoundDownTest.php | 31 + .../Functions/MathTrig/RoundUpTest.php | 31 + .../Functions/MathTrig/SecTest.php | 32 + .../Functions/MathTrig/SechTest.php | 32 + .../Functions/MathTrig/SeriesSumTest.php | 31 + .../Functions/MathTrig/SignTest.php | 31 + .../Functions/MathTrig/SqrtPiTest.php | 31 + .../Functions/MathTrig/SubTotalTest.php | 198 ++++ .../Functions/MathTrig/SumIfTest.php | 31 + .../Functions/MathTrig/SumIfsTest.php | 31 + .../Functions/MathTrig/SumProductTest.php | 31 + .../Functions/MathTrig/SumSqTest.php | 31 + .../Functions/MathTrig/SumX2MY2Test.php | 31 + .../Functions/MathTrig/SumX2PY2Test.php | 31 + .../Functions/MathTrig/SumXMY2Test.php | 31 + .../Functions/MathTrig/TruncTest.php | 31 + .../Calculation/MathTrigTest.php | 893 ------------------ tests/data/Calculation/DateTime/DATEDIF.php | 408 ++------ tests/data/Calculation/DateTime/DAY.php | 4 +- tests/data/Calculation/DateTime/DAYS.php | 57 +- tests/data/Calculation/DateTime/DAYS360.php | 136 +-- tests/data/Calculation/DateTime/EDATE.php | 45 +- tests/data/Calculation/DateTime/EOMONTH.php | 51 +- tests/data/Calculation/MathTrig/ATAN2.php | 48 +- 60 files changed, 1780 insertions(+), 1454 deletions(-) create mode 100644 tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/AcotTest.php create mode 100644 tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/AcothTest.php create mode 100644 tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/Atan2Test.php create mode 100644 tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/CeilingTest.php create mode 100644 tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/CombinTest.php create mode 100644 tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/CotTest.php create mode 100644 tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/CothTest.php create mode 100644 tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/CscTest.php create mode 100644 tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/CschTest.php create mode 100644 tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/EvenTest.php create mode 100644 tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/FactDoubleTest.php create mode 100644 tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/FactTest.php create mode 100644 tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/FloorTest.php create mode 100644 tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/GcdTest.php create mode 100644 tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/IntTest.php create mode 100644 tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/LcmTest.php create mode 100644 tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/LogTest.php create mode 100644 tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/MInverseTest.php create mode 100644 tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/MMultTest.php create mode 100644 tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/MRoundTest.php create mode 100644 tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/MdeTermTest.php create mode 100644 tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/ModTest.php create mode 100644 tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/MultinomialTest.php create mode 100644 tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/OddTest.php create mode 100644 tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/PowerTest.php create mode 100644 tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/ProductTest.php create mode 100644 tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/QuotientTest.php create mode 100644 tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/RomanTest.php create mode 100644 tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/RoundDownTest.php create mode 100644 tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/RoundUpTest.php create mode 100644 tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/SecTest.php create mode 100644 tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/SechTest.php create mode 100644 tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/SeriesSumTest.php create mode 100644 tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/SignTest.php create mode 100644 tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/SqrtPiTest.php create mode 100644 tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/SubTotalTest.php create mode 100644 tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/SumIfTest.php create mode 100644 tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/SumIfsTest.php create mode 100644 tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/SumProductTest.php create mode 100644 tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/SumSqTest.php create mode 100644 tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/SumX2MY2Test.php create mode 100644 tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/SumX2PY2Test.php create mode 100644 tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/SumXMY2Test.php create mode 100644 tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/TruncTest.php delete mode 100644 tests/PhpSpreadsheetTests/Calculation/MathTrigTest.php diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/DateTime/DateDifTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/DateTime/DateDifTest.php index f221903c..9c61dcc9 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/DateTime/DateDifTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/DateTime/DateDifTest.php @@ -20,10 +20,13 @@ class DateDifTest extends TestCase * @dataProvider providerDATEDIF * * @param mixed $expectedResult + * @param $startDate + * @param $endDate + * @param $unit */ - public function testDATEDIF($expectedResult, ...$args) + public function testDATEDIF($expectedResult, $startDate, $endDate, $unit) { - $result = DateTime::DATEDIF(...$args); + $result = DateTime::DATEDIF($startDate, $endDate, $unit); $this->assertEquals($expectedResult, $result, '', 1E-8); } diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/DateTime/DateTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/DateTime/DateTest.php index ce27e564..08587336 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/DateTime/DateTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/DateTime/DateTest.php @@ -20,10 +20,13 @@ class DateTest extends TestCase * @dataProvider providerDATE * * @param mixed $expectedResult + * @param $year + * @param $month + * @param $day */ - public function testDATE($expectedResult, ...$args) + public function testDATE($expectedResult, $year, $month, $day) { - $result = DateTime::DATE(...$args); + $result = DateTime::DATE($year, $month, $day); $this->assertEquals($expectedResult, $result, '', 1E-8); } diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/DateTime/DateValueTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/DateTime/DateValueTest.php index 0064815a..937fc10a 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/DateTime/DateValueTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/DateTime/DateValueTest.php @@ -20,10 +20,11 @@ class DateValueTest extends TestCase * @dataProvider providerDATEVALUE * * @param mixed $expectedResult + * @param $dateValue */ - public function testDATEVALUE($expectedResult, ...$args) + public function testDATEVALUE($expectedResult, $dateValue) { - $result = DateTime::DATEVALUE(...$args); + $result = DateTime::DATEVALUE($dateValue); $this->assertEquals($expectedResult, $result, '', 1E-8); } diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/DateTime/DayTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/DateTime/DayTest.php index 732582a0..48dd72c1 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/DateTime/DayTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/DateTime/DayTest.php @@ -21,15 +21,16 @@ class DayTest extends TestCase * * @param mixed $expectedResultExcel * @param mixed $expectedResultOpenOffice + * @param $dateValue */ - public function testDAY($expectedResultExcel, $expectedResultOpenOffice, ...$args) + public function testDAY($expectedResultExcel, $expectedResultOpenOffice, $dateValue) { - $resultExcel = DateTime::DAYOFMONTH(...$args); + $resultExcel = DateTime::DAYOFMONTH($dateValue); $this->assertEquals($expectedResultExcel, $resultExcel, '', 1E-8); Functions::setCompatibilityMode(Functions::COMPATIBILITY_OPENOFFICE); - $resultOpenOffice = DateTime::DAYOFMONTH(...$args); + $resultOpenOffice = DateTime::DAYOFMONTH($dateValue); $this->assertEquals($expectedResultOpenOffice, $resultOpenOffice, '', 1E-8); } diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/DateTime/Days360Test.php b/tests/PhpSpreadsheetTests/Calculation/Functions/DateTime/Days360Test.php index e256316e..ec067aca 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/DateTime/Days360Test.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/DateTime/Days360Test.php @@ -20,10 +20,13 @@ class Days360Test extends TestCase * @dataProvider providerDAYS360 * * @param mixed $expectedResult + * @param $startDate + * @param $endDate + * @param $method */ - public function testDAYS360($expectedResult, ...$args) + public function testDAYS360($expectedResult, $startDate, $endDate, $method) { - $result = DateTime::DAYS360(...$args); + $result = DateTime::DAYS360($startDate, $endDate, $method); $this->assertEquals($expectedResult, $result, '', 1E-8); } diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/DateTime/DaysTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/DateTime/DaysTest.php index 1b45d49d..6e63b1db 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/DateTime/DaysTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/DateTime/DaysTest.php @@ -20,10 +20,12 @@ class DaysTest extends TestCase * @dataProvider providerDAYS * * @param mixed $expectedResult + * @param $endDate + * @param $startDate */ - public function testDAYS($expectedResult, ...$args) + public function testDAYS($expectedResult, $endDate, $startDate) { - $result = DateTime::DAYS(...$args); + $result = DateTime::DAYS($endDate, $startDate); $this->assertEquals($expectedResult, $result, '', 1E-8); } diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/DateTime/EDateTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/DateTime/EDateTest.php index 60678794..74c4a388 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/DateTime/EDateTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/DateTime/EDateTest.php @@ -20,10 +20,12 @@ class EDateTest extends TestCase * @dataProvider providerEDATE * * @param mixed $expectedResult + * @param $dateValue + * @param $adjustmentMonths */ - public function testEDATE($expectedResult, ...$args) + public function testEDATE($expectedResult, $dateValue, $adjustmentMonths) { - $result = DateTime::EDATE(...$args); + $result = DateTime::EDATE($dateValue, $adjustmentMonths); $this->assertEquals($expectedResult, $result, '', 1E-8); } diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/DateTime/EoMonthTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/DateTime/EoMonthTest.php index 7c66733e..edb9d7ed 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/DateTime/EoMonthTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/DateTime/EoMonthTest.php @@ -20,10 +20,12 @@ class EoMonthTest extends TestCase * @dataProvider providerEOMONTH * * @param mixed $expectedResult + * @param $dateValue + * @param $adjustmentMonths */ - public function testEOMONTH($expectedResult, ...$args) + public function testEOMONTH($expectedResult, $dateValue, $adjustmentMonths) { - $result = DateTime::EOMONTH(...$args); + $result = DateTime::EOMONTH($dateValue, $adjustmentMonths); $this->assertEquals($expectedResult, $result, '', 1E-8); } diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/AcotTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/AcotTest.php new file mode 100644 index 00000000..898c1939 --- /dev/null +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/AcotTest.php @@ -0,0 +1,32 @@ +assertEquals($expectedResult, $result, '', 1E-12); + } + + public function providerACOT() + { + return require 'data/Calculation/MathTrig/ACOT.php'; + } +} diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/AcothTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/AcothTest.php new file mode 100644 index 00000000..abc899b3 --- /dev/null +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/AcothTest.php @@ -0,0 +1,32 @@ +assertEquals($expectedResult, $result, '', 1E-12); + } + + public function providerACOTH() + { + return require 'data/Calculation/MathTrig/ACOTH.php'; + } +} diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/Atan2Test.php b/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/Atan2Test.php new file mode 100644 index 00000000..db11c89c --- /dev/null +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/Atan2Test.php @@ -0,0 +1,33 @@ +assertEquals($expectedResult, $result, '', 1E-12); + } + + public function providerATAN2() + { + return require 'data/Calculation/MathTrig/ATAN2.php'; + } +} diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/CeilingTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/CeilingTest.php new file mode 100644 index 00000000..ec0b32e0 --- /dev/null +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/CeilingTest.php @@ -0,0 +1,31 @@ +assertEquals($expectedResult, $result, '', 1E-12); + } + + public function providerCEILING() + { + return require 'data/Calculation/MathTrig/CEILING.php'; + } +} diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/CombinTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/CombinTest.php new file mode 100644 index 00000000..7d1002a2 --- /dev/null +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/CombinTest.php @@ -0,0 +1,31 @@ +assertEquals($expectedResult, $result, '', 1E-12); + } + + public function providerCOMBIN() + { + return require 'data/Calculation/MathTrig/COMBIN.php'; + } +} diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/CotTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/CotTest.php new file mode 100644 index 00000000..cd524725 --- /dev/null +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/CotTest.php @@ -0,0 +1,32 @@ +assertEquals($expectedResult, $result, '', 1E-12); + } + + public function providerCOT() + { + return require 'data/Calculation/MathTrig/COT.php'; + } +} diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/CothTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/CothTest.php new file mode 100644 index 00000000..2ed5515d --- /dev/null +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/CothTest.php @@ -0,0 +1,32 @@ +assertEquals($expectedResult, $result, '', 1E-12); + } + + public function providerCOTH() + { + return require 'data/Calculation/MathTrig/COTH.php'; + } +} diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/CscTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/CscTest.php new file mode 100644 index 00000000..f84415a3 --- /dev/null +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/CscTest.php @@ -0,0 +1,32 @@ +assertEquals($expectedResult, $result, '', 1E-12); + } + + public function providerCSC() + { + return require 'data/Calculation/MathTrig/CSC.php'; + } +} diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/CschTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/CschTest.php new file mode 100644 index 00000000..98b02f3a --- /dev/null +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/CschTest.php @@ -0,0 +1,32 @@ +assertEquals($expectedResult, $result, '', 1E-12); + } + + public function providerCSCH() + { + return require 'data/Calculation/MathTrig/CSCH.php'; + } +} diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/EvenTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/EvenTest.php new file mode 100644 index 00000000..7327ac96 --- /dev/null +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/EvenTest.php @@ -0,0 +1,31 @@ +assertEquals($expectedResult, $result, '', 1E-12); + } + + public function providerEVEN() + { + return require 'data/Calculation/MathTrig/EVEN.php'; + } +} diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/FactDoubleTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/FactDoubleTest.php new file mode 100644 index 00000000..9dd381d8 --- /dev/null +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/FactDoubleTest.php @@ -0,0 +1,31 @@ +assertEquals($expectedResult, $result, '', 1E-12); + } + + public function providerFACTDOUBLE() + { + return require 'data/Calculation/MathTrig/FACTDOUBLE.php'; + } +} diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/FactTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/FactTest.php new file mode 100644 index 00000000..0270c493 --- /dev/null +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/FactTest.php @@ -0,0 +1,31 @@ +assertEquals($expectedResult, $result, '', 1E-12); + } + + public function providerFACT() + { + return require 'data/Calculation/MathTrig/FACT.php'; + } +} diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/FloorTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/FloorTest.php new file mode 100644 index 00000000..e43ba3d1 --- /dev/null +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/FloorTest.php @@ -0,0 +1,31 @@ +assertEquals($expectedResult, $result, '', 1E-12); + } + + public function providerFLOOR() + { + return require 'data/Calculation/MathTrig/FLOOR.php'; + } +} diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/GcdTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/GcdTest.php new file mode 100644 index 00000000..d066f405 --- /dev/null +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/GcdTest.php @@ -0,0 +1,31 @@ +assertEquals($expectedResult, $result, '', 1E-12); + } + + public function providerGCD() + { + return require 'data/Calculation/MathTrig/GCD.php'; + } +} diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/IntTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/IntTest.php new file mode 100644 index 00000000..8754dbef --- /dev/null +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/IntTest.php @@ -0,0 +1,31 @@ +assertEquals($expectedResult, $result); + } + + public function providerINT() + { + return require 'data/Calculation/MathTrig/INT.php'; + } +} diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/LcmTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/LcmTest.php new file mode 100644 index 00000000..6be79feb --- /dev/null +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/LcmTest.php @@ -0,0 +1,31 @@ +assertEquals($expectedResult, $result, '', 1E-12); + } + + public function providerLCM() + { + return require 'data/Calculation/MathTrig/LCM.php'; + } +} diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/LogTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/LogTest.php new file mode 100644 index 00000000..eccec454 --- /dev/null +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/LogTest.php @@ -0,0 +1,31 @@ +assertEquals($expectedResult, $result, '', 1E-12); + } + + public function providerLOG() + { + return require 'data/Calculation/MathTrig/LOG.php'; + } +} diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/MInverseTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/MInverseTest.php new file mode 100644 index 00000000..d61ceaf8 --- /dev/null +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/MInverseTest.php @@ -0,0 +1,31 @@ +assertEquals($expectedResult, $result, '', 1E-8); + } + + public function providerMINVERSE() + { + return require 'data/Calculation/MathTrig/MINVERSE.php'; + } +} diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/MMultTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/MMultTest.php new file mode 100644 index 00000000..1e2d65b7 --- /dev/null +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/MMultTest.php @@ -0,0 +1,31 @@ +assertEquals($expectedResult, $result, '', 1E-8); + } + + public function providerMMULT() + { + return require 'data/Calculation/MathTrig/MMULT.php'; + } +} diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/MRoundTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/MRoundTest.php new file mode 100644 index 00000000..c02e70ba --- /dev/null +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/MRoundTest.php @@ -0,0 +1,31 @@ +assertEquals($expectedResult, $result, '', 1E-12); + } + + public function providerMROUND() + { + return require 'data/Calculation/MathTrig/MROUND.php'; + } +} diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/MdeTermTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/MdeTermTest.php new file mode 100644 index 00000000..4b2d3279 --- /dev/null +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/MdeTermTest.php @@ -0,0 +1,31 @@ +assertEquals($expectedResult, $result, '', 1E-12); + } + + public function providerMDETERM() + { + return require 'data/Calculation/MathTrig/MDETERM.php'; + } +} diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/ModTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/ModTest.php new file mode 100644 index 00000000..fa60000e --- /dev/null +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/ModTest.php @@ -0,0 +1,31 @@ +assertEquals($expectedResult, $result, '', 1E-12); + } + + public function providerMOD() + { + return require 'data/Calculation/MathTrig/MOD.php'; + } +} diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/MultinomialTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/MultinomialTest.php new file mode 100644 index 00000000..3c8d1916 --- /dev/null +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/MultinomialTest.php @@ -0,0 +1,31 @@ +assertEquals($expectedResult, $result, '', 1E-12); + } + + public function providerMULTINOMIAL() + { + return require 'data/Calculation/MathTrig/MULTINOMIAL.php'; + } +} diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/OddTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/OddTest.php new file mode 100644 index 00000000..0f2fbb4d --- /dev/null +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/OddTest.php @@ -0,0 +1,31 @@ +assertEquals($expectedResult, $result, '', 1E-12); + } + + public function providerODD() + { + return require 'data/Calculation/MathTrig/ODD.php'; + } +} diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/PowerTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/PowerTest.php new file mode 100644 index 00000000..7d86ebf8 --- /dev/null +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/PowerTest.php @@ -0,0 +1,31 @@ +assertEquals($expectedResult, $result, '', 1E-12); + } + + public function providerPOWER() + { + return require 'data/Calculation/MathTrig/POWER.php'; + } +} diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/ProductTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/ProductTest.php new file mode 100644 index 00000000..bd99fd0e --- /dev/null +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/ProductTest.php @@ -0,0 +1,31 @@ +assertEquals($expectedResult, $result, '', 1E-12); + } + + public function providerPRODUCT() + { + return require 'data/Calculation/MathTrig/PRODUCT.php'; + } +} diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/QuotientTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/QuotientTest.php new file mode 100644 index 00000000..ac96f079 --- /dev/null +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/QuotientTest.php @@ -0,0 +1,31 @@ +assertEquals($expectedResult, $result, '', 1E-12); + } + + public function providerQUOTIENT() + { + return require 'data/Calculation/MathTrig/QUOTIENT.php'; + } +} diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/RomanTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/RomanTest.php new file mode 100644 index 00000000..6a09e458 --- /dev/null +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/RomanTest.php @@ -0,0 +1,31 @@ +assertEquals($expectedResult, $result); + } + + public function providerROMAN() + { + return require 'data/Calculation/MathTrig/ROMAN.php'; + } +} diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/RoundDownTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/RoundDownTest.php new file mode 100644 index 00000000..a3368827 --- /dev/null +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/RoundDownTest.php @@ -0,0 +1,31 @@ +assertEquals($expectedResult, $result, '', 1E-12); + } + + public function providerROUNDDOWN() + { + return require 'data/Calculation/MathTrig/ROUNDDOWN.php'; + } +} diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/RoundUpTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/RoundUpTest.php new file mode 100644 index 00000000..ba36c776 --- /dev/null +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/RoundUpTest.php @@ -0,0 +1,31 @@ +assertEquals($expectedResult, $result, '', 1E-12); + } + + public function providerROUNDUP() + { + return require 'data/Calculation/MathTrig/ROUNDUP.php'; + } +} diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/SecTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/SecTest.php new file mode 100644 index 00000000..c2742346 --- /dev/null +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/SecTest.php @@ -0,0 +1,32 @@ +assertEquals($expectedResult, $result, '', 1E-12); + } + + public function providerSEC() + { + return require 'data/Calculation/MathTrig/SEC.php'; + } +} diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/SechTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/SechTest.php new file mode 100644 index 00000000..c9ff29bf --- /dev/null +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/SechTest.php @@ -0,0 +1,32 @@ +assertEquals($expectedResult, $result, '', 1E-12); + } + + public function providerSECH() + { + return require 'data/Calculation/MathTrig/SECH.php'; + } +} diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/SeriesSumTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/SeriesSumTest.php new file mode 100644 index 00000000..ef8ee62e --- /dev/null +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/SeriesSumTest.php @@ -0,0 +1,31 @@ +assertEquals($expectedResult, $result, '', 1E-12); + } + + public function providerSERIESSUM() + { + return require 'data/Calculation/MathTrig/SERIESSUM.php'; + } +} diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/SignTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/SignTest.php new file mode 100644 index 00000000..747a435c --- /dev/null +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/SignTest.php @@ -0,0 +1,31 @@ +assertEquals($expectedResult, $result, '', 1E-12); + } + + public function providerSIGN() + { + return require 'data/Calculation/MathTrig/SIGN.php'; + } +} diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/SqrtPiTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/SqrtPiTest.php new file mode 100644 index 00000000..18e12871 --- /dev/null +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/SqrtPiTest.php @@ -0,0 +1,31 @@ +assertEquals($expectedResult, $result, '', 1E-12); + } + + public function providerSQRTPI() + { + return require 'data/Calculation/MathTrig/SQRTPI.php'; + } +} diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/SubTotalTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/SubTotalTest.php new file mode 100644 index 00000000..a12984e7 --- /dev/null +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/SubTotalTest.php @@ -0,0 +1,198 @@ +getMockBuilder(Cell::class) + ->setMethods(['getValue', 'isFormula']) + ->disableOriginalConstructor() + ->getMock(); + $cell->method('getValue') + ->willReturn(null); + $cell->method('getValue') + ->willReturn(false); + $worksheet = $this->getMockBuilder(Worksheet::class) + ->setMethods(['cellExists', 'getCell']) + ->disableOriginalConstructor() + ->getMock(); + $worksheet->method('cellExists') + ->willReturn(true); + $worksheet->method('getCell') + ->willReturn($cell); + $cellReference = $this->getMockBuilder(Cell::class) + ->setMethods(['getWorksheet']) + ->disableOriginalConstructor() + ->getMock(); + $cellReference->method('getWorksheet') + ->willReturn($worksheet); + + array_push($args, $cellReference); + $result = MathTrig::SUBTOTAL(...$args); + $this->assertEquals($expectedResult, $result, '', 1E-12); + } + + public function providerSUBTOTAL() + { + return require 'data/Calculation/MathTrig/SUBTOTAL.php'; + } + + protected function rowVisibility() + { + $data = [1 => false, 2 => true, 3 => false, 4 => true, 5 => false, 6 => false, 7 => false, 8 => true, 9 => false, 10 => true, 11 => true]; + foreach ($data as $k => $v) { + yield $k => $v; + } + } + + /** + * @dataProvider providerHiddenSUBTOTAL + * + * @param mixed $expectedResult + */ + public function testHiddenSUBTOTAL($expectedResult, ...$args) + { + $visibilityGenerator = $this->rowVisibility(); + + $rowDimension = $this->getMockBuilder(RowDimension::class) + ->setMethods(['getVisible']) + ->disableOriginalConstructor() + ->getMock(); + $rowDimension->method('getVisible') + ->will($this->returnCallback(function () use ($visibilityGenerator) { + $result = $visibilityGenerator->current(); + $visibilityGenerator->next(); + + return $result; + })); + $columnDimension = $this->getMockBuilder(ColumnDimension::class) + ->setMethods(['getVisible']) + ->disableOriginalConstructor() + ->getMock(); + $columnDimension->method('getVisible') + ->willReturn(true); + $cell = $this->getMockBuilder(Cell::class) + ->setMethods(['getValue', 'isFormula']) + ->disableOriginalConstructor() + ->getMock(); + $cell->method('getValue') + ->willReturn(''); + $cell->method('getValue') + ->willReturn(false); + $worksheet = $this->getMockBuilder(Worksheet::class) + ->setMethods(['cellExists', 'getCell', 'getRowDimension', 'getColumnDimension']) + ->disableOriginalConstructor() + ->getMock(); + $worksheet->method('cellExists') + ->willReturn(true); + $worksheet->method('getCell') + ->willReturn($cell); + $worksheet->method('getRowDimension') + ->willReturn($rowDimension); + $worksheet->method('getColumnDimension') + ->willReturn($columnDimension); + $cellReference = $this->getMockBuilder(Cell::class) + ->setMethods(['getWorksheet']) + ->disableOriginalConstructor() + ->getMock(); + $cellReference->method('getWorksheet') + ->willReturn($worksheet); + + array_push($args, $cellReference); + $result = MathTrig::SUBTOTAL(...$args); + $this->assertEquals($expectedResult, $result, '', 1E-12); + } + + public function providerHiddenSUBTOTAL() + { + return require 'data/Calculation/MathTrig/SUBTOTALHIDDEN.php'; + } + + protected function cellValues(array $cellValues) + { + foreach ($cellValues as $k => $v) { + yield $k => $v; + } + } + + protected function cellIsFormula(array $cellValues) + { + foreach ($cellValues as $cellValue) { + yield $cellValue[0] === '='; + } + } + + /** + * @dataProvider providerNestedSUBTOTAL + * + * @param mixed $expectedResult + */ + public function testNestedSUBTOTAL($expectedResult, ...$args) + { + $cellValueGenerator = $this->cellValues(Functions::flattenArray(array_slice($args, 1))); + $cellIsFormulaGenerator = $this->cellIsFormula(Functions::flattenArray(array_slice($args, 1))); + + $cell = $this->getMockBuilder(Cell::class) + ->setMethods(['getValue', 'isFormula']) + ->disableOriginalConstructor() + ->getMock(); + $cell->method('getValue') + ->will($this->returnCallback(function () use ($cellValueGenerator) { + $result = $cellValueGenerator->current(); + $cellValueGenerator->next(); + + return $result; + })); + $cell->method('isFormula') + ->will($this->returnCallback(function () use ($cellIsFormulaGenerator) { + $result = $cellIsFormulaGenerator->current(); + $cellIsFormulaGenerator->next(); + + return $result; + })); + $worksheet = $this->getMockBuilder(Worksheet::class) + ->setMethods(['cellExists', 'getCell']) + ->disableOriginalConstructor() + ->getMock(); + $worksheet->method('cellExists') + ->willReturn(true); + $worksheet->method('getCell') + ->willReturn($cell); + $cellReference = $this->getMockBuilder(Cell::class) + ->setMethods(['getWorksheet']) + ->disableOriginalConstructor() + ->getMock(); + $cellReference->method('getWorksheet') + ->willReturn($worksheet); + + array_push($args, $cellReference); + + $result = MathTrig::SUBTOTAL(...$args); + $this->assertEquals($expectedResult, $result, '', 1E-12); + } + + public function providerNestedSUBTOTAL() + { + return require 'data/Calculation/MathTrig/SUBTOTALNESTED.php'; + } +} diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/SumIfTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/SumIfTest.php new file mode 100644 index 00000000..51755dc8 --- /dev/null +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/SumIfTest.php @@ -0,0 +1,31 @@ +assertEquals($expectedResult, $result, '', 1E-12); + } + + public function providerSUMIF() + { + return require 'data/Calculation/MathTrig/SUMIF.php'; + } +} diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/SumIfsTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/SumIfsTest.php new file mode 100644 index 00000000..9336cec8 --- /dev/null +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/SumIfsTest.php @@ -0,0 +1,31 @@ +assertEquals($expectedResult, $result, '', 1E-12); + } + + public function providerSUMIFS() + { + return require 'data/Calculation/MathTrig/SUMIFS.php'; + } +} diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/SumProductTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/SumProductTest.php new file mode 100644 index 00000000..13558661 --- /dev/null +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/SumProductTest.php @@ -0,0 +1,31 @@ +assertEquals($expectedResult, $result, '', 1E-12); + } + + public function providerSUMPRODUCT() + { + return require 'data/Calculation/MathTrig/SUMPRODUCT.php'; + } +} diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/SumSqTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/SumSqTest.php new file mode 100644 index 00000000..91c6ec15 --- /dev/null +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/SumSqTest.php @@ -0,0 +1,31 @@ +assertEquals($expectedResult, $result, '', 1E-12); + } + + public function providerSUMSQ() + { + return require 'data/Calculation/MathTrig/SUMSQ.php'; + } +} diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/SumX2MY2Test.php b/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/SumX2MY2Test.php new file mode 100644 index 00000000..b8904612 --- /dev/null +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/SumX2MY2Test.php @@ -0,0 +1,31 @@ +assertEquals($expectedResult, $result, '', 1E-12); + } + + public function providerSUMX2MY2() + { + return require 'data/Calculation/MathTrig/SUMX2MY2.php'; + } +} diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/SumX2PY2Test.php b/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/SumX2PY2Test.php new file mode 100644 index 00000000..ce016e6f --- /dev/null +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/SumX2PY2Test.php @@ -0,0 +1,31 @@ +assertEquals($expectedResult, $result, '', 1E-12); + } + + public function providerSUMX2PY2() + { + return require 'data/Calculation/MathTrig/SUMX2PY2.php'; + } +} diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/SumXMY2Test.php b/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/SumXMY2Test.php new file mode 100644 index 00000000..67e3c80d --- /dev/null +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/SumXMY2Test.php @@ -0,0 +1,31 @@ +assertEquals($expectedResult, $result, '', 1E-12); + } + + public function providerSUMXMY2() + { + return require 'data/Calculation/MathTrig/SUMXMY2.php'; + } +} diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/TruncTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/TruncTest.php new file mode 100644 index 00000000..fec38428 --- /dev/null +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/TruncTest.php @@ -0,0 +1,31 @@ +assertEquals($expectedResult, $result, '', 1E-12); + } + + public function providerTRUNC() + { + return require 'data/Calculation/MathTrig/TRUNC.php'; + } +} diff --git a/tests/PhpSpreadsheetTests/Calculation/MathTrigTest.php b/tests/PhpSpreadsheetTests/Calculation/MathTrigTest.php deleted file mode 100644 index 5b7e1f01..00000000 --- a/tests/PhpSpreadsheetTests/Calculation/MathTrigTest.php +++ /dev/null @@ -1,893 +0,0 @@ -getMockBuilder(Cell::class) - ->setMethods(['getValue']) - ->disableOriginalConstructor() - ->getMock(); - $cell->method('getValue') - ->willReturn(null); - $worksheet = $this->getMockBuilder(Worksheet::class) - ->setMethods(['cellExists', 'getCell']) - ->disableOriginalConstructor() - ->getMock(); - $worksheet->method('cellExists') - ->willReturn(true); - $worksheet->method('getCell') - ->willReturn($cell); - $cellReference = $this->getMockBuilder(Cell::class) - ->setMethods(['getWorksheet']) - ->disableOriginalConstructor() - ->getMock(); - $cellReference->method('getWorksheet') - ->willReturn($worksheet); - - array_push($args, $cellReference); - $result = MathTrig::SUBTOTAL(...$args); - self::assertEquals($expectedResult, $result, null, 1E-12); - } - - public function providerSUBTOTAL() - { - return require 'data/Calculation/MathTrig/SUBTOTAL.php'; - } - - protected function rowVisibility() - { - $data = [1 => false, 2 => true, 3 => false, 4 => true, 5 => false, 6 => false, 7 => false, 8 => true, 9 => false, 10 => true, 11 => true]; - foreach ($data as $k => $v) { - yield $k => $v; - } - } - - /** - * @dataProvider providerHiddenSUBTOTAL - * - * @param mixed $expectedResult - */ - public function testHiddenSUBTOTAL($expectedResult, ...$args) - { - $visibilityGenerator = $this->rowVisibility(); - - $rowDimension = $this->getMockBuilder(RowDimension::class) - ->setMethods(['getVisible']) - ->disableOriginalConstructor() - ->getMock(); - $rowDimension->method('getVisible') - ->will($this->returnCallback(function () use ($visibilityGenerator) { - $result = $visibilityGenerator->current(); - $visibilityGenerator->next(); - - return $result; - })); - $columnDimension = $this->getMockBuilder(ColumnDimension::class) - ->setMethods(['getVisible']) - ->disableOriginalConstructor() - ->getMock(); - $columnDimension->method('getVisible') - ->willReturn(true); - $cell = $this->getMockBuilder(Cell::class) - ->setMethods(['getValue']) - ->disableOriginalConstructor() - ->getMock(); - $cell->method('getValue') - ->willReturn(''); - $worksheet = $this->getMockBuilder(Worksheet::class) - ->setMethods(['cellExists', 'getCell', 'getRowDimension', 'getColumnDimension']) - ->disableOriginalConstructor() - ->getMock(); - $worksheet->method('cellExists') - ->willReturn(true); - $worksheet->method('getCell') - ->willReturn($cell); - $worksheet->method('getRowDimension') - ->willReturn($rowDimension); - $worksheet->method('getColumnDimension') - ->willReturn($columnDimension); - $cellReference = $this->getMockBuilder(Cell::class) - ->setMethods(['getWorksheet']) - ->disableOriginalConstructor() - ->getMock(); - $cellReference->method('getWorksheet') - ->willReturn($worksheet); - - array_push($args, $cellReference); - $result = MathTrig::SUBTOTAL(...$args); - self::assertEquals($expectedResult, $result, null, 1E-12); - } - - public function providerHiddenSUBTOTAL() - { - return require 'data/Calculation/MathTrig/SUBTOTALHIDDEN.php'; - } - - protected function cellValues(array $cellValues) - { - foreach ($cellValues as $k => $v) { - yield $k => $v; - } - } - - protected function cellIsFormula(array $cellValues) - { - foreach ($cellValues as $cellValue) { - yield $cellValue[0] === '='; - } - } - - /** - * @dataProvider providerNestedSUBTOTAL - * - * @param mixed $expectedResult - */ - public function testNestedSUBTOTAL($expectedResult, ...$args) - { - $cellValueGenerator = $this->cellValues(Functions::flattenArray(array_slice($args, 1))); - $cellIsFormulaGenerator = $this->cellIsFormula(Functions::flattenArray(array_slice($args, 1))); - - $cell = $this->getMockBuilder(Cell::class) - ->setMethods(['getValue', 'isFormula']) - ->disableOriginalConstructor() - ->getMock(); - $cell->method('getValue') - ->will($this->returnCallback(function () use ($cellValueGenerator) { - $result = $cellValueGenerator->current(); - $cellValueGenerator->next(); - - return $result; - })); - $cell->method('isFormula') - ->will($this->returnCallback(function () use ($cellIsFormulaGenerator) { - $result = $cellIsFormulaGenerator->current(); - $cellIsFormulaGenerator->next(); - - return $result; - })); - $worksheet = $this->getMockBuilder(Worksheet::class) - ->setMethods(['cellExists', 'getCell']) - ->disableOriginalConstructor() - ->getMock(); - $worksheet->method('cellExists') - ->willReturn(true); - $worksheet->method('getCell') - ->willReturn($cell); - $cellReference = $this->getMockBuilder(Cell::class) - ->setMethods(['getWorksheet']) - ->disableOriginalConstructor() - ->getMock(); - $cellReference->method('getWorksheet') - ->willReturn($worksheet); - - array_push($args, $cellReference); - - $result = MathTrig::SUBTOTAL(...$args); - self::assertEquals($expectedResult, $result, null, 1E-12); - } - - public function providerNestedSUBTOTAL() - { - return require 'data/Calculation/MathTrig/SUBTOTALNESTED.php'; - } - - /** - * @dataProvider providerSEC - * - * @param mixed $expectedResult - * @param mixed $angle - */ - public function testSEC($expectedResult, $angle) - { - $result = MathTrig::SEC($angle); - self::assertEquals($expectedResult, $result, null, 1E-12); - } - - public function providerSEC() - { - return require 'data/Calculation/MathTrig/SEC.php'; - } - - /** - * @dataProvider providerSECH - * - * @param mixed $expectedResult - * @param mixed $angle - */ - public function testSECH($expectedResult, $angle) - { - $result = MathTrig::SECH($angle); - self::assertEquals($expectedResult, $result, null, 1E-12); - } - - public function providerSECH() - { - return require 'data/Calculation/MathTrig/SECH.php'; - } - - /** - * @dataProvider providerCSC - * - * @param mixed $expectedResult - * @param mixed $angle - */ - public function testCSC($expectedResult, $angle) - { - $result = MathTrig::CSC($angle); - self::assertEquals($expectedResult, $result, null, 1E-12); - } - - public function providerCSC() - { - return require 'data/Calculation/MathTrig/CSC.php'; - } - - /** - * @dataProvider providerCSCH - * - * @param mixed $expectedResult - * @param mixed $angle - */ - public function testCSCH($expectedResult, $angle) - { - $result = MathTrig::CSCH($angle); - self::assertEquals($expectedResult, $result, null, 1E-12); - } - - public function providerCSCH() - { - return require 'data/Calculation/MathTrig/CSCH.php'; - } - - /** - * @dataProvider providerCOT - * - * @param mixed $expectedResult - * @param mixed $angle - */ - public function testCOT($expectedResult, $angle) - { - $result = MathTrig::COT($angle); - self::assertEquals($expectedResult, $result, null, 1E-12); - } - - public function providerCOT() - { - return require 'data/Calculation/MathTrig/COT.php'; - } - - /** - * @dataProvider providerCOTH - * - * @param mixed $expectedResult - * @param mixed $angle - */ - public function testCOTH($expectedResult, $angle) - { - $result = MathTrig::COTH($angle); - self::assertEquals($expectedResult, $result, null, 1E-12); - } - - public function providerCOTH() - { - return require 'data/Calculation/MathTrig/COTH.php'; - } - - /** - * @dataProvider providerACOT - * - * @param mixed $expectedResult - * @param mixed $number - */ - public function testACOT($expectedResult, $number) - { - $result = MathTrig::ACOT($number); - self::assertEquals($expectedResult, $result, null, 1E-12); - } - - public function providerACOT() - { - return require 'data/Calculation/MathTrig/ACOT.php'; - } - - /** - * @dataProvider providerACOTH - * - * @param mixed $expectedResult - * @param mixed $number - */ - public function testACOTH($expectedResult, $number) - { - $result = MathTrig::ACOTH($number); - self::assertEquals($expectedResult, $result, null, 1E-12); - } - - public function providerACOTH() - { - return require 'data/Calculation/MathTrig/ACOTH.php'; - } -} diff --git a/tests/data/Calculation/DateTime/DATEDIF.php b/tests/data/Calculation/DateTime/DATEDIF.php index e7910e3c..d113d3aa 100644 --- a/tests/data/Calculation/DateTime/DATEDIF.php +++ b/tests/data/Calculation/DateTime/DATEDIF.php @@ -3,614 +3,410 @@ return [ [ 365, - '2016-01-01', - '2016-12-31', - 'YD', + '2016-01-01', '2016-12-31', 'YD', ], [ 364, - '2015-01-01', - '2015-12-31', - 'YD', + '2015-01-01', '2015-12-31', 'YD', ], [ 364, - '2015-01-01', - '2016-12-31', - 'YD', + '2015-01-01', '2016-12-31', 'YD', ], [ 365, - '2016-01-01', - '2017-12-31', - 'YD', + '2016-01-01', '2017-12-31', 'YD', ], [ 364, - '2017-01-01', - '2018-12-31', - 'YD', + '2017-01-01', '2018-12-31', 'YD', ], [ '#VALUE!', - 'ABC', - '2007-1-10', - 'Y', + 'ABC', '2007-1-10', 'Y', ], [ '#VALUE!', - '2007-1-1', - 'DEF', - 'Y', + '2007-1-1', 'DEF', 'Y', ], [ '#VALUE!', - '2007-1-1', - '2007-1-10', - 'XYZ', + '2007-1-1', '2007-1-10', 'XYZ', ], [ '#NUM!', - '2007-1-10', - '2007-1-1', - 'Y', + '2007-1-10', '2007-1-1', 'Y', ], [ 0, - '2007-12-31', - '2008-1-10', - 'Y', + '2007-12-31', '2008-1-10', 'Y', ], [ 0, - '2007-1-1', - '2007-1-10', - 'Y', + '2007-1-1', '2007-1-10', 'Y', ], [ 0, - '2007-1-1', - '2007-1-10', - 'M', + '2007-1-1', '2007-1-10', 'M', ], [ 9, - '2007-1-1', - '2007-1-10', - 'D', + '2007-1-1', '2007-1-10', 'D', ], [ 0, - '2007-1-1', - '2007-1-10', - 'YM', + '2007-1-1', '2007-1-10', 'YM', ], [ 9, - '2007-1-1', - '2007-1-10', - 'YD', + '2007-1-1', '2007-1-10', 'YD', ], [ 9, - '2007-1-1', - '2007-1-10', - 'MD', + '2007-1-1', '2007-1-10', 'MD', ], [ 0, - '2007-1-1', - '2007-12-31', - 'Y', + '2007-1-1', '2007-12-31', 'Y', ], [ 11, - '2007-1-1', - '2007-12-31', - 'M', + '2007-1-1', '2007-12-31', 'M', ], [ 364, - '2007-1-1', - '2007-12-31', - 'D', + '2007-1-1', '2007-12-31', 'D', ], [ 11, - '2007-1-1', - '2007-12-31', - 'YM', + '2007-1-1', '2007-12-31', 'YM', ], [ 364, - '2007-1-1', - '2007-12-31', - 'YD', + '2007-1-1', '2007-12-31', 'YD', ], [ 30, - '2007-1-1', - '2007-12-31', - 'MD', + '2007-1-1', '2007-12-31', 'MD', ], [ 1, - '2007-1-1', - '2008-7-1', - 'Y', + '2007-1-1', '2008-7-1', 'Y', ], [ 18, - '2007-1-1', - '2008-7-1', - 'M', + '2007-1-1', '2008-7-1', 'M', ], [ 547, - '2007-1-1', - '2008-7-1', - 'D', + '2007-1-1', '2008-7-1', 'D', ], [ 6, - '2007-1-1', - '2008-7-1', - 'YM', + '2007-1-1', '2008-7-1', 'YM', ], [ 181, - '2007-1-1', - '2008-7-1', - 'YD', + '2007-1-1', '2008-7-1', 'YD', ], [ 0, - '2007-1-1', - '2008-7-1', - 'MD', + '2007-1-1', '2008-7-1', 'MD', ], [ 0, - '2007-1-1', - '2007-1-31', - 'Y', + '2007-1-1', '2007-1-31', 'Y', ], [ 0, - '2007-1-1', - '2007-1-31', - 'M', + '2007-1-1', '2007-1-31', 'M', ], [ 30, - '2007-1-1', - '2007-1-31', - 'D', + '2007-1-1', '2007-1-31', 'D', ], [ 0, - '2007-1-1', - '2007-1-31', - 'YM', + '2007-1-1', '2007-1-31', 'YM', ], [ 30, - '2007-1-1', - '2007-1-31', - 'YD', + '2007-1-1', '2007-1-31', 'YD', ], [ 30, - '2007-1-1', - '2007-1-31', - 'MD', + '2007-1-1', '2007-1-31', 'MD', ], [ 0, - '2007-1-1', - '2007-2-1', - 'Y', + '2007-1-1', '2007-2-1', 'Y', ], [ 1, - '2007-1-1', - '2007-2-1', - 'M', + '2007-1-1', '2007-2-1', 'M', ], [ 31, - '2007-1-1', - '2007-2-1', - 'D', + '2007-1-1', '2007-2-1', 'D', ], [ 1, - '2007-1-1', - '2007-2-1', - 'YM', + '2007-1-1', '2007-2-1', 'YM', ], [ 31, - '2007-1-1', - '2007-2-1', - 'YD', + '2007-1-1', '2007-2-1', 'YD', ], [ 0, - '2007-1-1', - '2007-2-1', - 'MD', + '2007-1-1', '2007-2-1', 'MD', ], [ 0, - '2007-1-1', - '2007-2-28', - 'Y', + '2007-1-1', '2007-2-28', 'Y', ], [ 1, - '2007-1-1', - '2007-2-28', - 'M', + '2007-1-1', '2007-2-28', 'M', ], [ 58, - '2007-1-1', - '2007-2-28', - 'D', + '2007-1-1', '2007-2-28', 'D', ], [ 1, - '2007-1-1', - '2007-2-28', - 'YM', + '2007-1-1', '2007-2-28', 'YM', ], [ 58, - '2007-1-1', - '2007-2-28', - 'YD', + '2007-1-1', '2007-2-28', 'YD', ], [ 27, - '2007-1-1', - '2007-2-28', - 'MD', + '2007-1-1', '2007-2-28', 'MD', ], [ 0, - '2007-1-31', - '2007-2-1', - 'Y', + '2007-1-31', '2007-2-1', 'Y', ], [ 0, - '2007-1-31', - '2007-2-1', - 'M', + '2007-1-31', '2007-2-1', 'M', ], [ 1, - '2007-1-31', - '2007-2-1', - 'D', + '2007-1-31', '2007-2-1', 'D', ], [ 0, - '2007-1-31', - '2007-2-1', - 'YM', + '2007-1-31', '2007-2-1', 'YM', ], [ 1, - '2007-1-31', - '2007-2-1', - 'YD', + '2007-1-31', '2007-2-1', 'YD', ], [ 1, - '2007-1-31', - '2007-2-1', - 'MD', + '2007-1-31', '2007-2-1', 'MD', ], [ 0, - '2007-1-31', - '2007-3-1', - 'Y', + '2007-1-31', '2007-3-1', 'Y', ], [ 1, - '2007-1-31', - '2007-3-1', - 'M', + '2007-1-31', '2007-3-1', 'M', ], [ 29, - '2007-1-31', - '2007-3-1', - 'D', + '2007-1-31', '2007-3-1', 'D', ], [ 1, - '2007-1-31', - '2007-3-1', - 'YM', + '2007-1-31', '2007-3-1', 'YM', ], [ 29, - '2007-1-31', - '2007-3-1', - 'YD', + '2007-1-31', '2007-3-1', 'YD', ], [ -2, - '2007-1-31', - '2007-3-1', - 'MD', + '2007-1-31', '2007-3-1', 'MD', ], [ 0, - '2007-1-31', - '2007-3-31', - 'Y', + '2007-1-31', '2007-3-31', 'Y', ], [ 2, - '2007-1-31', - '2007-3-31', - 'M', + '2007-1-31', '2007-3-31', 'M', ], [ 59, - '2007-1-31', - '2007-3-31', - 'D', + '2007-1-31', '2007-3-31', 'D', ], [ 2, - '2007-1-31', - '2007-3-31', - 'YM', + '2007-1-31', '2007-3-31', 'YM', ], [ 59, - '2007-1-31', - '2007-3-31', - 'YD', + '2007-1-31', '2007-3-31', 'YD', ], [ 0, - '2007-1-31', - '2007-3-31', - 'MD', + '2007-1-31', '2007-3-31', 'MD', ], [ 0, - '2008-1-1', - '2008-9-1', - 'Y', + '2008-1-1', '2008-9-1', 'Y', ], [ 8, - '2008-1-1', - '2008-9-1', - 'M', + '2008-1-1', '2008-9-1', 'M', ], [ 244, - '2008-1-1', - '2008-9-1', - 'D', + '2008-1-1', '2008-9-1', 'D', ], [ 8, - '2008-1-1', - '2008-9-1', - 'YM', + '2008-1-1', '2008-9-1', 'YM', ], [ 244, - '2008-1-1', - '2008-9-1', - 'YD', + '2008-1-1', '2008-9-1', 'YD', ], [ 0, - '2008-1-1', - '2008-9-1', - 'MD', + '2008-1-1', '2008-9-1', 'MD', ], [ 1, - '2007-2-1', - '2008-4-1', - 'Y', + '2007-2-1', '2008-4-1', 'Y', ], [ 14, - '2007-2-1', - '2008-4-1', - 'M', + '2007-2-1', '2008-4-1', 'M', ], [ 425, - '2007-2-1', - '2008-4-1', - 'D', + '2007-2-1', '2008-4-1', 'D', ], [ 2, - '2007-2-1', - '2008-4-1', - 'YM', + '2007-2-1', '2008-4-1', 'YM', ], [ 59, - '2007-2-1', - '2008-4-1', - 'YD', + '2007-2-1', '2008-4-1', 'YD', ], [ 0, - '2007-2-1', - '2008-4-1', - 'MD', + '2007-2-1', '2008-4-1', 'MD', ], [ 47, - '1960-12-19', - '2008-6-28', - 'Y', + '1960-12-19', '2008-6-28', 'Y', ], [ 570, - '1960-12-19', - '2008-6-28', - 'M', + '1960-12-19', '2008-6-28', 'M', ], [ 17358, - '1960-12-19', - '2008-6-28', - 'D', + '1960-12-19', '2008-6-28', 'D', ], [ 6, - '1960-12-19', - '2008-6-28', - 'YM', + '1960-12-19', '2008-6-28', 'YM', ], [ 191, - '1960-12-19', - '2008-6-28', - 'YD', + '1960-12-19', '2008-6-28', 'YD', ], [ 9, - '1960-12-19', - '2008-6-28', - 'MD', + '1960-12-19', '2008-6-28', 'MD', ], [ 25, - '1982-12-7', - '2008-6-28', - 'Y', + '1982-12-7', '2008-6-28', 'Y', ], [ 306, - '1982-12-7', - '2008-6-28', - 'M', + '1982-12-7', '2008-6-28', 'M', ], [ 9335, - '1982-12-7', - '2008-6-28', - 'D', + '1982-12-7', '2008-6-28', 'D', ], [ 6, - '1982-12-7', - '2008-6-28', - 'YM', + '1982-12-7', '2008-6-28', 'YM', ], [ 203, - '1982-12-7', - '2008-6-28', - 'YD', + '1982-12-7', '2008-6-28', 'YD', ], [ 21, - '1982-12-7', - '2008-6-28', - 'MD', + '1982-12-7', '2008-6-28', 'MD', ], [ 2, - '2007-12-25', - '2010-3-17', - 'Y', + '2007-12-25', '2010-3-17', 'Y', ], [ 26, - '2007-12-25', - '2010-3-17', - 'M', + '2007-12-25', '2010-3-17', 'M', ], [ 813, - '2007-12-25', - '2010-3-17', - 'D', + '2007-12-25', '2010-3-17', 'D', ], [ 2, - '2007-12-25', - '2010-3-17', - 'YM', + '2007-12-25', '2010-3-17', 'YM', ], [ 82, - '2007-12-25', - '2010-3-17', - 'YD', + '2007-12-25', '2010-3-17', 'YD', ], [ 20, - '2007-12-25', - '2010-3-17', - 'MD', + '2007-12-25', '2010-3-17', 'MD', ], [ 51, - '19-12-1960', - '26-01-2012', - 'Y', + '19-12-1960', '26-01-2012', 'Y', ], [ 613, - '19-12-1960', - '26-01-2012', - 'M', + '19-12-1960', '26-01-2012', 'M', ], [ 18665, - '19-12-1960', - '26-01-2012', - 'D', + '19-12-1960', '26-01-2012', 'D', ], [ 1, - '19-12-1960', - '26-01-2012', - 'YM', + '19-12-1960', '26-01-2012', 'YM', ], [ 38, - '19-12-1960', - '26-01-2012', - 'YD', + '19-12-1960', '26-01-2012', 'YD', ], [ 7, - '19-12-1960', - '26-01-2012', - 'MD', + '19-12-1960', '26-01-2012', 'MD', ], [ 50, - '19-12-1960', - '12-12-2012', - 'Y', + '19-12-1960', '12-12-2012', 'Y', ], [ 0, - '1982-12-07', - '1982-12-7', - 'D', + '1982-12-07', '1982-12-7', 'D', ], ]; diff --git a/tests/data/Calculation/DateTime/DAY.php b/tests/data/Calculation/DateTime/DAY.php index c7fe7a48..8ba4ad41 100644 --- a/tests/data/Calculation/DateTime/DAY.php +++ b/tests/data/Calculation/DateTime/DAY.php @@ -29,8 +29,8 @@ return [ '28-Feb-1904', ], [ - '#VALUE!', // Result for Excel - '#VALUE!', // Result for OpenOffice + '#VALUE!', // Result for Excel + '#VALUE!', // Result for OpenOffice 'Invalid', ], [ diff --git a/tests/data/Calculation/DateTime/DAYS.php b/tests/data/Calculation/DateTime/DAYS.php index 074fc302..26fd4042 100644 --- a/tests/data/Calculation/DateTime/DAYS.php +++ b/tests/data/Calculation/DateTime/DAYS.php @@ -3,97 +3,78 @@ return [ [ '#VALUE!', - '2007-1-10', - 'ABC', + '2007-1-10', 'ABC', ], [ '#VALUE!', - 'DEF', - '2007-1-1', + 'DEF', '2007-1-1', ], [ 9, - '2007-1-10', - '2007-1-1', + '2007-1-10', '2007-1-1', ], [ 364, - '2007-12-31', - '2007-1-1', + '2007-12-31', '2007-1-1', ], [ 547, - '2008-7-1', - '2007-1-1', + '2008-7-1', '2007-1-1', ], [ 30, - '2007-1-31', - '2007-1-1', + '2007-1-31', '2007-1-1', ], [ 31, - '2007-2-1', - '2007-1-1', + '2007-2-1', '2007-1-1', ], [ 58, - '2007-2-28', - '2007-1-1', + '2007-2-28', '2007-1-1', ], [ 1, - '2007-2-1', - '2007-1-31', + '2007-2-1', '2007-1-31', ], [ 29, - '2007-3-1', - '2007-1-31', + '2007-3-1', '2007-1-31', ], [ 59, - '2007-3-31', - '2007-1-31', + '2007-3-31', '2007-1-31', ], [ 244, - '2008-9-1', - '2008-1-1', + '2008-9-1', '2008-1-1', ], [ 425, - '2008-4-1', - '2007-2-1', + '2008-4-1', '2007-2-1', ], [ 17358, - '2008-6-28', - '1960-12-19', + '2008-6-28', '1960-12-19', ], [ 9335, - '2008-6-28', - '1982-12-7', + '2008-6-28', '1982-12-7', ], [ 32, - '2000-3-31', - '2000-2-28', + '2000-3-31', '2000-2-28', ], [ 31, - '2000-3-31', - '2000-2-29', + '2000-3-31', '2000-2-29', ], [ 31, - new \DateTime('2000-3-31'), - new \DateTimeImmutable('2000-2-29'), + new \DateTime('2000-3-31'), new \DateTimeImmutable('2000-2-29'), ], [ 31, - 36616, - 36585, + 36616, 36585, ], ]; diff --git a/tests/data/Calculation/DateTime/DAYS360.php b/tests/data/Calculation/DateTime/DAYS360.php index d41e7fb5..3118f3ad 100644 --- a/tests/data/Calculation/DateTime/DAYS360.php +++ b/tests/data/Calculation/DateTime/DAYS360.php @@ -3,206 +3,138 @@ return [ [ '#VALUE!', - 'ABC', - '2007-1-10', - false, + 'ABC', '2007-1-10', false, ], [ '#VALUE!', - '2007-1-1', - 'DEF', - true, + '2007-1-1', 'DEF', true, ], [ '#VALUE!', - '2007-1-1', - '2007-1-10', - 'XYZ', + '2007-1-1', '2007-1-10', 'XYZ', ], [ '#VALUE!', - '2007-1-10', - '2007-1-1', - 'Y', + '2007-1-10', '2007-1-1', 'Y', ], [ 9, - '2007-1-1', - '2007-1-10', - false, + '2007-1-1', '2007-1-10', false, ], [ 9, - '2007-1-1', - '2007-1-10', - true, + '2007-1-1', '2007-1-10', true, ], [ 360, - '2007-1-1', - '2007-12-31', - false, + '2007-1-1', '2007-12-31', false, ], [ 359, - '2007-1-1', - '2007-12-31', - true, + '2007-1-1', '2007-12-31', true, ], [ 540, - '2007-1-1', - '2008-7-1', - false, + '2007-1-1', '2008-7-1', false, ], [ 540, - '2007-1-1', - '2008-7-1', - true, + '2007-1-1', '2008-7-1', true, ], [ 30, - '2007-1-1', - '2007-1-31', - false, + '2007-1-1', '2007-1-31', false, ], [ 29, - '2007-1-1', - '2007-1-31', - true, + '2007-1-1', '2007-1-31', true, ], [ 30, - '2007-1-1', - '2007-2-1', - false, + '2007-1-1', '2007-2-1', false, ], [ 30, - '2007-1-1', - '2007-2-1', - true, + '2007-1-1', '2007-2-1', true, ], [ 57, - '2007-1-1', - '2007-2-28', - false, + '2007-1-1', '2007-2-28', false, ], [ 57, - '2007-1-1', - '2007-2-28', - true, + '2007-1-1', '2007-2-28', true, ], [ 1, - '2007-1-31', - '2007-2-1', - false, + '2007-1-31', '2007-2-1', false, ], [ 1, - '2007-1-31', - '2007-2-1', - true, + '2007-1-31', '2007-2-1', true, ], [ 31, - '2007-1-31', - '2007-3-1', - false, + '2007-1-31', '2007-3-1', false, ], [ 31, - '2007-1-31', - '2007-3-1', - true, + '2007-1-31', '2007-3-1', true, ], [ 60, - '2007-1-31', - '2007-3-31', - false, + '2007-1-31', '2007-3-31', false, ], [ 60, - '2007-1-31', - '2007-3-31', - true, + '2007-1-31', '2007-3-31', true, ], [ 240, - '2008-1-1', - '2008-9-1', - false, + '2008-1-1', '2008-9-1', false, ], [ 240, - '2008-1-1', - '2008-9-1', - true, + '2008-1-1', '2008-9-1', true, ], [ 420, - '2007-2-1', - '2008-4-1', - false, + '2007-2-1', '2008-4-1', false, ], [ 420, - '2007-2-1', - '2008-4-1', - true, + '2007-2-1', '2008-4-1', true, ], [ 17109, - '1960-12-19', - '2008-6-28', - false, + '1960-12-19', '2008-6-28', false, ], [ 17109, - '1960-12-19', - '2008-6-28', - true, + '1960-12-19', '2008-6-28', true, ], [ 9201, - '1982-12-7', - '2008-6-28', - false, + '1982-12-7', '2008-6-28', false, ], [ 9201, - '1982-12-7', - '2008-6-28', - true, + '1982-12-7', '2008-6-28', true, ], [ 33, - '2000-2-28', - '2000-3-31', - false, + '2000-2-28', '2000-3-31', false, ], [ 32, - '2000-2-28', - '2000-3-31', - true, + '2000-2-28', '2000-3-31', true, ], [ 30, - '2000-2-29', - '2000-3-31', - false, + '2000-2-29', '2000-3-31', false, ], [ 31, - '2000-2-29', - '2000-3-31', - true, + '2000-2-29', '2000-3-31', true, ], ]; diff --git a/tests/data/Calculation/DateTime/EDATE.php b/tests/data/Calculation/DateTime/EDATE.php index 6b3a513f..15e50e91 100644 --- a/tests/data/Calculation/DateTime/EDATE.php +++ b/tests/data/Calculation/DateTime/EDATE.php @@ -3,77 +3,62 @@ return [ [ 39493, - '15-Jan-2008', - 1, + '15-Jan-2008', 1, ], [ 39431, - '15-Jan-2008', - -1, + '15-Jan-2008', -1, ], [ 39522, - '15-Jan-2008', - 2, + '15-Jan-2008', 2, ], [ 39202, - '31-Mar-2007', - 1, + '31-Mar-2007', 1, ], [ 39141, - '31-Mar-2007', - -1, + '31-Mar-2007', -1, ], [ 39507, - '31-Mar-2008', - -1, + '31-Mar-2008', -1, ], [ 39416, - '31-Mar-2008', - -4, + '31-Mar-2008', -4, ], [ 39141, - '29-Feb-2008', - -12, + '29-Feb-2008', -12, ], [ 39248, - '15-Mar-2007', - 3, + '15-Mar-2007', 3, ], [ 22269, - 22269.0, - 0, + 22269.0, 0, ], [ 22331, - 22269.0, - 2, + 22269.0, 2, ], [ 25618, - 22269.0, - 110, + 22269.0, 110, ], [ 18920, - 22269.0, - -110, + 22269.0, -110, ], [ '#VALUE!', - '15-Mar-2007', - 'ABC', + '15-Mar-2007', 'ABC', ], [ '#VALUE!', - 'Invalid', - 12, + 'Invalid', 12, ], ]; diff --git a/tests/data/Calculation/DateTime/EOMONTH.php b/tests/data/Calculation/DateTime/EOMONTH.php index 6379f1e1..8fd0f14b 100644 --- a/tests/data/Calculation/DateTime/EOMONTH.php +++ b/tests/data/Calculation/DateTime/EOMONTH.php @@ -3,87 +3,70 @@ return [ [ 39507, - '15-Jan-2008', - 1, + '15-Jan-2008', 1, ], [ 39447, - '15-Jan-2008', - -1, + '15-Jan-2008', -1, ], [ 39538, - '15-Jan-2008', - 2, + '15-Jan-2008', 2, ], [ 39202, - '31-Mar-2007', - 1, + '31-Mar-2007', 1, ], [ 39141, - '31-Mar-2007', - -1, + '31-Mar-2007', -1, ], [ 39507, - '31-Mar-2008', - -1, + '31-Mar-2008', -1, ], [ 39416, - '31-Mar-2008', - -4, + '31-Mar-2008', -4, ], [ 39141, - '29-Feb-2008', - -12, + '29-Feb-2008', -12, ], [ 39263, - '15-Mar-2007', - 3, + '15-Mar-2007', 3, ], [ 22281, - 22269.0, - 0, + 22269.0, 0, ], [ 22340, - 22269.0, - 2, + 22269.0, 2, ], [ 25627, - 22269.0, - 110, + 22269.0, 110, ], [ 18932, - 22269.0, - -110, + 22269.0, -110, ], [ 22371, - 22269.0, - 3, + 22269.0, 3, ], [ 22371, - 22269.0, - 3.75, + 22269.0, 3.75, ], [ '#VALUE!', - '15-Mar-2007', - 'ABC', + '15-Mar-2007', 'ABC', ], [ '#VALUE!', - 'Invalid', - 12, + 'Invalid', 12, ], ]; diff --git a/tests/data/Calculation/MathTrig/ATAN2.php b/tests/data/Calculation/MathTrig/ATAN2.php index 19e6b552..1050b437 100644 --- a/tests/data/Calculation/MathTrig/ATAN2.php +++ b/tests/data/Calculation/MathTrig/ATAN2.php @@ -5,82 +5,66 @@ return [ [ '#DIV/0!', - 0, - 0, + 0, 0, ], [ 0.78539816339699997, - 1, - 1, + 1, 1, ], [ -2.3561944901919998, - -1, - -1, + -1, -1, ], [ 2.3561944901919998, - -1, - 1, + -1, 1, ], [ -0.78539816339699997, - 1, - -1, + 1, -1, ], [ 1.107148717794, - 0.5, - 1, + 0.5, 1, ], [ 1.8157749899219999, - -0.5, - 2, + -0.5, 2, ], [ 0.67474094222400005, - 1, - 0.80000000000000004, + 1, 0.80000000000000004, ], [ -0.64350110879300004, - 0.80000000000000004, - -0.59999999999999998, + 0.80000000000000004, -0.59999999999999998, ], [ -1.460139105621, - 1, - -9, + 1, -9, ], [ 0.0, - 0.20000000000000001, - 0, + 0.20000000000000001, 0, ], [ 1.107148717794, - 0.10000000000000001, - 0.20000000000000001, + 0.10000000000000001, 0.20000000000000001, ], [ 1.570796326795, - 0, - 0.20000000000000001, + 0, 0.20000000000000001, ], [ '#VALUE!', - 'A', - 0.20000000000000001, + 'A', 0.20000000000000001, ], [ 0.78539816339699997, - true, - 1, + true, 1, ], [ -1.570796326795, - false, - -2.5, + false, -2.5, ], ];