1 | <?php |
||
32 | final class ShippingContext implements Context |
||
33 | { |
||
34 | /** |
||
35 | * @var SharedStorageInterface |
||
36 | */ |
||
37 | private $sharedStorage; |
||
38 | |||
39 | /** |
||
40 | * @var ShippingMethodRepositoryInterface |
||
41 | */ |
||
42 | private $shippingMethodRepository; |
||
43 | |||
44 | /** |
||
45 | * @var ZoneRepositoryInterface |
||
46 | */ |
||
47 | private $zoneRepository; |
||
48 | |||
49 | /** |
||
50 | * @var FactoryInterface |
||
51 | */ |
||
52 | private $shippingMethodFactory; |
||
53 | |||
54 | /** |
||
55 | * @var FactoryInterface |
||
56 | */ |
||
57 | private $shippingMethodTranslationFactory; |
||
58 | |||
59 | /** |
||
60 | * @var ObjectManager |
||
61 | */ |
||
62 | private $shippingMethodManager; |
||
63 | |||
64 | /** |
||
65 | * @param SharedStorageInterface $sharedStorage |
||
66 | * @param ShippingMethodRepositoryInterface $shippingMethodRepository |
||
67 | * @param ZoneRepositoryInterface $zoneRepository |
||
68 | * @param FactoryInterface $shippingMethodFactory |
||
69 | * @param FactoryInterface $shippingMethodTranslationFactory |
||
70 | * @param ObjectManager $shippingMethodManager |
||
71 | */ |
||
72 | public function __construct( |
||
87 | |||
88 | /** |
||
89 | * @Given the store ships everything for free within the :zone zone |
||
90 | * @Given /^the store ships everything for free for the (rest of the world)$/ |
||
91 | */ |
||
92 | public function storeShipsEverythingForFree(ZoneInterface $zone = null) |
||
96 | |||
97 | /** |
||
98 | * @Given the store ships everywhere for free |
||
99 | */ |
||
100 | public function theStoreShipsEverywhereForFree() |
||
106 | |||
107 | /** |
||
108 | * @Given the store (also) allows shipping with :name |
||
109 | * @Given the store (also) allows shipping with :name identified by :code |
||
110 | * @Given the store (also) allows shipping with :name at position :position |
||
111 | */ |
||
112 | public function theStoreAllowsShippingMethod($name, $code = null, $position = null) |
||
116 | |||
117 | /** |
||
118 | * @Given /^(this shipping method) is named "([^"]+)" in the "([^"]+)" locale$/ |
||
119 | */ |
||
120 | public function thisShippingMethodIsNamedInLocale(ShippingMethodInterface $shippingMethod, $name, $locale) |
||
131 | |||
132 | /** |
||
133 | * @Given the store allows shipping with :firstName and :secondName |
||
134 | */ |
||
135 | public function theStoreAllowsShippingWithAnd($firstName, $secondName) |
||
140 | |||
141 | /** |
||
142 | * @Given /^the store has "([^"]+)" shipping method with ("[^"]+") fee$/ |
||
143 | * @Given /^the store has "([^"]+)" shipping method with ("[^"]+") fee within the ("[^"]+" zone)$/ |
||
144 | * @Given /^the store has "([^"]+)" shipping method with ("[^"]+") fee for the (rest of the world)$/ |
||
145 | */ |
||
146 | public function storeHasShippingMethodWithFee($shippingMethodName, $fee, ZoneInterface $zone = null) |
||
150 | |||
151 | /** |
||
152 | * @Given /^the store has disabled "([^"]+)" shipping method with ("[^"]+") fee$/ |
||
153 | */ |
||
154 | public function storeHasDisabledShippingMethodWithFee($shippingMethodName, $fee) |
||
158 | |||
159 | /** |
||
160 | * @Given /^the store has "([^"]+)" shipping method with ("[^"]+") fee per unit$/ |
||
161 | */ |
||
162 | public function theStoreHasShippingMethodWithFeePerUnit($shippingMethodName, $fee) |
||
166 | |||
167 | /** |
||
168 | * @Given /^the store has "([^"]+)" shipping method with ("[^"]+") fee on fist unit and ("[^"]+") on next (\d+)$/ |
||
169 | */ |
||
170 | public function theStoreHasShippingMethodWithFeeOnFistUnitAndOnNext($shippingMethodName, $fee, $perUnitFee, $limit) |
||
182 | |||
183 | /** |
||
184 | * @Given /^the store has "([^"]+)" shipping method with ("[^"]+") fee not assigned to any channel$/ |
||
185 | */ |
||
186 | public function storeHasShippingMethodWithFeeNotAssignedToAnyChannel($shippingMethodName, $fee) |
||
190 | |||
191 | /** |
||
192 | * @Given /^(shipping method "[^"]+") belongs to ("[^"]+" tax category)$/ |
||
193 | */ |
||
194 | public function shippingMethodBelongsToTaxCategory(ShippingMethodInterface $shippingMethod, TaxCategoryInterface $taxCategory) |
||
199 | |||
200 | /** |
||
201 | * @Given the shipping method :shippingMethod is enabled |
||
202 | */ |
||
203 | public function theShippingMethodIsEnabled(ShippingMethodInterface $shippingMethod) |
||
208 | |||
209 | /** |
||
210 | * @Given the shipping method :shippingMethod is disabled |
||
211 | */ |
||
212 | public function theShippingMethodIsDisabled(ShippingMethodInterface $shippingMethod) |
||
217 | |||
218 | /** |
||
219 | * @Given /^(this shipping method) requires at least one unit matches to ("([^"]+)" shipping category)$/ |
||
220 | */ |
||
221 | public function thisShippingMethodRequiresAtLeastOneUnitMatchToShippingCategory( |
||
229 | |||
230 | /** |
||
231 | * @Given /^(this shipping method) requires that all units match to ("([^"]+)" shipping category)$/ |
||
232 | */ |
||
233 | public function thisShippingMethodRequiresThatAllUnitsMatchToShippingCategory( |
||
241 | |||
242 | /** |
||
243 | * @Given /^(this shipping method) requires that no units match to ("([^"]+)" shipping category)$/ |
||
244 | */ |
||
245 | public function thisShippingMethodRequiresThatNoUnitsMatchToShippingCategory( |
||
253 | |||
254 | /** |
||
255 | * @param string $name |
||
256 | * @param string|null $code |
||
257 | * @param int|null $position |
||
258 | * @param ZoneInterface|null $zone |
||
259 | * @param string $locale |
||
260 | * @param array $configuration |
||
261 | * @param string $calculator |
||
262 | * @param bool $enabled |
||
263 | * @param bool $addForCurrentChannel |
||
264 | */ |
||
265 | private function createShippingMethod( |
||
302 | |||
303 | /** |
||
304 | * @param string $shippingMethodName |
||
305 | * @param string|null $zoneCode |
||
306 | * |
||
307 | * @return string |
||
308 | */ |
||
309 | private function generateCodeFromNameAndZone($shippingMethodName, $zoneCode = null) |
||
313 | } |
||
314 |
Very long variable names usually make code harder to read. It is therefore recommended not to make variable names too verbose.