diff options
author | Frederic Guillot <fred@kanboard.net> | 2016-03-22 20:44:15 -0400 |
---|---|---|
committer | Frederic Guillot <fred@kanboard.net> | 2016-03-22 20:44:15 -0400 |
commit | 8768a4e3699c5b9235d8c834ad7689ae66ef36aa (patch) | |
tree | 6be77f7213fd6e3f865c3d71e4f3809cf1cac1c4 /tests/units/Analytic | |
parent | 585f73433373d8e2912c60f4ed0efab827484232 (diff) |
Fixes cycle time calculation when the start date is defined in the future
Diffstat (limited to 'tests/units/Analytic')
-rw-r--r-- | tests/units/Analytic/AverageLeadCycleTimeAnalyticTest.php | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/tests/units/Analytic/AverageLeadCycleTimeAnalyticTest.php b/tests/units/Analytic/AverageLeadCycleTimeAnalyticTest.php index b8faec6c..b87e9573 100644 --- a/tests/units/Analytic/AverageLeadCycleTimeAnalyticTest.php +++ b/tests/units/Analytic/AverageLeadCycleTimeAnalyticTest.php @@ -23,6 +23,7 @@ class AverageLeadCycleTimeAnalyticTest extends Base $this->assertEquals(2, $taskCreationModel->create(array('project_id' => 1, 'title' => 'test'))); $this->assertEquals(3, $taskCreationModel->create(array('project_id' => 1, 'title' => 'test'))); $this->assertEquals(4, $taskCreationModel->create(array('project_id' => 1, 'title' => 'test'))); + $this->assertEquals(5, $taskCreationModel->create(array('project_id' => 1, 'title' => 'test'))); // LT=3600 CT=1800 $this->container['db']->table(Task::TABLE)->eq('id', 1)->update(array('date_completed' => $now + 3600, 'date_started' => $now + 1800)); @@ -36,21 +37,22 @@ class AverageLeadCycleTimeAnalyticTest extends Base // LT=2*3600 CT=0 $this->container['db']->table(Task::TABLE)->eq('id', 4)->update(array('date_completed' => $now + 2 * 3600)); + // CT=0 + $this->container['db']->table(Task::TABLE)->eq('id', 5)->update(array('date_started' => $now + 900)); + $stats = $averageLeadCycleTimeAnalytic->build(1); - $this->assertEquals(4, $stats['count']); + $this->assertEquals(5, $stats['count']); $this->assertEquals(3600 + 1800 + 3600 + 2*3600, $stats['total_lead_time'], '', 5); $this->assertEquals(1800 + 900, $stats['total_cycle_time'], '', 5); - $this->assertEquals((3600 + 1800 + 3600 + 2*3600) / 4, $stats['avg_lead_time'], '', 5); - $this->assertEquals((1800 + 900) / 4, $stats['avg_cycle_time'], '', 5); + $this->assertEquals((3600 + 1800 + 3600 + 2*3600) / 5, $stats['avg_lead_time'], '', 5); + $this->assertEquals((1800 + 900) / 5, $stats['avg_cycle_time'], '', 5); } public function testBuildWithNoTasks() { - $taskCreationModel = new TaskCreation($this->container); $projectModel = new Project($this->container); $averageLeadCycleTimeAnalytic = new AverageLeadCycleTimeAnalytic($this->container); - $now = time(); $this->assertEquals(1, $projectModel->create(array('name' => 'test1'))); $this->assertEquals(2, $projectModel->create(array('name' => 'test1'))); |