-
Notifications
You must be signed in to change notification settings - Fork 9.4k
Add missing unit test for WishlistSettings plugin #18906
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
Add missing unit test for WishlistSettings plugin #18906
Conversation
Hi @dmytro-ch. Thank you for your contribution
For more details, please, review the Magento Contributor Assistant documentation |
@dmytro-ch I really doubt the test is "missing" here. Raised this question in Slack. |
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.
@dmytro-ch thanks for your contribution.
My personal feeling is that we should concentrate on methods with maximum C.R.A.P. index instead of simple ones, as when simple method becomes complex usually you would have to change test too much. Still this topic does not seem to bring a lot of attention in Slack, probably there is no recommendation currently or even it contradicts to my feelings.
$subjectMock = $this->createMock(DataProvider::class); | ||
$result = []; | ||
$isAllow = true; | ||
$this->helperMock->expects($this->once())->method('isAllow')->willReturn(true); |
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.
Generally, please avoid strict checks like expects($this->once())
in order to not make test too fragile.
In order to check method behavior rather than execution flow here the only thing to be asserted is new array key added.
Hi @orlangur, thank you for the review. |
@orlangur thank you for the details! :) |
Hi @dmytro-ch. Thank you for your contribution. |
Description (*)
Add missing unit test for
\Magento\Wishlist\Plugin\Ui\DataProvider\WishlistSettings
class.Fixed Issues (if relevant)
N/A
Manual testing scenarios (*)
N/A
Contribution checklist (*)