public function testIsEqualToReturnFalse() { $currency1 = new Currency('EUR'); $currency2 = new Currency('USD'); $this->assertFalse($currency1->isEqualTo($currency2)); $this->assertFalse($currency2->isEqualTo($currency1)); }
/** * @param Price $price * * @return bool * * @throws UnexpectedCurrencyException */ public function isEqualTo(Price $price) { if (!$this->currency->isEqualTo($price->getCurrency())) { throw new UnexpectedCurrencyException("Impossible to compare two prices with different currencies."); } return $this->amount === $price->getAmount(); }