PhpSpreadsheet/tests/PhpSpreadsheetTests
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
..
Calculation Fix for Issue 2158 (AverageIf Calculation Problem) (#2160) 2021-06-15 09:54:57 +02:00
Cell PHPCS appeasement again 2021-06-03 21:42:20 +02:00
Chart Reduce PHPStan error in tests 2021-04-12 11:10:23 +09:00
Collection Resolve Deprecated setMethods() call when Mocking for tests (#1925) 2021-03-15 14:50:05 +01:00
Custom Reduce PHPStan error in tests 2021-04-12 11:10:23 +09:00
Document Document Properties - Coverage and 32-bit-safe Timestamps (#2113) 2021-05-30 13:55:58 +02:00
Functional BREAKING `Worksheet::getRowDimension()` and `Worksheet::getColumnDimension()` cannot return null anymore 2021-04-25 17:02:36 +09:00
Helper Improve Identification of Samples in Coverage Report (#2153) 2021-06-11 22:29:44 +02:00
Reader Fix for the BIFF-8 Xls colour mappings in the Reader (#2156) 2021-06-13 21:46:49 +02:00
Shared Html import dimension conversions (#2152) 2021-06-11 17:29:49 +02:00
Style fix: Set font size to 10 when given 0 2021-05-29 11:17:25 +02:00
Worksheet Merge branch 'master' into moredatefilter 2021-06-14 20:13:36 -07:00
Writer Document Properties - Coverage and 32-bit-safe Timestamps (#2113) 2021-05-30 13:55:58 +02:00
DefinedNameFormulaTest.php Reduce PHPStan error in tests 2021-04-12 11:10:23 +09:00
DefinedNameTest.php Reduce PHPStan error in tests 2021-04-12 11:10:23 +09:00
DocumentGeneratorTest.php Move documentation builder to infra so that it isn't included in non `--dev` composer downloads 2021-05-28 22:35:37 +02:00
HashTableTest.php Improve Coverage for HashTable, Fix Clone 2021-05-30 13:03:37 +02:00
IOFactoryTest.php Reduce PHPStan error in tests 2021-04-12 11:10:23 +09:00
LocaleGeneratorTest.php Fix phpcs, phpstan and scrutinizer issues 2021-05-28 22:35:37 +02:00
NamedFormulaTest.php Named formula implementation, and improved handling of Defined Names generally (#1535) 2020-07-26 12:00:06 +02:00
NamedRangeTest.php Named formula implementation, and improved handling of Defined Names generally (#1535) 2020-07-26 12:00:06 +02:00
ReferenceHelperTest.php Named formula implementation, and improved handling of Defined Names generally (#1535) 2020-07-26 12:00:06 +02:00
SettingsTest.php Reduce PHPStan error in tests 2021-04-12 11:10:23 +09:00
SpreadsheetTest.php Reduce PHPStan error in tests 2021-04-12 11:10:23 +09:00