Beispiel #1
0
 /**
  * @param CashFlow $cashflow
  *
  * @return bool
  *
  * @throws UnexpectedDateException
  */
 public function isEqualTo(CashFlow $cashflow)
 {
     if ($this->date->format('Y-m-d') !== $cashflow->getDate()->format('Y-m-d')) {
         throw new UnexpectedDateException('Impossible to compare two cashflows not belonging to the same day.');
     }
     return $this->price->isEqualTo($cashflow->getPrice());
 }
Beispiel #2
0
 /**
  * @covers Price::isEqualTo
  * @expectedException \MonoidPoc\Exception\UnexpectedCurrencyException
  */
 public function testIsEqualToRaiseExceptionIfNecessary()
 {
     $price1 = new Price(25, 'EUR');
     $price2 = new Price(25, 'USD');
     $price1->isEqualTo($price2);
 }