Exemple #1
0
 public function it_sets_revenue_to_which_it_belong_and_adds_itself_to_that_revenue_inflows(Revenue $revenue1)
 {
     $revenue1->addInflow($this)->shouldBeCalled();
     $this->setRevenue($revenue1);
     $this->getRevenue()->shouldReturnAnInstanceOf('\\MoneyFlow\\Revenue\\Revenue');
 }
Exemple #2
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);
 }
Exemple #3
0
 /**
  * Sets inflow revenue
  *
  * @return Inflow
  */
 public function setRevenue($revenue)
 {
     $this->revenue = $revenue;
     $this->revenue->addInflow($this);
     return $this;
 }