コード例 #1
0
 /**
  * @param PromotionInterface $promotion
  * @param float $discount
  * @param array $configuration
  * @param RuleInterface $rule
  */
 private function createPercentagePromotion(PromotionInterface $promotion, $discount, array $configuration = [], RuleInterface $rule = null)
 {
     $this->persistPromotion($promotion, $this->actionFactory->createPercentageDiscount($discount), $configuration, $rule);
 }
コード例 #2
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);
 }
コード例 #3
0
ファイル: PromotionContext.php プロジェクト: Mozan/Sylius
 /**
  * @param PromotionInterface $promotion
  * @param int $discount
  * @param array $configuration
  */
 private function createPercentagePromotionWithPriceRangeFilter(PromotionInterface $promotion, $discount, array $configuration)
 {
     $this->persistPromotionWithAction($promotion, $this->actionFactory->createItemPercentageDiscount($discount), $configuration);
 }
コード例 #4
0
ファイル: PromotionContextSpec.php プロジェクト: Mozan/Sylius
 function it_creates_item_percentage_discount_action_for_promotion_products_priced_between(ActionFactoryInterface $actionFactory, ActionInterface $action, ObjectManager $objectManager, PromotionInterface $promotion)
 {
     $actionFactory->createItemPercentageDiscount(0.1)->willReturn($action);
     $action->getConfiguration()->willReturn([]);
     $action->setConfiguration(['filters' => ['price_range' => ['min' => 5000, 'max' => 10000]]])->shouldBeCalled();
     $promotion->addAction($action)->shouldBeCalled();
     $objectManager->flush()->shouldBeCalled();
     $this->thisPromotionPercentageGivesOffOnEveryProductPricedBetween($promotion, 0.1, 5000, 10000);
 }