summaryrefslogtreecommitdiff
path: root/tests/ActionTest.php
diff options
context:
space:
mode:
authorFrédéric Guillot <fred@kanboard.net>2014-05-26 12:54:06 -0400
committerFrédéric Guillot <fred@kanboard.net>2014-05-26 12:54:06 -0400
commit93783274a438204a31865c848913088af96f0377 (patch)
tree0624ee61a42d20f55a765c4e1ef4cfa080aa0a83 /tests/ActionTest.php
parent2cb6b77ac87c52e9655a1333d39d0263b4880ed5 (diff)
Improve automatic actions (move task to another position same columns)
Diffstat (limited to 'tests/ActionTest.php')
-rw-r--r--tests/ActionTest.php30
1 files changed, 25 insertions, 5 deletions
diff --git a/tests/ActionTest.php b/tests/ActionTest.php
index 5cab0fc0..2eb12784 100644
--- a/tests/ActionTest.php
+++ b/tests/ActionTest.php
@@ -107,7 +107,7 @@ class ActionTest extends Base
// We create a task
$this->assertEquals(1, $task->create(array(
- 'title' => 'unit_test',
+ 'title' => 'unit_test 0',
'project_id' => 1,
'owner_id' => 1,
'color_id' => 'red',
@@ -115,6 +115,15 @@ class ActionTest extends Base
'category_id' => 1,
)));
+ $this->assertEquals(2, $task->create(array(
+ 'title' => 'unit_test 1',
+ 'project_id' => 1,
+ 'owner_id' => 1,
+ 'color_id' => 'yellow',
+ 'column_id' => 1,
+ 'category_id' => 1,
+ )));
+
// We create a new action, when the category_id=2 then the color_id should be green
$this->assertTrue($action->create(array(
'project_id' => 1,
@@ -137,14 +146,25 @@ class ActionTest extends Base
$this->assertEquals(1, $t1['is_active']);
$this->assertEquals('red', $t1['color_id']);
- // We move our task
- $task->move(1, 1, 2);
+ $t1 = $task->getById(2);
+ $this->assertEquals(1, $t1['position']);
+ $this->assertEquals(1, $t1['is_active']);
+ $this->assertEquals('yellow', $t1['color_id']);
+
+ // We move our tasks
+ $task->move(1, 1, 1); // task #1 to position 1
+ $task->move(2, 1, 0); // task #2 to position 0
$this->assertTrue($this->event->isEventTriggered(Task::EVENT_MOVE_POSITION));
- // Our task should be green and have the position 2
+ // Both tasks should be green
$t1 = $task->getById(1);
- $this->assertEquals(2, $t1['position']);
+ $this->assertEquals(1, $t1['position']);
+ $this->assertEquals(1, $t1['is_active']);
+ $this->assertEquals('green', $t1['color_id']);
+
+ $t1 = $task->getById(2);
+ $this->assertEquals(0, $t1['position']);
$this->assertEquals(1, $t1['is_active']);
$this->assertEquals('green', $t1['color_id']);
}