1 | <?php |
||
28 | final class PromotionContext implements Context |
||
29 | { |
||
30 | /** |
||
31 | * @var SharedStorageInterface |
||
32 | */ |
||
33 | private $sharedStorage; |
||
34 | |||
35 | /** |
||
36 | * @var ActionFactoryInterface |
||
37 | */ |
||
38 | private $actionFactory; |
||
39 | |||
40 | /** |
||
41 | * @var RuleFactoryInterface |
||
42 | */ |
||
43 | private $ruleFactory; |
||
44 | |||
45 | /** |
||
46 | * @var TestPromotionFactoryInterface |
||
47 | */ |
||
48 | private $testPromotionFactory; |
||
49 | |||
50 | /** |
||
51 | * @var PromotionRepositoryInterface |
||
52 | */ |
||
53 | private $promotionRepository; |
||
54 | |||
55 | /** |
||
56 | * @var ObjectManager |
||
57 | */ |
||
58 | private $objectManager; |
||
59 | |||
60 | /** |
||
61 | * @param SharedStorageInterface $sharedStorage |
||
62 | * @param ActionFactoryInterface $actionFactory |
||
63 | * @param RuleFactoryInterface $ruleFactory |
||
64 | * @param TestPromotionFactoryInterface $testPromotionFactory |
||
65 | * @param PromotionRepositoryInterface $promotionRepository |
||
66 | * @param ObjectManager $objectManager |
||
67 | */ |
||
68 | public function __construct( |
||
83 | |||
84 | /** |
||
85 | * @Given there is a promotion :promotionName |
||
86 | */ |
||
87 | public function thereIsPromotion($promotionName) |
||
96 | |||
97 | /** |
||
98 | * @Given /^([^"]+) gives ("[^"]+") fixed discount to every order$/ |
||
99 | */ |
||
100 | public function itGivesFixedDiscountToEveryOrder(PromotionInterface $promotion, $amount) |
||
107 | |||
108 | /** |
||
109 | * @Given /^([^"]+) gives ("[^"]+") percentage discount to every order$/ |
||
110 | */ |
||
111 | public function itGivesPercentageDiscountToEveryOrder(PromotionInterface $promotion, $discount) |
||
118 | |||
119 | /** |
||
120 | * @Given /^([^"]+) gives ("[^"]+") fixed discount to every order with quantity at least ([^"]+)$/ |
||
121 | */ |
||
122 | public function itGivesFixedDiscountToEveryOrderWithQuantityAtLeast(PromotionInterface $promotion, $amount, $quantity) |
||
132 | |||
133 | /** |
||
134 | * @Given /^([^"]+) gives ("[^"]+") fixed discount to every order with items total at least ("[^"]+")$/ |
||
135 | */ |
||
136 | public function itGivesFixedDiscountToEveryOrderWithItemsTotalAtLeast( |
||
149 | |||
150 | /** |
||
151 | * @Given /^([^"]+) gives ("[^"]+") percentage discount on shipping to every order$/ |
||
152 | */ |
||
153 | public function itGivesPercentageDiscountOnShippingToEveryOrder(PromotionInterface $promotion, $discount) |
||
160 | |||
161 | /** |
||
162 | * @Given /^([^"]+) gives ("[^"]+%") off every product (classified as "[^"]+")$/ |
||
163 | */ |
||
164 | public function itGivesPercentageOffEveryProductClassifiedAs( |
||
174 | |||
175 | /** |
||
176 | * @Given /^([^"]+) gives ("(?:€|£|\$)[^"]+") off on every product (classified as "[^"]+")$/ |
||
177 | */ |
||
178 | public function itGivesFixedOffEveryProductClassifiedAs( |
||
188 | |||
189 | /** |
||
190 | * @param ActionInterface $action |
||
191 | * @param array $taxonCodes |
||
192 | * |
||
193 | * @return ActionInterface |
||
194 | */ |
||
195 | private function configureActionTaxonFilter(ActionInterface $action, array $taxonCodes) |
||
202 | } |
||
203 |