/** * test theorical burndown generation. */ public function testGetTheoricalBurndown() { $sprint = new Sprint(); $duration = new \DateInterval('P14D'); $start = new \DateTime('2016-05-24'); $sprint->setStart($start); $sprint->setDuration($duration); $doneSP = $this->doneSPProvider(); $burndown = new StoryPointBurndown($sprint, 250.0, $doneSP, 25); $theoricalBurndown = ['2016-05-24' => 250.0, '2016-05-25' => 225.0, '2016-05-26' => 200.0, '2016-05-27' => 175.0, '2016-05-30' => 150.0, '2016-05-31' => 125.0, '2016-06-01' => 100.0, '2016-06-02' => 75.0, '2016-06-03' => 50.0, '2016-06-06' => 25.0]; $this->assertEquals($theoricalBurndown, $burndown->getTheoreticalBurndown()); }
/** * @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; }
/** * @param double $totalOfSprint * @param Sprint $sprint * * @return float */ public function getAverageStoryPointsPerDay(float $totalOfSprint, Sprint $sprint) { return round($totalOfSprint / $sprint->getTotalWorkDays(), 2); }
/** * Test total work days calculation. */ public function testGetTotalWorkDays() { $sprint = new Sprint(); $sprint->setStart(new \DateTime('2016-04-12')); $sprint->setDuration($duration = new \DateInterval('P14D')); $this->assertEquals(9, $sprint->getTotalWorkDays()); }