From 0a7370b9e5652918ad9386baa81cc12627069755 Mon Sep 17 00:00:00 2001 From: Frederic Guillot Date: Sat, 21 Nov 2015 18:41:15 -0500 Subject: Remove workaround for 'INSERT ON DUPLICATE KEY UPDATE...' --- tests/units/Model/ProjectDailyStatsTest.php | 45 +++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 tests/units/Model/ProjectDailyStatsTest.php (limited to 'tests/units/Model') diff --git a/tests/units/Model/ProjectDailyStatsTest.php b/tests/units/Model/ProjectDailyStatsTest.php new file mode 100644 index 00000000..c17017c9 --- /dev/null +++ b/tests/units/Model/ProjectDailyStatsTest.php @@ -0,0 +1,45 @@ +container); + $pds = new ProjectDailyStats($this->container); + $tc = new TaskCreation($this->container); + $ts = new TaskStatus($this->container); + + $this->assertEquals(1, $p->create(array('name' => 'UnitTest'))); + + $this->assertEquals(1, $tc->create(array('title' => 'Task #1', 'project_id' => 1, 'date_started' => strtotime('-1 day')))); + $this->assertEquals(2, $tc->create(array('title' => 'Task #1', 'project_id' => 1))); + $pds->updateTotals(1, date('Y-m-d', strtotime('-1 day'))); + + $this->assertTrue($ts->close(1)); + $pds->updateTotals(1, date('Y-m-d')); + + $metrics = $pds->getRawMetrics(1, date('Y-m-d', strtotime('-1days')), date('Y-m-d')); + $expected = array( + array( + 'day' => '2015-11-20', + 'avg_lead_time' => 0, + 'avg_cycle_time' => 43200, + ), + array( + 'day' => '2015-11-21', + 'avg_lead_time' => 0, + 'avg_cycle_time' => 43200, + ) + ); + + $this->assertEquals($expected, $metrics); + } +} -- cgit v1.2.3