summaryrefslogtreecommitdiff
path: root/tests/units/ActionTest.php
diff options
context:
space:
mode:
authorFrédéric Guillot <fred@kanboard.net>2014-09-28 14:26:40 -0400
committerFrédéric Guillot <fred@kanboard.net>2014-09-28 14:26:40 -0400
commit03fa01ac7b036820ee232d893ec63241918c6012 (patch)
tree295e82e6552ffb044554a11afa95318a4e180f87 /tests/units/ActionTest.php
parent0c8de6a3f58cde2696ac276b3456f3577d312e2b (diff)
Improve automatic actions (check for compatible events/actions/parameters)
Diffstat (limited to 'tests/units/ActionTest.php')
-rw-r--r--tests/units/ActionTest.php86
1 files changed, 0 insertions, 86 deletions
diff --git a/tests/units/ActionTest.php b/tests/units/ActionTest.php
index 23148c44..f155d0c0 100644
--- a/tests/units/ActionTest.php
+++ b/tests/units/ActionTest.php
@@ -95,92 +95,6 @@ class ActionTest extends Base
$this->assertEquals(0, $t1['is_active']);
}
- public function testEventMovePosition()
- {
- $task = new Task($this->registry);
- $board = new Board($this->registry);
- $project = new Project($this->registry);
- $action = new Action($this->registry);
-
- // We create a project
- $this->assertEquals(1, $project->create(array('name' => 'unit_test')));
-
- // We create a task
- $this->assertEquals(1, $task->create(array(
- 'title' => 'unit_test 0',
- 'project_id' => 1,
- 'owner_id' => 1,
- 'color_id' => 'red',
- 'column_id' => 1,
- '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,
- 'event_name' => Task::EVENT_MOVE_POSITION,
- 'action_name' => 'TaskAssignColorCategory',
- 'params' => array(
- 'category_id' => 1,
- 'color_id' => 'green',
- )
- )));
-
- // We bind events
- $action->attachEvents();
-
- $this->assertTrue($this->registry->shared('event')->hasListener(Task::EVENT_MOVE_POSITION, 'Action\TaskAssignColorCategory'));
-
- // Our task should have the color red and position=1
- $t1 = $task->getById(1);
- $this->assertEquals(1, $t1['position']);
- $this->assertEquals(1, $t1['is_active']);
- $this->assertEquals('red', $t1['color_id']);
-
- $t1 = $task->getById(2);
- $this->assertEquals(2, $t1['position']);
- $this->assertEquals(1, $t1['is_active']);
- $this->assertEquals('yellow', $t1['color_id']);
-
- // We move our tasks
- $this->assertTrue($task->movePosition(1, 1, 1, 10)); // task #1 to the end of the column
- $this->assertTrue($this->registry->shared('event')->isEventTriggered(Task::EVENT_MOVE_POSITION));
-
- $t1 = $task->getById(1);
- $this->assertEquals(2, $t1['position']);
- $this->assertEquals(1, $t1['is_active']);
- $this->assertEquals('green', $t1['color_id']);
-
- $t1 = $task->getById(2);
- $this->assertEquals(1, $t1['position']);
- $this->assertEquals(1, $t1['is_active']);
- $this->assertEquals('yellow', $t1['color_id']);
-
- $this->registry->shared('event')->clearTriggeredEvents();
- $this->assertTrue($task->movePosition(1, 2, 1, 44)); // task #2 to position 1
- $this->assertTrue($this->registry->shared('event')->isEventTriggered(Task::EVENT_MOVE_POSITION));
- $this->assertEquals('Action\TaskAssignColorCategory', $this->registry->shared('event')->getLastListenerExecuted());
-
- $t1 = $task->getById(1);
- $this->assertEquals(1, $t1['position']);
- $this->assertEquals(1, $t1['is_active']);
- $this->assertEquals('green', $t1['color_id']);
-
- $t1 = $task->getById(2);
- $this->assertEquals(2, $t1['position']);
- $this->assertEquals(1, $t1['is_active']);
- $this->assertEquals('green', $t1['color_id']);
- }
-
public function testExecuteMultipleActions()
{
$task = new Task($this->registry);