From 1484b1c39cac6af68038420b8525620a5424d4ab Mon Sep 17 00:00:00 2001 From: Frederic Guillot Date: Thu, 20 Aug 2015 21:26:42 -0400 Subject: Show closed tasks on the Gantt chart and fix rounding for task progress --- tests/units/TaskPositionTest.php | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) (limited to 'tests/units') diff --git a/tests/units/TaskPositionTest.php b/tests/units/TaskPositionTest.php index f3be325b..83436683 100644 --- a/tests/units/TaskPositionTest.php +++ b/tests/units/TaskPositionTest.php @@ -3,6 +3,8 @@ require_once __DIR__.'/Base.php'; use Model\Task; +use Model\Board; +use Model\TaskStatus; use Model\TaskPosition; use Model\TaskCreation; use Model\TaskFinder; @@ -11,6 +13,33 @@ use Model\Swimlane; class TaskPositionTest extends Base { + public function testGetTaskProgression() + { + $t = new Task($this->container); + $ts = new TaskStatus($this->container); + $tp = new TaskPosition($this->container); + $tc = new TaskCreation($this->container); + $tf = new TaskFinder($this->container); + $p = new Project($this->container); + $b = new Board($this->container); + + $this->assertEquals(1, $p->create(array('name' => 'Project #1'))); + $this->assertEquals(1, $tc->create(array('title' => 'Task #1', 'project_id' => 1, 'column_id' => 1))); + $this->assertEquals(0, $t->getProgress($tf->getById(1), $b->getColumnsList(1))); + + $this->assertTrue($tp->movePosition(1, 1, 2, 1)); + $this->assertEquals(25, $t->getProgress($tf->getById(1), $b->getColumnsList(1))); + + $this->assertTrue($tp->movePosition(1, 1, 3, 1)); + $this->assertEquals(50, $t->getProgress($tf->getById(1), $b->getColumnsList(1))); + + $this->assertTrue($tp->movePosition(1, 1, 4, 1)); + $this->assertEquals(75, $t->getProgress($tf->getById(1), $b->getColumnsList(1))); + + $this->assertTrue($ts->close(1)); + $this->assertEquals(100, $t->getProgress($tf->getById(1), $b->getColumnsList(1))); + } + public function testMoveTaskToWrongPosition() { $tp = new TaskPosition($this->container); -- cgit v1.2.3