public function save(Sprint $sprint) { $project = $sprint->getProject(); if (!isset($this->sprints[$project->getName()])) { $this->sprints[$project->getName()] = []; } $this->sprints[$project->getName()][] = $sprint; }
function it_stores_sprints_of_specific_projects(Sprint $sprint1, Sprint $sprint2, Project $project1, Project $project2) { $project1->getName()->willReturn('Nokia'); $project2->getName()->willReturn('Siemens'); $sprint1->getProject()->willReturn($project1); $sprint2->getProject()->willReturn($project2); $this->save($sprint1); $this->save($sprint2); $this->getProjectSprints($project1)->shouldReturn([$sprint1]); $this->getProjectSprints($project2)->shouldReturn([$sprint2]); }
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])); }
function it_reports_failure_to_the_dispatcher(Sprint $sprint, $dispatcher) { $sprint->getLength()->willReturn(0); $dispatcher->dispatch($this->FAILURE, Argument::any())->shouldBeCalled(); $this->scheduleSprint($sprint); }