/**
  * Test save action
  *
  * @magentoDbIsolation enabled
  */
 public function testSaveAction()
 {
     $currencyCode = 'USD';
     $currencyTo = 'USD';
     $rate = 1.0;
     $request = $this->getRequest();
     $request->setPostValue('rate', [$currencyCode => [$currencyTo => $rate]]);
     $this->dispatch('backend/admin/system_currency/saveRates');
     $this->assertSessionMessages($this->contains((string) __('All valid rates have been saved.')), \Magento\Framework\Message\MessageInterface::TYPE_SUCCESS);
     $this->assertEquals($rate, $this->currencyRate->load($currencyCode)->getRate($currencyTo), 'Currency rate has not been saved');
 }
Example #2
0
 /**
  * Get currency model instance. Will be used currency with which order placed
  *
  * @return Currency
  */
 public function getOrderCurrency()
 {
     if ($this->_orderCurrency === null) {
         $this->_orderCurrency = $this->_currencyFactory->create();
         $this->_orderCurrency->load($this->getOrderCurrencyCode());
     }
     return $this->_orderCurrency;
 }
Example #3
0
 /**
  * Get currency rate
  *
  * @param string $fromRate
  * @param string $toRate
  * @return float
  */
 protected function _getRate($fromRate, $toRate)
 {
     return $this->_currencyModel->load($fromRate)->getAnyRate($toRate);
 }