Exemplo n.º 1
0
 /**
  * @expectedException RuntimeException
  */
 public function testAddingInvestmentThrowsAnExeptionWhenMaxAmountExceeded()
 {
     $tranche = new Tranche();
     $tranche->setMaxAmount(1000);
     $investment = new Investment();
     $investment->setInvestor(new Investor());
     $investment->setAmount(1500);
     $tranche->addInvestment($investment);
 }
Exemplo n.º 2
0
 /**
  * @param Investment $investment
  */
 public function addInvestment(Investment $investment)
 {
     $currentAmount = $this->getCurrentAmount();
     $investmentAmount = $investment->getAmount();
     if ($currentAmount + $investmentAmount > $this->getMaxAmount()) {
         throw new \RuntimeException();
     }
     $this->investments[] = $investment;
 }