-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
[Core] Add missing spec for ContainsProductRuleChecker #3340
[Core] Add missing spec for ContainsProductRuleChecker #3340
Conversation
PWalkow
commented
Sep 23, 2015
Q | A |
---|---|
Bug fix? | [no] |
New feature? | [no] |
BC breaks? | [no] |
Deprecations? | [no] |
Fixed tickets | [] |
License | MIT |
Doc PR | [missing Specs for RuleChecker] |
0197dec
to
76ce9ec
Compare
76ce9ec
to
4275c5a
Compare
$this->shouldImplement('Sylius\Component\Promotion\Checker\RuleCheckerInterface'); | ||
} | ||
|
||
function it_throw_exception_on_invalid_subject(PromotionSubjectInterface $subject) |
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.
throws
4275c5a
to
4d3201e
Compare
OrderItem $orderItem, | ||
ProductVariant $variant | ||
) { | ||
$subject->getItems()->shouldBeCalled()->willReturn([$orderItem]); |
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.
shouldBeCalled()
is useless when you use willReturn()
. Don't use mocks & stubs to test same thing!
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.
shouldBeCalled()
says explicitly that some method should be called (spec should be as readable as possible) and gives us faster and direct feedback if something that should be called hasn't been called.
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.
Then you misunderstand purposes of those two things, I have already explained it some time ago but don't have time now to do this again (as well for looking across the PRs to find those notes), please read:
- http://adamwathan.me/2014/09/22/when-to-mock/
- some parts of this http://everzet.com/post/33178339051/sus-collaborators cover that topic too
4d3201e
to
abe6d7a
Compare
Removed 'shouldBeCalled' |
…roduct-rule-checker [Core] Add missing spec for ContainsProductRuleChecker
Thanks @PWalkow! |
…ains-product-rule-checker [Core] Add missing spec for ContainsProductRuleChecker