1 | <?php |
||
27 | final class CurrencyContext implements Context |
||
28 | { |
||
29 | /** |
||
30 | * @var SharedStorageInterface |
||
31 | */ |
||
32 | private $sharedStorage; |
||
33 | |||
34 | /** |
||
35 | * @var RepositoryInterface |
||
36 | */ |
||
37 | private $currencyRepository; |
||
38 | |||
39 | /** |
||
40 | * @var FactoryInterface |
||
41 | */ |
||
42 | private $currencyFactory; |
||
43 | |||
44 | /** |
||
45 | * @var CurrencyStorageInterface |
||
46 | */ |
||
47 | private $currencyStorage; |
||
48 | |||
49 | /** |
||
50 | * @var ObjectManager |
||
51 | */ |
||
52 | private $currencyManager; |
||
53 | |||
54 | /** |
||
55 | * @var ObjectManager |
||
56 | */ |
||
57 | private $channelManager; |
||
58 | |||
59 | /** |
||
60 | * @param SharedStorageInterface $sharedStorage |
||
61 | * @param RepositoryInterface $currencyRepository |
||
62 | * @param FactoryInterface $currencyFactory |
||
63 | * @param CurrencyStorageInterface $currencyStorage |
||
64 | * @param ObjectManager $currencyManager |
||
65 | * @param ObjectManager $channelManager |
||
66 | */ |
||
67 | public function __construct( |
||
82 | |||
83 | /** |
||
84 | * @Given the store has currency :currencyCode |
||
85 | */ |
||
86 | public function theStoreHasCurrency($currencyCode) |
||
93 | |||
94 | /** |
||
95 | * @Given the store has currency :currencyCode, :secondCurrencyCode |
||
96 | */ |
||
97 | public function theStoreHasCurrencyAnd($currencyCode, $secondCurrencyCode) |
||
102 | |||
103 | /** |
||
104 | * @Given the store has disabled currency :currencyCode |
||
105 | * @Given the currency :currencyCode is disabled (as well) |
||
106 | * @Given the currency :currencyCode gets disabled |
||
107 | * @Given the currency :currencyCode has been disabled |
||
108 | */ |
||
109 | public function theStoreHasDisabledCurrency($currencyCode) |
||
116 | |||
117 | /** |
||
118 | * @Given the store has currency :currencyCode with exchange rate :exchangeRate |
||
119 | */ |
||
120 | public function theStoreHasCurrencyWithExchangeRate($currencyCode, $exchangeRate) |
||
127 | |||
128 | /** |
||
129 | * @Given /^(that channel) allows to shop using the "([^"]+)" currency$/ |
||
130 | * @Given /^(that channel) allows to shop using "([^"]+)" and "([^"]+)" currencies$/ |
||
131 | * @Given /^(that channel) allows to shop using "([^"]+)", "([^"]+)" and "([^"]+)" currencies$/ |
||
132 | */ |
||
133 | public function thatChannelAllowsToShopUsingAndCurrencies(ChannelInterface $channel, ...$currenciesCodes) |
||
145 | |||
146 | /** |
||
147 | * @Given /^(that channel)(?: also|) allows to shop using the "([^"]+)" currency with exchange rate ([0-9\.]+)$/ |
||
148 | */ |
||
149 | public function thatChannelAllowsToShopUsingCurrency(ChannelInterface $channel, $currencyCode, $exchangeRate = 1.0) |
||
157 | |||
158 | /** |
||
159 | * @Given /^the exchange rate for (currency "[^"]+") was changed to ([0-9\.]+)$/ |
||
160 | * @Given /^the ("[^"]+" currency) has an exchange rate of ([0-9\.]+)$/ |
||
161 | */ |
||
162 | public function theExchangeRateForWasChangedTo(CurrencyInterface $currency, $exchangeRate) |
||
167 | |||
168 | /** |
||
169 | * @param CurrencyInterface $currency |
||
170 | */ |
||
171 | private function saveCurrency(CurrencyInterface $currency) |
||
176 | |||
177 | /** |
||
178 | * @param $currencyCode |
||
179 | * @param float $exchangeRate |
||
180 | * |
||
181 | * @return CurrencyInterface |
||
182 | */ |
||
183 | private function createCurrency($currencyCode, $exchangeRate = 1.0) |
||
192 | |||
193 | /** |
||
194 | * @param string $currencyCode |
||
195 | * |
||
196 | * @return CurrencyInterface |
||
197 | */ |
||
198 | private function provideCurrency($currencyCode) |
||
210 | } |
||
211 |