public function testEqualButNotSame() { $eur1 = new Currency("EUR", 5); $eur2 = new Currency("EUR", 10); $this->assertTrue($eur1->isEqualTo($eur2)); $this->assertTrue($eur2->isEqualTo($eur1)); $this->assertFalse($eur1->isSameTo($eur2)); $this->assertFalse($eur2->isSameTo($eur1)); }
/** * Checks the Money are equal to other. * * @param Money $other * * @return boolean Return TRUE if the Currency and the amount are same. */ public function isEqualTo(Money $other) { return $this->currency->isEqualTo($other->getCurrency()) && $other->getAmount() == $this->amount; }