/** * @Given /^([^"]+) gives ("(?:€|£|\$)[^"]+") discount to every order in the ("[^"]+" channel) and ("(?:€|£|\$)[^"]+") discount to every order in the ("[^"]+" channel)$/ */ public function thisPromotionGivesDiscountToEveryOrderInTheChannelAndDiscountToEveryOrderInTheChannel(PromotionInterface $promotion, $firstChannelDiscount, ChannelInterface $firstChannel, $secondChannelDiscount, ChannelInterface $secondChannel) { /** @var PromotionActionInterface $action */ $action = $this->actionFactory->createFixedDiscount($firstChannelDiscount, $firstChannel->getCode()); $action->setConfiguration(array_merge($action->getConfiguration(), [$secondChannel->getCode() => ['amount' => $secondChannelDiscount]])); $promotion->addChannel($firstChannel); $promotion->addChannel($secondChannel); $promotion->addAction($action); $this->objectManager->flush(); }