Files
MarkBaker a91dd60a98 Refactor unit tests to ensure that assertions are in the actual test, and not in an abstract class; and that setup/teardown are in the test and not an abstract. This means that assertions and setup/teardown are always in the file when reviewing PRs.
Also enforce more rigorous Excel Function implementation by testing the underlying implementation, call via the Calc Engine, and execution from in a worksheet.
Separate out unhappy path (exception) checks into a separate test, so that a single test isn't made overcomplex checking for every potentiality.

Scrutinizer may dislike variadics, for variable number of arguments of mixed type; but tough. It's 100% valid PHP, accepted by phpstan, and makes life a lot easier.

Initial work here covers all the database and datetime unit tests for Excel function implementations.
2023-03-10 04:15:12 +01:00

40 lines
1.8 KiB
PHP

<?php
use PhpOffice\PhpSpreadsheet\Calculation\Information\ExcelError;
return [
[ExcelError::VALUE(), '1-Jan-2007', 'ABC'],
[39094.0, '1-Jan-2007', 9],
[39619.0, '18-Jun-2008', 2],
[39619.0, '16-Jun-2008', 4],
[39622.0, '14-Jun-2008', 6],
[39629.0, '14-Jun-2008', 11],
[39611.0, '14-Jun-2008', -2],
[39605.0, '14-Jun-2008', -6],
[39815.0, '19-Dec-2008', 10],
[39820.0, '19-Dec-2008', 10, ['25-Dec-2008', '26-Dec-2008', '01-Jan-2009']],
[39820.0, '19-Dec-2008', 10, [['25-Dec-2008', '26-Dec-2008', '01-Jan-2009']]],
[39821.0, '19-Dec-2008', 10, [['25-Dec-2008', '26-Dec-2008'], ['01-Jan-2009', '02-Jan-2009']]],
[39801.0, 39820, -10, [['25-Dec-2008', '26-Dec-2008', '01-Jan-2009']]],
// this had been 41010, which is wrong - confirmed with Excel
[41011.0, '5-Apr-2012', 3, [['6-Apr-2012', '9-Apr-2012']]],
[44242.0, '15-Feb-2021', 0],
[ExcelError::VALUE(), '5-Apr-2012', 3, [['6-Apr-2012', 'ABQZ']]],
[39598.0, '2008-06-12', -9],
[44273.0, '2021-03-15', 3], // issue 1936 Monday
[44274.0, '2021-03-16', 3], // issue 1936 Tuesday
[44277.0, '2021-03-17', 3], // issue 1936 Wednesday
[44278.0, '2021-03-18', 3], // issue 1936 Thursday
[44279.0, '2021-03-19', 3], // issue 1936 Friday
[44279.0, '2021-03-20', 3], // issue 1936 Saturday
[44279.0, '2021-03-21', 3], // issue 1936 Sunday
[44276.0, '2021-03-21', 0], // issue 1936 Sunday doesn't change for 0
[44258.0, '2021-03-15', -8], // issue 1936 Monday
[44259.0, '2021-03-16', -8], // issue 1936 Tuesday
[44260.0, '2021-03-17', -8], // issue 1936 Wednesday
[44263.0, '2021-03-18', -8], // issue 1936 Thursday
[44264.0, '2021-03-19', -8], // issue 1936 Friday
[44265.0, '2021-03-20', -8], // issue 1936 Saturday
[44265.0, '2021-03-21', -8], // issue 1936 Sunday
];