-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement __serialize() on DefaultTestResultCache #4662
Implement __serialize() on DefaultTestResultCache #4662
Conversation
Codecov Report
@@ Coverage Diff @@
## 8.5 #4662 +/- ##
=========================================
Coverage 84.21% 84.21%
- Complexity 3981 3983 +2
=========================================
Files 154 154
Lines 10185 10187 +2
=========================================
+ Hits 8577 8579 +2
Misses 1608 1608
Continue to review full report at Codecov.
|
Thank you for working on this, Alexander. However, it may not be as simple as "just" updating the tests. Is the new code able to load from a cache file created by the old code? It is is: great! If it's not, we need to adapt the loader to not crash when loading a file it does not understand and treat that situation as a cache miss. |
It should be. There is a test in this PR that performs an |
Thank you for pointing that out, I did not have time yet to (closely) look at the proposed changes. |
However, it does not work the other way round: PHP 7.3 won't be able to unserialize the format generated by PHP 7.4. |
Good to know, thanks. Only goes to show that using |
Thank you for your contribution. I appreciate the time you invested in preparing this pull request. However, I have decided not to merge it. Instead, I have changed the implementation of |
No worries. Your way is certainly the better solution in the long run! |
The
Serializable
interface is being phased out as described in https://wiki.php.net/rfc/phase_out_serializableThe consequence is that PHP 8.1 will trigger a deprecation notice if a class implements
Serializable
unless it also implements the magic methods__serialize()
and__unserialize()
. Those have been introduced with PHP 7.4 and are meant to replace the oldSerializable
mechanism.PHPUnit's
DefaultTestResultCache
is affected by this change. This PR proposes to implement__serialize()
and__unserialize()
to avoid the deprecation.Because this changes the output of the serialization slightly, I had to adjust a couple of tests.