From 9ad6de620edb5484ae5255b4b26a75f5c88ca2fa Mon Sep 17 00:00:00 2001 From: Mark Baker Date: Sun, 21 Jul 2019 20:55:41 +0200 Subject: [PATCH] Refactoring of date time tests (#1101) * Merge branch 'master' of C:\Projects\PHPOffice\PHPSpreadsheet\develop with conflicts. * Separate out date/time tests into individual tests * Need to update the version of phpunit at some point to deal with the new assertions and deprecated assertions * Appease the CS Gods * More refactoring of Date/Time tests * Replace self assertions with instance assertions (looking forward to upgrading phpunit) * Finish refactoring of date/time tests as individual tests * Test for DateTimeInterface rather than for DateTime * A few strict comparisons * Fix to test names --- src/PhpSpreadsheet/Calculation/DateTime.php | 48 +- src/PhpSpreadsheet/Calculation/Functions.php | 15 +- .../Calculation/DateTimeTest.php | 503 ------------------ .../Functions/DateTime/DateDifTest.php | 34 ++ .../Functions/DateTime/DateTest.php | 71 +++ .../Functions/DateTime/DateValueTest.php | 55 ++ .../Functions/DateTime/DayTest.php | 40 ++ .../Functions/DateTime/Days360Test.php | 34 ++ .../Functions/DateTime/DaysTest.php | 34 ++ .../Functions/DateTime/EDateTest.php | 55 ++ .../Functions/DateTime/EoMonthTest.php | 55 ++ .../Functions/DateTime/HourTest.php | 34 ++ .../Functions/DateTime/IsoWeekNumTest.php | 35 ++ .../Functions/DateTime/MinuteTest.php | 34 ++ .../Functions/DateTime/MonthTest.php | 34 ++ .../Functions/DateTime/NetworkDaysTest.php | 34 ++ .../Functions/DateTime/SecondTest.php | 34 ++ .../Functions/DateTime/TimeTest.php | 55 ++ .../Functions/DateTime/TimeValueTest.php | 55 ++ .../Functions/DateTime/WeekDayTest.php | 34 ++ .../Functions/DateTime/WeekNumTest.php | 34 ++ .../Functions/DateTime/WorkDayTest.php | 34 ++ .../Functions/DateTime/YearFracTest.php | 34 ++ .../Functions/DateTime/YearTest.php | 34 ++ .../Functions/Statistical/AveDevTest.php | 2 +- .../Functions/Statistical/AverageATest.php | 2 +- .../Functions/Statistical/AverageIfTest.php | 2 +- .../Functions/Statistical/AverageTest.php | 2 +- .../Functions/Statistical/BetaDistTest.php | 2 +- .../Functions/Statistical/BetaInvTest.php | 2 +- .../Functions/Statistical/BinomDistTest.php | 2 +- .../Functions/Statistical/ChiDistTest.php | 2 +- .../Functions/Statistical/ChiInvTest.php | 2 +- .../Functions/Statistical/ConfidenceTest.php | 2 +- .../Functions/Statistical/CorrelTest.php | 2 +- .../Functions/Statistical/CountATest.php | 2 +- .../Functions/Statistical/CountBlankTest.php | 2 +- .../Functions/Statistical/CountIfTest.php | 2 +- .../Functions/Statistical/CountIfsTest.php | 2 +- .../Functions/Statistical/CountTest.php | 8 +- .../Functions/Statistical/CovarTest.php | 2 +- .../Functions/Statistical/ForecastTest.php | 2 +- .../Functions/Statistical/InterceptTest.php | 2 +- .../Functions/Statistical/MaxIfsTest.php | 2 +- .../Functions/Statistical/MinIfsTest.php | 2 +- .../Functions/Statistical/PermutTest.php | 2 +- .../Functions/Statistical/RsqTest.php | 2 +- .../Functions/Statistical/SlopeTest.php | 2 +- .../Functions/Statistical/SteyxTest.php | 2 +- tests/data/Calculation/DateTime/DATE.php | 324 +++-------- tests/data/Calculation/DateTime/DAY.php | 36 +- tests/data/Calculation/DateTime/TIME.php | 88 +-- tests/data/Calculation/DateTime/WEEKDAY.php | 51 +- 53 files changed, 1064 insertions(+), 920 deletions(-) delete mode 100644 tests/PhpSpreadsheetTests/Calculation/DateTimeTest.php create mode 100644 tests/PhpSpreadsheetTests/Calculation/Functions/DateTime/DateDifTest.php create mode 100644 tests/PhpSpreadsheetTests/Calculation/Functions/DateTime/DateTest.php create mode 100644 tests/PhpSpreadsheetTests/Calculation/Functions/DateTime/DateValueTest.php create mode 100644 tests/PhpSpreadsheetTests/Calculation/Functions/DateTime/DayTest.php create mode 100644 tests/PhpSpreadsheetTests/Calculation/Functions/DateTime/Days360Test.php create mode 100644 tests/PhpSpreadsheetTests/Calculation/Functions/DateTime/DaysTest.php create mode 100644 tests/PhpSpreadsheetTests/Calculation/Functions/DateTime/EDateTest.php create mode 100644 tests/PhpSpreadsheetTests/Calculation/Functions/DateTime/EoMonthTest.php create mode 100644 tests/PhpSpreadsheetTests/Calculation/Functions/DateTime/HourTest.php create mode 100644 tests/PhpSpreadsheetTests/Calculation/Functions/DateTime/IsoWeekNumTest.php create mode 100644 tests/PhpSpreadsheetTests/Calculation/Functions/DateTime/MinuteTest.php create mode 100644 tests/PhpSpreadsheetTests/Calculation/Functions/DateTime/MonthTest.php create mode 100644 tests/PhpSpreadsheetTests/Calculation/Functions/DateTime/NetworkDaysTest.php create mode 100644 tests/PhpSpreadsheetTests/Calculation/Functions/DateTime/SecondTest.php create mode 100644 tests/PhpSpreadsheetTests/Calculation/Functions/DateTime/TimeTest.php create mode 100644 tests/PhpSpreadsheetTests/Calculation/Functions/DateTime/TimeValueTest.php create mode 100644 tests/PhpSpreadsheetTests/Calculation/Functions/DateTime/WeekDayTest.php create mode 100644 tests/PhpSpreadsheetTests/Calculation/Functions/DateTime/WeekNumTest.php create mode 100644 tests/PhpSpreadsheetTests/Calculation/Functions/DateTime/WorkDayTest.php create mode 100644 tests/PhpSpreadsheetTests/Calculation/Functions/DateTime/YearFracTest.php create mode 100644 tests/PhpSpreadsheetTests/Calculation/Functions/DateTime/YearTest.php diff --git a/src/PhpSpreadsheet/Calculation/DateTime.php b/src/PhpSpreadsheet/Calculation/DateTime.php index 3c39db2a..796e7959 100644 --- a/src/PhpSpreadsheet/Calculation/DateTime.php +++ b/src/PhpSpreadsheet/Calculation/DateTime.php @@ -16,7 +16,7 @@ class DateTime */ public static function isLeapYear($year) { - return (($year % 4) == 0) && (($year % 100) != 0) || (($year % 400) == 0); + return (($year % 4) === 0) && (($year % 100) !== 0) || (($year % 400) === 0); } /** @@ -156,11 +156,11 @@ class DateTime $retValue = (float) Date::PHPToExcel(time()); break; - case Functions::RETURNDATE_PHP_NUMERIC: + case Functions::RETURNDATE_UNIX_TIMESTAMP: $retValue = (int) time(); break; - case Functions::RETURNDATE_PHP_OBJECT: + case Functions::RETURNDATE_PHP_DATETIME_OBJECT: $retValue = new \DateTime(); break; @@ -200,11 +200,11 @@ class DateTime $retValue = (float) $excelDateTime; break; - case Functions::RETURNDATE_PHP_NUMERIC: + case Functions::RETURNDATE_UNIX_TIMESTAMP: $retValue = (int) Date::excelToTimestamp($excelDateTime); break; - case Functions::RETURNDATE_PHP_OBJECT: + case Functions::RETURNDATE_PHP_DATETIME_OBJECT: $retValue = Date::excelToDateTimeObject($excelDateTime); break; @@ -325,9 +325,9 @@ class DateTime switch (Functions::getReturnDateType()) { case Functions::RETURNDATE_EXCEL: return (float) $excelDateValue; - case Functions::RETURNDATE_PHP_NUMERIC: + case Functions::RETURNDATE_UNIX_TIMESTAMP: return (int) Date::excelToTimestamp($excelDateValue); - case Functions::RETURNDATE_PHP_OBJECT: + case Functions::RETURNDATE_PHP_DATETIME_OBJECT: return Date::excelToDateTimeObject($excelDateValue); } } @@ -420,9 +420,9 @@ class DateTime } return (float) Date::formattedPHPToExcel($calendar, 1, $date, $hour, $minute, $second); - case Functions::RETURNDATE_PHP_NUMERIC: + case Functions::RETURNDATE_UNIX_TIMESTAMP: return (int) Date::excelToTimestamp(Date::formattedPHPToExcel(1970, 1, 1, $hour, $minute, $second)); // -2147468400; // -2147472000 + 3600 - case Functions::RETURNDATE_PHP_OBJECT: + case Functions::RETURNDATE_PHP_DATETIME_OBJECT: $dayAdjust = 0; if ($hour < 0) { $dayAdjust = floor($hour / 24); @@ -472,7 +472,6 @@ class DateTime */ public static function DATEVALUE($dateValue = 1) { - $dateValueOrig = $dateValue; $dateValue = trim(Functions::flattenSingleValue($dateValue), '"'); // Strip any ordinals because they're allowed in Excel (English only) $dateValue = preg_replace('/(\d)(st|nd|rd|th)([ -\/])/Ui', '$1$3', $dateValue); @@ -569,9 +568,9 @@ class DateTime switch (Functions::getReturnDateType()) { case Functions::RETURNDATE_EXCEL: return (float) $excelDateValue; - case Functions::RETURNDATE_PHP_NUMERIC: + case Functions::RETURNDATE_UNIX_TIMESTAMP: return (int) Date::excelToTimestamp($excelDateValue); - case Functions::RETURNDATE_PHP_OBJECT: + case Functions::RETURNDATE_PHP_DATETIME_OBJECT: return new \DateTime($PHPDateArray['year'] . '-' . $PHPDateArray['month'] . '-' . $PHPDateArray['day'] . ' 00:00:00'); } } @@ -631,9 +630,9 @@ class DateTime switch (Functions::getReturnDateType()) { case Functions::RETURNDATE_EXCEL: return (float) $excelDateValue; - case Functions::RETURNDATE_PHP_NUMERIC: + case Functions::RETURNDATE_UNIX_TIMESTAMP: return (int) $phpDateValue = Date::excelToTimestamp($excelDateValue + 25569) - 3600; - case Functions::RETURNDATE_PHP_OBJECT: + case Functions::RETURNDATE_PHP_DATETIME_OBJECT: return new \DateTime('1900-01-01 ' . $PHPDateArray['hour'] . ':' . $PHPDateArray['minute'] . ':' . $PHPDateArray['second']); } } @@ -683,7 +682,6 @@ class DateTime $endMonths = $PHPEndDateObject->format('n'); $endYears = $PHPEndDateObject->format('Y'); - $retVal = Functions::NAN(); switch ($unit) { case 'D': $retVal = (int) $difference; @@ -1154,9 +1152,9 @@ class DateTime switch (Functions::getReturnDateType()) { case Functions::RETURNDATE_EXCEL: return (float) $endDate; - case Functions::RETURNDATE_PHP_NUMERIC: + case Functions::RETURNDATE_UNIX_TIMESTAMP: return (int) Date::excelToTimestamp($endDate); - case Functions::RETURNDATE_PHP_OBJECT: + case Functions::RETURNDATE_PHP_DATETIME_OBJECT: return Date::excelToDateTimeObject($endDate); } } @@ -1239,7 +1237,7 @@ class DateTime // Execute function $PHPDateObject = Date::excelToDateTimeObject($dateValue); - $DoW = $PHPDateObject->format('w'); + $DoW = (int) $PHPDateObject->format('w'); $firstDay = 1; switch ($style) { @@ -1248,13 +1246,13 @@ class DateTime break; case 2: - if ($DoW == 0) { + if ($DoW === 0) { $DoW = 7; } break; case 3: - if ($DoW == 0) { + if ($DoW === 0) { $DoW = 7; } $firstDay = 0; @@ -1272,7 +1270,7 @@ class DateTime } } - return (int) $DoW; + return $DoW; } /** @@ -1591,9 +1589,9 @@ class DateTime switch (Functions::getReturnDateType()) { case Functions::RETURNDATE_EXCEL: return (float) Date::PHPToExcel($PHPDateObject); - case Functions::RETURNDATE_PHP_NUMERIC: + case Functions::RETURNDATE_UNIX_TIMESTAMP: return (int) Date::excelToTimestamp(Date::PHPToExcel($PHPDateObject)); - case Functions::RETURNDATE_PHP_OBJECT: + case Functions::RETURNDATE_PHP_DATETIME_OBJECT: return $PHPDateObject; } } @@ -1640,9 +1638,9 @@ class DateTime switch (Functions::getReturnDateType()) { case Functions::RETURNDATE_EXCEL: return (float) Date::PHPToExcel($PHPDateObject); - case Functions::RETURNDATE_PHP_NUMERIC: + case Functions::RETURNDATE_UNIX_TIMESTAMP: return (int) Date::excelToTimestamp(Date::PHPToExcel($PHPDateObject)); - case Functions::RETURNDATE_PHP_OBJECT: + case Functions::RETURNDATE_PHP_DATETIME_OBJECT: return $PHPDateObject; } } diff --git a/src/PhpSpreadsheet/Calculation/Functions.php b/src/PhpSpreadsheet/Calculation/Functions.php index 3e18eb8e..d2baf4ea 100644 --- a/src/PhpSpreadsheet/Calculation/Functions.php +++ b/src/PhpSpreadsheet/Calculation/Functions.php @@ -17,8 +17,11 @@ class Functions const COMPATIBILITY_EXCEL = 'Excel'; const COMPATIBILITY_GNUMERIC = 'Gnumeric'; const COMPATIBILITY_OPENOFFICE = 'OpenOfficeCalc'; + const RETURNDATE_PHP_NUMERIC = 'P'; + const RETURNDATE_UNIX_TIMESTAMP = 'P'; const RETURNDATE_PHP_OBJECT = 'O'; + const RETURNDATE_PHP_DATETIME_OBJECT = 'O'; const RETURNDATE_EXCEL = 'E'; /** @@ -101,16 +104,16 @@ class Functions * * @param string $returnDateType Return Date Format * Permitted values are: - * Functions::RETURNDATE_PHP_NUMERIC 'P' - * Functions::RETURNDATE_PHP_OBJECT 'O' + * Functions::RETURNDATE_UNIX_TIMESTAMP 'P' + * Functions::RETURNDATE_PHP_DATETIME_OBJECT 'O' * Functions::RETURNDATE_EXCEL 'E' * * @return bool Success or failure */ public static function setReturnDateType($returnDateType) { - if (($returnDateType == self::RETURNDATE_PHP_NUMERIC) || - ($returnDateType == self::RETURNDATE_PHP_OBJECT) || + if (($returnDateType == self::RETURNDATE_UNIX_TIMESTAMP) || + ($returnDateType == self::RETURNDATE_PHP_DATETIME_OBJECT) || ($returnDateType == self::RETURNDATE_EXCEL) ) { self::$returnDateType = $returnDateType; @@ -128,8 +131,8 @@ class Functions * * @return string Return Date Format * Possible Return values are: - * Functions::RETURNDATE_PHP_NUMERIC 'P' - * Functions::RETURNDATE_PHP_OBJECT 'O' + * Functions::RETURNDATE_UNIX_TIMESTAMP 'P' + * Functions::RETURNDATE_PHP_DATETIME_OBJECT 'O' * Functions::RETURNDATE_EXCEL 'E' */ public static function getReturnDateType() diff --git a/tests/PhpSpreadsheetTests/Calculation/DateTimeTest.php b/tests/PhpSpreadsheetTests/Calculation/DateTimeTest.php deleted file mode 100644 index 0e671152..00000000 --- a/tests/PhpSpreadsheetTests/Calculation/DateTimeTest.php +++ /dev/null @@ -1,503 +0,0 @@ -format('d-M-Y'), '31-Jan-2012'); - } - - public function testDATEwith1904Calendar() - { - Date::setExcelCalendar(Date::CALENDAR_MAC_1904); - $result = DateTime::DATE(1918, 11, 11); - Date::setExcelCalendar(Date::CALENDAR_WINDOWS_1900); - self::assertEquals($result, 5428); - } - - public function testDATEwith1904CalendarError() - { - Date::setExcelCalendar(Date::CALENDAR_MAC_1904); - $result = DateTime::DATE(1901, 1, 31); - Date::setExcelCalendar(Date::CALENDAR_WINDOWS_1900); - self::assertEquals($result, '#NUM!'); - } - - /** - * @dataProvider providerDATEVALUE - * - * @param mixed $expectedResult - */ - public function testDATEVALUE($expectedResult, ...$args) - { - $result = DateTime::DATEVALUE(...$args); - self::assertEquals($expectedResult, $result, null, 1E-8); - } - - public function providerDATEVALUE() - { - return require 'data/Calculation/DateTime/DATEVALUE.php'; - } - - public function testDATEVALUEtoPHP() - { - Functions::setReturnDateType(Functions::RETURNDATE_PHP_NUMERIC); - $result = DateTime::DATEVALUE('2012-1-31'); - Functions::setReturnDateType(Functions::RETURNDATE_EXCEL); - self::assertEquals(1327968000, $result, null, 1E-8); - } - - public function testDATEVALUEtoPHPObject() - { - Functions::setReturnDateType(Functions::RETURNDATE_PHP_OBJECT); - $result = DateTime::DATEVALUE('2012-1-31'); - Functions::setReturnDateType(Functions::RETURNDATE_EXCEL); - // Must return an object... - self::assertInternalType('object', $result); - // ... of the correct type - self::assertTrue(is_a($result, 'DateTime')); - // ... with the correct value - self::assertEquals($result->format('d-M-Y'), '31-Jan-2012'); - } - - /** - * @dataProvider providerYEAR - * - * @param mixed $expectedResult - */ - public function testYEAR($expectedResult, ...$args) - { - $result = DateTime::YEAR(...$args); - self::assertEquals($expectedResult, $result, null, 1E-8); - } - - public function providerYEAR() - { - return require 'data/Calculation/DateTime/YEAR.php'; - } - - /** - * @dataProvider providerMONTH - * - * @param mixed $expectedResult - */ - public function testMONTH($expectedResult, ...$args) - { - $result = DateTime::MONTHOFYEAR(...$args); - self::assertEquals($expectedResult, $result, null, 1E-8); - } - - public function providerMONTH() - { - return require 'data/Calculation/DateTime/MONTH.php'; - } - - /** - * @dataProvider providerWEEKNUM - * - * @param mixed $expectedResult - */ - public function testWEEKNUM($expectedResult, ...$args) - { - $result = DateTime::WEEKNUM(...$args); - self::assertEquals($expectedResult, $result, null, 1E-8); - } - - public function providerWEEKNUM() - { - return require 'data/Calculation/DateTime/WEEKNUM.php'; - } - - /** - * @dataProvider providerISOWEEKNUM - * - * @param mixed $expectedResult - * @param mixed $dateValue - */ - public function testISOWEEKNUM($expectedResult, $dateValue) - { - $result = DateTime::ISOWEEKNUM($dateValue); - self::assertEquals($expectedResult, $result, null, 1E-8); - } - - public function providerISOWEEKNUM() - { - return require 'data/Calculation/DateTime/ISOWEEKNUM.php'; - } - - /** - * @dataProvider providerWEEKDAY - * - * @param mixed $expectedResult - */ - public function testWEEKDAY($expectedResult, ...$args) - { - $result = DateTime::WEEKDAY(...$args); - self::assertEquals($expectedResult, $result, null, 1E-8); - } - - public function providerWEEKDAY() - { - return require 'data/Calculation/DateTime/WEEKDAY.php'; - } - - /** - * @dataProvider providerDAY - * - * @param mixed $expectedResultExcel - * @param mixed $expectedResultOpenOffice - */ - public function testDAY($expectedResultExcel, $expectedResultOpenOffice, ...$args) - { - $resultExcel = DateTime::DAYOFMONTH(...$args); - self::assertEquals($expectedResultExcel, $resultExcel, null, 1E-8); - - Functions::setCompatibilityMode(Functions::COMPATIBILITY_OPENOFFICE); - $resultOpenOffice = DateTime::DAYOFMONTH(...$args); - self::assertEquals($expectedResultOpenOffice, $resultOpenOffice, null, 1E-8); - } - - public function providerDAY() - { - return require 'data/Calculation/DateTime/DAY.php'; - } - - /** - * @dataProvider providerTIME - * - * @param mixed $expectedResult - */ - public function testTIME($expectedResult, ...$args) - { - $result = DateTime::TIME(...$args); - self::assertEquals($expectedResult, $result, null, 1E-8); - } - - public function providerTIME() - { - return require 'data/Calculation/DateTime/TIME.php'; - } - - public function testTIMEtoPHP() - { - Functions::setReturnDateType(Functions::RETURNDATE_PHP_NUMERIC); - $result = DateTime::TIME(7, 30, 20); - Functions::setReturnDateType(Functions::RETURNDATE_EXCEL); - self::assertEquals(27020, $result, null, 1E-8); - } - - public function testTIMEtoPHPObject() - { - Functions::setReturnDateType(Functions::RETURNDATE_PHP_OBJECT); - $result = DateTime::TIME(7, 30, 20); - Functions::setReturnDateType(Functions::RETURNDATE_EXCEL); - // Must return an object... - self::assertInternalType('object', $result); - // ... of the correct type - self::assertTrue(is_a($result, 'DateTime')); - // ... with the correct value - self::assertEquals($result->format('H:i:s'), '07:30:20'); - } - - /** - * @dataProvider providerTIMEVALUE - * - * @param mixed $expectedResult - */ - public function testTIMEVALUE($expectedResult, ...$args) - { - $result = DateTime::TIMEVALUE(...$args); - self::assertEquals($expectedResult, $result, null, 1E-8); - } - - public function providerTIMEVALUE() - { - return require 'data/Calculation/DateTime/TIMEVALUE.php'; - } - - public function testTIMEVALUEtoPHP() - { - Functions::setReturnDateType(Functions::RETURNDATE_PHP_NUMERIC); - $result = DateTime::TIMEVALUE('7:30:20'); - Functions::setReturnDateType(Functions::RETURNDATE_EXCEL); - self::assertEquals(23420, $result, null, 1E-8); - } - - public function testTIMEVALUEtoPHPObject() - { - Functions::setReturnDateType(Functions::RETURNDATE_PHP_OBJECT); - $result = DateTime::TIMEVALUE('7:30:20'); - Functions::setReturnDateType(Functions::RETURNDATE_EXCEL); - // Must return an object... - self::assertInternalType('object', $result); - // ... of the correct type - self::assertTrue(is_a($result, 'DateTime')); - // ... with the correct value - self::assertEquals($result->format('H:i:s'), '07:30:20'); - } - - /** - * @dataProvider providerHOUR - * - * @param mixed $expectedResult - */ - public function testHOUR($expectedResult, ...$args) - { - $result = DateTime::HOUROFDAY(...$args); - self::assertEquals($expectedResult, $result, null, 1E-8); - } - - public function providerHOUR() - { - return require 'data/Calculation/DateTime/HOUR.php'; - } - - /** - * @dataProvider providerMINUTE - * - * @param mixed $expectedResult - */ - public function testMINUTE($expectedResult, ...$args) - { - $result = DateTime::MINUTE(...$args); - self::assertEquals($expectedResult, $result, null, 1E-8); - } - - public function providerMINUTE() - { - return require 'data/Calculation/DateTime/MINUTE.php'; - } - - /** - * @dataProvider providerSECOND - * - * @param mixed $expectedResult - */ - public function testSECOND($expectedResult, ...$args) - { - $result = DateTime::SECOND(...$args); - self::assertEquals($expectedResult, $result, null, 1E-8); - } - - public function providerSECOND() - { - return require 'data/Calculation/DateTime/SECOND.php'; - } - - /** - * @dataProvider providerNETWORKDAYS - * - * @param mixed $expectedResult - */ - public function testNETWORKDAYS($expectedResult, ...$args) - { - $result = DateTime::NETWORKDAYS(...$args); - self::assertEquals($expectedResult, $result, null, 1E-8); - } - - public function providerNETWORKDAYS() - { - return require 'data/Calculation/DateTime/NETWORKDAYS.php'; - } - - /** - * @dataProvider providerWORKDAY - * - * @param mixed $expectedResult - */ - public function testWORKDAY($expectedResult, ...$args) - { - $result = DateTime::WORKDAY(...$args); - self::assertEquals($expectedResult, $result, null, 1E-8); - } - - public function providerWORKDAY() - { - return require 'data/Calculation/DateTime/WORKDAY.php'; - } - - /** - * @dataProvider providerEDATE - * - * @param mixed $expectedResult - */ - public function testEDATE($expectedResult, ...$args) - { - $result = DateTime::EDATE(...$args); - self::assertEquals($expectedResult, $result, null, 1E-8); - } - - public function providerEDATE() - { - return require 'data/Calculation/DateTime/EDATE.php'; - } - - public function testEDATEtoPHP() - { - Functions::setReturnDateType(Functions::RETURNDATE_PHP_NUMERIC); - $result = DateTime::EDATE('2012-1-26', -1); - Functions::setReturnDateType(Functions::RETURNDATE_EXCEL); - self::assertEquals(1324857600, $result, null, 1E-8); - } - - public function testEDATEtoPHPObject() - { - Functions::setReturnDateType(Functions::RETURNDATE_PHP_OBJECT); - $result = DateTime::EDATE('2012-1-26', -1); - Functions::setReturnDateType(Functions::RETURNDATE_EXCEL); - // Must return an object... - self::assertInternalType('object', $result); - // ... of the correct type - self::assertTrue(is_a($result, 'DateTime')); - // ... with the correct value - self::assertEquals($result->format('d-M-Y'), '26-Dec-2011'); - } - - /** - * @dataProvider providerEOMONTH - * - * @param mixed $expectedResult - */ - public function testEOMONTH($expectedResult, ...$args) - { - $result = DateTime::EOMONTH(...$args); - self::assertEquals($expectedResult, $result, null, 1E-8); - } - - public function providerEOMONTH() - { - return require 'data/Calculation/DateTime/EOMONTH.php'; - } - - public function testEOMONTHtoPHP() - { - Functions::setReturnDateType(Functions::RETURNDATE_PHP_NUMERIC); - $result = DateTime::EOMONTH('2012-1-26', -1); - Functions::setReturnDateType(Functions::RETURNDATE_EXCEL); - self::assertEquals(1325289600, $result, null, 1E-8); - } - - public function testEOMONTHtoPHPObject() - { - Functions::setReturnDateType(Functions::RETURNDATE_PHP_OBJECT); - $result = DateTime::EOMONTH('2012-1-26', -1); - Functions::setReturnDateType(Functions::RETURNDATE_EXCEL); - // Must return an object... - self::assertInternalType('object', $result); - // ... of the correct type - self::assertTrue(is_a($result, 'DateTime')); - // ... with the correct value - self::assertEquals($result->format('d-M-Y'), '31-Dec-2011'); - } - - /** - * @dataProvider providerDATEDIF - * - * @param mixed $expectedResult - */ - public function testDATEDIF($expectedResult, ...$args) - { - $result = DateTime::DATEDIF(...$args); - self::assertEquals($expectedResult, $result, null, 1E-8); - } - - public function providerDATEDIF() - { - return require 'data/Calculation/DateTime/DATEDIF.php'; - } - - /** - * @dataProvider providerDAYS - * - * @param mixed $expectedResult - */ - public function testDAYS($expectedResult, ...$args) - { - $result = DateTime::DAYS(...$args); - self::assertEquals($expectedResult, $result, null, 1E-8); - } - - public function providerDAYS() - { - return require 'data/Calculation/DateTime/DAYS.php'; - } - - /** - * @dataProvider providerDAYS360 - * - * @param mixed $expectedResult - */ - public function testDAYS360($expectedResult, ...$args) - { - $result = DateTime::DAYS360(...$args); - self::assertEquals($expectedResult, $result, null, 1E-8); - } - - public function providerDAYS360() - { - return require 'data/Calculation/DateTime/DAYS360.php'; - } - - /** - * @dataProvider providerYEARFRAC - * - * @param mixed $expectedResult - */ - public function testYEARFRAC($expectedResult, ...$args) - { - $result = DateTime::YEARFRAC(...$args); - self::assertEquals($expectedResult, $result, null, 1E-8); - } - - public function providerYEARFRAC() - { - return require 'data/Calculation/DateTime/YEARFRAC.php'; - } -} diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/DateTime/DateDifTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/DateTime/DateDifTest.php new file mode 100644 index 00000000..f221903c --- /dev/null +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/DateTime/DateDifTest.php @@ -0,0 +1,34 @@ +assertEquals($expectedResult, $result, '', 1E-8); + } + + public function providerDATEDIF() + { + return require 'data/Calculation/DateTime/DATEDIF.php'; + } +} diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/DateTime/DateTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/DateTime/DateTest.php new file mode 100644 index 00000000..ce27e564 --- /dev/null +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/DateTime/DateTest.php @@ -0,0 +1,71 @@ +assertEquals($expectedResult, $result, '', 1E-8); + } + + public function providerDATE() + { + return require 'data/Calculation/DateTime/DATE.php'; + } + + public function testDATEtoUnixTimestamp() + { + Functions::setReturnDateType(Functions::RETURNDATE_UNIX_TIMESTAMP); + + $result = DateTime::DATE(2012, 1, 31); + $this->assertEquals(1327968000, $result, '', 1E-8); + } + + public function testDATEtoDateTimeObject() + { + Functions::setReturnDateType(Functions::RETURNDATE_PHP_DATETIME_OBJECT); + + $result = DateTime::DATE(2012, 1, 31); + // Must return an object... + $this->assertInternalType('object', $result); + // ... of the correct type + $this->assertTrue(is_a($result, 'DateTimeInterface')); + // ... with the correct value + $this->assertEquals($result->format('d-M-Y'), '31-Jan-2012'); + } + + public function testDATEwith1904Calendar() + { + Date::setExcelCalendar(Date::CALENDAR_MAC_1904); + + $result = DateTime::DATE(1918, 11, 11); + $this->assertEquals($result, 5428); + } + + public function testDATEwith1904CalendarError() + { + Date::setExcelCalendar(Date::CALENDAR_MAC_1904); + + $result = DateTime::DATE(1901, 1, 31); + $this->assertEquals($result, '#NUM!'); + } +} diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/DateTime/DateValueTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/DateTime/DateValueTest.php new file mode 100644 index 00000000..0064815a --- /dev/null +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/DateTime/DateValueTest.php @@ -0,0 +1,55 @@ +assertEquals($expectedResult, $result, '', 1E-8); + } + + public function providerDATEVALUE() + { + return require 'data/Calculation/DateTime/DATEVALUE.php'; + } + + public function testDATEVALUEtoUnixTimestamp() + { + Functions::setReturnDateType(Functions::RETURNDATE_UNIX_TIMESTAMP); + + $result = DateTime::DATEVALUE('2012-1-31'); + $this->assertEquals(1327968000, $result, '', 1E-8); + } + + public function testDATEVALUEtoDateTimeObject() + { + Functions::setReturnDateType(Functions::RETURNDATE_PHP_DATETIME_OBJECT); + + $result = DateTime::DATEVALUE('2012-1-31'); + // Must return an object... + $this->assertInternalType('object', $result); + // ... of the correct type + $this->assertTrue(is_a($result, 'DateTimeInterface')); + // ... with the correct value + $this->assertEquals($result->format('d-M-Y'), '31-Jan-2012'); + } +} diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/DateTime/DayTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/DateTime/DayTest.php new file mode 100644 index 00000000..732582a0 --- /dev/null +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/DateTime/DayTest.php @@ -0,0 +1,40 @@ +assertEquals($expectedResultExcel, $resultExcel, '', 1E-8); + + Functions::setCompatibilityMode(Functions::COMPATIBILITY_OPENOFFICE); + + $resultOpenOffice = DateTime::DAYOFMONTH(...$args); + $this->assertEquals($expectedResultOpenOffice, $resultOpenOffice, '', 1E-8); + } + + public function providerDAY() + { + return require 'data/Calculation/DateTime/DAY.php'; + } +} diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/DateTime/Days360Test.php b/tests/PhpSpreadsheetTests/Calculation/Functions/DateTime/Days360Test.php new file mode 100644 index 00000000..e256316e --- /dev/null +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/DateTime/Days360Test.php @@ -0,0 +1,34 @@ +assertEquals($expectedResult, $result, '', 1E-8); + } + + public function providerDAYS360() + { + return require 'data/Calculation/DateTime/DAYS360.php'; + } +} diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/DateTime/DaysTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/DateTime/DaysTest.php new file mode 100644 index 00000000..1b45d49d --- /dev/null +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/DateTime/DaysTest.php @@ -0,0 +1,34 @@ +assertEquals($expectedResult, $result, '', 1E-8); + } + + public function providerDAYS() + { + return require 'data/Calculation/DateTime/DAYS.php'; + } +} diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/DateTime/EDateTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/DateTime/EDateTest.php new file mode 100644 index 00000000..60678794 --- /dev/null +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/DateTime/EDateTest.php @@ -0,0 +1,55 @@ +assertEquals($expectedResult, $result, '', 1E-8); + } + + public function providerEDATE() + { + return require 'data/Calculation/DateTime/EDATE.php'; + } + + public function testEDATEtoUnixTimestamp() + { + Functions::setReturnDateType(Functions::RETURNDATE_UNIX_TIMESTAMP); + + $result = DateTime::EDATE('2012-1-26', -1); + $this->assertEquals(1324857600, $result, '', 1E-8); + } + + public function testEDATEtoDateTimeObject() + { + Functions::setReturnDateType(Functions::RETURNDATE_PHP_DATETIME_OBJECT); + + $result = DateTime::EDATE('2012-1-26', -1); + // Must return an object... + $this->assertInternalType('object', $result); + // ... of the correct type + $this->assertTrue(is_a($result, 'DateTimeInterface')); + // ... with the correct value + $this->assertEquals($result->format('d-M-Y'), '26-Dec-2011'); + } +} diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/DateTime/EoMonthTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/DateTime/EoMonthTest.php new file mode 100644 index 00000000..7c66733e --- /dev/null +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/DateTime/EoMonthTest.php @@ -0,0 +1,55 @@ +assertEquals($expectedResult, $result, '', 1E-8); + } + + public function providerEOMONTH() + { + return require 'data/Calculation/DateTime/EOMONTH.php'; + } + + public function testEOMONTHtoUnixTimestamp() + { + Functions::setReturnDateType(Functions::RETURNDATE_UNIX_TIMESTAMP); + + $result = DateTime::EOMONTH('2012-1-26', -1); + $this->assertEquals(1325289600, $result, '', 1E-8); + } + + public function testEOMONTHtoDateTimeObject() + { + Functions::setReturnDateType(Functions::RETURNDATE_PHP_DATETIME_OBJECT); + + $result = DateTime::EOMONTH('2012-1-26', -1); + // Must return an object... + $this->assertInternalType('object', $result); + // ... of the correct type + $this->assertTrue(is_a($result, 'DateTimeInterface')); + // ... with the correct value + $this->assertEquals($result->format('d-M-Y'), '31-Dec-2011'); + } +} diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/DateTime/HourTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/DateTime/HourTest.php new file mode 100644 index 00000000..27a20f3a --- /dev/null +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/DateTime/HourTest.php @@ -0,0 +1,34 @@ +assertEquals($expectedResult, $result, '', 1E-8); + } + + public function providerHOUR() + { + return require 'data/Calculation/DateTime/HOUR.php'; + } +} diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/DateTime/IsoWeekNumTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/DateTime/IsoWeekNumTest.php new file mode 100644 index 00000000..39c9f036 --- /dev/null +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/DateTime/IsoWeekNumTest.php @@ -0,0 +1,35 @@ +assertEquals($expectedResult, $result, '', 1E-8); + } + + public function providerISOWEEKNUM() + { + return require 'data/Calculation/DateTime/ISOWEEKNUM.php'; + } +} diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/DateTime/MinuteTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/DateTime/MinuteTest.php new file mode 100644 index 00000000..cc416358 --- /dev/null +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/DateTime/MinuteTest.php @@ -0,0 +1,34 @@ +assertEquals($expectedResult, $result, '', 1E-8); + } + + public function providerMINUTE() + { + return require 'data/Calculation/DateTime/MINUTE.php'; + } +} diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/DateTime/MonthTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/DateTime/MonthTest.php new file mode 100644 index 00000000..f3dbd35e --- /dev/null +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/DateTime/MonthTest.php @@ -0,0 +1,34 @@ +assertEquals($expectedResult, $result, '', 1E-8); + } + + public function providerMONTH() + { + return require 'data/Calculation/DateTime/MONTH.php'; + } +} diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/DateTime/NetworkDaysTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/DateTime/NetworkDaysTest.php new file mode 100644 index 00000000..e1aa446f --- /dev/null +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/DateTime/NetworkDaysTest.php @@ -0,0 +1,34 @@ +assertEquals($expectedResult, $result, '', 1E-8); + } + + public function providerNETWORKDAYS() + { + return require 'data/Calculation/DateTime/NETWORKDAYS.php'; + } +} diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/DateTime/SecondTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/DateTime/SecondTest.php new file mode 100644 index 00000000..e55f01ce --- /dev/null +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/DateTime/SecondTest.php @@ -0,0 +1,34 @@ +assertEquals($expectedResult, $result, '', 1E-8); + } + + public function providerSECOND() + { + return require 'data/Calculation/DateTime/SECOND.php'; + } +} diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/DateTime/TimeTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/DateTime/TimeTest.php new file mode 100644 index 00000000..5a0f3b00 --- /dev/null +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/DateTime/TimeTest.php @@ -0,0 +1,55 @@ +assertEquals($expectedResult, $result, '', 1E-8); + } + + public function providerTIME() + { + return require 'data/Calculation/DateTime/TIME.php'; + } + + public function testTIMEtoUnixTimestamp() + { + Functions::setReturnDateType(Functions::RETURNDATE_PHP_NUMERIC); + + $result = DateTime::TIME(7, 30, 20); + $this->assertEquals(27020, $result, '', 1E-8); + } + + public function testTIMEtoDateTimeObject() + { + Functions::setReturnDateType(Functions::RETURNDATE_PHP_OBJECT); + + $result = DateTime::TIME(7, 30, 20); + // Must return an object... + $this->assertInternalType('object', $result); + // ... of the correct type + $this->assertTrue(is_a($result, 'DateTimeInterface')); + // ... with the correct value + $this->assertEquals($result->format('H:i:s'), '07:30:20'); + } +} diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/DateTime/TimeValueTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/DateTime/TimeValueTest.php new file mode 100644 index 00000000..6a45f6a3 --- /dev/null +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/DateTime/TimeValueTest.php @@ -0,0 +1,55 @@ +assertEquals($expectedResult, $result, '', 1E-8); + } + + public function providerTIMEVALUE() + { + return require 'data/Calculation/DateTime/TIMEVALUE.php'; + } + + public function testTIMEVALUEtoUnixTimestamp() + { + Functions::setReturnDateType(Functions::RETURNDATE_UNIX_TIMESTAMP); + + $result = DateTime::TIMEVALUE('7:30:20'); + $this->assertEquals(23420, $result, '', 1E-8); + } + + public function testTIMEVALUEtoDateTimeObject() + { + Functions::setReturnDateType(Functions::RETURNDATE_PHP_DATETIME_OBJECT); + + $result = DateTime::TIMEVALUE('7:30:20'); + // Must return an object... + $this->assertInternalType('object', $result); + // ... of the correct type + $this->assertTrue(is_a($result, 'DateTimeInterface')); + // ... with the correct value + $this->assertEquals($result->format('H:i:s'), '07:30:20'); + } +} diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/DateTime/WeekDayTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/DateTime/WeekDayTest.php new file mode 100644 index 00000000..9636e7e7 --- /dev/null +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/DateTime/WeekDayTest.php @@ -0,0 +1,34 @@ +assertEquals($expectedResult, $result, '', 1E-8); + } + + public function providerWEEKDAY() + { + return require 'data/Calculation/DateTime/WEEKDAY.php'; + } +} diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/DateTime/WeekNumTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/DateTime/WeekNumTest.php new file mode 100644 index 00000000..f310aa18 --- /dev/null +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/DateTime/WeekNumTest.php @@ -0,0 +1,34 @@ +assertEquals($expectedResult, $result, '', 1E-8); + } + + public function providerWEEKNUM() + { + return require 'data/Calculation/DateTime/WEEKNUM.php'; + } +} diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/DateTime/WorkDayTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/DateTime/WorkDayTest.php new file mode 100644 index 00000000..d735203c --- /dev/null +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/DateTime/WorkDayTest.php @@ -0,0 +1,34 @@ +assertEquals($expectedResult, $result, '', 1E-8); + } + + public function providerWORKDAY() + { + return require 'data/Calculation/DateTime/WORKDAY.php'; + } +} diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/DateTime/YearFracTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/DateTime/YearFracTest.php new file mode 100644 index 00000000..60c35819 --- /dev/null +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/DateTime/YearFracTest.php @@ -0,0 +1,34 @@ +assertEquals($expectedResult, $result, '', 1E-8); + } + + public function providerYEARFRAC() + { + return require 'data/Calculation/DateTime/YEARFRAC.php'; + } +} diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/DateTime/YearTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/DateTime/YearTest.php new file mode 100644 index 00000000..f0412739 --- /dev/null +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/DateTime/YearTest.php @@ -0,0 +1,34 @@ +assertEquals($expectedResult, $result, '', 1E-8); + } + + public function providerYEAR() + { + return require 'data/Calculation/DateTime/YEAR.php'; + } +} diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/Statistical/AveDevTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/Statistical/AveDevTest.php index 6babf483..9866082f 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/Statistical/AveDevTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/Statistical/AveDevTest.php @@ -21,7 +21,7 @@ class AveDevTest extends TestCase public function testAVEDEV($expectedResult, ...$args) { $result = Statistical::AVEDEV(...$args); - self::assertEquals($expectedResult, $result, '', 1E-12); + $this->assertEquals($expectedResult, $result, '', 1E-12); } public function providerAVEDEV() diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/Statistical/AverageATest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/Statistical/AverageATest.php index 64fb7401..b0c6ff81 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/Statistical/AverageATest.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/Statistical/AverageATest.php @@ -21,7 +21,7 @@ class AverageATest extends TestCase public function testAVERAGEA($expectedResult, ...$args) { $result = Statistical::AVERAGEA(...$args); - self::assertEquals($expectedResult, $result, '', 1E-12); + $this->assertEquals($expectedResult, $result, '', 1E-12); } public function providerAVERAGEA() diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/Statistical/AverageIfTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/Statistical/AverageIfTest.php index cd2938ac..25462c7f 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/Statistical/AverageIfTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/Statistical/AverageIfTest.php @@ -21,7 +21,7 @@ class AverageIfTest extends TestCase public function testAVERAGEIF($expectedResult, ...$args) { $result = Statistical::AVERAGEIF(...$args); - self::assertEquals($expectedResult, $result, '', 1E-12); + $this->assertEquals($expectedResult, $result, '', 1E-12); } public function providerAVERAGEIF() diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/Statistical/AverageTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/Statistical/AverageTest.php index f7f75fc9..87d7bed8 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/Statistical/AverageTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/Statistical/AverageTest.php @@ -21,7 +21,7 @@ class AverageTest extends TestCase public function testAVERAGE($expectedResult, ...$args) { $result = Statistical::AVERAGE(...$args); - self::assertEquals($expectedResult, $result, '', 1E-12); + $this->assertEquals($expectedResult, $result, '', 1E-12); } public function providerAVERAGE() diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/Statistical/BetaDistTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/Statistical/BetaDistTest.php index cb84f75e..d40d0c3a 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/Statistical/BetaDistTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/Statistical/BetaDistTest.php @@ -21,7 +21,7 @@ class BetaDistTest extends TestCase public function testBETADIST($expectedResult, ...$args) { $result = Statistical::BETADIST(...$args); - self::assertEquals($expectedResult, $result, '', 1E-12); + $this->assertEquals($expectedResult, $result, '', 1E-12); } public function providerBETADIST() diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/Statistical/BetaInvTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/Statistical/BetaInvTest.php index 7dbc4bd7..3721c50d 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/Statistical/BetaInvTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/Statistical/BetaInvTest.php @@ -21,7 +21,7 @@ class BetaInvTest extends TestCase public function testBETAINV($expectedResult, ...$args) { $result = Statistical::BETAINV(...$args); - self::assertEquals($expectedResult, $result, '', 1E-12); + $this->assertEquals($expectedResult, $result, '', 1E-12); } public function providerBETAINV() diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/Statistical/BinomDistTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/Statistical/BinomDistTest.php index 3132c3ac..c9cfcf8e 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/Statistical/BinomDistTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/Statistical/BinomDistTest.php @@ -21,7 +21,7 @@ class BinomDistTest extends TestCase public function testBINOMDIST($expectedResult, ...$args) { $result = Statistical::BINOMDIST(...$args); - self::assertEquals($expectedResult, $result, '', 1E-12); + $this->assertEquals($expectedResult, $result, '', 1E-12); } public function providerBINOMDIST() diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/Statistical/ChiDistTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/Statistical/ChiDistTest.php index 935ef71b..1e2eb13a 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/Statistical/ChiDistTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/Statistical/ChiDistTest.php @@ -21,7 +21,7 @@ class ChiDistTest extends TestCase public function testCHIDIST($expectedResult, ...$args) { $result = Statistical::CHIDIST(...$args); - self::assertEquals($expectedResult, $result, '', 1E-12); + $this->assertEquals($expectedResult, $result, '', 1E-12); } public function providerCHIDIST() diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/Statistical/ChiInvTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/Statistical/ChiInvTest.php index 9980781e..c99c8f9c 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/Statistical/ChiInvTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/Statistical/ChiInvTest.php @@ -21,7 +21,7 @@ class ChiInvTest extends TestCase public function testCHIINV($expectedResult, ...$args) { $result = Statistical::CHIINV(...$args); - self::assertEquals($expectedResult, $result, '', 1E-12); + $this->assertEquals($expectedResult, $result, '', 1E-12); } public function providerCHIINV() diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/Statistical/ConfidenceTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/Statistical/ConfidenceTest.php index b42cae4b..5f6bb2e8 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/Statistical/ConfidenceTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/Statistical/ConfidenceTest.php @@ -21,7 +21,7 @@ class ConfidenceTest extends TestCase public function testCONFIDENCE($expectedResult, ...$args) { $result = Statistical::CONFIDENCE(...$args); - self::assertEquals($expectedResult, $result, '', 1E-12); + $this->assertEquals($expectedResult, $result, '', 1E-12); } public function providerCONFIDENCE() diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/Statistical/CorrelTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/Statistical/CorrelTest.php index 9add74b4..cefdff7b 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/Statistical/CorrelTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/Statistical/CorrelTest.php @@ -21,7 +21,7 @@ class CorrelTest extends TestCase public function testCORREL($expectedResult, array $xargs, array $yargs) { $result = Statistical::CORREL($xargs, $yargs); - self::assertEquals($expectedResult, $result, '', 1E-12); + $this->assertEquals($expectedResult, $result, '', 1E-12); } public function providerCORREL() diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/Statistical/CountATest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/Statistical/CountATest.php index 623062ae..51538a2c 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/Statistical/CountATest.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/Statistical/CountATest.php @@ -21,7 +21,7 @@ class CountATest extends TestCase public function testCOUNTA($expectedResult, ...$args) { $result = Statistical::COUNTA(...$args); - self::assertEquals($expectedResult, $result, '', 1E-12); + $this->assertEquals($expectedResult, $result, '', 1E-12); } public function providerCOUNTA() diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/Statistical/CountBlankTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/Statistical/CountBlankTest.php index e58c8d19..86979d87 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/Statistical/CountBlankTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/Statistical/CountBlankTest.php @@ -21,7 +21,7 @@ class CountBlankTest extends TestCase public function testCOUNTBLANK($expectedResult, ...$args) { $result = Statistical::COUNTBLANK(...$args); - self::assertEquals($expectedResult, $result, '', 1E-12); + $this->assertEquals($expectedResult, $result, '', 1E-12); } public function providerCOUNTBLANK() diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/Statistical/CountIfTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/Statistical/CountIfTest.php index cad1765a..92c39865 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/Statistical/CountIfTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/Statistical/CountIfTest.php @@ -21,7 +21,7 @@ class CountIfTest extends TestCase public function testCOUNTIF($expectedResult, ...$args) { $result = Statistical::COUNTIF(...$args); - self::assertEquals($expectedResult, $result, '', 1E-12); + $this->assertEquals($expectedResult, $result, '', 1E-12); } public function providerCOUNTIF() diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/Statistical/CountIfsTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/Statistical/CountIfsTest.php index 4f6e4776..472d9d61 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/Statistical/CountIfsTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/Statistical/CountIfsTest.php @@ -21,7 +21,7 @@ class CountIfsTest extends TestCase public function testCOUNTIFS($expectedResult, ...$args) { $result = Statistical::COUNTIFS(...$args); - self::assertEquals($expectedResult, $result, '', 1E-12); + $this->assertEquals($expectedResult, $result, '', 1E-12); } public function providerCOUNTIFS() diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/Statistical/CountTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/Statistical/CountTest.php index 065a0af1..73c20d25 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/Statistical/CountTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/Statistical/CountTest.php @@ -21,7 +21,7 @@ class CountTest extends TestCase public function testBasicCOUNT($expectedResult, ...$args) { $result = Statistical::COUNT(...$args); - self::assertEquals($expectedResult, $result, '', 1E-12); + $this->assertEquals($expectedResult, $result, '', 1E-12); } public function providerBasicCOUNT() @@ -37,7 +37,7 @@ class CountTest extends TestCase public function testExcelCOUNT($expectedResult, ...$args) { $result = Statistical::COUNT(...$args); - self::assertEquals($expectedResult, $result, '', 1E-12); + $this->assertEquals($expectedResult, $result, '', 1E-12); } public function providerExcelCOUNT() @@ -55,7 +55,7 @@ class CountTest extends TestCase Functions::setCompatibilityMode(Functions::COMPATIBILITY_OPENOFFICE); $result = Statistical::COUNT(...$args); - self::assertEquals($expectedResult, $result, '', 1E-12); + $this->assertEquals($expectedResult, $result, '', 1E-12); } public function providerOpenOfficeCOUNT() @@ -73,7 +73,7 @@ class CountTest extends TestCase Functions::setCompatibilityMode(Functions::COMPATIBILITY_GNUMERIC); $result = Statistical::COUNT(...$args); - self::assertEquals($expectedResult, $result, '', 1E-12); + $this->assertEquals($expectedResult, $result, '', 1E-12); } public function providerGnumericCOUNT() diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/Statistical/CovarTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/Statistical/CovarTest.php index 57d43d34..7d70283a 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/Statistical/CovarTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/Statistical/CovarTest.php @@ -21,7 +21,7 @@ class CovarTest extends TestCase public function testCOVAR($expectedResult, ...$args) { $result = Statistical::COVAR(...$args); - self::assertEquals($expectedResult, $result, '', 1E-12); + $this->assertEquals($expectedResult, $result, '', 1E-12); } public function providerCOVAR() diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/Statistical/ForecastTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/Statistical/ForecastTest.php index 2011285e..2fcb1e54 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/Statistical/ForecastTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/Statistical/ForecastTest.php @@ -21,7 +21,7 @@ class ForecastTest extends TestCase public function testFORECAST($expectedResult, ...$args) { $result = Statistical::FORECAST(...$args); - self::assertEquals($expectedResult, $result, '', 1E-12); + $this->assertEquals($expectedResult, $result, '', 1E-12); } public function providerFORECAST() diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/Statistical/InterceptTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/Statistical/InterceptTest.php index f2cb233f..b66bd766 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/Statistical/InterceptTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/Statistical/InterceptTest.php @@ -21,7 +21,7 @@ class InterceptTest extends TestCase public function testINTERCEPT($expectedResult, array $xargs, array $yargs) { $result = Statistical::INTERCEPT($xargs, $yargs); - self::assertEquals($expectedResult, $result, '', 1E-12); + $this->assertEquals($expectedResult, $result, '', 1E-12); } public function providerINTERCEPT() diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/Statistical/MaxIfsTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/Statistical/MaxIfsTest.php index 1000a09b..5e4ae376 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/Statistical/MaxIfsTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/Statistical/MaxIfsTest.php @@ -21,7 +21,7 @@ class MaxIfsTest extends TestCase public function testMAXIFS($expectedResult, ...$args) { $result = Statistical::MAXIFS(...$args); - self::assertEquals($expectedResult, $result, '', 1E-12); + $this->assertEquals($expectedResult, $result, '', 1E-12); } public function providerMAXIFS() diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/Statistical/MinIfsTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/Statistical/MinIfsTest.php index bbe21b00..b0ab4088 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/Statistical/MinIfsTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/Statistical/MinIfsTest.php @@ -21,7 +21,7 @@ class MinIfsTest extends TestCase public function testMINIFS($expectedResult, ...$args) { $result = Statistical::MINIFS(...$args); - self::assertEquals($expectedResult, $result, '', 1E-12); + $this->assertEquals($expectedResult, $result, '', 1E-12); } public function providerMINIFS() diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/Statistical/PermutTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/Statistical/PermutTest.php index 4f03d07f..8f4eeb69 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/Statistical/PermutTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/Statistical/PermutTest.php @@ -21,7 +21,7 @@ class PermutTest extends TestCase public function testPERMUT($expectedResult, ...$args) { $result = Statistical::PERMUT(...$args); - self::assertEquals($expectedResult, $result, '', 1E-12); + $this->assertEquals($expectedResult, $result, '', 1E-12); } public function providerPERMUT() diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/Statistical/RsqTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/Statistical/RsqTest.php index 7c540516..cf91b314 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/Statistical/RsqTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/Statistical/RsqTest.php @@ -21,7 +21,7 @@ class RsqTest extends TestCase public function testRSQ($expectedResult, array $xargs, array $yargs) { $result = Statistical::RSQ($xargs, $yargs); - self::assertEquals($expectedResult, $result, '', 1E-12); + $this->assertEquals($expectedResult, $result, '', 1E-12); } public function providerRSQ() diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/Statistical/SlopeTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/Statistical/SlopeTest.php index a400ceae..b62fede3 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/Statistical/SlopeTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/Statistical/SlopeTest.php @@ -21,7 +21,7 @@ class SlopeTest extends TestCase public function testSLOPE($expectedResult, array $xargs, array $yargs) { $result = Statistical::SLOPE($xargs, $yargs); - self::assertEquals($expectedResult, $result, '', 1E-12); + $this->assertEquals($expectedResult, $result, '', 1E-12); } public function providerSLOPE() diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/Statistical/SteyxTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/Statistical/SteyxTest.php index 01d1b1bf..fe8d2ae5 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/Statistical/SteyxTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/Statistical/SteyxTest.php @@ -21,7 +21,7 @@ class SteyxTest extends TestCase public function testSTEYX($expectedResult, array $xargs, array $yargs) { $result = Statistical::STEYX($xargs, $yargs); - self::assertEquals($expectedResult, $result, '', 1E-12); + $this->assertEquals($expectedResult, $result, '', 1E-12); } public function providerSTEYX() diff --git a/tests/data/Calculation/DateTime/DATE.php b/tests/data/Calculation/DateTime/DATE.php index d8882fba..83beefb8 100644 --- a/tests/data/Calculation/DateTime/DATE.php +++ b/tests/data/Calculation/DateTime/DATE.php @@ -5,485 +5,329 @@ return [ [ 6890, - 18, - 11, - 11, + 18, 11, 11, ], // Excel 1900 Calendar Base Date [ 1, - 1900, - 1, - 1, + 1900, 1, 1, ], // Day before Excel mythical 1900 leap day [ 59, - 1900, - 2, - 28, + 1900, 2, 28, ], // Excel mythical 1900 leap day [ 60, - 1900, - 2, - 29, + 1900, 2, 29, ], - // Day after Excel mythical 1900 leap day [ + // Day after Excel mythical 1900 leap day 61, - 1900, - 3, - 1, + 1900, 3, 1, ], - // Day after Excel mythical 1900 leap day + // Day after Excel actual 1904 leap day [ 713, - 1901, - 12, - 13, + 1901, 12, 13, ], - // PHP 32-bit Earliest Date + // PHP 32-bit Earliest Date (unix timestamp) [ 714, - 1901, - 12, - 14, + 1901, 12, 14, ], [ 1461, - 1903, - 12, - 31, + 1903, 12, 31, ], // Excel 1904 Calendar Base Date [ 1462, - 1904, - 1, - 1, + 1904, 1, 1, ], [ 1463, - 1904, - 1, - 2, + 1904, 1, 2, ], [ 22269, - 1960, - 12, - 19, + 1960, 12, 19, ], - // PHP Base Date + // PHP (unix timestamp) Base Date [ 25569, - 1970, - 1, - 1, + 1970, 1, 1, ], [ 30292, - 1982, - 12, - 7, + 1982, 12, 7, ], [ 39611, - 2008, - 6, - 12, + 2008, 6, 12, ], - // PHP 32-bit Latest Date + // PHP (unix timestamp) 32-bit Latest Date [ 50424, - 2038, - 1, - 19, + 2038, 1, 19, ], - // Day after PHP 32-bit Latest Date + // Day after PHP (unix timestamp) 32-bit Latest Date [ 50425, - 2038, - 1, - 20, + 2038, 1, 20, ], [ 39448, - 2008, - 1, - 1, + 2008, 1, 1, ], [ 39447, - 2008, - 1, - null, + 2008, 1, null, ], [ 39446, - 2008, - 1, - -1, + 2008, 1, -1, ], [ 39417, - 2008, - 1, - -30, + 2008, 1, -30, ], [ 39416, - 2008, - 1, - -31, + 2008, 1, -31, ], [ 39082, - 2008, - 1, - -365, + 2008, 1, -365, ], [ 39508, - 2008, - 3, - 1, + 2008, 3, 1, ], [ 39507, - 2008, - 3, - null, + 2008, 3, null, ], [ 39506, - 2008, - 3, - -1, + 2008, 3, -1, ], [ 39142, - 2008, - 3, - -365, + 2008, 3, -365, ], [ 39417, - 2008, - null, - 1, + 2008, null, 1, ], [ 39387, - 2008, - -1, - 1, + 2008, -1, 1, ], [ 39083, - 2008, - -11, - 1, + 2008, -11, 1, ], [ 39052, - 2008, - -12, - 1, + 2008, -12, 1, ], [ 39022, - 2008, - -13, - 1, + 2008, -13, 1, ], [ 39051, - 2008, - -13, - 30, + 2008, -13, 30, ], [ 39021, - 2008, - -13, - null, + 2008, -13, null, ], [ 38991, - 2008, - -13, - -30, + 2008, -13, -30, ], [ 38990, - 2008, - -13, - -31, + 2008, -13, -31, ], [ 39814, - 2008, - 13, - 1, + 2008, 13, 1, ], [ 39507, - 2007, - 15, - null, + 2007, 15, null, ], [ 40210, - 2008, - 26, - 1, + 2008, 26, 1, ], [ 40199, - 2008, - 26, - -10, + 2008, 26, -10, ], [ 38686, - 2008, - -26, - 61, + 2008, -26, 61, ], [ 39641, - 2010, - -15, - -50, + 2010, -15, -50, ], [ 39741, - 2010, - -15, - 50, + 2010, -15, 50, ], [ 40552, - 2010, - 15, - -50, + 2010, 15, -50, ], [ 40652, - 2010, - 15, - 50, + 2010, 15, 50, ], [ 40179, - 2010, - 1.5, - 1, + 2010, 1.5, 1, ], [ 40178, - 2010, - 1.5, - 0, + 2010, 1.5, 0, ], [ 40148, - 2010, - 0, - 1.5, + 2010, 0, 1.5, ], [ 40179, - 2010, - 1, - 1.5, + 2010, 1, 1.5, ], [ 41075, - 2012, - 6, - 15, + 2012, 6, 15, ], [ 41060, - 2012, - 6, - null, + 2012, 6, null, ], [ 40892, - 2012, - null, - 15, + 2012, null, 15, ], [ 167, - null, - 6, - 15, + null, 6, 15, ], [ 3819, - 10, - 6, - 15, + 10, 6, 15, ], [ 3622, - 10, - null, - null, + 10, null, null, ], [ 274, - null, - 10, - null, + null, 10, null, ], [ '#NUM!', - null, - null, - 10, + null, null, 10, ], [ '#NUM!', - -20, - null, - null, + -20, null, null, ], [ '#NUM!', - -20, - 6, - 15, + -20, 6, 15, ], // Excel Maximum Date [ 2958465, - 9999, - 12, - 31, + 9999, 12, 31, ], // Exceeded Excel Maximum Date [ '#NUM!', - 10000, - 1, - 1, + 10000, 1, 1, ], [ 39670, - 2008, - 8, - 10, + 2008, 8, 10, ], [ 39813, - 2008, - 12, - 31, + 2008, 12, 31, ], [ 39692, - 2008, - 8, - 32, + 2008, 8, 32, ], [ 39844, - 2008, - 13, - 31, + 2008, 13, 31, ], [ 39813, - 2009, - 1, - 0, + 2009, 1, 0, ], [ 39812, - 2009, - 1, - -1, + 2009, 1, -1, ], [ 39782, - 2009, - 0, - 0, + 2009, 0, 0, ], [ 39781, - 2009, - 0, - -1, + 2009, 0, -1, ], [ 39752, - 2009, - -1, - 0, + 2009, -1, 0, ], [ 39751, - 2009, - -1, - -1, + 2009, -1, -1, ], [ 40146, - 2010, - 0, - -1, + 2010, 0, -1, ], [ 40329, - 2010, - 5, - 31, + 2010, 5, 31, ], // MS Excel will fail with a #VALUE return, but PhpSpreadsheet can parse this date [ 40199, - 2010, - 1, - '21st', + 2010, 1, '21st', ], // MS Excel will fail with a #VALUE return, but PhpSpreadsheet can parse this date [ 40258, - 2010, - 'March', - '21st', + 2010, 'March', '21st', ], // MS Excel will fail with a #VALUE return, but PhpSpreadsheet can parse this date [ 40258, - 2010, - 'March', - 21, + 2010, 'March', 21, ], [ '#VALUE!', - 'ABC', - 1, - 21, + 'ABC', 1, 21, ], [ '#VALUE!', - 2010, - 'DEF', - 21, + 2010, 'DEF', 21, ], [ '#VALUE!', - 2010, - 3, - 'GHI', + 2010, 3, 'GHI', ], ]; diff --git a/tests/data/Calculation/DateTime/DAY.php b/tests/data/Calculation/DateTime/DAY.php index affc4df3..c7fe7a48 100644 --- a/tests/data/Calculation/DateTime/DAY.php +++ b/tests/data/Calculation/DateTime/DAY.php @@ -4,28 +4,28 @@ return [ [ - 19, // Result for Excel - 19, // Result for OpenOffice + 19, // Result for Excel + 19, // Result for OpenOffice 22269, ], [ - 1, // Result for Excel - 1, // Result for OpenOffice + 1, // Result for Excel + 1, // Result for OpenOffice 30348, ], [ - 10, // Result for Excel - 10, // Result for OpenOffice + 10, // Result for Excel + 10, // Result for OpenOffice 30843, ], [ - 11, // Result for Excel - 11, // Result for OpenOffice + 11, // Result for Excel + 11, // Result for OpenOffice '11-Nov-1918', ], [ - 28, // Result for Excel - 28, // Result for OpenOffice + 28, // Result for Excel + 28, // Result for OpenOffice '28-Feb-1904', ], [ @@ -34,23 +34,23 @@ return [ 'Invalid', ], [ - '#NUM!', // Result for Excel - 29, // Result for OpenOffice + '#NUM!', // Result for Excel + 29, // Result for OpenOffice -1, ], [ - 1, // Result for Excel - 31, // Result for OpenOffice + 1, // Result for Excel + 31, // Result for OpenOffice 1, ], [ - 0, // Result for Excel - 30, // Result for OpenOffice + 0, // Result for Excel + 30, // Result for OpenOffice 0.5, ], [ - 0, // Result for Excel - 30, // Result for OpenOffice + 0, // Result for Excel + 30, // Result for OpenOffice 0, ], ]; diff --git a/tests/data/Calculation/DateTime/TIME.php b/tests/data/Calculation/DateTime/TIME.php index 636c316e..6f609712 100644 --- a/tests/data/Calculation/DateTime/TIME.php +++ b/tests/data/Calculation/DateTime/TIME.php @@ -3,134 +3,90 @@ return [ [ 0.75776620370400005, - 18, - 11, - 11, + 18, 11, 11, ], [ 0.26047453703700002, - 6, - 15, - 5, + 6, 15, 5, ], [ 0.52094907407400004, - 12, - 30, - 10, + 12, 30, 10, ], [ 0.78153935185199996, - 18, - 45, - 25, + 18, 45, 25, ], [ 0.64780092592600003, - 15, - 32, - 50, + 15, 32, 50, ], [ 0.50070601851899998, - 12, - null, - 61, + 12, null, 61, ], [ 0.45832175925899998, - 11, - null, - -1, + 11, null, -1, ], [ 0.41589120370400001, - 10, - null, - -67, + 10, null, -67, ], [ 0.58478009259300001, - 13, - 62, - 5, + 13, 62, 5, ], [ 0.31964120370400001, - 9, - -80, - 17, + 9, -80, 17, ], [ 0.22083333333300001, - 8, - -162, - null, + 8, -162, null, ], [ '#NUM!', - 2, - -120, - -1, + 2, -120, -1, ], [ 0.0, - 2, - -120, - null, + 2, -120, null, ], [ 1.1574074E-5, - 2, - -120, - 1, + 2, -120, 1, ], [ 0.50071759259299997, - 36, - 1, - 2, + 36, 1, 2, ], [ '#NUM!', - -1, - 2, - 3, + -1, 2, 3, ], [ 0.001030092593, - -1, - 61, - 29, + -1, 61, 29, ], [ 0.0, - -1, - 61, - -60, + -1, 61, -60, ], [ '#VALUE!', - 'A', - null, - null, + 'A', null, null, ], [ 0.49930555555599998, - 11, - 59, - 0, + 11, 59, 0, ], [ 0.5, - 12, - 0, - 0, + 12, 0, 0, ], [ 0.70011574074100003, - 16, - 48, - 10, + 16, 48, 10, ], ]; diff --git a/tests/data/Calculation/DateTime/WEEKDAY.php b/tests/data/Calculation/DateTime/WEEKDAY.php index b1013d94..8cc68082 100644 --- a/tests/data/Calculation/DateTime/WEEKDAY.php +++ b/tests/data/Calculation/DateTime/WEEKDAY.php @@ -7,13 +7,11 @@ return [ ], [ 4, - '24-Oct-1968', - 2, + '24-Oct-1968', 2, ], [ 3, - '24-Oct-1968', - 3, + '24-Oct-1968', 3, ], [ 4, @@ -21,13 +19,11 @@ return [ ], [ 3, - '2000-06-14', - 2, + '2000-06-14', 2, ], [ 2, - '2000-06-14', - 3, + '2000-06-14', 3, ], [ 4, @@ -35,13 +31,11 @@ return [ ], [ 3, - '1996-07-24', - 2, + '1996-07-24', 2, ], [ 2, - '1996-07-24', - 3, + '1996-07-24', 3, ], [ 7, @@ -49,13 +43,11 @@ return [ ], [ 6, - '1996-07-27', - 2, + '1996-07-27', 2, ], [ 5, - '1996-07-27', - 3, + '1996-07-27', 3, ], [ 1, @@ -63,13 +55,11 @@ return [ ], [ 7, - '1977-7-31', - 2, + '1977-7-31', 2, ], [ 6, - '1977-7-31', - 3, + '1977-7-31', 3, ], [ 2, @@ -77,18 +67,15 @@ return [ ], [ 1, - '1977-8-1', - 2, + '1977-8-1', 2, ], [ 0, - '1977-8-1', - 3, + '1977-8-1', 3, ], [ 7, - '1900-2-5', - 2, + '1900-2-5', 2, ], [ 4, @@ -100,23 +87,19 @@ return [ ], [ 5, - 38093, - 2, + 38093, 2, ], [ 4, - 38093, - 3, + 38093, 3, ], [ '#VALUE!', - '3/7/1977', - 'A', + '3/7/1977', 'A', ], [ '#NUM!', - '3/7/1977', - 0, + '3/7/1977', 0, ], [ '#VALUE!',