/** * 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(); }
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))); }