summaryrefslogtreecommitdiff
path: root/tests/TaskTest.php
diff options
context:
space:
mode:
authorFrédéric Guillot <fred@kanboard.net>2014-05-26 12:27:33 -0400
committerFrédéric Guillot <fred@kanboard.net>2014-05-26 12:27:33 -0400
commit2cb6b77ac87c52e9655a1333d39d0263b4880ed5 (patch)
tree0539622e8cf589a1f71ffe8ddcbfcc0a4122579f /tests/TaskTest.php
parentdbc4443bb18ab2f588b5f8e2f6dbec4332a46660 (diff)
Improve events handling
Diffstat (limited to 'tests/TaskTest.php')
-rw-r--r--tests/TaskTest.php19
1 files changed, 10 insertions, 9 deletions
diff --git a/tests/TaskTest.php b/tests/TaskTest.php
index 2f645131..da7e6a70 100644
--- a/tests/TaskTest.php
+++ b/tests/TaskTest.php
@@ -110,7 +110,7 @@ class TaskTest extends Base
// We duplicate our task
$this->assertEquals(2, $t->duplicate(1));
- $this->assertEquals(Task::EVENT_CREATE, $this->event->getLastTriggeredEvent());
+ $this->assertTrue($this->event->isEventTriggered(Task::EVENT_CREATE));
// Check the values of the duplicated task
$task = $t->getById(2);
@@ -136,7 +136,7 @@ class TaskTest extends Base
// We duplicate our task to the 2nd project
$this->assertEquals(2, $t->duplicateToAnotherProject(1, 2));
- $this->assertEquals(Task::EVENT_CREATE, $this->event->getLastTriggeredEvent());
+ $this->assertTrue($this->event->isEventTriggered(Task::EVENT_CREATE));
// Check the values of the duplicated task
$task = $t->getById(2);
@@ -157,30 +157,31 @@ class TaskTest extends Base
// We create task
$this->assertEquals(1, $t->create(array('title' => 'test', 'project_id' => 1, 'column_id' => 1)));
- $this->assertEquals(Task::EVENT_CREATE, $this->event->getLastTriggeredEvent());
+ $this->assertTrue($this->event->isEventTriggered(Task::EVENT_CREATE));
// We update a task
$this->assertTrue($t->update(array('title' => 'test2', 'id' => 1)));
- $this->assertEquals(Task::EVENT_UPDATE, $this->event->getLastTriggeredEvent());
+ $this->assertTrue($this->event->isEventTriggered(Task::EVENT_UPDATE));
+ $this->assertTrue($this->event->isEventTriggered(Task::EVENT_CREATE_UPDATE));
// We close our task
$this->assertTrue($t->close(1));
- $this->assertEquals(Task::EVENT_CLOSE, $this->event->getLastTriggeredEvent());
+ $this->assertTrue($this->event->isEventTriggered(Task::EVENT_CLOSE));
// We open our task
$this->assertTrue($t->open(1));
- $this->assertEquals(Task::EVENT_OPEN, $this->event->getLastTriggeredEvent());
+ $this->assertTrue($this->event->isEventTriggered(Task::EVENT_OPEN));
// We change the column of our task
$this->assertTrue($t->move(1, 2, 1));
- $this->assertEquals(Task::EVENT_MOVE_COLUMN, $this->event->getLastTriggeredEvent());
+ $this->assertTrue($this->event->isEventTriggered(Task::EVENT_MOVE_COLUMN));
// We change the position of our task
$this->assertTrue($t->move(1, 2, 2));
- $this->assertEquals(Task::EVENT_MOVE_POSITION, $this->event->getLastTriggeredEvent());
+ $this->assertTrue($this->event->isEventTriggered(Task::EVENT_MOVE_POSITION));
// We change the column and the position of our task
$this->assertTrue($t->move(1, 1, 3));
- $this->assertEquals(Task::EVENT_MOVE_COLUMN, $this->event->getLastTriggeredEvent());
+ $this->assertTrue($this->event->isEventTriggered(Task::EVENT_MOVE_COLUMN));
}
}