Exemple #1
0
 public function testInvert()
 {
     $conv = new ExchangeRate("EUR/USD 1.25");
     $conv->invert();
     $this->assertEquals(0.8, $conv->getRate());
     $this->assertEquals("USD", $conv->getSourceCurrency()->__toString());
     $this->assertEquals("EUR", $conv->getTargetCurrency()->__toString());
     $this->assertEquals("USD/EUR 0.8", $conv->__toString());
     $conv->invert();
     $this->assertEquals("EUR/USD 1.25", $conv->__toString());
 }
Exemple #2
0
 /**
  * Checks source and target currencies provided are equal to the $exRate object's source and target
  *
  * @param ExchangeRate $exRate
  * @param Currency $source
  * @param Currency $target
  *
  * @return boolean
  */
 protected function isEqualCurrencies($exRate, Currency $source, Currency $target)
 {
     return $exRate->getSourceCurrency()->isEqualTo($source) && $exRate->getTargetCurrency()->isEqualTo($target);
 }