function it_reports_success_to_the_dispatcher(Sprint $sprint, Specification $spec, $specRepo, $dispatcher) { $sprint->getLength()->willReturn(10); $specRepo->getSpecificationForSprintLength(10)->willReturn($spec); $sprint->applySpecification($spec)->shouldBeCalled(); $dispatcher->dispatch($this->SUCCESS, Argument::any())->shouldBeCalled(); $this->scheduleSprint($sprint); }
public function scheduleSprint(Sprint $sprint) { $specification = $this->specRepo->getSpecificationForSprintLength($sprint->getLength()); if (!$specification) { $this->dispatcher->dispatch(self::FAILURE, new Event(['sprint' => $sprint, 'reason' => 'No specification found for sprints with length = ' . $sprint->getLength()])); return; } $sprint->applySpecification($specification); $this->projectRepo->save($sprint); $this->dispatcher->dispatch(self::SUCCESS, new Event(['sprint' => $sprint])); }