Ejemplo n.º 1
0
 public function add(CashFlow $cashflow)
 {
     if ($this->getFormattedDate() !== $cashflow->getFormattedDate()) {
         throw new UnexpectedDateException('Impossible to compare two cashflows not belonging to the same day.');
     }
     $newCashflow = clone $this;
     return $newCashflow->setPrice($this->price->add($cashflow->getPrice()));
 }
Ejemplo n.º 2
0
 /**
  * @covers Prive::add
  * @expectedException \MonoidPoc\Exception\UnexpectedCurrencyException
  */
 public function testAddRaisesExceptionIfNecessary()
 {
     $price1 = new Price(25, 'EUR');
     $price2 = new Price(30, 'USD');
     $price1->add($price2);
 }