Skip to content
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

Utility\FilteredIteratorTest: split up test class + minor improvements to FilteredIterator #729

Merged

Conversation

jrfnl
Copy link
Member

@jrfnl jrfnl commented Apr 25, 2022

Utility\FilteredIteratorTest: split constructor specific tests to dedicated test class

Utility\FilteredIterator\FilteredIteratorTest: rename to SerializationTest

... as the remaining test relates directly to the serialization methods.

Includes renaming the test method.

FilteredIterator: improve method order

... by grouping the two [__]unserialize() methods together to make it more obvious that both have been implemented (the magic method for PHP 7.4+, the Serializable interface method for PHP < 7.4).

Includes updating the documentation to reflect this as well.

FilteredIterator: remove redundant method

As per the PHP documentation:

The Serializable interface

Interface for customized serializing.
Classes that implement this interface no longer support __sleep() and __wakeup().

Ref: https://www.php.net/manual/en/class.serializable.php

Note:
If both __unserialize() and __wakeup() are defined in the same object, only __unserialize() will be called. __wakeup() will be ignored.

Ref: https://www.php.net/manual/en/language.oop5.magic.php#object.unserialize

Based on the above, the wake_up() method is redundant and has been for quite a while.

FilteredIterator: add dedicated test for the current() functionality

Related to #648

…onTest`

... as the remaining test relates directly to the serialization methods.

Includes renaming the test method.
... by grouping the two `[__]unserialize()` methods together to make it more obvious that both have been implemented (the magic method for PHP 7.4+, the Serializable interface method for PHP < 7.4).

Includes updating the documentation to reflect this as well.
As per the PHP documentation:

> The Serializable interface
>
> Interface for customized serializing.
> **Classes that implement this interface no longer support `__sleep()` and `__wakeup()`.**

Ref: https://www.php.net/manual/en/class.serializable.php

> Note:
> If both `__unserialize()` and `__wakeup()` are defined in the same object, only `__unserialize()` will be called. `__wakeup()` will be ignored.

Ref: https://www.php.net/manual/en/language.oop5.magic.php#object.unserialize

Based on the above, the `wake_up()` method is redundant and has been for quite a while.
@jrfnl jrfnl added this to the 2.1.0 milestone Apr 25, 2022
@jrfnl jrfnl requested a review from schlessera April 25, 2022 12:35
@schlessera schlessera merged commit 05689de into develop May 9, 2022
@schlessera schlessera deleted the feature/648-split-test-class-utility-filterediteratortest branch May 9, 2022 15:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants