-
Notifications
You must be signed in to change notification settings - Fork 264
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
PHPLIB-1184: Improve CallbackIterator #1126
PHPLIB-1184: Improve CallbackIterator #1126
Conversation
4d9a002
to
56a33c1
Compare
tests/Model/CallbackIteratorTest.php
Outdated
|
||
class CallbackIteratorTest extends TestCase | ||
{ | ||
public function testArrayIteration(): void |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd propose rewriting all of these tests to use the following matrix:
- Callbacks in various forms that apply the same transformation (
*= 2
seems fine)- Closure
- Object method (e.g. static method on this class)
- Iterables
- ArrayIterator constructed from an indexed array
- ArrayIterator constructed from an associative array (to show that keys are preserved)
- IteratorAggregate for both of the above (per @GromNaN's suggestion below)
Using a data provider for iterables and expected arrays would probably be most efficient.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@alcaeus I can make the changes if it frees you up.
926726f
to
4818124
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
PHPLIB-1184
#1059 contained some improvements to the
CallbackIterator
. These have been extracted here:Closure
instance