1 | <?php |
||
27 | final class ManagingCountriesContext implements Context |
||
28 | { |
||
29 | /** @var ApiClientInterface */ |
||
30 | private $client; |
||
31 | |||
32 | /** @var ApiClientInterface */ |
||
33 | private $provincesClient; |
||
34 | |||
35 | /** @var ResponseCheckerInterface */ |
||
36 | private $responseChecker; |
||
37 | |||
38 | /** @var SharedStorageInterface */ |
||
39 | private $sharedStorage; |
||
40 | |||
41 | /** @var IriConverterInterface */ |
||
42 | private $iriConverter; |
||
43 | |||
44 | public function __construct( |
||
57 | |||
58 | /** |
||
59 | * @When I want to add a new country |
||
60 | */ |
||
61 | public function iWantToAddANewCountry(): void |
||
65 | |||
66 | /** |
||
67 | * @When I choose :countryName |
||
68 | */ |
||
69 | public function iChoose(string $countryName): void |
||
73 | |||
74 | /** |
||
75 | * @When I add it |
||
76 | */ |
||
77 | public function iAddIt(): void |
||
81 | |||
82 | /** |
||
83 | * @When /^I want to edit (this country)$/ |
||
84 | * @When /^I want to create a new province in (country "([^"]+)")$/ |
||
85 | */ |
||
86 | public function iWantToEditThisCountry(CountryInterface $country): void |
||
90 | |||
91 | /** |
||
92 | * @When I enable it |
||
93 | */ |
||
94 | public function iEnableIt(): void |
||
98 | |||
99 | /** |
||
100 | * @When I disable it |
||
101 | */ |
||
102 | public function iDisableIt(): void |
||
106 | |||
107 | /** |
||
108 | * @When I save my changes |
||
109 | * @When I try to save changes |
||
110 | */ |
||
111 | public function iSaveMyChanges(): void |
||
115 | |||
116 | /** |
||
117 | * @When I name the province :provinceName |
||
118 | */ |
||
119 | public function iNameTheProvince(string $provinceName): void |
||
126 | |||
127 | /** |
||
128 | * @When I specify the province code as :provinceCode |
||
129 | */ |
||
130 | public function iSpecifyTheProvinceCodeAs(string $provinceCode): void |
||
137 | |||
138 | /** |
||
139 | * @When I add the :provinceName province with :provinceCode code |
||
140 | */ |
||
141 | public function iAddTheProvinceWithCode(string $provinceName, string $provinceCode): void |
||
148 | |||
149 | /** |
||
150 | * @When I add the :name province with :code code and :abbreviation abbreviation |
||
151 | */ |
||
152 | public function iAddTheProvinceWithCodeAndAbbreviation(string $name, string $code, string $abbreviation): void |
||
159 | |||
160 | /** |
||
161 | * @When /^I delete the ("[^"]+" province) of (this country)$/ |
||
162 | */ |
||
163 | public function iDeleteTheProvinceOfThisCountry(ProvinceInterface $province, CountryInterface $country): void |
||
174 | |||
175 | /** |
||
176 | * @When I do not specify the province code |
||
177 | * @When I do not name the province |
||
178 | */ |
||
179 | public function iDoNotSpecifyTheProvince(): void |
||
183 | |||
184 | /** |
||
185 | * @When I remove :province province name |
||
186 | */ |
||
187 | public function iRemoveProvinceName(ProvinceInterface $province): void |
||
193 | |||
194 | /** |
||
195 | * @Then I should be notified that it has been successfully created |
||
196 | */ |
||
197 | public function iShouldBeNotifiedThatItHasBeenSuccessfullyCreated(): void |
||
204 | |||
205 | /** |
||
206 | * @Then the country :country should appear in the store |
||
207 | */ |
||
208 | public function theCountryShouldAppearInTheStore(CountryInterface $country): void |
||
215 | |||
216 | /** |
||
217 | * @Then the country :country should have the :province province |
||
218 | * @Then /^(this country) should have the ("[^"]*" province)$/ |
||
219 | */ |
||
220 | public function theCountryShouldHaveTheProvince(CountryInterface $country, ProvinceInterface $province): void |
||
228 | |||
229 | /** |
||
230 | * @Then the province should still be named :province in this country |
||
231 | */ |
||
232 | public function theProvinceShouldStillBeNamedInThisCountry(ProvinceInterface $province): void |
||
242 | |||
243 | /** |
||
244 | * @Then I should not be able to choose :countryName |
||
245 | */ |
||
246 | public function iShouldNotBeAbleToChoose(string $countryName): void |
||
256 | |||
257 | /** |
||
258 | * @Then I should be notified that it has been successfully edited |
||
259 | */ |
||
260 | public function iShouldBeNotifiedThatItHasBeenSuccessfullyEdited(): void |
||
267 | |||
268 | /** |
||
269 | * @Then /^(this country) should be (enabled|disabled)$/ |
||
270 | */ |
||
271 | public function thisCountryShouldBeDisabled(CountryInterface $country, string $enabled): void |
||
282 | |||
283 | /** |
||
284 | * @Then I should not be able to edit its code |
||
285 | */ |
||
286 | public function theCodeFieldShouldBeDisabled(): void |
||
292 | |||
293 | /** |
||
294 | * @Then /^province with code ("[^"]*") should not be added in (this country)$/ |
||
295 | */ |
||
296 | public function provinceWithCodeShouldNotBeAddedInThisCountry(string $provinceCode, CountryInterface $country): void |
||
306 | |||
307 | /** |
||
308 | * @Then this country should not have the :provinceName province |
||
309 | * @Then province with name :provinceName should not be added in this country |
||
310 | */ |
||
311 | public function thisCountryShouldNotHaveTheProvince(string $provinceName): void |
||
323 | |||
324 | /** |
||
325 | * @Then I should be notified that province code must be unique |
||
326 | */ |
||
327 | public function iShouldBeNotifiedThatProvinceCodeMustBeUnique(): void |
||
334 | |||
335 | /** |
||
336 | * @Then I should be notified that :field is required |
||
337 | */ |
||
338 | public function iShouldBeNotifiedThatFieldIsRequired(string $field): void |
||
345 | |||
346 | /** |
||
347 | * @Then I should be notified that name of the province is required |
||
348 | */ |
||
349 | public function iShouldBeNotifiedThatNameOfTheProvinceIsRequired(): void |
||
356 | |||
357 | private function getCountryCodeByName(string $countryName): string |
||
368 | |||
369 | private function getProvincesOfCountry(CountryInterface $country): iterable |
||
378 | } |
||
379 |
It seems like the type of the argument is not accepted by the function/method which you are calling.
In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.
We suggest to add an explicit type cast like in the following example: