Exemple #1
0
 /**
  * @inheritdoc
  */
 public function isSameCurrency(Money $money)
 {
     if ($this->getCurrency()->getAlpha3() !== $money->getCurrency()->getAlpha3()) {
         return false;
     }
     return true;
 }
Exemple #2
0
 /**
  * @dataProvider getConvertToData
  */
 public function testConvertTo(Money $argument1, $argument2, $expectedResult, $expectedCurrency)
 {
     $argument1Amount = $argument1->getAmount();
     $argument1Currency = $argument1->getCurrency();
     /** @var Money $result */
     $result = $argument1->convertTo($argument2, new ISO4217Currency($expectedCurrency));
     $this->assertSame($expectedResult, $result->getAmount());
     $this->assertSame($expectedCurrency, $result->getCurrency()->getAlpha3());
     //Test values not being modified
     $this->assertSame($argument1Amount, $argument1->getAmount());
     $this->assertSame($argument1Currency, $argument1->getCurrency());
 }