1 | <?php |
||
28 | final class ManagingZonesContext implements Context |
||
29 | { |
||
30 | /** |
||
31 | * @var CreatePageInterface |
||
32 | */ |
||
33 | private $createPage; |
||
34 | |||
35 | /** |
||
36 | * @var IndexPageInterface |
||
37 | */ |
||
38 | private $indexPage; |
||
39 | |||
40 | /** |
||
41 | * @var UpdatePageInterface |
||
42 | */ |
||
43 | private $updatePage; |
||
44 | |||
45 | /** |
||
46 | * @var CurrentPageResolverInterface |
||
47 | */ |
||
48 | private $currentPageResolver; |
||
49 | |||
50 | /** |
||
51 | * @var NotificationCheckerInterface |
||
52 | */ |
||
53 | private $notificationChecker; |
||
54 | |||
55 | /** |
||
56 | * @param CreatePageInterface $createPage |
||
57 | * @param IndexPageInterface $indexPage |
||
58 | * @param UpdatePageInterface $updatePage |
||
59 | * @param CurrentPageResolverInterface $currentPageResolver |
||
60 | * @param NotificationCheckerInterface $notificationChecker |
||
61 | */ |
||
62 | public function __construct( |
||
75 | |||
76 | /** |
||
77 | * @When I want to create a new zone consisting of :memberType |
||
78 | */ |
||
79 | public function iWantToCreateANewZoneWithMembers($memberType) |
||
83 | |||
84 | /** |
||
85 | * @When I want to see all zones in store |
||
86 | */ |
||
87 | public function iWantToSeeAllZonesInStore() |
||
91 | |||
92 | /** |
||
93 | * @When /^I want to modify the (zone named "[^"]+")$/ |
||
94 | */ |
||
95 | public function iWantToModifyAZoneNamed(ZoneInterface $zone) |
||
99 | |||
100 | /** |
||
101 | * @When /^I delete (zone named "([^"]*)")$/ |
||
102 | */ |
||
103 | public function iDeleteZoneNamed(ZoneInterface $zone) |
||
108 | |||
109 | /** |
||
110 | * @When /^I remove (the "([^"]*)" (?:country|province|zone) member)$/ |
||
111 | */ |
||
112 | public function iRemoveTheMember(ZoneMemberInterface $zoneMember) |
||
116 | |||
117 | /** |
||
118 | * @When I rename it to :name |
||
119 | */ |
||
120 | public function iRenameItTo($name) |
||
124 | |||
125 | /** |
||
126 | * @When I name it :name |
||
127 | */ |
||
128 | public function iNameIt($name) |
||
132 | |||
133 | /** |
||
134 | * @When I specify its code as :code |
||
135 | */ |
||
136 | public function iSpecifyItsCodeAs($code) |
||
140 | |||
141 | /** |
||
142 | * @When I do not specify its code |
||
143 | */ |
||
144 | public function iDoNotSpecifyItsCode() |
||
148 | |||
149 | /** |
||
150 | * @When I do not specify its name |
||
151 | */ |
||
152 | public function iDoNotSpecifyItsName() |
||
156 | |||
157 | /** |
||
158 | * @When I do not add a country member |
||
159 | */ |
||
160 | public function iDoNotAddACountryMember() |
||
164 | |||
165 | /** |
||
166 | * @When /^I add a(?: country| province| zone) "([^"]+)"$/ |
||
167 | */ |
||
168 | public function iAddAZoneMember($name) |
||
173 | |||
174 | /** |
||
175 | * @When I select its scope as :scope |
||
176 | */ |
||
177 | public function iSelectItsScopeAs($scope) |
||
181 | |||
182 | /** |
||
183 | * @When I add it |
||
184 | * @When I try to add it |
||
185 | */ |
||
186 | public function iAddIt() |
||
190 | |||
191 | /** |
||
192 | * @When I save my changes |
||
193 | */ |
||
194 | public function iSaveMyChanges() |
||
198 | |||
199 | /** |
||
200 | * @Then /^the (zone named "[^"]+") with (the "[^"]+" (?:country|province|zone) member) should appear in the registry$/ |
||
201 | */ |
||
202 | public function theZoneWithTheCountryShouldAppearInTheRegistry(ZoneInterface $zone, ZoneMemberInterface $zoneMember) |
||
206 | |||
207 | /** |
||
208 | * @Given its scope should be :scope |
||
209 | */ |
||
210 | public function itsScopeShouldBe($scope) |
||
220 | |||
221 | /** |
||
222 | * @Then /^(this zone) should have only (the "([^"]*)" (?:country|province|zone) member)$/ |
||
223 | */ |
||
224 | public function thisZoneShouldHaveOnlyTheProvinceMember(ZoneInterface $zone, ZoneMemberInterface $zoneMember) |
||
234 | |||
235 | /** |
||
236 | * @Then /^(this zone) name should be "([^"]*)"/ |
||
237 | */ |
||
238 | public function thisZoneNameShouldBe(ZoneInterface $zone, $name) |
||
245 | |||
246 | /** |
||
247 | * @Then /^the code field should be disabled$/ |
||
248 | */ |
||
249 | public function theCodeFieldShouldBeDisabled() |
||
256 | |||
257 | /** |
||
258 | * @Then /^I should be notified that zone with this code already exists$/ |
||
259 | */ |
||
260 | public function iShouldBeNotifiedThatZoneWithThisCodeAlreadyExists() |
||
267 | |||
268 | /** |
||
269 | * @Then /^there should still be only one zone with code "([^"]*)"$/ |
||
270 | */ |
||
271 | public function thereShouldStillBeOnlyOneZoneWithCode($code) |
||
280 | |||
281 | /** |
||
282 | * @Then I should be notified that :element is required |
||
283 | */ |
||
284 | public function iShouldBeNotifiedThatIsRequired($element) |
||
291 | |||
292 | /** |
||
293 | * @Then zone with :element :value should not be added |
||
294 | */ |
||
295 | public function zoneWithNameShouldNotBeAdded($element, $value) |
||
304 | |||
305 | /** |
||
306 | * @Then /^I should be notified that at least one zone member is required$/ |
||
307 | */ |
||
308 | public function iShouldBeNotifiedThatAtLeastOneZoneMemberIsRequired() |
||
315 | |||
316 | /** |
||
317 | * @Then the type field should be disabled |
||
318 | */ |
||
319 | public function theTypeFieldShouldBeDisabled() |
||
326 | |||
327 | /** |
||
328 | * @Then it should be of :type type |
||
329 | */ |
||
330 | public function itShouldBeOfType($type) |
||
337 | |||
338 | /** |
||
339 | * @Then the zone named :zoneName should no longer exist in the registry |
||
340 | */ |
||
341 | public function thisZoneShouldNoLongerExistInTheRegistry($zoneName) |
||
348 | |||
349 | /** |
||
350 | * @Then /^I should see (\d+) zones in the list$/ |
||
351 | */ |
||
352 | public function iShouldSeeZonesInTheList($number) |
||
362 | |||
363 | /** |
||
364 | * @Then /^I should(?:| still) see the (zone named "([^"]+)") in the list$/ |
||
365 | */ |
||
366 | public function iShouldSeeTheZoneNamedInTheList(ZoneInterface $zone) |
||
373 | |||
374 | /** |
||
375 | * @Then I should be notified that this zone cannot be deleted |
||
376 | */ |
||
377 | public function iShouldBeNotifiedThatThisZoneCannotBeDeleted() |
||
381 | |||
382 | /** |
||
383 | * @param ZoneInterface $zone |
||
384 | * @param ZoneMemberInterface $zoneMember |
||
385 | * |
||
386 | * @throws \InvalidArgumentException |
||
387 | */ |
||
388 | private function assertZoneAndItsMember(ZoneInterface $zone, ZoneMemberInterface $zoneMember) |
||
403 | } |
||
404 |