summaryrefslogtreecommitdiff
path: root/tests/units/TaskStatusTest.php
diff options
context:
space:
mode:
Diffstat (limited to 'tests/units/TaskStatusTest.php')
-rw-r--r--tests/units/TaskStatusTest.php23
1 files changed, 20 insertions, 3 deletions
diff --git a/tests/units/TaskStatusTest.php b/tests/units/TaskStatusTest.php
index f2847bda..b1c3f695 100644
--- a/tests/units/TaskStatusTest.php
+++ b/tests/units/TaskStatusTest.php
@@ -33,6 +33,9 @@ class TaskStatusTest extends Base
// We close the task
+ $this->container['dispatcher']->addListener(Task::EVENT_CLOSE, array($this, 'onTaskClose'));
+ $this->container['dispatcher']->addListener(Task::EVENT_OPEN, array($this, 'onTaskOpen'));
+
$this->assertTrue($ts->close(1));
$this->assertTrue($ts->isClosed(1));
@@ -42,8 +45,6 @@ class TaskStatusTest extends Base
$this->assertEquals(time(), $task['date_completed']);
$this->assertEquals(time(), $task['date_modification']);
- $this->assertTrue($this->container['event']->isEventTriggered(Task::EVENT_CLOSE));
-
// We open the task again
$this->assertTrue($ts->open(1));
@@ -55,6 +56,22 @@ class TaskStatusTest extends Base
$this->assertEquals(0, $task['date_completed']);
$this->assertEquals(time(), $task['date_modification']);
- $this->assertTrue($this->container['event']->isEventTriggered(Task::EVENT_OPEN));
+ $called = $this->container['dispatcher']->getCalledListeners();
+ $this->assertArrayHasKey('task.close.TaskStatusTest::onTaskClose', $called);
+ $this->assertArrayHasKey('task.open.TaskStatusTest::onTaskOpen', $called);
+ }
+
+ public function onTaskOpen($event)
+ {
+ $this->assertInstanceOf('Event\TaskEvent', $event);
+ $this->assertArrayHasKey('task_id', $event);
+ $this->assertNotEmpty($event['task_id']);
+ }
+
+ public function onTaskClose($event)
+ {
+ $this->assertInstanceOf('Event\TaskEvent', $event);
+ $this->assertArrayHasKey('task_id', $event);
+ $this->assertNotEmpty($event['task_id']);
}
}