diff options
Diffstat (limited to 'tests/units/ActionTaskAssignCurrentUserTest.php')
-rw-r--r-- | tests/units/ActionTaskAssignCurrentUserTest.php | 28 |
1 files changed, 15 insertions, 13 deletions
diff --git a/tests/units/ActionTaskAssignCurrentUserTest.php b/tests/units/ActionTaskAssignCurrentUserTest.php index edc2577c..f32fc77c 100644 --- a/tests/units/ActionTaskAssignCurrentUserTest.php +++ b/tests/units/ActionTaskAssignCurrentUserTest.php @@ -2,16 +2,18 @@ require_once __DIR__.'/Base.php'; +use Event\GenericEvent; use Model\Task; +use Model\TaskCreation; use Model\TaskFinder; use Model\Project; -use Model\Acl; +use Model\UserSession; class ActionTaskAssignCurrentUser extends Base { public function testBadProject() { - $action = new Action\TaskAssignCurrentUser($this->registry, 3, Task::EVENT_CREATE); + $action = new Action\TaskAssignCurrentUser($this->container, 3, Task::EVENT_CREATE); $action->setParam('column_id', 5); $event = array( @@ -21,12 +23,12 @@ class ActionTaskAssignCurrentUser extends Base ); $this->assertFalse($action->isExecutable($event)); - $this->assertFalse($action->execute($event)); + $this->assertFalse($action->execute(new GenericEvent($event))); } public function testBadColumn() { - $action = new Action\TaskAssignCurrentUser($this->registry, 3, Task::EVENT_CREATE); + $action = new Action\TaskAssignCurrentUser($this->container, 3, Task::EVENT_CREATE); $action->setParam('column_id', 5); $event = array( @@ -35,26 +37,26 @@ class ActionTaskAssignCurrentUser extends Base 'column_id' => 3, ); - $this->assertFalse($action->execute($event)); + $this->assertFalse($action->execute(new GenericEvent($event))); } public function testExecute() { - $action = new Action\TaskAssignCurrentUser($this->registry, 1, Task::EVENT_MOVE_COLUMN); + $action = new Action\TaskAssignCurrentUser($this->container, 1, Task::EVENT_MOVE_COLUMN); $action->setParam('column_id', 2); $_SESSION = array( 'user' => array('id' => 5) ); // We create a task in the first column - $t = new Task($this->registry); - $tf = new TaskFinder($this->registry); - $p = new Project($this->registry); - $a = new Acl($this->registry); + $tc = new TaskCreation($this->container); + $tf = new TaskFinder($this->container); + $p = new Project($this->container); + $us = new UserSession($this->container); - $this->assertEquals(5, $a->getUserId()); + $this->assertEquals(5, $us->getId()); $this->assertEquals(1, $p->create(array('name' => 'test'))); - $this->assertEquals(1, $t->create(array('title' => 'test', 'project_id' => 1, 'column_id' => 1))); + $this->assertEquals(1, $tc->create(array('title' => 'test', 'project_id' => 1, 'column_id' => 1))); // We create an event to move the task to the 2nd column $event = array( @@ -64,7 +66,7 @@ class ActionTaskAssignCurrentUser extends Base ); // Our event should be executed - $this->assertTrue($action->execute($event)); + $this->assertTrue($action->execute(new GenericEvent($event))); // Our task should be assigned to the user 5 (from the session) $task = $tf->getById(1); |