/** * {@inheritdoc} */ public function specifyPriceForChannelAndCurrency($price, ChannelInterface $channel, CurrencyInterface $currency) { $calculatorElement = $this->getElement('calculator'); $calculatorElement->waitFor(5, function () use($channel, $currency) { return $this->getElement('calculator')->hasField(sprintf('%s %s', $channel->getName(), $currency->getCode())); }); $calculatorElement->fillField(sprintf('%s %s', $channel->getName(), $currency->getCode()), $price); }
function it_returns_only_channels_enabled_currencies_as_available_ones(ChannelContextInterface $channelContext, ChannelInterface $channel, CurrencyInterface $currency) { $channelContext->getChannel()->willReturn($channel); $channel->getCurrencies()->willReturn(new ArrayCollection([$currency->getWrappedObject()])); $currency->getCode()->willReturn('BTC'); $this->getAvailableCurrenciesCodes()->shouldReturn(['BTC']); }
/** * @param CurrencyInterface $currency * @param string $status * * @return bool * * @throws \InvalidArgumentException */ private function checkCurrencyStatus(CurrencyInterface $currency, $status) { $tableAccessor = $this->getTableAccessor(); $table = $this->getElement('table'); $row = $tableAccessor->getRowWithFields($table, ['code' => $currency->getCode()]); $enabledField = $tableAccessor->getFieldFromRow($table, $row, 'enabled'); return $enabledField->getText() === $status; }
function it_updates_orders_exchange_rate(RepositoryInterface $currencyRepository, OrderInterface $order, CurrencyInterface $currency) { $order->getCurrencyCode()->willReturn('USD'); $currency->getCode()->willReturn('USD'); $currency->getExchangeRate()->willReturn(2); $currencyRepository->findOneBy(['code' => 'USD'])->willReturn($currency); $order->setExchangeRate(2)->shouldBeCalled(); $this->update($order); }
/** * {@inheritdoc} */ public function getPricingConfigurationForChannelAndCurrencyCalculator(ChannelInterface $channel, CurrencyInterface $currency) { $priceConfigurationElement = $this->getElement('pricing_configuration'); $priceElement = $priceConfigurationElement->find('css', sprintf('label:contains("%s %s")', $channel->getCode(), $currency->getCode()))->getParent(); return $priceElement->find('css', 'input')->getValue(); }
/** * @Then the currency :currency should appear in the store * @Then I should see the currency :currency in the list */ public function currencyShouldAppearInTheStore(CurrencyInterface $currency) { $this->indexPage->open(); Assert::true($this->indexPage->isSingleResourceOnPage(['code' => $currency->getCode()]), sprintf('Currency %s should exist but it does not.', $currency->getCode())); }
function it_returns_all_enabled_currencies(RepositoryInterface $currencyRepository, CurrencyInterface $currency) { $currencyRepository->findBy(['enabled' => true])->willReturn([$currency]); $currency->getCode()->willReturn('PLN'); $this->getAvailableCurrenciesCodes()->shouldReturn(['PLN']); }
/** * @param CurrencyInterface $baseCurrency * @param CurrencyInterface $targetCurrency * * @return bool */ private function isCurrencyPairUnique(CurrencyInterface $baseCurrency, CurrencyInterface $targetCurrency) { $exchangeRate = $this->exchangeRateRepository->findOneWithCurrencyPair($baseCurrency->getCode(), $targetCurrency->getCode()); return null === $exchangeRate; }