/** * Test Start getter and setter. */ public function testStart() { $sprint = new Sprint(); $start = new \DateTime(); $sprint->setStart($start); $this->assertEquals($sprint->getStart(), $start); }
/** * @return array|null */ public function getTheoreticalBurndown() { $theoreticalBurndown = []; $theoreticalBurndown[$this->sprint->getStart()->format('Y-m-d')] = $this->totalSP; $sprintDays = $this->sprint->getSprintDays(); if (!$sprintDays instanceof \DatePeriod) { return; } foreach ($sprintDays as $day) { if ($this->isWeekend($day)) { continue; } $rest = end($theoreticalBurndown) != false ? end($theoreticalBurndown) : $this->totalSP; $formatedDate = $this->formatDate($day); $doneSP = $rest - $this->averageSP; $theoreticalBurndown[$formatedDate] = round($doneSP, 2); } return $theoreticalBurndown; }
/** * Return an array of done story points per day. * * @param array $todoLists * @param array $wipLists * @param array $doneLists * @param Sprint $sprint * * @return array|null */ public function getDoneStoryPoints(array $todoLists, array $wipLists, array $doneLists, Sprint $sprint) { $doneCards = $this->actionManager->getCardsMovedFromTodoToDone($todoLists, $wipLists, $doneLists); $sprintDays = $sprint->getSprintDays(); $sp = []; if (!$sprintDays instanceof \DatePeriod) { return; } foreach ($sprintDays as $day) { $countSP = 0; if ($day instanceof \DateTime && $day->getTimestamp() > $sprint->getNextDayInSprint()->getTimestamp()) { break; } if ($this->isWeekend($day)) { continue; } foreach ($doneCards as $card) { $actionDate = new \DateTime($card['date']); if ($actionDate->getTimestamp() > $sprint->getStart()->getTimestamp() && $actionDate->getTimestamp() < $day->getTimestamp()) { $countSP += $this->parseStoryPoints($card['card']); } } $sp[] = ['date' => $day, 'count' => $countSP]; } return $sp; }