예제 #1
0
 public function it_sets_expense_to_which_it_belong_and_adds_itself_to_that_expense_outflows(Expense $expense1)
 {
     $expense1->addOutflow($this)->shouldBeCalled();
     $this->setExpense($expense1);
     $this->getExpense()->shouldReturnAnInstanceOf('\\MoneyFlow\\Expense\\Expense');
 }
예제 #2
0
 /**
  * Sets outflow expense
  *
  * @return Outflow
  */
 public function setExpense($expense)
 {
     $this->expense = $expense;
     $this->expense->addOutflow($this);
     return $this;
 }
예제 #3
0
 public function it_returns_predicted_balance_for_future_day(Revenue $revenue, Expense $expense, Inflow $inflow, Outflow $outflow, Expense $expense1)
 {
     $date = new DateTime('+15 days');
     $inflow->getProbability()->shouldBeCalled()->willReturn(0.73);
     $inflow->getDate()->shouldBeCalled()->willReturn(new DateTime('+2 days'));
     $inflow->getValue()->shouldBeCalled()->willReturn(120.0);
     $revenue->getInflows()->shouldBeCalled()->willReturn([$inflow]);
     $outflow->getProbability()->shouldBeCalled()->willReturn(0.83);
     $outflow->getDate()->shouldBeCalled()->willReturn(new DateTime('+3 days'));
     $outflow->getValue()->shouldBeCalled()->willReturn(50.0);
     $expense->getOutflows()->shouldBeCalled()->willReturn([$outflow]);
     $revenue->addInflow($inflow);
     $expense->addOutflow($outflow);
     $this->addRevenue($revenue)->addExpense($expense);
     $this->getBalancePrediction($date)->shouldReturn(49.0);
 }