PhpSpreadsheet/tests/data/Calculation/MathTrig
oleibman 1e74282259
Fix for Issue 2158 (AverageIf Calculation Problem) (#2160)
* Improve Identification of Samples in Coverage Report

The Phpunit coverage report currently contains bullet items like `PhpOffice\PhpSpreadsheetTests\Helper\SampleTest\testSample with data set "49"`. This extremely simple change takes advantage of Phpunit's ability to accept an array with keys which are either strings or integers, by using the sample filenames as the array keys rather than sequential but otherwise meaningless integers (e.g. `49` in the earlier cited item). The bullet item will now read `PhpOffice\PhpSpreadsheetTests\Helper\SampleTest\testSample with data set "Basic/38_Clone_worksheet.php"`.

* Fix for Issue 2158 (AverageIf Calculation Problem)

Issue #2158 reports an error calculating AverageIf because a function returns null rather than a string. There turn out to be several components to this problem:
- The nominal fix to the problem is to add some null-to-nullstring coercion in DatabaseAbstract.
- This fixes the error, but does not necessarily lead to the correct result because buildQuery treats values of null and null-string identically, whereas Excel does not. So change that to treat null-string as any other string.
- But that doesn't lead to the correct result either. That's because Functions/ifCondition recognizes a null string, but then continues to (over-)process it until it returns the wrong result. Fix this problem in conjunction with the other two, and we finally get the correct result.

A new unit test is added for AVERAGEIF, and new test cases are added for SUMIF. In each case, there are complementary tests for conditions of null and null-string, and the results agree with Excel. There may or may not be value in adding new tests to other functions, and I will be glad to do so for any functions which you care to identify, but no existing tests broke as a result of these changes.
2021-06-15 09:54:57 +02:00
..
ABS.php Continue MathTrig Breakup - Completion! (#1985) 2021-04-05 16:39:03 +02:00
ACOS.php Continue MathTrig Breakup - Trig Functions (#1905) 2021-03-13 12:06:30 +01:00
ACOSH.php Continue MathTrig Breakup - Trig Functions (#1905) 2021-03-13 12:06:30 +01:00
ACOT.php Continue MathTrig Breakup - Trig Functions (#1905) 2021-03-13 12:06:30 +01:00
ACOTH.php Continue MathTrig Breakup - Trig Functions (#1905) 2021-03-13 12:06:30 +01:00
ARABIC.php Update PHP-CS-Fixer rules 2020-05-18 13:49:57 +09:00
ASIN.php Continue MathTrig Breakup - Trig Functions (#1905) 2021-03-13 12:06:30 +01:00
ASINH.php Continue MathTrig Breakup - Trig Functions (#1905) 2021-03-13 12:06:30 +01:00
ATAN.php Continue MathTrig Breakup - Trig Functions (#1905) 2021-03-13 12:06:30 +01:00
ATAN2.php Continue MathTrig Breakup - Trig Functions (#1905) 2021-03-13 12:06:30 +01:00
ATANH.php Continue MathTrig Breakup - Trig Functions (#1905) 2021-03-13 12:06:30 +01:00
BASE.php Continue MathTrig Breakup - Problem Children (#1954) 2021-03-26 17:35:30 +09:00
CEILING.php ROUND Accepts null, false, and true as First Parameter (#1837) 2021-02-13 21:00:08 +01:00
CEILINGMATH.php ROUND Accepts null, false, and true as First Parameter (#1837) 2021-02-13 21:00:08 +01:00
CEILINGPRECISE.php ROUND Accepts null, false, and true as First Parameter (#1837) 2021-02-13 21:00:08 +01:00
COMBIN.php Continue MathTrig Breakup - Penultimate? (#1973) 2021-04-02 14:35:34 +02:00
COMBINA.php Continue MathTrig Breakup - Penultimate? (#1973) 2021-04-02 14:35:34 +02:00
COS.php Continue MathTrig Breakup - Trig Functions (#1905) 2021-03-13 12:06:30 +01:00
COSH.php Continue MathTrig Breakup - Trig Functions (#1905) 2021-03-13 12:06:30 +01:00
COT.php Continue MathTrig Breakup - Trig Functions (#1905) 2021-03-13 12:06:30 +01:00
COTH.php Continue MathTrig Breakup - Trig Functions (#1905) 2021-03-13 12:06:30 +01:00
CSC.php Continue MathTrig Breakup - Trig Functions (#1905) 2021-03-13 12:06:30 +01:00
CSCH.php Continue MathTrig Breakup - Trig Functions (#1905) 2021-03-13 12:06:30 +01:00
DEGREES.php Continue MathTrig Breakup - Completion! (#1985) 2021-04-05 16:39:03 +02:00
EVEN.php Continue MathTrig Breakup - Trig Functions (#1905) 2021-03-13 12:06:30 +01:00
EXP.php Continue MathTrig Breakup - Completion! (#1985) 2021-04-05 16:39:03 +02:00
FACT.php Continue MathTrig Breakup - Problem Children (#1954) 2021-03-26 17:35:30 +09:00
FACTDOUBLE.php Use proper syntax for variadic functions 2017-01-23 15:01:20 +09:00
FACTGNUMERIC.php Continue MathTrig Breakup - Problem Children (#1954) 2021-03-26 17:35:30 +09:00
FLOOR.php ROUND Accepts null, false, and true as First Parameter (#1837) 2021-02-13 21:00:08 +01:00
FLOORMATH.php ROUND Accepts null, false, and true as First Parameter (#1837) 2021-02-13 21:00:08 +01:00
FLOORPRECISE.php ROUND Accepts null, false, and true as First Parameter (#1837) 2021-02-13 21:00:08 +01:00
GCD.php Continue MathTrig Breakup - Penultimate? (#1973) 2021-04-02 14:35:34 +02:00
INT.php ROUND Accepts null, false, and true as First Parameter (#1837) 2021-02-13 21:00:08 +01:00
LCM.php Continue MathTrig Breakup - Penultimate? (#1973) 2021-04-02 14:35:34 +02:00
LN.php Continue MathTrig Breakup - Penultimate? (#1973) 2021-04-02 14:35:34 +02:00
LOG.php Continue MathTrig Breakup - Penultimate? (#1973) 2021-04-02 14:35:34 +02:00
LOG10.php Continue MathTrig Breakup - Penultimate? (#1973) 2021-04-02 14:35:34 +02:00
MDETERM.php Continue MathTrig Breakup - Penultimate? (#1973) 2021-04-02 14:35:34 +02:00
MINVERSE.php Continue MathTrig Breakup - Penultimate? (#1973) 2021-04-02 14:35:34 +02:00
MMULT.php Continue MathTrig Breakup - Problem Children (#1954) 2021-03-26 17:35:30 +09:00
MOD.php Continue MathTrig Breakup - Penultimate? (#1973) 2021-04-02 14:35:34 +02:00
MROUND.php ROUND Accepts null, false, and true as First Parameter (#1837) 2021-02-13 21:00:08 +01:00
MULTINOMIAL.php Continue MathTrig Breakup - Problem Children (#1954) 2021-03-26 17:35:30 +09:00
ODD.php Continue MathTrig Breakup - Trig Functions (#1905) 2021-03-13 12:06:30 +01:00
POWER.php Continue MathTrig Breakup - Penultimate? (#1973) 2021-04-02 14:35:34 +02:00
PRODUCT.php Continue MathTrig Breakup - Problem Children (#1954) 2021-03-26 17:35:30 +09:00
QUOTIENT.php Continue MathTrig Breakup - Problem Children (#1954) 2021-03-26 17:35:30 +09:00
RADIANS.php Continue MathTrig Breakup - Completion! (#1985) 2021-04-05 16:39:03 +02:00
RANDBETWEEN.php Continue MathTrig Breakup - Penultimate? (#1973) 2021-04-02 14:35:34 +02:00
ROMAN.php Support 'Forms' for ROMAN Function (#1828) 2021-02-13 21:23:58 +01:00
ROUND.php ROUND Accepts null, false, and true as First Parameter (#1837) 2021-02-13 21:00:08 +01:00
ROUNDDOWN.php ROUND Accepts null, false, and true as First Parameter (#1837) 2021-02-13 21:00:08 +01:00
ROUNDUP.php ROUND Accepts null, false, and true as First Parameter (#1837) 2021-02-13 21:00:08 +01:00
SEC.php Continue MathTrig Breakup - Trig Functions (#1905) 2021-03-13 12:06:30 +01:00
SECH.php Continue MathTrig Breakup - Trig Functions (#1905) 2021-03-13 12:06:30 +01:00
SERIESSUM.php Continue MathTrig Breakup - Problem Children (#1954) 2021-03-26 17:35:30 +09:00
SIGN.php Continue MathTrig Breakup - Trig Functions (#1905) 2021-03-13 12:06:30 +01:00
SIN.php Continue MathTrig Breakup - Trig Functions (#1905) 2021-03-13 12:06:30 +01:00
SINH.php Continue MathTrig Breakup - Trig Functions (#1905) 2021-03-13 12:06:30 +01:00
SQRT.php Continue MathTrig Breakup - Completion! (#1985) 2021-04-05 16:39:03 +02:00
SQRTPI.php Continue MathTrig Breakup - Completion! (#1985) 2021-04-05 16:39:03 +02:00
SUBTOTAL.php Continue MathTrig Breakup - Problem Children (#1954) 2021-03-26 17:35:30 +09:00
SUBTOTALHIDDEN.php Continue MathTrig Breakup - Problem Children (#1954) 2021-03-26 17:35:30 +09:00
SUM.php Fix for Issue 2042 (SUM Partially Broken) (#2045) 2021-05-03 18:31:01 +02:00
SUMIF.php Fix for Issue 2158 (AverageIf Calculation Problem) (#2160) 2021-06-15 09:54:57 +02:00
SUMIFS.php Additional conditionals from math trig (#1885) 2021-02-28 10:24:33 +01:00
SUMLITERALS.php Fix for Issue 2042 (SUM Partially Broken) (#2045) 2021-05-03 18:31:01 +02:00
SUMPRODUCT.php Continue MathTrig Breakup - Problem Children (#1954) 2021-03-26 17:35:30 +09:00
SUMSQ.php Continue MathTrig Breakup - Completion! (#1985) 2021-04-05 16:39:03 +02:00
SUMX2MY2.php Continue MathTrig Breakup - Completion! (#1985) 2021-04-05 16:39:03 +02:00
SUMX2PY2.php Continue MathTrig Breakup - Completion! (#1985) 2021-04-05 16:39:03 +02:00
SUMXMY2.php Continue MathTrig Breakup - Completion! (#1985) 2021-04-05 16:39:03 +02:00
TAN.php Continue MathTrig Breakup - Trig Functions (#1905) 2021-03-13 12:06:30 +01:00
TANH.php Continue MathTrig Breakup - Trig Functions (#1905) 2021-03-13 12:06:30 +01:00
TRUNC.php ROUND Accepts null, false, and true as First Parameter (#1837) 2021-02-13 21:00:08 +01:00