1 | <?php |
||
21 | final class ManagingExchangeRatesContext implements Context |
||
22 | { |
||
23 | /** @var ApiClientInterface */ |
||
24 | private $client; |
||
25 | |||
26 | /** @var SharedStorageInterface */ |
||
27 | private $sharedStorage; |
||
28 | |||
29 | public function __construct( |
||
36 | |||
37 | /** |
||
38 | * @When I want to add a new exchange rate |
||
39 | */ |
||
40 | public function iWantToAddNewExchangeRate(): void |
||
44 | |||
45 | /** |
||
46 | * @When /^I want to edit (this exchange rate)$/ |
||
47 | * @Given /^I am editing (this exchange rate)$/ |
||
48 | */ |
||
49 | public function iWantToEditThisExchangeRate(ExchangeRateInterface $exchangeRate): void |
||
55 | |||
56 | /** |
||
57 | * @Given I am browsing exchange rates of the store |
||
58 | * @When I browse exchange rates |
||
59 | * @When I browse exchange rates of the store |
||
60 | */ |
||
61 | public function iBrowseExchangeRatesOfTheStore(): void |
||
65 | |||
66 | /** |
||
67 | * @When I specify its ratio as :ratio |
||
68 | * @When I don't specify its ratio |
||
69 | */ |
||
70 | public function iSpecifyItsRatioAs(?string $ratio = null): void |
||
76 | |||
77 | /** |
||
78 | * @When I choose :currencyCode as the source currency |
||
79 | */ |
||
80 | public function iChooseAsTheSourceCurrency(string $currencyCode): void |
||
84 | |||
85 | /** |
||
86 | * @When I choose :currencyCode as the target currency |
||
87 | */ |
||
88 | public function iChooseAsTheTargetCurrency(string $currencyCode): void |
||
92 | |||
93 | /** |
||
94 | * @When I (try to) add it |
||
95 | */ |
||
96 | public function iAddIt(): void |
||
100 | |||
101 | /** |
||
102 | * @When I change ratio to :ratio |
||
103 | */ |
||
104 | public function iChangeRatioTo(string $ratio): void |
||
108 | |||
109 | /** |
||
110 | * @When I save my changes |
||
111 | */ |
||
112 | public function iSaveMyChanges(): void |
||
116 | |||
117 | /** |
||
118 | * @When /^I delete the (exchange rate between "[^"]+" and "[^"]+")$/ |
||
119 | */ |
||
120 | public function iDeleteTheExchangeRateBetweenAnd(ExchangeRateInterface $exchangeRate) : void |
||
124 | |||
125 | /** |
||
126 | * @When I choose :currency as a currency filter |
||
127 | */ |
||
128 | public function iChooseCurrencyAsACurrencyFilter(CurrencyInterface $currency): void |
||
132 | |||
133 | /** |
||
134 | * @When I filter |
||
135 | */ |
||
136 | public function iFilter(): void |
||
140 | |||
141 | /** |
||
142 | * @Then I should see :count exchange rates on the list |
||
143 | */ |
||
144 | public function iShouldSeeExchangeRatesOnTheList(int $count): void |
||
148 | |||
149 | /** |
||
150 | * @Then I should see a single exchange rate in the list |
||
151 | * @Then I should( still) see one exchange rate on the list |
||
152 | */ |
||
153 | public function iShouldSeeASingleExchangeRateInTheList(): void |
||
158 | |||
159 | /** |
||
160 | * @Then the exchange rate with ratio :ratio between :sourceCurrency and :targetCurrency should appear in the store |
||
161 | */ |
||
162 | public function theExchangeRateWithRatioBetweenAndShouldAppearInTheStore( |
||
177 | |||
178 | /** |
||
179 | * @Then I should see the exchange rate between :sourceCurrency and :targetCurrency in the list |
||
180 | * @Then I should (also) see an exchange rate between :sourceCurrency and :targetCurrency on the list |
||
181 | */ |
||
182 | public function iShouldSeeTheExchangeRateBetweenAndInTheList( |
||
191 | |||
192 | /** |
||
193 | * @Then it should have a ratio of :ratio |
||
194 | */ |
||
195 | public function itShouldHaveARatioOf(float $ratio): void |
||
204 | |||
205 | /** |
||
206 | * @Then /^(this exchange rate) should no longer be on the list$/ |
||
207 | */ |
||
208 | public function thisExchangeRateShouldNoLongerBeOnTheList(ExchangeRateInterface $exchangeRate): void |
||
224 | |||
225 | /** |
||
226 | * @Then the exchange rate between :sourceCurrency and :targetCurrency should not be added |
||
227 | */ |
||
228 | public function theExchangeRateBetweenAndShouldNotBeAdded( |
||
236 | |||
237 | /** |
||
238 | * @Then /^(this exchange rate) should have a ratio of ([0-9\.]+)$/ |
||
239 | */ |
||
240 | public function thisExchangeRateShouldHaveARatioOf(ExchangeRateInterface $exchangeRate, float $ratio): void |
||
249 | |||
250 | /** |
||
251 | * @Then I should not be able to edit its source currency |
||
252 | */ |
||
253 | public function iShouldNotBeAbleToEditItsSourceCurrency(): void |
||
257 | |||
258 | /** |
||
259 | * @Then I should not be able to edit its target currency |
||
260 | */ |
||
261 | public function iShouldNotBeAbleToEditItsTargetCurrency(): void |
||
265 | |||
266 | /** |
||
267 | * @Then I should be notified that :element is required |
||
268 | */ |
||
269 | public function iShouldBeNotifiedThatIsRequired(string $element): void |
||
273 | |||
274 | /** |
||
275 | * @Then I should be notified that the ratio must be greater than zero |
||
276 | */ |
||
277 | public function iShouldBeNotifiedThatRatioMustBeGreaterThanZero(): void |
||
281 | |||
282 | /** |
||
283 | * @Then I should be notified that source and target currencies must differ |
||
284 | */ |
||
285 | public function iShouldBeNotifiedThatSourceAndTargetCurrenciesMustDiffer(): void |
||
289 | |||
290 | /** |
||
291 | * @Then I should be notified that the currency pair must be unique |
||
292 | */ |
||
293 | public function iShouldBeNotifiedThatTheCurrencyPairMustBeUnique(): void |
||
297 | |||
298 | private function assertIfNotBeAbleToEditItCurrency(string $currencyType): void |
||
311 | |||
312 | private function getExchangeRateFromResponse( |
||
331 | |||
332 | private function responseHasExchangeRate( |
||
339 | } |
||
340 |
Our type inference engine in quite powerful, but sometimes the code does not provide enough clues to go by. In these cases we request you to add a
@return
annotation as described here.