예제 #1
0
 /**
  * @param string $currencyCode
  *
  * @return float
  */
 public function getMoneyInMicros($currencyCode = CIA_APPLICATION_CURRENCY)
 {
     if ($currencyCode !== $this->_currency) {
         return $this->_exchangeRateCalculator->convert($this->_moneyInMicros, $this->_currency, $currencyCode, $this->_exchangeDate);
     }
     return $this->_moneyInMicros;
 }
 public function testConvert()
 {
     $converter = new ExchangeRateCalculator();
     //€4,30 to $'s
     $date = new DateTime('2015-09-16 16:49:30', new DateTimeZone(CIA_APPLICATION_TIMEZONE));
     $x = $converter->convert(4300000, 'EUR', 'USD', $date);
     $this->assertEquals(4705232, $x);
     //This amount should also be equal to the original amount, but minus two surcharges.
     $this->assertEquals(4300000 * 0.977 * 0.977, $converter->convert(4705232, 'USD', 'EUR', $date));
 }