PhpSpreadsheet/tests/PhpSpreadsheetTests
oleibman cd84020693
Xlsx Reader Better Namespace Handling Phase 1 Try2 (#2173)
* Xlsx Reader Better Namespace Handling Phase 1 Try2

This is a replacement for #2088, which has run into merge conflicts. I will close that PR in the near future, however the comments in that PR may prove useful for this one. While that PR has been in draft status all along, I am marking this one as ready. I will gladly add additional tests (and, of course, make code changes) that anyone has to suggest, but, with my most recent test files which I will describe in a separate comment, I have no further ideas on useful additions.

As mentioned in the earlier ticket, this is a risky change. But, as has been demonstrated, delaying it comes with its own set of risks. It would be helpful to have a temporary moratorium on changes to Reader/Xlsx until this change is merged.

The original commit message follows.

There have been a number of issues concerning the handling of legitimate but unexpected namespace prefixes in Xlsx spreadsheets created by software other than Excel and PhpSpreadsheet/PhpExcel.I have studied them, but, till now, have not had a good idea on how to act on them. A recent comment https://github.com/PHPOffice/PhpSpreadsheet/issues/860#issuecomment-824926224 in issue #860 by @IMSoP has triggered an idea about how to proceed.

Gnumeric Reader was recently changed to handle namespaces better. Using that as a model, this PR begins the process of doing the same for Xlsx. Xlsx is much larger and more complicated than Gnumeric, hence the need to tackle it in multiple phases. I believe that this PR handles all of:
- listWorkSheetNames
- listWorkSheetInfo. Note that there was a bug in this function which would cause it to count only used columns rather than all columns. That bug is corrected.
- active sheet
- selected cell and top left cell
- cell content (formulas, numbers, text)
- hyperlinks
- comments (partial - see below)

This PR does not address:
- styles
- images and charts
- VBA and ribbons
- many other items, I'm sure

The issue for non-standard namespacing till now has been the use of unexpected prefixes. While I was working on this change, @Lambik introduced issue #2067 PR #2068 which introduced a completely different problem - the use of unexpected URLs. That PR and the issue associated with it were quite well documented, including the supplying of a test file and tests for it. I asked if I could take a look to see if it could be integrated with my change, and the result seems to be yes, so those changes are also part of this PR.

While adding a comment to my test file, I discovered that Microsoft had added "threaded comments" as a new feature. I believe these are not yet supported by PhpSpreadsheet, and I am not going to add it, at least not now. I believe that, among other things, this will make identifying the author of a comment more difficult.

Although there are a number of Phpstan baseline changes as part of this PR, I did not attempt to resolve all Phpstan reports for Reader/Xlsx. Nor did I do anything to increase coverage. This change is already large and complex enough without those efforts.
2021-06-25 09:05:49 +02:00
..
Calculation Additional unit tests for negative interest rates in the financial functions, and also tests using negative present/future value arguments (#2166) 2021-06-16 14:16:48 +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 Xlsx Reader Better Namespace Handling Phase 1 Try2 (#2173) 2021-06-25 09:05: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 Scrutinizer 2021-06-24 10:09:21 +02:00
Writer Changes to the default arguments for `htmlspecialchars()` and `html_entity_decode()` requires setting of the argument value explicitly to prevent changes in behaviour. (#2176) 2021-06-21 12:56:03 +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