1 | <?php |
||
32 | final class ZoneContext implements Context |
||
33 | { |
||
34 | /** |
||
35 | * @var SharedStorageInterface |
||
36 | */ |
||
37 | private $sharedStorage; |
||
38 | |||
39 | /** |
||
40 | * @var RepositoryInterface |
||
41 | */ |
||
42 | private $zoneRepository; |
||
43 | |||
44 | /** |
||
45 | * @var ObjectManager |
||
46 | */ |
||
47 | private $objectManager; |
||
48 | |||
49 | /** |
||
50 | * @var ZoneFactoryInterface |
||
51 | */ |
||
52 | private $zoneFactory; |
||
53 | |||
54 | /** |
||
55 | * @var FactoryInterface |
||
56 | */ |
||
57 | private $zoneMemberFactory; |
||
58 | |||
59 | /** |
||
60 | * @param SharedStorageInterface $sharedStorage |
||
61 | * @param RepositoryInterface $zoneRepository |
||
62 | * @param ObjectManager $objectManager |
||
63 | * @param ZoneFactoryInterface $zoneFactory |
||
64 | * @param FactoryInterface $zoneMemberFactory |
||
65 | */ |
||
66 | public function __construct( |
||
79 | |||
80 | /** |
||
81 | * @Given /^there is a zone "The Rest of the World" containing all other countries$/ |
||
82 | */ |
||
83 | public function thereIsAZoneTheRestOfTheWorldContainingAllOtherCountries() |
||
95 | |||
96 | /** |
||
97 | * @Given default tax zone is :zone |
||
98 | */ |
||
99 | public function defaultTaxZoneIs(ZoneInterface $zone) |
||
107 | |||
108 | /** |
||
109 | * @Given the store does not have any zones defined |
||
110 | */ |
||
111 | public function theStoreDoesNotHaveAnyZonesDefined() |
||
119 | |||
120 | /** |
||
121 | * @Given the store has (also) a zone :zoneName |
||
122 | * @Given the store has a zone :zoneName with code :code |
||
123 | * @Given the store also has a zone :zoneName with code :code |
||
124 | */ |
||
125 | public function theStoreHasAZoneWithCode(string $zoneName, string $code = null): void |
||
129 | |||
130 | /** |
||
131 | * @Given the store has zones :firstName, :secondName and :thirdName |
||
132 | */ |
||
133 | public function theStoreHasZones(string ...$names): void |
||
139 | |||
140 | /** |
||
141 | * @Given the store has a :scope zone :zoneName with code :code |
||
142 | */ |
||
143 | public function theStoreHasAScopedZoneWithCode($scope, $zoneName, $code) |
||
147 | |||
148 | /** |
||
149 | * @Given /^(it)(?:| also) has the ("([^"]+)" country) member$/ |
||
150 | * @Given /^(this zone)(?:| also) has the ("([^"]+)" country) member$/ |
||
151 | */ |
||
152 | public function itHasTheCountryMemberAndTheCountryMember( |
||
161 | |||
162 | /** |
||
163 | * @Given /^(it) has the ("[^"]+" province) member$/ |
||
164 | * @Given /^(it) also has the ("[^"]+" province) member$/ |
||
165 | */ |
||
166 | public function itHasTheProvinceMemberAndTheProvinceMember( |
||
175 | |||
176 | /** |
||
177 | * @Given /^(it) has the (zone named "([^"]+)")$/ |
||
178 | * @Given /^(it) also has the (zone named "([^"]+)")$/ |
||
179 | */ |
||
180 | public function itHasTheZoneMemberAndTheZoneMember( |
||
189 | |||
190 | /** |
||
191 | * @param CodeAwareInterface $zoneMember |
||
192 | * |
||
193 | * @return ZoneMemberInterface |
||
194 | */ |
||
195 | private function createZoneMember(CodeAwareInterface $zoneMember) |
||
204 | |||
205 | /** |
||
206 | * @param string $name |
||
207 | * @param string|null $code |
||
208 | * @param string $scope |
||
209 | * |
||
210 | * @return ZoneInterface |
||
211 | */ |
||
212 | private function createZone(string $name, ?string $code = null, ?string $scope = Scope::ALL): ZoneInterface |
||
221 | |||
222 | /** |
||
223 | * @param ZoneInterface $zone |
||
224 | * @param string $key |
||
225 | */ |
||
226 | private function saveZone($zone, $key) |
||
231 | } |
||
232 |