/** * @Given /^([^"]+) gives ("(?:€|£|\$)[^"]+") off if order contains products (classified as "[^"]+") with a minimum value of ("(?:€|£|\$)[^"]+")$/ */ public function thePromotionGivesOffIfOrderContainsProductsClassifiedAsAndPricedAt(PromotionInterface $promotion, $discount, TaxonInterface $taxon, $amount) { $rule = $this->ruleFactory->createItemsFromTaxonTotal($taxon->getCode(), $amount); $this->createFixedPromotion($promotion, $discount, [], $rule); }
function it_creates_fixed_discount_promotion_with_total_of_items_from_taxon_rule(ActionFactoryInterface $actionFactory, ActionInterface $action, ObjectManager $objectManager, PromotionInterface $promotion, RuleFactoryInterface $ruleFactory, RuleInterface $rule, TaxonInterface $tanks) { $tanks->getCode()->willReturn('tanks'); $ruleFactory->createItemsFromTaxonTotal('tanks', 1000)->willReturn($rule); $actionFactory->createFixedDiscount(500)->willReturn($action); $action->getConfiguration()->willReturn([]); $action->setConfiguration([])->shouldBeCalled(); $promotion->addAction($action)->shouldBeCalled(); $promotion->addRule($rule)->shouldBeCalled(); $objectManager->flush()->shouldBeCalled(); $this->thePromotionGivesOffIfOrderContainsProductsClassifiedAsAndPricedAt($promotion, 500, $tanks, 1000); }