diff options
-rw-r--r-- | app/Action/TaskUpdateStartDateOnMoveColumn.php | 4 | ||||
-rw-r--r-- | tests/units/Action/TaskUpdateStartDateOnMoveColumnTest.php | 38 |
2 files changed, 15 insertions, 27 deletions
diff --git a/app/Action/TaskUpdateStartDateOnMoveColumn.php b/app/Action/TaskUpdateStartDateOnMoveColumn.php index 8a00bbab..c386d1e1 100644 --- a/app/Action/TaskUpdateStartDateOnMoveColumn.php +++ b/app/Action/TaskUpdateStartDateOnMoveColumn.php @@ -60,8 +60,8 @@ class TaskUpdateStartDateOnMoveColumn extends Base 'task_id', 'task' => array( 'project_id', - 'column_id', ), + 'src_column_id', ); } @@ -91,6 +91,6 @@ class TaskUpdateStartDateOnMoveColumn extends Base */ public function hasRequiredCondition(array $data) { - return empty($data['task']['date_started']) && $data['task']['column_id'] != $this->getParam('column_id'); + return empty($data['task']['date_started']) && $data['src_column_id'] == $this->getParam('column_id'); } } diff --git a/tests/units/Action/TaskUpdateStartDateOnMoveColumnTest.php b/tests/units/Action/TaskUpdateStartDateOnMoveColumnTest.php index f95492d6..f2d0a0fc 100644 --- a/tests/units/Action/TaskUpdateStartDateOnMoveColumnTest.php +++ b/tests/units/Action/TaskUpdateStartDateOnMoveColumnTest.php @@ -19,17 +19,13 @@ class TaskUpdateStartDateOnMoveColumnTest extends Base $this->assertEquals(1, $projectModel->create(array('name' => 'test1'))); $this->assertEquals(1, $taskCreationModel->create(array('project_id' => 1, 'title' => 'test', 'column_id' => 1))); - $this->container['db']->table(TaskModel::TABLE)->eq('id', 1)->update(array('column_id' => 2)); - - $task = $taskFinderModel->getById(1); - $this->assertNotEmpty($task); $event = new TaskEvent(array( - 'task_id' => $task['id'], + 'task_id' => 1, 'task' => array( - 'project_id' => $task['project_id'], - 'column_id' => $task['column_id'], - ) + 'project_id' => 1, + ), + 'src_column_id' => 1, )); $action = new TaskUpdateStartDateOnMoveColumn($this->container); @@ -49,17 +45,13 @@ class TaskUpdateStartDateOnMoveColumnTest extends Base $this->assertEquals(1, $projectModel->create(array('name' => 'test1'))); $this->assertEquals(1, $taskCreationModel->create(array('project_id' => 1, 'title' => 'test', 'column_id' => 2))); - $this->container['db']->table(TaskModel::TABLE)->eq('id', 1)->update(array('column_id' => 1)); - - $task = $taskFinderModel->getById(1); - $this->assertNotEmpty($task); $event = new TaskEvent(array( - 'task_id' => $task['id'], + 'task_id' => 1, 'task' => array( - 'project_id' => $task['project_id'], - 'column_id' => $task['column_id'], - ) + 'project_id' => 1, + ), + 'src_column_id' => 2, )); $action = new TaskUpdateStartDateOnMoveColumn($this->container); @@ -76,18 +68,14 @@ class TaskUpdateStartDateOnMoveColumnTest extends Base $this->assertEquals(1, $projectModel->create(array('name' => 'test1'))); $this->assertEquals(1, $taskCreationModel->create(array('project_id' => 1, 'title' => 'test', 'column_id' => 1, 'date_started' => time()))); - $this->container['db']->table(TaskModel::TABLE)->eq('id', 1)->update(array('column_id' => 2)); - - $task = $taskFinderModel->getById(1); - $this->assertNotEmpty($task); $event = new TaskEvent(array( - 'task_id' => $task['id'], + 'task_id' => 1, 'task' => array( - 'project_id' => $task['project_id'], - 'column_id' => $task['column_id'], - 'date_started' => $task['date_started'], - ) + 'project_id' => 1, + 'date_started' => time(), + ), + 'src_column_id' => 1, )); $action = new TaskUpdateStartDateOnMoveColumn($this->container); |