diff options
author | Frédéric Guillot <fred@kanboard.net> | 2014-05-26 12:27:33 -0400 |
---|---|---|
committer | Frédéric Guillot <fred@kanboard.net> | 2014-05-26 12:27:33 -0400 |
commit | 2cb6b77ac87c52e9655a1333d39d0263b4880ed5 (patch) | |
tree | 0539622e8cf589a1f71ffe8ddcbfcc0a4122579f /tests/ActionTest.php | |
parent | dbc4443bb18ab2f588b5f8e2f6dbec4332a46660 (diff) |
Improve events handling
Diffstat (limited to 'tests/ActionTest.php')
-rw-r--r-- | tests/ActionTest.php | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/tests/ActionTest.php b/tests/ActionTest.php index 391f0e25..5cab0fc0 100644 --- a/tests/ActionTest.php +++ b/tests/ActionTest.php @@ -86,6 +86,9 @@ class ActionTest extends Base // We move our task $task->move(1, 4, 1); + $this->assertTrue($this->event->isEventTriggered(Task::EVENT_MOVE_COLUMN)); + $this->assertTrue($this->event->isEventTriggered(Task::EVENT_UPDATE)); + // Our task should be closed $t1 = $task->getById(1); $this->assertEquals(4, $t1['column_id']); @@ -109,15 +112,16 @@ class ActionTest extends Base 'owner_id' => 1, 'color_id' => 'red', '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, 'event_name' => Task::EVENT_MOVE_POSITION, - 'action_name' => 'TaskClose', + 'action_name' => 'TaskAssignColorCategory', 'params' => array( - 'column_id' => 1, + 'category_id' => 1, 'color_id' => 'green', ) ))); @@ -125,21 +129,24 @@ class ActionTest extends Base // We bind events $action->attachEvents(); - $this->assertTrue($this->event->hasListener(Task::EVENT_MOVE_POSITION, 'Action\TaskClose')); + $this->assertTrue($this->event->hasListener(Task::EVENT_MOVE_POSITION, 'Action\TaskAssignColorCategory')); // Our task should have the color red and position=0 $t1 = $task->getById(1); $this->assertEquals(0, $t1['position']); $this->assertEquals(1, $t1['is_active']); + $this->assertEquals('red', $t1['color_id']); // We move our task $task->move(1, 1, 2); - $this->assertEquals(Task::EVENT_CLOSE, $this->event->getLastTriggeredEvent()); + + $this->assertTrue($this->event->isEventTriggered(Task::EVENT_MOVE_POSITION)); // Our task should be green and have the position 2 $t1 = $task->getById(1); $this->assertEquals(2, $t1['position']); - $this->assertEquals(0, $t1['is_active']); + $this->assertEquals(1, $t1['is_active']); + $this->assertEquals('green', $t1['color_id']); } public function testExecuteMultipleActions() @@ -197,7 +204,9 @@ class ActionTest extends Base // We move our task $task->move(1, 4, 1); - $this->assertEquals(Task::EVENT_CREATE, $this->event->getLastTriggeredEvent()); + + $this->assertTrue($this->event->isEventTriggered(Task::EVENT_CLOSE)); + $this->assertTrue($this->event->isEventTriggered(Task::EVENT_MOVE_COLUMN)); // Our task should be closed $t1 = $task->getById(1); @@ -212,6 +221,4 @@ class ActionTest extends Base $this->assertEquals(2, $t2['project_id']); $this->assertEquals('unit_test', $t2['title']); } - - } |