Пример #1
0
 /**
  * @Given /^([^"]+) gives ("[^"]+%") off on every product (classified as "[^"]+" or "[^"]+") if order contains any product (classified as "[^"]+" or "[^"]+")$/
  */
 public function itGivesOffOnEveryProductClassifiedAsOrIfOrderContainsAnyProductClassifiedAsOr(PromotionInterface $promotion, $discount, array $discountTaxons, array $targetTaxons)
 {
     $discountTaxonsCodes = [$discountTaxons[0]->getCode(), $discountTaxons[1]->getCode()];
     $targetTaxonsCodes = [$targetTaxons[0]->getCode(), $targetTaxons[1]->getCode()];
     $rule = $this->ruleFactory->createTaxon($targetTaxonsCodes);
     $this->createUnitPercentagePromotion($promotion, $discount, $this->getTaxonFilterConfiguration($discountTaxonsCodes), $rule);
 }
Пример #2
0
 /**
  * @Given /^([^"]+) gives ("(?:€|£|\$)[^"]+") off if order contains products (classified as "[^"]+" or "[^"]+")$/
  */
 public function thePromotionGivesOffIfOrderContainsProductsClassifiedAsOr(PromotionInterface $promotion, $discount, array $taxons)
 {
     $rule = $this->ruleFactory->createTaxon([$taxons[0]->getCode(), $taxons[1]->getCode()]);
     $this->createFixedPromotion($promotion, $discount, [], $rule);
 }
Пример #3
0
 function it_creates_fixed_discount_promotion_with_taxon_rule_for_multiple_taxons(ActionFactoryInterface $actionFactory, ActionInterface $action, ObjectManager $objectManager, PromotionInterface $promotion, RuleFactoryInterface $ruleFactory, RuleInterface $rule, TaxonInterface $tanks, TaxonInterface $cannons)
 {
     $tanks->getCode()->willReturn('tanks');
     $cannons->getCode()->willReturn('cannons');
     $ruleFactory->createTaxon(['tanks', 'cannons'])->willReturn($rule);
     $actionFactory->createFixedDiscount(1000)->willReturn($action);
     $action->getConfiguration()->willReturn([]);
     $action->setConfiguration([])->shouldBeCalled();
     $promotion->addAction($action)->shouldBeCalled();
     $promotion->addRule($rule)->shouldBeCalled();
     $objectManager->flush()->shouldBeCalled();
     $this->thePromotionGivesOffIfOrderContainsProductsClassifiedAsOr($promotion, 1000, [$tanks, $cannons]);
 }