예제 #1
0
 /**
  * @Given /^([^"]+) gives ("(?:€|£|\$)[^"]+") discount to every order with quantity at least ([^"]+)$/
  */
 public function itGivesFixedDiscountToEveryOrderWithQuantityAtLeast(PromotionInterface $promotion, $amount, $quantity)
 {
     $action = $this->actionFactory->createFixedDiscount($amount);
     $promotion->addAction($action);
     $rule = $this->ruleFactory->createCartQuantity((int) $quantity);
     $promotion->addRule($rule);
     $this->objectManager->flush();
 }
예제 #2
0
 /**
  * @Given /^([^"]+) gives ("(?:€|£|\$)[^"]+") discount to every order with quantity at least ([^"]+)$/
  */
 public function itGivesFixedDiscountToEveryOrderWithQuantityAtLeast(PromotionInterface $promotion, $discount, $quantity)
 {
     $rule = $this->ruleFactory->createCartQuantity((int) $quantity);
     $this->createFixedPromotion($promotion, $discount, [], $rule);
 }
예제 #3
0
 function it_creates_fixed_discount_promotion_for_cart_with_specified_quantity(ActionFactoryInterface $actionFactory, ActionInterface $action, ObjectManager $objectManager, PromotionInterface $promotion, RuleFactoryInterface $ruleFactory, RuleInterface $rule, SharedStorageInterface $sharedStorage)
 {
     $sharedStorage->get('promotion')->willReturn($promotion);
     $actionFactory->createFixedDiscount(1000)->willReturn($action);
     $promotion->addAction($action)->shouldBeCalled();
     $ruleFactory->createCartQuantity(5)->willReturn($rule);
     $promotion->addRule($rule)->shouldBeCalled();
     $objectManager->flush()->shouldBeCalled();
     $this->itGivesFixedDiscountToEveryOrderWithQuantityAtLeast($promotion, 1000, '5');
 }