From bcda8307ab7b46d09f53edab8a9d72ffd894d166 Mon Sep 17 00:00:00 2001 From: MarkBaker Date: Sun, 14 Jul 2019 19:39:33 +0200 Subject: [PATCH 1/6] Merge branch 'master' of C:\Projects\PHPOffice\PHPSpreadsheet\develop with conflicts. --- tests/data/Style/NumberFormat.php | 47 +++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) diff --git a/tests/data/Style/NumberFormat.php b/tests/data/Style/NumberFormat.php index 69590b94..64cbd7c1 100644 --- a/tests/data/Style/NumberFormat.php +++ b/tests/data/Style/NumberFormat.php @@ -33,6 +33,16 @@ return [ 12, '#.0#', ], + [ + '-70', + -70, + '#,##0;[Red]-#,##0' + ], + [ + '70', + -70, + '#,##0;[Red]#,##0' + ], [ '0.1', 0.10000000000000001, @@ -114,6 +124,12 @@ return [ 12200000, '0.0,,', ], + // Percentage + [ + '12%', + 0.12, + '0%', + ], [ '8%', 0.080000000000000002, @@ -221,4 +237,35 @@ return [ 13.0316, '_("€"* #,##0.00_);_("€"* \(#,##0.00\);_("€"* "-"??_);_(@_)', ], + // Named colours + // Simple color + [ + '12345', + 12345, + '[Green]General', + ], + // Multiple colors + [ + '12345', + 12345, + '[Blue]0;[Red]0', + ], + // Multiple colors + [ + 'Positive', + 12, + '[Green]"Positive";[Red]"Negative";[Blue]"Zero"', + ], + // Multiple colors + [ + 'Zero', + 0, + '[Green]"Positive";[Red]"Negative";[Blue]"Zero"', + ], + // Multiple colors + [ + 'Negative', + -2, + '[Green]"Positive";[Red]"Negative";[Blue]"Zero"', + ], ]; From 905a697639d904d08e9ee5ffe3402ae63bbb8d2d Mon Sep 17 00:00:00 2001 From: MarkBaker Date: Sat, 27 Jul 2019 16:02:58 +0200 Subject: [PATCH 2/6] More work on refactoring Excel Calculation Function Unit Tests --- CHANGELOG.md | 1 + src/PhpSpreadsheet/Calculation/MathTrig.php | 7 ++- src/PhpSpreadsheet/Calculation/TextData.php | 33 ++++++------- .../Calculation/FinancialTest.php | 32 ------------- .../Functions/Financial/AccrintMTest.php | 31 ++++++++++++ .../Functions/Financial/AccrintTest.php | 31 ++++++++++++ .../Functions/LookupRef/HLookupTest.php | 31 ++++++++++++ .../Functions/LookupRef/LookupTest.php | 31 ++++++++++++ .../Functions/LookupRef/VLookupTest.php | 31 ++++++++++++ .../Calculation/LookupRefTest.php | 48 ------------------- 10 files changed, 174 insertions(+), 102 deletions(-) create mode 100644 tests/PhpSpreadsheetTests/Calculation/Functions/Financial/AccrintMTest.php create mode 100644 tests/PhpSpreadsheetTests/Calculation/Functions/Financial/AccrintTest.php create mode 100644 tests/PhpSpreadsheetTests/Calculation/Functions/LookupRef/HLookupTest.php create mode 100644 tests/PhpSpreadsheetTests/Calculation/Functions/LookupRef/LookupTest.php create mode 100644 tests/PhpSpreadsheetTests/Calculation/Functions/LookupRef/VLookupTest.php diff --git a/CHANGELOG.md b/CHANGELOG.md index 20819876..26b1d35b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org). ### Added +- Implementation of IFNA() Logical Function - When <br> appears in a table cell, set the cell to wrap [Issue #1071](https://github.com/PHPOffice/PhpSpreadsheet/issues/1071) and [PR #1070](https://github.com/PHPOffice/PhpSpreadsheet/pull/1070) - Add MAXIFS, MINIFS, COUNTIFS and Remove MINIF, MAXIF - [Issue #1056](https://github.com/PHPOffice/PhpSpreadsheet/issues/1056) - HLookup needs an ordered list even if range_lookup is set to false [Issue #1055](https://github.com/PHPOffice/PhpSpreadsheet/issues/1055) and [PR #1076](https://github.com/PHPOffice/PhpSpreadsheet/pull/1076) diff --git a/src/PhpSpreadsheet/Calculation/MathTrig.php b/src/PhpSpreadsheet/Calculation/MathTrig.php index 4e384ea3..30071c2d 100644 --- a/src/PhpSpreadsheet/Calculation/MathTrig.php +++ b/src/PhpSpreadsheet/Calculation/MathTrig.php @@ -220,10 +220,9 @@ class MathTrig return Functions::NAN(); } $factLoop = floor($factVal); - if (Functions::getCompatibilityMode() == Functions::COMPATIBILITY_GNUMERIC) { - if ($factVal > $factLoop) { - return Functions::NAN(); - } + if ((Functions::getCompatibilityMode() == Functions::COMPATIBILITY_GNUMERIC) && + ($factVal > $factLoop)) { + return Functions::NAN(); } $factorial = 1; diff --git a/src/PhpSpreadsheet/Calculation/TextData.php b/src/PhpSpreadsheet/Calculation/TextData.php index e30b2ff7..d03c4983 100644 --- a/src/PhpSpreadsheet/Calculation/TextData.php +++ b/src/PhpSpreadsheet/Calculation/TextData.php @@ -52,7 +52,7 @@ class TextData return ($stringValue) ? Calculation::getTRUE() : Calculation::getFALSE(); } - if (self::$invalidChars == null) { + if (self::$invalidChars === null) { self::$invalidChars = range(chr(0), chr(31)); } @@ -84,6 +84,15 @@ class TextData return null; } + private static function convertBooleanValue($value) + { + if (Functions::getCompatibilityMode() == Functions::COMPATIBILITY_OPENOFFICE) { + return (int)$value; + } + + return ($value) ? Calculation::getTRUE() : Calculation::getFALSE(); + } + /** * ASCIICODE. * @@ -98,11 +107,7 @@ class TextData } $characters = Functions::flattenSingleValue($characters); if (is_bool($characters)) { - if (Functions::getCompatibilityMode() == Functions::COMPATIBILITY_OPENOFFICE) { - $characters = (int) $characters; - } else { - $characters = ($characters) ? Calculation::getTRUE() : Calculation::getFALSE(); - } + $characters = self::convertBooleanValue($characters); } $character = $characters; @@ -126,11 +131,7 @@ class TextData $aArgs = Functions::flattenArray($args); foreach ($aArgs as $arg) { if (is_bool($arg)) { - if (Functions::getCompatibilityMode() == Functions::COMPATIBILITY_OPENOFFICE) { - $arg = (int) $arg; - } else { - $arg = ($arg) ? Calculation::getTRUE() : Calculation::getFALSE(); - } + $arg = self::convertBooleanValue($arg); } $returnValue .= $arg; } @@ -197,7 +198,7 @@ class TextData } if (($offset > 0) && (StringHelper::countCharacters($haystack) > $offset)) { - if (StringHelper::countCharacters($needle) == 0) { + if (StringHelper::countCharacters($needle) === 0) { return $offset; } @@ -232,7 +233,7 @@ class TextData } if (($offset > 0) && (StringHelper::countCharacters($haystack) > $offset)) { - if (StringHelper::countCharacters($needle) == 0) { + if (StringHelper::countCharacters($needle) === 0) { return $offset; } @@ -659,11 +660,7 @@ class TextData if ($ignoreEmpty && trim($arg) == '') { unset($aArgs[$key]); } elseif (is_bool($arg)) { - if (Functions::getCompatibilityMode() == Functions::COMPATIBILITY_OPENOFFICE) { - $arg = (int) $arg; - } else { - $arg = ($arg) ? Calculation::getTRUE() : Calculation::getFALSE(); - } + $arg = self::convertBooleanValue($arg); } } diff --git a/tests/PhpSpreadsheetTests/Calculation/FinancialTest.php b/tests/PhpSpreadsheetTests/Calculation/FinancialTest.php index 2d8d770a..d98d91c5 100644 --- a/tests/PhpSpreadsheetTests/Calculation/FinancialTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/FinancialTest.php @@ -13,38 +13,6 @@ class FinancialTest extends TestCase Functions::setCompatibilityMode(Functions::COMPATIBILITY_EXCEL); } - /** - * @dataProvider providerACCRINT - * - * @param mixed $expectedResult - */ - public function testACCRINT($expectedResult, ...$args) - { - $result = Financial::ACCRINT(...$args); - self::assertEquals($expectedResult, $result, '', 1E-8); - } - - public function providerACCRINT() - { - return require 'data/Calculation/Financial/ACCRINT.php'; - } - - /** - * @dataProvider providerACCRINTM - * - * @param mixed $expectedResult - */ - public function testACCRINTM($expectedResult, ...$args) - { - $result = Financial::ACCRINTM(...$args); - self::assertEquals($expectedResult, $result, '', 1E-8); - } - - public function providerACCRINTM() - { - return require 'data/Calculation/Financial/ACCRINTM.php'; - } - /** * @dataProvider providerAMORDEGRC * diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/Financial/AccrintMTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/Financial/AccrintMTest.php new file mode 100644 index 00000000..a89d74f1 --- /dev/null +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/Financial/AccrintMTest.php @@ -0,0 +1,31 @@ +assertEquals($expectedResult, $result, '', 1E-8); + } + + public function providerACCRINT() + { + return require 'data/Calculation/Financial/ACCRINT.php'; + } +} diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/LookupRef/HLookupTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/LookupRef/HLookupTest.php new file mode 100644 index 00000000..41a79621 --- /dev/null +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/LookupRef/HLookupTest.php @@ -0,0 +1,31 @@ +assertEquals($expectedResult, $result); + } + + public function providerHLOOKUP() + { + return require 'data/Calculation/LookupRef/HLOOKUP.php'; + } +} diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/LookupRef/LookupTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/LookupRef/LookupTest.php new file mode 100644 index 00000000..815d5b73 --- /dev/null +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/LookupRef/LookupTest.php @@ -0,0 +1,31 @@ +assertEquals($expectedResult, $result); + } + + public function providerLOOKUP() + { + return require 'data/Calculation/LookupRef/LOOKUP.php'; + } +} diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/LookupRef/VLookupTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/LookupRef/VLookupTest.php new file mode 100644 index 00000000..1de96dff --- /dev/null +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/LookupRef/VLookupTest.php @@ -0,0 +1,31 @@ +assertEquals($expectedResult, $result); + } + + public function providerVLOOKUP() + { + return require 'data/Calculation/LookupRef/VLOOKUP.php'; + } +} diff --git a/tests/PhpSpreadsheetTests/Calculation/LookupRefTest.php b/tests/PhpSpreadsheetTests/Calculation/LookupRefTest.php index f7f035e7..2d9b5e7b 100644 --- a/tests/PhpSpreadsheetTests/Calculation/LookupRefTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/LookupRefTest.php @@ -19,54 +19,6 @@ class LookupRefTest extends TestCase Functions::setCompatibilityMode(Functions::COMPATIBILITY_EXCEL); } - /** - * @dataProvider providerHLOOKUP - * - * @param mixed $expectedResult - */ - public function testHLOOKUP($expectedResult, ...$args) - { - $result = LookupRef::HLOOKUP(...$args); - self::assertEquals($expectedResult, $result); - } - - public function providerHLOOKUP() - { - return require 'data/Calculation/LookupRef/HLOOKUP.php'; - } - - /** - * @dataProvider providerVLOOKUP - * - * @param mixed $expectedResult - */ - public function testVLOOKUP($expectedResult, ...$args) - { - $result = LookupRef::VLOOKUP(...$args); - self::assertEquals($expectedResult, $result); - } - - public function providerVLOOKUP() - { - return require 'data/Calculation/LookupRef/VLOOKUP.php'; - } - - /** - * @dataProvider providerLOOKUP - * - * @param mixed $expectedResult - */ - public function testLOOKUP($expectedResult, ...$args) - { - $result = LookupRef::LOOKUP(...$args); - self::assertEquals($expectedResult, $result); - } - - public function providerLOOKUP() - { - return require 'data/Calculation/LookupRef/LOOKUP.php'; - } - /** * @dataProvider providerMATCH * From f14e5ea837af19ba26d5502c1af7c4ac6e723e92 Mon Sep 17 00:00:00 2001 From: MarkBaker Date: Sat, 27 Jul 2019 16:35:27 +0200 Subject: [PATCH 3/6] More refactoring Excel of Calculation Function Unit Tests --- src/PhpSpreadsheet/Calculation/TextData.php | 2 +- .../Functions/LookupRef/ChooseTest.php | 31 +++++++++ .../Functions/LookupRef/ColumnsTest.php | 31 +++++++++ .../Functions/LookupRef/HLookupTest.php | 2 +- .../Functions/LookupRef/IndexTest.php | 31 +++++++++ .../Functions/LookupRef/LookupTest.php | 2 +- .../Functions/LookupRef/MatchTest.php | 31 +++++++++ .../Functions/LookupRef/RowsTest.php | 31 +++++++++ .../Functions/LookupRef/VLookupTest.php | 2 +- .../Calculation/LookupRefTest.php | 64 ------------------- tests/data/Calculation/LookupRef/CHOOSE.php | 28 ++++++++ 11 files changed, 187 insertions(+), 68 deletions(-) create mode 100644 tests/PhpSpreadsheetTests/Calculation/Functions/LookupRef/ChooseTest.php create mode 100644 tests/PhpSpreadsheetTests/Calculation/Functions/LookupRef/ColumnsTest.php create mode 100644 tests/PhpSpreadsheetTests/Calculation/Functions/LookupRef/IndexTest.php create mode 100644 tests/PhpSpreadsheetTests/Calculation/Functions/LookupRef/MatchTest.php create mode 100644 tests/PhpSpreadsheetTests/Calculation/Functions/LookupRef/RowsTest.php create mode 100644 tests/data/Calculation/LookupRef/CHOOSE.php diff --git a/src/PhpSpreadsheet/Calculation/TextData.php b/src/PhpSpreadsheet/Calculation/TextData.php index d03c4983..050c1a9b 100644 --- a/src/PhpSpreadsheet/Calculation/TextData.php +++ b/src/PhpSpreadsheet/Calculation/TextData.php @@ -87,7 +87,7 @@ class TextData private static function convertBooleanValue($value) { if (Functions::getCompatibilityMode() == Functions::COMPATIBILITY_OPENOFFICE) { - return (int)$value; + return (int) $value; } return ($value) ? Calculation::getTRUE() : Calculation::getFALSE(); diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/LookupRef/ChooseTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/LookupRef/ChooseTest.php new file mode 100644 index 00000000..c1e043e0 --- /dev/null +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/LookupRef/ChooseTest.php @@ -0,0 +1,31 @@ +assertEquals($expectedResult, $result); + } + + public function providerCHOOSE() + { + return require 'data/Calculation/LookupRef/CHOOSE.php'; + } +} diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/LookupRef/ColumnsTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/LookupRef/ColumnsTest.php new file mode 100644 index 00000000..06872eec --- /dev/null +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/LookupRef/ColumnsTest.php @@ -0,0 +1,31 @@ +assertEquals($expectedResult, $result); + } + + public function providerCOLUMNS() + { + return require 'data/Calculation/LookupRef/COLUMNS.php'; + } +} diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/LookupRef/HLookupTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/LookupRef/HLookupTest.php index 41a79621..cb1f08fa 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/LookupRef/HLookupTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/LookupRef/HLookupTest.php @@ -2,8 +2,8 @@ namespace PhpOffice\PhpSpreadsheetTests\Calculation\Functions\LookupRef; -use PhpOffice\PhpSpreadsheet\Calculation\LookupRef; use PhpOffice\PhpSpreadsheet\Calculation\Functions; +use PhpOffice\PhpSpreadsheet\Calculation\LookupRef; use PHPUnit\Framework\TestCase; class HLookupTest extends TestCase diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/LookupRef/IndexTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/LookupRef/IndexTest.php new file mode 100644 index 00000000..0da7de1b --- /dev/null +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/LookupRef/IndexTest.php @@ -0,0 +1,31 @@ +assertEquals($expectedResult, $result); + } + + public function providerINDEX() + { + return require 'data/Calculation/LookupRef/INDEX.php'; + } +} diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/LookupRef/LookupTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/LookupRef/LookupTest.php index 815d5b73..0c5e610e 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/LookupRef/LookupTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/LookupRef/LookupTest.php @@ -2,8 +2,8 @@ namespace PhpOffice\PhpSpreadsheetTests\Calculation\Functions\LookupRef; -use PhpOffice\PhpSpreadsheet\Calculation\LookupRef; use PhpOffice\PhpSpreadsheet\Calculation\Functions; +use PhpOffice\PhpSpreadsheet\Calculation\LookupRef; use PHPUnit\Framework\TestCase; class LookupTest extends TestCase diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/LookupRef/MatchTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/LookupRef/MatchTest.php new file mode 100644 index 00000000..42c7b3bb --- /dev/null +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/LookupRef/MatchTest.php @@ -0,0 +1,31 @@ +assertEquals($expectedResult, $result); + } + + public function providerMATCH() + { + return require 'data/Calculation/LookupRef/MATCH.php'; + } +} diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/LookupRef/RowsTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/LookupRef/RowsTest.php new file mode 100644 index 00000000..46dd9851 --- /dev/null +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/LookupRef/RowsTest.php @@ -0,0 +1,31 @@ +assertEquals($expectedResult, $result); + } + + public function providerROWS() + { + return require 'data/Calculation/LookupRef/ROWS.php'; + } +} diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/LookupRef/VLookupTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/LookupRef/VLookupTest.php index 1de96dff..ea9afa20 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/LookupRef/VLookupTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/LookupRef/VLookupTest.php @@ -2,8 +2,8 @@ namespace PhpOffice\PhpSpreadsheetTests\Calculation\Functions\LookupRef; -use PhpOffice\PhpSpreadsheet\Calculation\LookupRef; use PhpOffice\PhpSpreadsheet\Calculation\Functions; +use PhpOffice\PhpSpreadsheet\Calculation\LookupRef; use PHPUnit\Framework\TestCase; class VLookupTest extends TestCase diff --git a/tests/PhpSpreadsheetTests/Calculation/LookupRefTest.php b/tests/PhpSpreadsheetTests/Calculation/LookupRefTest.php index 2d9b5e7b..9d7da8dd 100644 --- a/tests/PhpSpreadsheetTests/Calculation/LookupRefTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/LookupRefTest.php @@ -19,70 +19,6 @@ class LookupRefTest extends TestCase Functions::setCompatibilityMode(Functions::COMPATIBILITY_EXCEL); } - /** - * @dataProvider providerMATCH - * - * @param mixed $expectedResult - */ - public function testMATCH($expectedResult, ...$args) - { - $result = LookupRef::MATCH(...$args); - self::assertEquals($expectedResult, $result); - } - - public function providerMATCH() - { - return require 'data/Calculation/LookupRef/MATCH.php'; - } - - /** - * @dataProvider providerINDEX - * - * @param mixed $expectedResult - */ - public function testINDEX($expectedResult, ...$args) - { - $result = LookupRef::INDEX(...$args); - self::assertEquals($expectedResult, $result); - } - - public function providerINDEX() - { - return require 'data/Calculation/LookupRef/INDEX.php'; - } - - /** - * @dataProvider providerCOLUMNS - * - * @param mixed $expectedResult - */ - public function testCOLUMNS($expectedResult, ...$args) - { - $result = LookupRef::COLUMNS(...$args); - self::assertEquals($expectedResult, $result); - } - - public function providerCOLUMNS() - { - return require 'data/Calculation/LookupRef/COLUMNS.php'; - } - - /** - * @dataProvider providerROWS - * - * @param mixed $expectedResult - */ - public function testROWS($expectedResult, ...$args) - { - $result = LookupRef::ROWS(...$args); - self::assertEquals($expectedResult, $result); - } - - public function providerROWS() - { - return require 'data/Calculation/LookupRef/ROWS.php'; - } - /** * @dataProvider providerFormulaText * diff --git a/tests/data/Calculation/LookupRef/CHOOSE.php b/tests/data/Calculation/LookupRef/CHOOSE.php new file mode 100644 index 00000000..020ef498 --- /dev/null +++ b/tests/data/Calculation/LookupRef/CHOOSE.php @@ -0,0 +1,28 @@ + Date: Tue, 30 Jul 2019 18:54:37 +0200 Subject: [PATCH 4/6] More refactoring Excel of Calculation Function Unit Tests --- tests/data/Calculation/DateTime/DATE.php | 42 +++++++++--------------- 1 file changed, 16 insertions(+), 26 deletions(-) diff --git a/tests/data/Calculation/DateTime/DATE.php b/tests/data/Calculation/DateTime/DATE.php index 83beefb8..b903a826 100644 --- a/tests/data/Calculation/DateTime/DATE.php +++ b/tests/data/Calculation/DateTime/DATE.php @@ -3,49 +3,44 @@ // Year, Month, Day, Result, Comments return [ - [ - 6890, + 'Year without century specified' => [ + 6890, // '11th November 1918' 18, 11, 11, ], - // Excel 1900 Calendar Base Date - [ + 'Excel 1900 Calendar Base Date' => [ 1, 1900, 1, 1, ], - // Day before Excel mythical 1900 leap day - [ + 'Day before Excel mythical 1900 leap day' => [ 59, 1900, 2, 28, ], - // Excel mythical 1900 leap day - [ + 'Excel mythical 1900 leap day' => [ 60, 1900, 2, 29, ], - [ - // Day after Excel mythical 1900 leap day + 'Day after Excel mythical 1900 leap day' => [ 61, 1900, 3, 1, ], - // Day after Excel actual 1904 leap day - [ + 'Day after Excel actual 1904 leap day' => [ 713, 1901, 12, 13, ], - // PHP 32-bit Earliest Date (unix timestamp) - [ + 'signed 32-bit Unix Timestamp Earliest Date' => [ 714, 1901, 12, 14, ], + 'Day before Excel 1904 Calendar Base Date' => [ [ 1461, 1903, 12, 31, ], - // Excel 1904 Calendar Base Date - [ + 'Excel 1904 Calendar Base Date' => [ 1462, 1904, 1, 1, ], + 'Day after Excel 1904 Calendar Base Date' => [ [ 1463, 1904, 1, 2, @@ -54,8 +49,7 @@ return [ 22269, 1960, 12, 19, ], - // PHP (unix timestamp) Base Date - [ + 'Unix Timestamp Base Date' => [ 25569, 1970, 1, 1, ], @@ -67,13 +61,11 @@ return [ 39611, 2008, 6, 12, ], - // PHP (unix timestamp) 32-bit Latest Date - [ + '32-bit signed Unix Timestamp Latest Date' => [ 50424, 2038, 1, 19, ], - // Day after PHP (unix timestamp) 32-bit Latest Date - [ + 'Day after 32-bit signed Unix Timestamp Latest Date' => [ 50425, 2038, 1, 20, ], @@ -245,13 +237,11 @@ return [ '#NUM!', -20, 6, 15, ], - // Excel Maximum Date - [ + 'Excel Maximum Date' => [ 2958465, 9999, 12, 31, ], - // Exceeded Excel Maximum Date - [ + 'Exceeded Excel Maximum Date' => [ '#NUM!', 10000, 1, 1, ], From 4c9d51c11b36568eabecf23901ddd3d9bbed6c88 Mon Sep 17 00:00:00 2001 From: MarkBaker Date: Tue, 30 Jul 2019 19:00:00 +0200 Subject: [PATCH 5/6] Add Associative indexing to dataprovider for DATE --- tests/data/Calculation/DateTime/DATE.php | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/tests/data/Calculation/DateTime/DATE.php b/tests/data/Calculation/DateTime/DATE.php index b903a826..2068f675 100644 --- a/tests/data/Calculation/DateTime/DATE.php +++ b/tests/data/Calculation/DateTime/DATE.php @@ -1,7 +1,5 @@ [ 6890, // '11th November 1918' @@ -32,7 +30,6 @@ return [ 1901, 12, 14, ], 'Day before Excel 1904 Calendar Base Date' => [ - [ 1461, 1903, 12, 31, ], @@ -40,8 +37,7 @@ return [ 1462, 1904, 1, 1, ], - 'Day after Excel 1904 Calendar Base Date' => [ - [ + 'Day after Excel 1904 Calendar Base Date' => [ 1463, 1904, 1, 2, ], @@ -319,5 +315,6 @@ return [ [ '#VALUE!', 2010, 3, 'GHI', - ], + ] ]; + From 7219e665a0ba2e018020aca0701dfdfc3c69e589 Mon Sep 17 00:00:00 2001 From: MarkBaker Date: Tue, 30 Jul 2019 19:07:24 +0200 Subject: [PATCH 6/6] As always, falling foul of codesniffer --- tests/data/Calculation/DateTime/DATE.php | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/data/Calculation/DateTime/DATE.php b/tests/data/Calculation/DateTime/DATE.php index 2068f675..a7b3e7cc 100644 --- a/tests/data/Calculation/DateTime/DATE.php +++ b/tests/data/Calculation/DateTime/DATE.php @@ -317,4 +317,3 @@ return [ 2010, 3, 'GHI', ] ]; -