Пример #1
0
 /**
  * @Given /^([^"]+) gives ("(?:€|£|\$)[^"]+") off if order contains (\d+) products (classified as "[^"]+")$/
  */
 public function thePromotionGivesOffIfOrderContainsNumberOfProductsClassifiedAs(PromotionInterface $promotion, $discount, $count, TaxonInterface $taxon)
 {
     $rule = $this->ruleFactory->createContainsTaxon($taxon->getCode(), $count);
     $this->createFixedPromotion($promotion, $discount, [], $rule);
 }
Пример #2
0
 /**
  * @Given /^([^"]+) gives ("[^"]+%") off on every product (classified as "[^"]+") if an order contains any product (classified as "[^"]+")$/
  */
 public function itGivesPercentageOffOnEveryProductClassifiedAsIfAnOrderContainsAnyProductClassifiedAs(PromotionInterface $promotion, $discount, TaxonInterface $discountTaxon, TaxonInterface $targetTaxon)
 {
     $rule = $this->ruleFactory->createContainsTaxon($targetTaxon->getCode(), 1);
     $this->createUnitPercentagePromotion($promotion, $discount, $this->getTaxonFilterConfiguration([$discountTaxon->getCode()]), $rule);
 }
Пример #3
0
 function it_creates_a_fixed_discount_promotion_which_contains_a_taxon_rule(ActionFactoryInterface $actionFactory, ActionInterface $action, ObjectManager $objectManager, PromotionInterface $promotion, RuleFactoryInterface $ruleFactory, RuleInterface $rule, TaxonInterface $tanks)
 {
     $tanks->getCode()->willReturn('tanks');
     $ruleFactory->createContainsTaxon('tanks', 10)->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->thePromotionGivesOffIfOrderContainsNumberOfProductsClassifiedAs($promotion, 500, 10, $tanks);
 }