Ejemplo n.º 1
0
 function it_creates_promotion_with_coupon(SharedStorageInterface $sharedStorage, CouponFactoryInterface $couponFactory, TestPromotionFactoryInterface $testPromotionFactory, PromotionRepositoryInterface $promotionRepository, ChannelInterface $channel, CouponInterface $coupon, PromotionInterface $promotion)
 {
     $couponFactory->createNew()->willReturn($coupon);
     $coupon->setCode('Coupon galore')->shouldBeCalled();
     $sharedStorage->get('channel')->willReturn($channel);
     $testPromotionFactory->createForChannel('Promotion galore', $channel)->willReturn($promotion);
     $promotion->addCoupon($coupon)->shouldBeCalled();
     $promotion->setCouponBased(true)->shouldBeCalled();
     $promotionRepository->add($promotion)->shouldBeCalled();
     $sharedStorage->set('promotion', $promotion)->shouldBeCalled();
     $sharedStorage->set('coupon', $coupon)->shouldBeCalled();
     $this->thereIsPromotionWithCoupon('Promotion galore', 'Coupon galore');
 }
Ejemplo n.º 2
0
 /**
  * @Given the store has promotion :promotionName with coupon :couponCode
  */
 public function thereIsPromotionWithCoupon($promotionName, $couponCode)
 {
     /** @var CouponInterface $coupon */
     $coupon = $this->couponFactory->createNew();
     $coupon->setCode($couponCode);
     $promotion = $this->testPromotionFactory->createForChannel($promotionName, $this->sharedStorage->get('channel'));
     $promotion->addCoupon($coupon);
     $promotion->setCouponBased(true);
     $this->promotionRepository->add($promotion);
     $this->sharedStorage->set('promotion', $promotion);
     $this->sharedStorage->set('coupon', $coupon);
 }
Ejemplo n.º 3
0
 /**
  * @Given there is a promotion :promotionName
  */
 public function thereIsPromotion($promotionName)
 {
     $promotion = $this->testPromotionFactory->createForChannel($promotionName, $this->sharedStorage->get('channel'));
     $this->promotionRepository->add($promotion);
     $this->sharedStorage->set('promotion', $promotion);
 }