PhpSpreadsheet/tests/PhpSpreadsheetTests/Reader
oleibman c0809b0c6c
Fix Spreadsheet Copy, Disable Clone, Improve Coverage (#2951)
* Fix Spreadsheet Copy, Disable Clone, Improve Coverage

This PR was supposed to be merely to increase coverage in Spreadsheet. However, in doing so, I discovered that neither clone nor copy worked correctly. Neither had been covered in the test suite. Copy not only did not work, it broke the source spreadsheet as well. I tried to debug and got nowhere; I even tried using myclabs/deep-copy which is already in use in the test suite, but it failed as well. However, write and reload ought to work just fine for copy. It can't be used for clone; however, since copy does what clone ought to do, there's no reason why clone needs to be used, so __clone is changed to throw an exception if attempted.

One other source change was needed, an obvious bug where an if condition uses 'or' when it should use 'and'. Also, one docblock declaration needed a change. Aside from that, the rest of this PR is test cases, and overall coverage passes 89% for the first time.

* Clone is Okay After All

But copy wasn't, changing it to just return clone. Perhaps save and reload will be needed instead at some point, but not yet.

* An Error I Cannot Reproduce

PHP8.1 unit test says error because GdImage can't be serialized. I can't reproduce this error on any of my test systems. I have no idea why GdImage is even involved. Using try/catch to see if it helps.

* Weird Failures in Github

I thought restoring clone was a good idea. That left me in a state where, after one change, copy/clone no longer worked on Github (unable to reproduce on any of my test systems). After a second change, copy worked but clone didn't, again unable to reproduce. So, reverting to original version - copy does save and reload, clone throws exception.
2022-07-28 07:03:26 -07:00
..
Csv Php/iconv Should Not Treat FFFE/FFFF as Valid (#2910) 2022-07-02 08:53:39 -07:00
Gnumeric Add support for reading Worksheet Visibility for Gnumeric 2022-05-24 14:08:41 +02:00
Html Html Reader Not Handling non-ASCII Data Correctly (#2943) 2022-07-16 22:08:44 -07:00
Ods Add Hidden Worksheet unit tests for other Readers 2022-05-24 14:40:45 +02:00
Security Phpstan Differences from Php7 to Php8, Again (#2665) 2022-03-11 23:28:30 -08:00
Slk Process Comments in Sylk File (#2277) 2021-08-26 11:56:13 -07:00
Utility When image source is a URL, store the URL for use during extraction. (#2072) 2021-06-24 10:50:44 +02:00
Xls Add Hidden Worksheet unit tests for other Readers 2022-05-24 14:40:45 +02:00
Xlsx Fix Spreadsheet Copy, Disable Clone, Improve Coverage (#2951) 2022-07-28 07:03:26 -07:00
Xml Phpstan Differences from Php7 to Php8, Again (#2665) 2022-03-11 23:28:30 -08:00
BaseNoLoad.php Coverage Improvements (#2859) 2022-06-01 08:29:56 -07:00
BaseNoLoadTest.php Coverage Improvements (#2859) 2022-06-01 08:29:56 -07:00