summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorFrédéric Guillot <fguillot@users.noreply.github.com>2014-03-19 21:49:39 -0400
committerFrédéric Guillot <fguillot@users.noreply.github.com>2014-03-19 21:49:39 -0400
commitab63ffafc565e75c73c27910abd465bebb09306e (patch)
tree795e09656cfaf3a2042b714dcc3850c9555dec72 /tests
parent41dd9b2eff07434a3393b20dcd875e76ac3846b3 (diff)
Task duplication
Diffstat (limited to 'tests')
-rw-r--r--tests/TaskTest.php26
1 files changed, 26 insertions, 0 deletions
diff --git a/tests/TaskTest.php b/tests/TaskTest.php
index a3417e91..5ddb1860 100644
--- a/tests/TaskTest.php
+++ b/tests/TaskTest.php
@@ -20,6 +20,32 @@ class TaskTest extends Base
$this->assertEquals(0, $t->getTimestampFromDate('5-3-2014', 'd/m/Y'));
}
+ public function testDuplicateTask()
+ {
+ $t = new Task($this->db, $this->event);
+ $p = new Project($this->db, $this->event);
+
+ // We create a task and a project
+ $this->assertEquals(1, $p->create(array('name' => 'test1')));
+ $this->assertEquals(1, $t->create(array('title' => 'test', 'project_id' => 1, 'column_id' => 3, 'owner_id' => 1)));
+
+ $task = $t->getById(1);
+ $this->assertNotEmpty($task);
+ $this->assertEquals(0, $task['position']);
+
+ // We duplicate our task
+ $this->assertEquals(2, $t->duplicate(1));
+ $this->assertEquals(Task::EVENT_CREATE, $this->event->getLastTriggeredEvent());
+
+ // Check the values of the duplicated task
+ $task = $t->getById(2);
+ $this->assertNotEmpty($task);
+ $this->assertEquals(Task::STATUS_OPEN, $task['is_active']);
+ $this->assertEquals(1, $task['project_id']);
+ $this->assertEquals(1, $task['owner_id']);
+ $this->assertEquals(1, $task['position']);
+ }
+
public function testDuplicateToAnotherProject()
{
$t = new Task($this->db, $this->event);