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 it_should_use_a_registered_modifier_when_it_is_part_of_the_plan_definition($basePlan, PlanModifierInterface $modifier, PaymentPlan $planProvidedByModifier, PaymentPlan $unmodifiedPlan)
 {
     $definition = PlanDefinition::withNameAndAttributesAsArray('Foo', ['modifiers' => ['mymodifier']]);
     $this->registerModifier('mymodifier', $modifier);
     $modifier->setBaseCalculator($basePlan)->shouldBeCalled();
     $modifier->getPlan($definition, Money::GBP(100), PlanParameters::none())->shouldBeCalled()->willReturn($planProvidedByModifier);
     $basePlan->getPlan(PlanDefinition::withName('Foo'), Money::GBP(100), PlanParameters::none())->willReturn($unmodifiedPlan);
     $this->getPlan($definition, Money::GBP(100), PlanParameters::none())->shouldReturn($planProvidedByModifier);
     $this->getPlan(PlanDefinition::withName('Foo'), Money::GBP(100), PlanParameters::none())->shouldReturn($unmodifiedPlan);
 }
 function it_should_require_definition_attributes()
 {
     $this->isAvailable(PlanDefinition::withName('PercentOnDate'), Money::GBP(100), PlanParameters::none())->shouldReturn(false);
     $this->isAvailable(PlanDefinition::withNameAndAttributesAsArray('PercentOnDate', ['short_description' => 'Foo', 'long_description' => 'FooFoo', 'payments' => ['immediate' => 0.1, '2014-01-01' => 0.7, '2015-01-01' => 0.2]]), Money::GBP(100), PlanParameters::none())->shouldReturn(true);
 }
 function it_should_support_whatever_plan_codes_its_children_support()
 {
     $this->supportsDefinition(PlanDefinition::withName('Foo'))->shouldReturn(true);
     $this->supportsDefinition(PlanDefinition::withName('Bar'))->shouldReturn(false);
 }