function it_should_spread_the_bursary_when_the_plan_spans_multiple_years($baseCalculator, PaymentPlan $planBeforeBursary, PaymentPlan $finalPlan)
 {
     $baseCalculator->getPlan(Def::withName('Foo'), Money::GBP(250), Argument::any())->willReturn($planBeforeBursary);
     $planBeforeBursary->getPlannedPayments()->willReturn([PlannedPayment::immediate(Money::GBP(50)), PlannedPayment::withDueDate(Money::GBP(50), DueDate::fromString('2014-01-01')), PlannedPayment::withDueDate(Money::GBP(50), DueDate::fromString('2014-06-01')), PlannedPayment::withDueDate(Money::GBP(50), DueDate::fromString('2015-01-01')), PlannedPayment::withDueDate(Money::GBP(50), DueDate::fromString('2015-06-01'))]);
     $planBeforeBursary->getShortDescription()->willReturn('foo');
     $planBeforeBursary->getLongDescription()->willReturn('foofoo');
     $finalPlan = new PaymentPlan([PlannedPayment::immediate(Money::GBP(50)), PlannedPayment::withDueDate(Money::GBP(50), DueDate::fromString('2014-01-01')), PlannedPayment::withDueDate(Money::GBP(40), DueDate::fromString('2014-06-01')), PlannedPayment::withDueDate(Money::GBP(50), DueDate::fromString('2015-01-01')), PlannedPayment::withDueDate(Money::GBP(40), DueDate::fromString('2015-06-01'))], 'foo', 'foofoo');
     $this->getPlan(Def::withName('Foo'), Money::GBP(230), Params::fromArray(['bursary_total_deduction' => 20]))->shouldBeLike($finalPlan);
 }
 function testIntegration()
 {
     $definition = PlanDefinition::withNameAndAttributesAsArray('PercentOnDate', ['short_description' => '20/40/40 split', 'long_description' => '20% immediately, 40% on 2014/01/01, 40% on 2014/03/01, except that bursaries are always taken from the final instalment', 'payments' => ['immediate' => 0.2, '2014-01-01' => 0.4, '2014-03-01' => 0.4], 'modifiers' => ['bursary_off_final_payment']]);
     $params = PlanParameters::fromArray(['bursary_total_deduction' => 10]);
     $this->assertTrue($this->factory->isAvailable($definition, Money::GBP(90), $params));
     $plan = $this->factory->getPlan($definition, Money::GBP(90), $params);
     /**
      * The net booking cost is 90, which includes a 10 deduction for a bursary. Without the bursary, we'd expect
      * the 100 to be split as 20/40/40. With the bursary_off_final_payment modifier, this becomes 20/40/30
      */
     $this->assertEquals(new PaymentPlan([PlannedPayment::immediate(Money::GBP(20)), PlannedPayment::withDueDate(Money::GBP(40), DueDate::fromString('2014-01-01')), PlannedPayment::withDueDate(Money::GBP(30), DueDate::fromString('2014-03-01'))], '20/40/40 split', '20% immediately, 40% on 2014/01/01, 40% on 2014/03/01, except that bursaries are always taken from the final instalment'), $plan);
 }