1 | <?php |
||
27 | final class ManagingCountriesContext implements Context |
||
28 | { |
||
29 | /** @var ApiClientInterface */ |
||
30 | private $client; |
||
31 | |||
32 | /** @var ResponseCheckerInterface */ |
||
33 | private $responseChecker; |
||
34 | |||
35 | /** @var SharedStorageInterface */ |
||
36 | private $sharedStorage; |
||
37 | |||
38 | /** @var IriConverterInterface */ |
||
39 | private $iriConverter; |
||
40 | |||
41 | public function __construct( |
||
52 | |||
53 | /** |
||
54 | * @When I want to add a new country |
||
55 | */ |
||
56 | public function iWantToAddANewCountry(): void |
||
60 | |||
61 | /** |
||
62 | * @When I choose :countryName |
||
63 | */ |
||
64 | public function iChoose(string $countryName): void |
||
68 | |||
69 | /** |
||
70 | * @When I add it |
||
71 | */ |
||
72 | public function iAddIt(): void |
||
76 | |||
77 | /** |
||
78 | * @When /^I want to edit (this country)$/ |
||
79 | * @When /^I want to create a new province in (country "([^"]+)")$/ |
||
80 | */ |
||
81 | public function iWantToEditThisCountry(CountryInterface $country): void |
||
85 | |||
86 | /** |
||
87 | * @When I enable it |
||
88 | */ |
||
89 | public function iEnableIt(): void |
||
93 | |||
94 | /** |
||
95 | * @When I disable it |
||
96 | */ |
||
97 | public function iDisableIt(): void |
||
101 | |||
102 | /** |
||
103 | * @When I save my changes |
||
104 | * @When I try to save changes |
||
105 | */ |
||
106 | public function iSaveMyChanges(): void |
||
110 | |||
111 | /** |
||
112 | * @When I name the province :provinceName |
||
113 | */ |
||
114 | public function iNameTheProvince(string $provinceName): void |
||
121 | |||
122 | /** |
||
123 | * @When I specify the province code as :provinceCode |
||
124 | */ |
||
125 | public function iSpecifyTheProvinceCodeAs(string $provinceCode): void |
||
132 | |||
133 | /** |
||
134 | * @When I add the :provinceName province with :provinceCode code |
||
135 | */ |
||
136 | public function iAddTheProvinceWithCode(string $provinceName, string $provinceCode): void |
||
143 | |||
144 | /** |
||
145 | * @When I add the :name province with :code code and :abbreviation abbreviation |
||
146 | */ |
||
147 | public function iAddTheProvinceWithCodeAndAbbreviation(string $name, string $code, string $abbreviation): void |
||
154 | |||
155 | /** |
||
156 | * @When /^I delete the ("[^"]+" province) of (this country)$/ |
||
157 | */ |
||
158 | public function iDeleteTheProvinceOfThisCountry(ProvinceInterface $province, CountryInterface $country): void |
||
169 | |||
170 | /** |
||
171 | * @When I do not specify the province code |
||
172 | * @When I do not name the province |
||
173 | */ |
||
174 | public function iDoNotSpecifyTheProvinceCode(): void |
||
178 | |||
179 | /** |
||
180 | * @Then I should be notified that it has been successfully created |
||
181 | */ |
||
182 | public function iShouldBeNotifiedThatItHasBeenSuccessfullyCreated(): void |
||
189 | |||
190 | /** |
||
191 | * @Then the country :country should appear in the store |
||
192 | */ |
||
193 | public function theCountryShouldAppearInTheStore(CountryInterface $country): void |
||
200 | |||
201 | /** |
||
202 | * @Then the country :country should have the :province province |
||
203 | * @Then /^(this country) should have the ("[^"]*" province)$/ |
||
204 | */ |
||
205 | public function theCountryShouldHaveTheProvince(CountryInterface $country, ProvinceInterface $province): void |
||
213 | |||
214 | /** |
||
215 | * @Then the province should still be named :province in this country |
||
216 | */ |
||
217 | public function theProvinceShouldStillBeNamedInThisCountry(ProvinceInterface $province): void |
||
227 | |||
228 | /** |
||
229 | * @Then I should not be able to choose :countryName |
||
230 | */ |
||
231 | public function iShouldNotBeAbleToChoose(string $countryName): void |
||
241 | |||
242 | /** |
||
243 | * @Then I should be notified that it has been successfully edited |
||
244 | */ |
||
245 | public function iShouldBeNotifiedThatItHasBeenSuccessfullyEdited(): void |
||
252 | |||
253 | /** |
||
254 | * @Then /^(this country) should be (enabled|disabled)$/ |
||
255 | */ |
||
256 | public function thisCountryShouldBeDisabled(CountryInterface $country, string $enabled): void |
||
267 | |||
268 | /** |
||
269 | * @Then I should not be able to edit its code |
||
270 | */ |
||
271 | public function theCodeFieldShouldBeDisabled(): void |
||
277 | |||
278 | /** |
||
279 | * @Then /^province with code ("[^"]*") should not be added in (this country)$/ |
||
280 | */ |
||
281 | public function provinceWithCodeShouldNotBeAddedInThisCountry(string $provinceCode, CountryInterface $country): void |
||
291 | |||
292 | /** |
||
293 | * @Then this country should not have the :provinceName province |
||
294 | * @Then province with name :provinceName should not be added in this country |
||
295 | */ |
||
296 | public function thisCountryShouldNotHaveTheProvince(string $provinceName): void |
||
308 | |||
309 | /** |
||
310 | * @Then I should be notified that province code must be unique |
||
311 | */ |
||
312 | public function iShouldBeNotifiedThatProvinceCodeMustBeUnique(): void |
||
319 | |||
320 | /** |
||
321 | * @Then I should be notified that :field is required |
||
322 | */ |
||
323 | public function iShouldBeNotifiedThatFieldIsRequired(string $field): void |
||
330 | |||
331 | private function getCountryCodeByName(string $countryName): string |
||
342 | |||
343 | private function getProvincesOfCountry(CountryInterface $country): iterable |
||
352 | } |
||
353 |
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: