Skip to content

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

Conversation

dmytro-ch
Copy link
Contributor

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 (*)

  • Pull request has a meaningful description of its purpose
  • All commits are accompanied by meaningful commit messages
  • All new or changed code is covered with unit/integration tests (if applicable)
  • All automated tests passed successfully (all builds on Travis CI are green)

@dmytro-ch dmytro-ch requested a review from rogyar October 28, 2018 11:12
@magento-engcom-team magento-engcom-team added Partner: Atwix Pull Request is created by partner Atwix partners-contribution Pull Request is created by Magento Partner Component: Wishlist labels Oct 28, 2018
@magento-engcom-team
Copy link
Contributor

Hi @dmytro-ch. Thank you for your contribution
Here is some useful tips how you can test your changes using Magento test environment.
Add the comment under your pull request to deploy test or vanilla Magento instance:

  • @magento-engcom-team give me test instance - deploy test instance based on PR changes
  • @magento-engcom-team give me $VERSION instance - deploy vanilla Magento instance

For more details, please, review the Magento Contributor Assistant documentation

@orlangur
Copy link
Contributor

@dmytro-ch I really doubt the test is "missing" here. Raised this question in Slack.

Copy link
Contributor

@orlangur orlangur left a 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.

Cc: @ishakhsuvarov @okorshenko @sidolov

$subjectMock = $this->createMock(DataProvider::class);
$result = [];
$isAllow = true;
$this->helperMock->expects($this->once())->method('isAllow')->willReturn(true);
Copy link
Contributor

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.

@magento-engcom-team
Copy link
Contributor

Hi @orlangur, thank you for the review.
ENGCOM-3307 has been created to process this Pull Request

@dmytro-ch
Copy link
Contributor Author

@orlangur thank you for the details! :)
I will take it into account next time.

@magento-engcom-team
Copy link
Contributor

Hi @dmytro-ch. Thank you for your contribution.
We will aim to release these changes as part of 2.3.1.
Please check the release notes for final confirmation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component: Wishlist Partner: Atwix Pull Request is created by partner Atwix partners-contribution Pull Request is created by Magento Partner Release Line: 2.3
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants