Esempio n. 1
0
 /**
  * Tests if two objects are of equal value.
  *
  * TODO: optionally supply a bank object to do a
  * currency conversion for an equals check?
  *
  * @param Money $money
  * @return bool
  */
 public function equals(Money $money)
 {
     if (!$money instanceof MultiCurrencyMoney) {
         return false;
     }
     return $money->currency == $this->currency && $money->getAmount() == $this->getAmount();
 }
Esempio n. 2
0
 public function testProductOfAProduct()
 {
     $money = new Money(10);
     $product = $money->times(2)->times(5);
     $this->assertEquals(10, $product->getMultiplier());
     $this->assertTrue($product->reduce()->equals(new Money(100)));
 }