/** * @param Sprint $sprint * * @return StoryPointBurndown */ public function getStoryPointBurndown(Sprint $sprint) { $doneSP = $this->storyPointManager->getDoneStoryPoints($this->todoLists, $this->wipLists, $this->doneLists, $sprint); $total = $this->storyPointManager->getTotalSprintStoryPoints($this->todoLists, $this->wipLists, $this->doneLists, $sprint); $average = $this->storyPointManager->getAverageStoryPointsPerDay($total, $sprint); $burndown = new StoryPointBurndown($sprint, $total, $doneSP, $average); return $burndown; }
/** * Test done story points. */ public function testGetDoneStoryPoints() { $trelloClient = $this->getTrelloClientMock(); $actionManager = new ActionManager($trelloClient); $storyPointManager = new StoryPointManager($trelloClient, $actionManager); $todoLists = [$this->getListMock('1')]; $wipLists = [$this->getListMock('2')]; $doneLists = [$this->getListMock('3')]; $sprint = $this->getSprintMock(); $doneSP = $storyPointManager->getDoneStoryPoints($todoLists, $wipLists, $doneLists, $sprint); $doneCards = $actionManager->getCardsMovedFromTodoToDone($todoLists, $wipLists, $doneLists); $sprintDays = $sprint->getSprintDays(); $sp = []; foreach ($sprintDays as $day) { $countSP = 0; if ($day instanceof \DateTime && $day->getTimestamp() > $sprint->getNextDayInSprint()->getTimestamp()) { break; } if ($day instanceof \DateTime && ($day->format('N') == 6 || $day->format('N') == 7)) { continue; } foreach ($doneCards as $card) { $actionDate = new \DateTime($card['date']); if ($actionDate->getTimestamp() > $sprint->getStart()->getTimestamp() && $actionDate->getTimestamp() < $day->getTimestamp()) { $countSP += $storyPointManager->parseStoryPoints($card['card']); } } $sp[] = ['date' => $day, 'count' => $countSP]; } $this->assertEquals($sp, $doneSP); }