function it_applies_only_exclusive_promotion(PreQualifiedPromotionsProviderInterface $preQualifiedPromotionsProvider, PromotionEligibilityCheckerInterface $promotionEligibilityChecker, PromotionApplicatorInterface $promotionApplicator, PromotionSubjectInterface $subject, PromotionInterface $promotion, PromotionInterface $exclusivePromotion) { $subject->getPromotions()->willReturn([]); $preQualifiedPromotionsProvider->getPromotions($subject)->willReturn([$promotion, $exclusivePromotion]); $exclusivePromotion->isExclusive()->willReturn(true); $promotionEligibilityChecker->isEligible($subject, $promotion)->willReturn(true); $promotionEligibilityChecker->isEligible($subject, $exclusivePromotion)->willReturn(true); $promotionApplicator->apply($subject, $exclusivePromotion)->shouldBeCalled(); $promotionApplicator->apply($subject, $promotion)->shouldNotBeCalled(); $promotionApplicator->revert($subject, $promotion)->shouldNotBeCalled(); $promotionApplicator->revert($subject, $exclusivePromotion)->shouldNotBeCalled(); $this->process($subject); }
function it_should_apply_only_exclusive_promotion($activePromotionsProvider, $checker, $applicator, PromotionSubjectInterface $subject, PromotionInterface $promotion, PromotionInterface $exclusivePromotion) { $subject->getPromotions()->shouldBeCalled()->willReturn([]); $activePromotionsProvider->getPromotions($subject)->willReturn([$promotion, $exclusivePromotion]); $exclusivePromotion->isExclusive()->shouldBeCalled()->willReturn(true); $checker->isEligible($subject, $promotion)->shouldBeCalled()->willReturn(true); $checker->isEligible($subject, $exclusivePromotion)->shouldBeCalled()->willReturn(true); $applicator->apply($subject, $exclusivePromotion)->shouldBeCalled(); $applicator->apply($subject, $promotion)->shouldNotBeCalled(); $applicator->revert($subject, $promotion)->shouldNotBeCalled(); $applicator->revert($subject, $exclusivePromotion)->shouldNotBeCalled(); $this->process($subject); }
function it_should_apply_only_exclusive_promotion($repository, $checker, $applicator, PromotionSubjectInterface $subject, PromotionInterface $promotion, PromotionInterface $exlusivePromotion) { $subject->getPromotions()->shouldBeCalled()->willReturn(array()); $repository->findActive()->shouldBeCalled()->willReturn(array($promotion, $exlusivePromotion)); $exlusivePromotion->isExclusive()->shouldBeCalled()->willReturn(true); $checker->isEligible($subject, $promotion)->shouldBeCalled()->willReturn(true); $checker->isEligible($subject, $exlusivePromotion)->shouldBeCalled()->willReturn(true); $applicator->apply($subject, $exlusivePromotion)->shouldBeCalled(); $applicator->apply($subject, $promotion)->shouldNotBeCalled(); $applicator->revert($subject, $promotion)->shouldNotBeCalled(); $applicator->revert($subject, $exlusivePromotion)->shouldNotBeCalled(); $this->process($subject); }