-
Notifications
You must be signed in to change notification settings - Fork 9.3k
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
Fix getSize method after clearing data collection #21670
Fix getSize method after clearing data collection #21670
Conversation
Hi @sergeynezbritskiy. Thank you for your contribution
For more details, please, review the Magento Contributor Assistant documentation |
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.
Hi @sergeynezbritskiy,
thank you for your contribution!
There is an integration test failure with current solution:
1) Magento\Customer\Block\Adminhtml\Edit\Tab\View\CartTest::testGetCollection
Failed asserting that 0 matches expected 1.
/home/travis/build/magento/magento2/dev/tests/integration/testsuite/Magento/Customer/Block/Adminhtml/Edit/Tab/View/CartTest.php:112
Could you please check this issue?
Also please make sure you sign the Contributor License Agreement before the Magento Community Engineering team can accept your contribution. :)
Thank you!
Hey @dmytro-ch |
Unfortunately I had to remove this test, as I found it does not test anything. Moreower the assert is also invalid. This test expects size collection to be 1, but when I check this collection in runtime, it has zero items but Collection::_totalRecords contains 1, So basically this test was based on the issue I fixed with this PR |
@sergeynezbritskiy, thank you for the update! I briefly checked the implementation for EAV collection. I guess we would be able to apply the same fix for Looking forward to your thoughts regarding this improvement. Thank you! |
Thanks @dmytro-ch will review that |
Hi @dmytro-ch, thank you for the review. |
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.
After changes are applied and all builds are green, please squash them into a single commit so that we have perfectly clean history 😉
lib/internal/Magento/Framework/Test/Unit/Data/CollectionTest.php
Outdated
Show resolved
Hide resolved
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.
@orlangur I checked your suggestions, and fixed issues you mentioned. Please review the PR. Thanks
lib/internal/Magento/Framework/Test/Unit/Data/CollectionTest.php
Outdated
Show resolved
Hide resolved
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.
a
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.
@sergeynezbritskiy great! Looks much more readable now and we got rid of useless test 🤝
Hi @orlangur, thank you for the review. |
…lection_clear_method_for_total_records
Hi @sergeynezbritskiy, thank you for your contribution! |
Description (*)
Fixed the issue with getSize() method in \Magento\Framework\Data\Collection, when we call clear() method after getSize()
Fixed Issues (if relevant)
Manual testing scenarios (*)
Contribution checklist (*)