diff options
author | Frédéric Guillot <fguillot@users.noreply.github.com> | 2014-03-12 21:18:38 -0400 |
---|---|---|
committer | Frédéric Guillot <fguillot@users.noreply.github.com> | 2014-03-12 21:18:38 -0400 |
commit | 9722cf61520b166454ab7b4cda5b610d56f1fa77 (patch) | |
tree | 6c289dd1249034ddde341f4811cedf5b8e285166 /actions | |
parent | b27a78e3229af5b477dbc5b31ba2beec7a7238ca (diff) |
Add unit tests for automatic actions
Diffstat (limited to 'actions')
-rw-r--r-- | actions/task_assign_color_user.php | 32 | ||||
-rw-r--r-- | actions/task_assign_current_user.php | 33 | ||||
-rw-r--r-- | actions/task_assign_specific_user.php | 32 | ||||
-rw-r--r-- | actions/task_close.php | 3 | ||||
-rw-r--r-- | actions/task_duplicate_another_project.php | 32 |
5 files changed, 130 insertions, 2 deletions
diff --git a/actions/task_assign_color_user.php b/actions/task_assign_color_user.php index a9f08e30..66002b80 100644 --- a/actions/task_assign_color_user.php +++ b/actions/task_assign_color_user.php @@ -4,14 +4,33 @@ namespace Action; require_once __DIR__.'/base.php'; +/** + * Assign a color to a specific user + * + * @package action + * @author Frederic Guillot + */ class TaskAssignColorUser extends Base { + /** + * Constructor + * + * @access public + * @param integer $project_id Project id + * @param Task $task Task model instance + */ public function __construct($project_id, \Model\Task $task) { parent::__construct($project_id); $this->task = $task; } + /** + * Get the required parameter for the action (defined by the user) + * + * @access public + * @return array + */ public function getActionRequiredParameters() { return array( @@ -21,6 +40,12 @@ class TaskAssignColorUser extends Base ); } + /** + * Get the required parameter for the event + * + * @access public + * @return array + */ public function getEventRequiredParameters() { return array( @@ -30,6 +55,13 @@ class TaskAssignColorUser extends Base ); } + /** + * Execute the action + * + * @access public + * @param array $data Event data dictionary + * @return bool True if the action was executed or false when not executed + */ public function doAction(array $data) { if ($data['column_id'] == $this->getParam('column_id') && $data['owner_id'] == $this->getParam('user_id')) { diff --git a/actions/task_assign_current_user.php b/actions/task_assign_current_user.php index 5a8edd01..35b8f89a 100644 --- a/actions/task_assign_current_user.php +++ b/actions/task_assign_current_user.php @@ -4,8 +4,22 @@ namespace Action; require_once __DIR__.'/base.php'; +/** + * Assign a task to the logged user + * + * @package action + * @author Frederic Guillot + */ class TaskAssignCurrentUser extends Base { + /** + * Constructor + * + * @access public + * @param integer $project_id Project id + * @param Task $task Task model instance + * @param Acl $acl Acl model instance + */ public function __construct($project_id, \Model\Task $task, \Model\Acl $acl) { parent::__construct($project_id); @@ -13,6 +27,12 @@ class TaskAssignCurrentUser extends Base $this->acl = $acl; } + /** + * Get the required parameter for the action (defined by the user) + * + * @access public + * @return array + */ public function getActionRequiredParameters() { return array( @@ -20,6 +40,12 @@ class TaskAssignCurrentUser extends Base ); } + /** + * Get the required parameter for the event + * + * @access public + * @return array + */ public function getEventRequiredParameters() { return array( @@ -28,6 +54,13 @@ class TaskAssignCurrentUser extends Base ); } + /** + * Execute the action + * + * @access public + * @param array $data Event data dictionary + * @return bool True if the action was executed or false when not executed + */ public function doAction(array $data) { if ($data['column_id'] == $this->getParam('column_id')) { diff --git a/actions/task_assign_specific_user.php b/actions/task_assign_specific_user.php index 8cafde6d..edde560e 100644 --- a/actions/task_assign_specific_user.php +++ b/actions/task_assign_specific_user.php @@ -4,14 +4,33 @@ namespace Action; require_once __DIR__.'/base.php'; +/** + * Assign a task to a specific user + * + * @package action + * @author Frederic Guillot + */ class TaskAssignSpecificUser extends Base { + /** + * Constructor + * + * @access public + * @param integer $project_id Project id + * @param Task $task Task model instance + */ public function __construct($project_id, \Model\Task $task) { parent::__construct($project_id); $this->task = $task; } + /** + * Get the required parameter for the action (defined by the user) + * + * @access public + * @return array + */ public function getActionRequiredParameters() { return array( @@ -20,6 +39,12 @@ class TaskAssignSpecificUser extends Base ); } + /** + * Get the required parameter for the event + * + * @access public + * @return array + */ public function getEventRequiredParameters() { return array( @@ -28,6 +53,13 @@ class TaskAssignSpecificUser extends Base ); } + /** + * Execute the action + * + * @access public + * @param array $data Event data dictionary + * @return bool True if the action was executed or false when not executed + */ public function doAction(array $data) { if ($data['column_id'] == $this->getParam('column_id')) { diff --git a/actions/task_close.php b/actions/task_close.php index 4d129d73..3c45ebc0 100644 --- a/actions/task_close.php +++ b/actions/task_close.php @@ -39,9 +39,8 @@ class TaskClose extends Base } /** - * Get the required parameter for the event (check if for the event data) + * Get the required parameter for the event * - * @abstract * @access public * @return array */ diff --git a/actions/task_duplicate_another_project.php b/actions/task_duplicate_another_project.php index 31089c67..e898f757 100644 --- a/actions/task_duplicate_another_project.php +++ b/actions/task_duplicate_another_project.php @@ -4,14 +4,33 @@ namespace Action; require_once __DIR__.'/base.php'; +/** + * Duplicate a task to another project + * + * @package action + * @author Frederic Guillot + */ class TaskDuplicateAnotherProject extends Base { + /** + * Constructor + * + * @access public + * @param integer $project_id Project id + * @param Task $task Task model instance + */ public function __construct($project_id, \Model\Task $task) { parent::__construct($project_id); $this->task = $task; } + /** + * Get the required parameter for the action (defined by the user) + * + * @access public + * @return array + */ public function getActionRequiredParameters() { return array( @@ -20,6 +39,12 @@ class TaskDuplicateAnotherProject extends Base ); } + /** + * Get the required parameter for the event + * + * @access public + * @return array + */ public function getEventRequiredParameters() { return array( @@ -29,6 +54,13 @@ class TaskDuplicateAnotherProject extends Base ); } + /** + * Execute the action + * + * @access public + * @param array $data Event data dictionary + * @return bool True if the action was executed or false when not executed + */ public function doAction(array $data) { if ($data['column_id'] == $this->getParam('column_id') && $data['project_id'] != $this->getParam('project_id')) { |