1 | <?php |
||
29 | final class ShippingContext implements Context |
||
30 | { |
||
31 | /** |
||
32 | * @var SharedStorageInterface |
||
33 | */ |
||
34 | private $sharedStorage; |
||
35 | |||
36 | /** |
||
37 | * @var ShippingMethodRepositoryInterface |
||
38 | */ |
||
39 | private $shippingMethodRepository; |
||
40 | |||
41 | /** |
||
42 | * @var ZoneRepositoryInterface |
||
43 | */ |
||
44 | private $zoneRepository; |
||
45 | |||
46 | /** |
||
47 | * @var FactoryInterface |
||
48 | */ |
||
49 | private $shippingMethodFactory; |
||
50 | |||
51 | /** |
||
52 | * @var ObjectManager |
||
53 | */ |
||
54 | private $shippingMethodManager; |
||
55 | |||
56 | /** |
||
57 | * @param SharedStorageInterface $sharedStorage |
||
58 | * @param ShippingMethodRepositoryInterface $shippingMethodRepository |
||
59 | * @param ZoneRepositoryInterface $zoneRepository |
||
60 | * @param FactoryInterface $shippingMethodFactory |
||
61 | * @param ObjectManager $shippingMethodManager |
||
62 | */ |
||
63 | public function __construct( |
||
64 | SharedStorageInterface $sharedStorage, |
||
65 | ShippingMethodRepositoryInterface $shippingMethodRepository, |
||
66 | ZoneRepositoryInterface $zoneRepository, |
||
67 | FactoryInterface $shippingMethodFactory, |
||
68 | ObjectManager $shippingMethodManager |
||
69 | ) { |
||
70 | $this->sharedStorage = $sharedStorage; |
||
71 | $this->shippingMethodRepository = $shippingMethodRepository; |
||
72 | $this->zoneRepository = $zoneRepository; |
||
73 | $this->shippingMethodFactory = $shippingMethodFactory; |
||
74 | $this->shippingMethodManager = $shippingMethodManager; |
||
75 | } |
||
76 | |||
77 | /** |
||
78 | * @Given the store ships everything for free within :zone zone |
||
79 | * @Given /^the store ships everything for free for (the rest of the world)$/ |
||
80 | */ |
||
81 | public function storeShipsEverythingForFree(ZoneInterface $zone = null) |
||
85 | |||
86 | /** |
||
87 | * @Given /^the store ships everywhere for free$/ |
||
88 | */ |
||
89 | public function theStoreShipsEverywhereForFree() |
||
95 | |||
96 | /** |
||
97 | * @Given /^the store allows shipping with "([^"]*)"$/ |
||
98 | */ |
||
99 | public function theStoreAllowsShippingMethod($shippingMethodName) |
||
103 | |||
104 | /** |
||
105 | * @Given /^the store has "([^"]*)" shipping method with ("[^"]+") fee$/ |
||
106 | * @Given /^the store has "([^"]*)" shipping method with ("[^"]+") fee within ("([^"]*)" zone)$/ |
||
107 | * @Given /^the store has "([^"]*)" shipping method with ("[^"]+") fee for (the rest of the world)$/ |
||
108 | */ |
||
109 | public function storeHasShippingMethodWithFee($shippingMethodName, $fee, ZoneInterface $zone = null) |
||
113 | |||
114 | /** |
||
115 | * @Given /^(shipping method "[^"]+") belongs to ("[^"]+" tax category)$/ |
||
116 | */ |
||
117 | public function shippingMethodBelongsToTaxCategory(ShippingMethodInterface $shippingMethod, TaxCategoryInterface $taxCategory) |
||
122 | |||
123 | /** |
||
124 | * @param string $name |
||
125 | * @param ZoneInterface|null $zone |
||
126 | * @param string $locale |
||
127 | * @param array $configuration |
||
128 | * @param string $calculator |
||
129 | */ |
||
130 | private function createShippingMethod( |
||
152 | |||
153 | /** |
||
154 | * @param string $shippingMethodName |
||
155 | * @param string|null $zoneCode |
||
156 | * |
||
157 | * @return string |
||
158 | */ |
||
159 | private function generateCodeFromNameAndZone($shippingMethodName, $zoneCode = null) |
||
163 | } |
||
164 |