/** * @Given /^([^"]+) gives ("(?:€|£|\$)[^"]+") off on every product (classified as "[^"]+") and a free shipping to every order with items total equal at least ("[^"]+")$/ */ public function itGivesOffOnEveryProductClassifiedAsAndAFreeShippingToEveryOrderWithItemsTotalEqualAtLeast(PromotionInterface $promotion, $discount, TaxonInterface $taxon, $targetAmount) { $freeShippingAction = $this->actionFactory->createPercentageShippingDiscount(1); $promotion->addAction($freeShippingAction); $rule = $this->ruleFactory->createItemTotal($targetAmount); $this->createUnitFixedPromotion($promotion, $discount, [], $rule); }
/** * @Given /^([^"]+) gives ("[^"]+%") discount on shipping to every order$/ */ public function itGivesPercentageDiscountOnShippingToEveryOrder(PromotionInterface $promotion, $discount) { $action = $this->actionFactory->createPercentageShippingDiscount($discount); $promotion->addAction($action); $this->objectManager->flush(); }
function it_creates_percentage_shipping_discount_action_for_promotion(ActionFactoryInterface $actionFactory, ActionInterface $action, ObjectManager $objectManager, PromotionInterface $promotion) { $actionFactory->createPercentageShippingDiscount(0.1)->willReturn($action); $promotion->addAction($action)->shouldBeCalled(); $objectManager->flush()->shouldBeCalled(); $this->itGivesPercentageDiscountOnShippingToEveryOrder($promotion, 0.1); }