예제 #1
0
 /**
  * @Given /^([^"]+) gives ("[^"]+%") off on every product (classified as "[^"]+") and a ("(?:€|£|\$)[^"]+") discount to every order with items total equal at least ("(?:€|£|\$)[^"]+")$/
  */
 public function itGivesOffOnEveryProductClassifiedAsAndAFixedDiscountToEveryOrderWithItemsTotalEqualAtLeast(PromotionInterface $promotion, $taxonDiscount, TaxonInterface $taxon, $orderDiscount, $targetAmount)
 {
     $orderDiscountAction = $this->actionFactory->createFixedDiscount($orderDiscount);
     $promotion->addAction($orderDiscountAction);
     $rule = $this->ruleFactory->createItemTotal($targetAmount);
     $this->createUnitPercentagePromotion($promotion, $taxonDiscount, $this->getTaxonFilterConfiguration([$taxon->getCode()]), $rule);
 }
예제 #2
0
 /**
  * @Given /^([^"]+) gives ("(?:€|£|\$)[^"]+") discount to every order with items total at least ("[^"]+")$/
  */
 public function itGivesFixedDiscountToEveryOrderWithItemsTotalAtLeast(PromotionInterface $promotion, $amount, $targetAmount)
 {
     $action = $this->actionFactory->createFixedDiscount($amount);
     $promotion->addAction($action);
     $rule = $this->ruleFactory->createItemTotal($targetAmount);
     $promotion->addRule($rule);
     $this->objectManager->flush();
 }
예제 #3
0
 function it_creates_fixed_discount_promotion_for_cart_with_specified_items_total(ActionFactoryInterface $actionFactory, ActionInterface $action, ObjectManager $objectManager, PromotionInterface $promotion, RuleFactoryInterface $ruleFactory, RuleInterface $rule)
 {
     $actionFactory->createFixedDiscount(1000)->willReturn($action);
     $promotion->addAction($action)->shouldBeCalled();
     $ruleFactory->createItemTotal(5000)->willReturn($rule);
     $promotion->addRule($rule)->shouldBeCalled();
     $objectManager->flush()->shouldBeCalled();
     $this->itGivesFixedDiscountToEveryOrderWithItemsTotalAtLeast($promotion, 1000, 5000);
 }