diff options
-rw-r--r-- | app/Model/ProjectDailySummary.php | 2 | ||||
-rw-r--r-- | tests/units/ProjectDailySummaryTest.php (renamed from tests/units/ProjectDailySummary.php) | 14 |
2 files changed, 11 insertions, 5 deletions
diff --git a/app/Model/ProjectDailySummary.php b/app/Model/ProjectDailySummary.php index acffa3a9..04dc5629 100644 --- a/app/Model/ProjectDailySummary.php +++ b/app/Model/ProjectDailySummary.php @@ -156,7 +156,7 @@ class ProjectDailySummary extends Base { $columns = $this->board->getColumnsList($project_id); $column_ids = array_keys($columns); - $metrics = array(array(e('Date')) + $columns); + $metrics = array(array_merge(array(e('Date')), array_values($columns))); $aggregates = array(); // Fetch metrics for the project diff --git a/tests/units/ProjectDailySummary.php b/tests/units/ProjectDailySummaryTest.php index 9ae875fa..ed806361 100644 --- a/tests/units/ProjectDailySummary.php +++ b/tests/units/ProjectDailySummaryTest.php @@ -6,6 +6,7 @@ use Model\Project; use Model\ProjectDailySummary; use Model\Task; use Model\TaskCreation; +use Model\TaskStatus; class ProjectDailySummaryTest extends Base { @@ -14,6 +15,7 @@ class ProjectDailySummaryTest extends Base $p = new Project($this->container); $pds = new ProjectDailySummary($this->container); $tc = new TaskCreation($this->container); + $ts = new TaskStatus($this->container); $this->assertEquals(1, $p->create(array('name' => 'UnitTest'))); $this->assertEquals(0, $pds->countDays(1, date('Y-m-d', strtotime('-2days')), date('Y-m-d'))); @@ -38,8 +40,8 @@ class ProjectDailySummaryTest extends Base $pds->updateTotals(1, date('Y-m-d', strtotime('-1 day'))); - $this->assertNotFalse($t->close(1)); - $this->assertNotFalse($t->close(2)); + $this->assertNotFalse($ts->close(1)); + $this->assertNotFalse($ts->close(2)); for ($i = 0; $i < 3; $i++) { $this->assertNotFalse($tc->create(array('title' => 'Task #'.$i, 'project_id' => 1, 'column_id' => 3))); @@ -55,13 +57,17 @@ class ProjectDailySummaryTest extends Base $pds->updateTotals(1, date('Y-m-d')); - $this->assertEquals(3, $pds->countDays(3, date('Y-m-d', strtotime('-2days')), date('Y-m-d'))); + $this->assertEquals(3, $pds->countDays(1, date('Y-m-d', strtotime('-2days')), date('Y-m-d'))); $metrics = $pds->getAggregatedMetrics(1, date('Y-m-d', strtotime('-2days')), date('Y-m-d')); $this->assertNotEmpty($metrics); $this->assertEquals(4, count($metrics)); $this->assertEquals(5, count($metrics[0])); + $this->assertEquals('Date', $metrics[0][0]); $this->assertEquals('Backlog', $metrics[0][1]); + $this->assertEquals('Ready', $metrics[0][2]); + $this->assertEquals('Work in progress', $metrics[0][3]); + $this->assertEquals('Done', $metrics[0][4]); $this->assertEquals(date('Y-m-d', strtotime('-2days')), $metrics[1][0]); $this->assertEquals(10, $metrics[1][1]); @@ -76,7 +82,7 @@ class ProjectDailySummaryTest extends Base $this->assertEquals(5, $metrics[2][4]); $this->assertEquals(date('Y-m-d'), $metrics[3][0]); - $this->assertEquals(8, $metrics[3][1]); + $this->assertEquals(10, $metrics[3][1]); $this->assertEquals(30, $metrics[3][2]); $this->assertEquals(18, $metrics[3][3]); $this->assertEquals(9, $metrics[3][4]); |