diff options
author | Frederic Guillot <fred@kanboard.net> | 2016-05-28 19:48:22 -0400 |
---|---|---|
committer | Frederic Guillot <fred@kanboard.net> | 2016-05-28 19:48:22 -0400 |
commit | 14713b0ec7ed93ca45578da069ad4e19a7d8addf (patch) | |
tree | 79972d53f6091a1ddb17f64a6a05a5523f5d5168 | |
parent | 936376ffe74c583d3cb819e98f53a85137fdf8bc (diff) |
Rename all models
411 files changed, 4145 insertions, 4156 deletions
diff --git a/app/Action/CommentCreation.php b/app/Action/CommentCreation.php index b91e39e2..60ca24f7 100644 --- a/app/Action/CommentCreation.php +++ b/app/Action/CommentCreation.php @@ -65,11 +65,11 @@ class CommentCreation extends Base */ public function doAction(array $data) { - return (bool) $this->comment->create(array( + return (bool) $this->commentModel->create(array( 'reference' => isset($data['reference']) ? $data['reference'] : '', 'comment' => $data['comment'], 'task_id' => $data['task_id'], - 'user_id' => isset($data['user_id']) && $this->projectPermission->isAssignable($this->getProjectId(), $data['user_id']) ? $data['user_id'] : 0, + 'user_id' => isset($data['user_id']) && $this->projectPermissionModel->isAssignable($this->getProjectId(), $data['user_id']) ? $data['user_id'] : 0, )); } diff --git a/app/Action/CommentCreationMoveTaskColumn.php b/app/Action/CommentCreationMoveTaskColumn.php index 11224d67..1b16f481 100644 --- a/app/Action/CommentCreationMoveTaskColumn.php +++ b/app/Action/CommentCreationMoveTaskColumn.php @@ -2,7 +2,7 @@ namespace Kanboard\Action; -use Kanboard\Model\Task; +use Kanboard\Model\TaskModel; /** * Add a comment of the triggering event to the task description. @@ -32,7 +32,7 @@ class CommentCreationMoveTaskColumn extends Base public function getCompatibleEvents() { return array( - Task::EVENT_MOVE_COLUMN, + TaskModel::EVENT_MOVE_COLUMN, ); } @@ -71,9 +71,9 @@ class CommentCreationMoveTaskColumn extends Base return false; } - $column = $this->column->getById($data['column_id']); + $column = $this->columnModel->getById($data['column_id']); - return (bool) $this->comment->create(array( + return (bool) $this->commentModel->create(array( 'comment' => t('Moved to column %s', $column['title']), 'task_id' => $data['task_id'], 'user_id' => $this->userSession->getId(), diff --git a/app/Action/TaskAssignCategoryColor.php b/app/Action/TaskAssignCategoryColor.php index f5085cb0..fc486870 100644 --- a/app/Action/TaskAssignCategoryColor.php +++ b/app/Action/TaskAssignCategoryColor.php @@ -2,7 +2,7 @@ namespace Kanboard\Action; -use Kanboard\Model\Task; +use Kanboard\Model\TaskModel; /** * Set a category automatically according to the color @@ -32,7 +32,7 @@ class TaskAssignCategoryColor extends Base public function getCompatibleEvents() { return array( - Task::EVENT_CREATE_UPDATE, + TaskModel::EVENT_CREATE_UPDATE, ); } @@ -78,7 +78,7 @@ class TaskAssignCategoryColor extends Base 'category_id' => $this->getParam('category_id'), ); - return $this->taskModification->update($values); + return $this->taskModificationModel->update($values); } /** diff --git a/app/Action/TaskAssignCategoryLabel.php b/app/Action/TaskAssignCategoryLabel.php index 95fa116e..48299010 100644 --- a/app/Action/TaskAssignCategoryLabel.php +++ b/app/Action/TaskAssignCategoryLabel.php @@ -74,7 +74,7 @@ class TaskAssignCategoryLabel extends Base 'category_id' => $this->getParam('category_id'), ); - return $this->taskModification->update($values); + return $this->taskModificationModel->update($values); } /** diff --git a/app/Action/TaskAssignCategoryLink.php b/app/Action/TaskAssignCategoryLink.php index b39e41b4..6937edd1 100644 --- a/app/Action/TaskAssignCategoryLink.php +++ b/app/Action/TaskAssignCategoryLink.php @@ -2,7 +2,7 @@ namespace Kanboard\Action; -use Kanboard\Model\TaskLink; +use Kanboard\Model\TaskLinkModel; /** * Set a category automatically according to a task link @@ -33,7 +33,7 @@ class TaskAssignCategoryLink extends Base public function getCompatibleEvents() { return array( - TaskLink::EVENT_CREATE_UPDATE, + TaskLinkModel::EVENT_CREATE_UPDATE, ); } @@ -79,7 +79,7 @@ class TaskAssignCategoryLink extends Base 'category_id' => $this->getParam('category_id'), ); - return $this->taskModification->update($values); + return $this->taskModificationModel->update($values); } /** @@ -92,7 +92,7 @@ class TaskAssignCategoryLink extends Base public function hasRequiredCondition(array $data) { if ($data['link_id'] == $this->getParam('link_id')) { - $task = $this->taskFinder->getById($data['task_id']); + $task = $this->taskFinderModel->getById($data['task_id']); return empty($task['category_id']); } diff --git a/app/Action/TaskAssignColorCategory.php b/app/Action/TaskAssignColorCategory.php index 139c24cb..284b8f40 100644 --- a/app/Action/TaskAssignColorCategory.php +++ b/app/Action/TaskAssignColorCategory.php @@ -2,7 +2,7 @@ namespace Kanboard\Action; -use Kanboard\Model\Task; +use Kanboard\Model\TaskModel; /** * Assign a color to a specific category @@ -32,7 +32,7 @@ class TaskAssignColorCategory extends Base public function getCompatibleEvents() { return array( - Task::EVENT_CREATE_UPDATE, + TaskModel::EVENT_CREATE_UPDATE, ); } @@ -78,7 +78,7 @@ class TaskAssignColorCategory extends Base 'color_id' => $this->getParam('color_id'), ); - return $this->taskModification->update($values, false); + return $this->taskModificationModel->update($values, false); } /** diff --git a/app/Action/TaskAssignColorColumn.php b/app/Action/TaskAssignColorColumn.php index 92412739..57fd6f44 100644 --- a/app/Action/TaskAssignColorColumn.php +++ b/app/Action/TaskAssignColorColumn.php @@ -2,7 +2,7 @@ namespace Kanboard\Action; -use Kanboard\Model\Task; +use Kanboard\Model\TaskModel; /** * Assign a color to a task @@ -32,8 +32,8 @@ class TaskAssignColorColumn extends Base public function getCompatibleEvents() { return array( - Task::EVENT_CREATE, - Task::EVENT_MOVE_COLUMN, + TaskModel::EVENT_CREATE, + TaskModel::EVENT_MOVE_COLUMN, ); } @@ -79,7 +79,7 @@ class TaskAssignColorColumn extends Base 'color_id' => $this->getParam('color_id'), ); - return $this->taskModification->update($values, false); + return $this->taskModificationModel->update($values, false); } /** diff --git a/app/Action/TaskAssignColorLink.php b/app/Action/TaskAssignColorLink.php index 12ceabb3..9ab5458b 100644 --- a/app/Action/TaskAssignColorLink.php +++ b/app/Action/TaskAssignColorLink.php @@ -2,7 +2,7 @@ namespace Kanboard\Action; -use Kanboard\Model\TaskLink; +use Kanboard\Model\TaskLinkModel; /** * Assign a color to a specific task link @@ -32,7 +32,7 @@ class TaskAssignColorLink extends Base public function getCompatibleEvents() { return array( - TaskLink::EVENT_CREATE_UPDATE, + TaskLinkModel::EVENT_CREATE_UPDATE, ); } @@ -78,7 +78,7 @@ class TaskAssignColorLink extends Base 'color_id' => $this->getParam('color_id'), ); - return $this->taskModification->update($values, false); + return $this->taskModificationModel->update($values, false); } /** diff --git a/app/Action/TaskAssignColorPriority.php b/app/Action/TaskAssignColorPriority.php index 2e24f9ef..eae1b771 100644 --- a/app/Action/TaskAssignColorPriority.php +++ b/app/Action/TaskAssignColorPriority.php @@ -2,7 +2,7 @@ namespace Kanboard\Action; -use Kanboard\Model\Task; +use Kanboard\Model\TaskModel; /** * Assign a color to a priority @@ -32,7 +32,7 @@ class TaskAssignColorPriority extends Base public function getCompatibleEvents() { return array( - Task::EVENT_CREATE_UPDATE, + TaskModel::EVENT_CREATE_UPDATE, ); } @@ -78,7 +78,7 @@ class TaskAssignColorPriority extends Base 'color_id' => $this->getParam('color_id'), ); - return $this->taskModification->update($values, false); + return $this->taskModificationModel->update($values, false); } /** diff --git a/app/Action/TaskAssignColorUser.php b/app/Action/TaskAssignColorUser.php index 6ec8ce95..4bcf7a5c 100644 --- a/app/Action/TaskAssignColorUser.php +++ b/app/Action/TaskAssignColorUser.php @@ -2,7 +2,7 @@ namespace Kanboard\Action; -use Kanboard\Model\Task; +use Kanboard\Model\TaskModel; /** * Assign a color to a specific user @@ -32,8 +32,8 @@ class TaskAssignColorUser extends Base public function getCompatibleEvents() { return array( - Task::EVENT_CREATE, - Task::EVENT_ASSIGNEE_CHANGE, + TaskModel::EVENT_CREATE, + TaskModel::EVENT_ASSIGNEE_CHANGE, ); } @@ -79,7 +79,7 @@ class TaskAssignColorUser extends Base 'color_id' => $this->getParam('color_id'), ); - return $this->taskModification->update($values, false); + return $this->taskModificationModel->update($values, false); } /** diff --git a/app/Action/TaskAssignCurrentUser.php b/app/Action/TaskAssignCurrentUser.php index 192a120c..997aa98f 100644 --- a/app/Action/TaskAssignCurrentUser.php +++ b/app/Action/TaskAssignCurrentUser.php @@ -2,7 +2,7 @@ namespace Kanboard\Action; -use Kanboard\Model\Task; +use Kanboard\Model\TaskModel; /** * Assign a task to the logged user @@ -32,7 +32,7 @@ class TaskAssignCurrentUser extends Base public function getCompatibleEvents() { return array( - Task::EVENT_CREATE, + TaskModel::EVENT_CREATE, ); } @@ -78,7 +78,7 @@ class TaskAssignCurrentUser extends Base 'owner_id' => $this->userSession->getId(), ); - return $this->taskModification->update($values); + return $this->taskModificationModel->update($values); } /** diff --git a/app/Action/TaskAssignCurrentUserColumn.php b/app/Action/TaskAssignCurrentUserColumn.php index 05d08dd3..bc28a90b 100644 --- a/app/Action/TaskAssignCurrentUserColumn.php +++ b/app/Action/TaskAssignCurrentUserColumn.php @@ -2,7 +2,7 @@ namespace Kanboard\Action; -use Kanboard\Model\Task; +use Kanboard\Model\TaskModel; /** * Assign a task to the logged user on column change @@ -32,7 +32,7 @@ class TaskAssignCurrentUserColumn extends Base public function getCompatibleEvents() { return array( - Task::EVENT_MOVE_COLUMN, + TaskModel::EVENT_MOVE_COLUMN, ); } @@ -81,7 +81,7 @@ class TaskAssignCurrentUserColumn extends Base 'owner_id' => $this->userSession->getId(), ); - return $this->taskModification->update($values); + return $this->taskModificationModel->update($values); } /** diff --git a/app/Action/TaskAssignSpecificUser.php b/app/Action/TaskAssignSpecificUser.php index 2dc3e966..50a2b2ae 100644 --- a/app/Action/TaskAssignSpecificUser.php +++ b/app/Action/TaskAssignSpecificUser.php @@ -2,7 +2,7 @@ namespace Kanboard\Action; -use Kanboard\Model\Task; +use Kanboard\Model\TaskModel; /** * Assign a task to a specific user @@ -32,8 +32,8 @@ class TaskAssignSpecificUser extends Base public function getCompatibleEvents() { return array( - Task::EVENT_CREATE_UPDATE, - Task::EVENT_MOVE_COLUMN, + TaskModel::EVENT_CREATE_UPDATE, + TaskModel::EVENT_MOVE_COLUMN, ); } @@ -79,7 +79,7 @@ class TaskAssignSpecificUser extends Base 'owner_id' => $this->getParam('user_id'), ); - return $this->taskModification->update($values); + return $this->taskModificationModel->update($values); } /** diff --git a/app/Action/TaskAssignUser.php b/app/Action/TaskAssignUser.php index da54d186..9ea22986 100644 --- a/app/Action/TaskAssignUser.php +++ b/app/Action/TaskAssignUser.php @@ -71,7 +71,7 @@ class TaskAssignUser extends Base 'owner_id' => $data['owner_id'], ); - return $this->taskModification->update($values); + return $this->taskModificationModel->update($values); } /** @@ -83,6 +83,6 @@ class TaskAssignUser extends Base */ public function hasRequiredCondition(array $data) { - return $this->projectPermission->isAssignable($this->getProjectId(), $data['owner_id']); + return $this->projectPermissionModel->isAssignable($this->getProjectId(), $data['owner_id']); } } diff --git a/app/Action/TaskClose.php b/app/Action/TaskClose.php index cf91e83e..91e8cf43 100644 --- a/app/Action/TaskClose.php +++ b/app/Action/TaskClose.php @@ -63,7 +63,7 @@ class TaskClose extends Base */ public function doAction(array $data) { - return $this->taskStatus->close($data['task_id']); + return $this->taskStatusModel->close($data['task_id']); } /** diff --git a/app/Action/TaskCloseColumn.php b/app/Action/TaskCloseColumn.php index 09af3b96..1edce8fa 100644 --- a/app/Action/TaskCloseColumn.php +++ b/app/Action/TaskCloseColumn.php @@ -2,7 +2,7 @@ namespace Kanboard\Action; -use Kanboard\Model\Task; +use Kanboard\Model\TaskModel; /** * Close automatically a task in a specific column @@ -32,7 +32,7 @@ class TaskCloseColumn extends Base public function getCompatibleEvents() { return array( - Task::EVENT_MOVE_COLUMN, + TaskModel::EVENT_MOVE_COLUMN, ); } @@ -67,7 +67,7 @@ class TaskCloseColumn extends Base */ public function doAction(array $data) { - return $this->taskStatus->close($data['task_id']); + return $this->taskStatusModel->close($data['task_id']); } /** diff --git a/app/Action/TaskCloseNoActivity.php b/app/Action/TaskCloseNoActivity.php index 59f7f56a..5a10510f 100644 --- a/app/Action/TaskCloseNoActivity.php +++ b/app/Action/TaskCloseNoActivity.php @@ -2,7 +2,7 @@ namespace Kanboard\Action; -use Kanboard\Model\Task; +use Kanboard\Model\TaskModel; /** * Close automatically a task after when inactive @@ -31,7 +31,7 @@ class TaskCloseNoActivity extends Base */ public function getCompatibleEvents() { - return array(Task::EVENT_DAILY_CRONJOB); + return array(TaskModel::EVENT_DAILY_CRONJOB); } /** @@ -74,7 +74,7 @@ class TaskCloseNoActivity extends Base $duration = time() - $task['date_modification']; if ($duration > $max) { - $results[] = $this->taskStatus->close($task['id']); + $results[] = $this->taskStatusModel->close($task['id']); } } diff --git a/app/Action/TaskCreation.php b/app/Action/TaskCreation.php index 290c31e1..e9e5c5f3 100644 --- a/app/Action/TaskCreation.php +++ b/app/Action/TaskCreation.php @@ -66,7 +66,7 @@ class TaskCreation extends Base */ public function doAction(array $data) { - return (bool) $this->taskCreation->create(array( + return (bool) $this->taskCreationModel->create(array( 'project_id' => $data['project_id'], 'title' => $data['title'], 'reference' => $data['reference'], diff --git a/app/Action/TaskDuplicateAnotherProject.php b/app/Action/TaskDuplicateAnotherProject.php index 5f05136e..93fae5cc 100644 --- a/app/Action/TaskDuplicateAnotherProject.php +++ b/app/Action/TaskDuplicateAnotherProject.php @@ -2,7 +2,7 @@ namespace Kanboard\Action; -use Kanboard\Model\Task; +use Kanboard\Model\TaskModel; /** * Duplicate a task to another project @@ -32,8 +32,8 @@ class TaskDuplicateAnotherProject extends Base public function getCompatibleEvents() { return array( - Task::EVENT_MOVE_COLUMN, - Task::EVENT_CLOSE, + TaskModel::EVENT_MOVE_COLUMN, + TaskModel::EVENT_CLOSE, ); } @@ -74,8 +74,8 @@ class TaskDuplicateAnotherProject extends Base */ public function doAction(array $data) { - $destination_column_id = $this->column->getFirstColumnId($this->getParam('project_id')); - return (bool) $this->taskDuplication->duplicateToProject($data['task_id'], $this->getParam('project_id'), null, $destination_column_id); + $destination_column_id = $this->columnModel->getFirstColumnId($this->getParam('project_id')); + return (bool) $this->taskDuplicationModel->duplicateToProject($data['task_id'], $this->getParam('project_id'), null, $destination_column_id); } /** diff --git a/app/Action/TaskEmail.php b/app/Action/TaskEmail.php index 4e0e06a6..7f9ba416 100644 --- a/app/Action/TaskEmail.php +++ b/app/Action/TaskEmail.php @@ -2,7 +2,7 @@ namespace Kanboard\Action; -use Kanboard\Model\Task; +use Kanboard\Model\TaskModel; /** * Email a task to someone @@ -32,8 +32,8 @@ class TaskEmail extends Base public function getCompatibleEvents() { return array( - Task::EVENT_MOVE_COLUMN, - Task::EVENT_CLOSE, + TaskModel::EVENT_MOVE_COLUMN, + TaskModel::EVENT_CLOSE, ); } @@ -75,16 +75,16 @@ class TaskEmail extends Base */ public function doAction(array $data) { - $user = $this->user->getById($this->getParam('user_id')); + $user = $this->userModel->getById($this->getParam('user_id')); if (! empty($user['email'])) { - $task = $this->taskFinder->getDetails($data['task_id']); + $task = $this->taskFinderModel->getDetails($data['task_id']); $this->emailClient->send( $user['email'], $user['name'] ?: $user['username'], $this->getParam('subject'), - $this->template->render('notification/task_create', array('task' => $task, 'application_url' => $this->config->get('application_url'))) + $this->template->render('notification/task_create', array('task' => $task, 'application_url' => $this->configModel->get('application_url'))) ); return true; diff --git a/app/Action/TaskEmailNoActivity.php b/app/Action/TaskEmailNoActivity.php index c5d7a797..c60702fb 100644 --- a/app/Action/TaskEmailNoActivity.php +++ b/app/Action/TaskEmailNoActivity.php @@ -2,7 +2,7 @@ namespace Kanboard\Action; -use Kanboard\Model\Task; +use Kanboard\Model\TaskModel; /** * Email a task with no activity @@ -32,7 +32,7 @@ class TaskEmailNoActivity extends Base public function getCompatibleEvents() { return array( - Task::EVENT_DAILY_CRONJOB, + TaskModel::EVENT_DAILY_CRONJOB, ); } @@ -85,7 +85,7 @@ class TaskEmailNoActivity extends Base { $results = array(); $max = $this->getParam('duration') * 86400; - $user = $this->user->getById($this->getParam('user_id')); + $user = $this->userModel->getById($this->getParam('user_id')); if (! empty($user['email'])) { foreach ($data['tasks'] as $task) { @@ -110,13 +110,13 @@ class TaskEmailNoActivity extends Base */ private function sendEmail($task_id, array $user) { - $task = $this->taskFinder->getDetails($task_id); + $task = $this->taskFinderModel->getDetails($task_id); $this->emailClient->send( $user['email'], $user['name'] ?: $user['username'], $this->getParam('subject'), - $this->template->render('notification/task_create', array('task' => $task, 'application_url' => $this->config->get('application_url'))) + $this->template->render('notification/task_create', array('task' => $task, 'application_url' => $this->configModel->get('application_url'))) ); return true; diff --git a/app/Action/TaskMoveAnotherProject.php b/app/Action/TaskMoveAnotherProject.php index fdff0d8c..73ad4b69 100644 --- a/app/Action/TaskMoveAnotherProject.php +++ b/app/Action/TaskMoveAnotherProject.php @@ -2,7 +2,7 @@ namespace Kanboard\Action; -use Kanboard\Model\Task; +use Kanboard\Model\TaskModel; /** * Move a task to another project @@ -32,8 +32,8 @@ class TaskMoveAnotherProject extends Base public function getCompatibleEvents() { return array( - Task::EVENT_MOVE_COLUMN, - Task::EVENT_CLOSE, + TaskModel::EVENT_MOVE_COLUMN, + TaskModel::EVENT_CLOSE, ); } @@ -75,7 +75,7 @@ class TaskMoveAnotherProject extends Base */ public function doAction(array $data) { - return $this->taskDuplication->moveToProject($data['task_id'], $this->getParam('project_id')); + return $this->taskDuplicationModel->moveToProject($data['task_id'], $this->getParam('project_id')); } /** diff --git a/app/Action/TaskMoveColumnAssigned.php b/app/Action/TaskMoveColumnAssigned.php index 1b23a591..7e3db9c5 100644 --- a/app/Action/TaskMoveColumnAssigned.php +++ b/app/Action/TaskMoveColumnAssigned.php @@ -2,7 +2,7 @@ namespace Kanboard\Action; -use Kanboard\Model\Task; +use Kanboard\Model\TaskModel; /** * Move a task to another column when an assignee is set @@ -32,8 +32,8 @@ class TaskMoveColumnAssigned extends Base public function getCompatibleEvents() { return array( - Task::EVENT_ASSIGNEE_CHANGE, - Task::EVENT_UPDATE, + TaskModel::EVENT_ASSIGNEE_CHANGE, + TaskModel::EVENT_UPDATE, ); } @@ -75,9 +75,9 @@ class TaskMoveColumnAssigned extends Base */ public function doAction(array $data) { - $original_task = $this->taskFinder->getById($data['task_id']); + $original_task = $this->taskFinderModel->getById($data['task_id']); - return $this->taskPosition->movePosition( + return $this->taskPositionModel->movePosition( $data['project_id'], $data['task_id'], $this->getParam('dest_column_id'), diff --git a/app/Action/TaskMoveColumnCategoryChange.php b/app/Action/TaskMoveColumnCategoryChange.php index 0f591eda..e4f88760 100644 --- a/app/Action/TaskMoveColumnCategoryChange.php +++ b/app/Action/TaskMoveColumnCategoryChange.php @@ -2,7 +2,7 @@ namespace Kanboard\Action; -use Kanboard\Model\Task; +use Kanboard\Model\TaskModel; /** * Move a task to another column when the category is changed @@ -32,7 +32,7 @@ class TaskMoveColumnCategoryChange extends Base public function getCompatibleEvents() { return array( - Task::EVENT_UPDATE, + TaskModel::EVENT_UPDATE, ); } @@ -74,9 +74,9 @@ class TaskMoveColumnCategoryChange extends Base */ public function doAction(array $data) { - $original_task = $this->taskFinder->getById($data['task_id']); + $original_task = $this->taskFinderModel->getById($data['task_id']); - return $this->taskPosition->movePosition( + return $this->taskPositionModel->movePosition( $data['project_id'], $data['task_id'], $this->getParam('dest_column_id'), diff --git a/app/Action/TaskMoveColumnUnAssigned.php b/app/Action/TaskMoveColumnUnAssigned.php index 99ef9351..c3ae9e1d 100644 --- a/app/Action/TaskMoveColumnUnAssigned.php +++ b/app/Action/TaskMoveColumnUnAssigned.php @@ -2,7 +2,7 @@ namespace Kanboard\Action; -use Kanboard\Model\Task; +use Kanboard\Model\TaskModel; /** * Move a task to another column when an assignee is cleared @@ -32,8 +32,8 @@ class TaskMoveColumnUnAssigned extends Base public function getCompatibleEvents() { return array( - Task::EVENT_ASSIGNEE_CHANGE, - Task::EVENT_UPDATE, + TaskModel::EVENT_ASSIGNEE_CHANGE, + TaskModel::EVENT_UPDATE, ); } @@ -75,9 +75,9 @@ class TaskMoveColumnUnAssigned extends Base */ public function doAction(array $data) { - $original_task = $this->taskFinder->getById($data['task_id']); + $original_task = $this->taskFinderModel->getById($data['task_id']); - return $this->taskPosition->movePosition( + return $this->taskPositionModel->movePosition( $data['project_id'], $data['task_id'], $this->getParam('dest_column_id'), diff --git a/app/Action/TaskOpen.php b/app/Action/TaskOpen.php index ec0f96f7..8e847b8e 100644 --- a/app/Action/TaskOpen.php +++ b/app/Action/TaskOpen.php @@ -63,7 +63,7 @@ class TaskOpen extends Base */ public function doAction(array $data) { - return $this->taskStatus->open($data['task_id']); + return $this->taskStatusModel->open($data['task_id']); } /** diff --git a/app/Action/TaskUpdateStartDate.php b/app/Action/TaskUpdateStartDate.php index e5cea01b..e5410a87 100644 --- a/app/Action/TaskUpdateStartDate.php +++ b/app/Action/TaskUpdateStartDate.php @@ -2,7 +2,7 @@ namespace Kanboard\Action; -use Kanboard\Model\Task; +use Kanboard\Model\TaskModel; /** * Set the start date of task @@ -32,7 +32,7 @@ class TaskUpdateStartDate extends Base public function getCompatibleEvents() { return array( - Task::EVENT_MOVE_COLUMN, + TaskModel::EVENT_MOVE_COLUMN, ); } @@ -77,7 +77,7 @@ class TaskUpdateStartDate extends Base 'date_started' => time(), ); - return $this->taskModification->update($values, false); + return $this->taskModificationModel->update($values, false); } /** diff --git a/app/Analytic/AverageLeadCycleTimeAnalytic.php b/app/Analytic/AverageLeadCycleTimeAnalytic.php index 62c83559..d6cd1f86 100644 --- a/app/Analytic/AverageLeadCycleTimeAnalytic.php +++ b/app/Analytic/AverageLeadCycleTimeAnalytic.php @@ -3,7 +3,7 @@ namespace Kanboard\Analytic; use Kanboard\Core\Base; -use Kanboard\Model\Task; +use Kanboard\Model\TaskModel; /** * Average Lead and Cycle Time @@ -106,7 +106,7 @@ class AverageLeadCycleTimeAnalytic extends Base private function getTasks($project_id) { return $this->db - ->table(Task::TABLE) + ->table(TaskModel::TABLE) ->columns('date_completed', 'date_creation', 'date_started') ->eq('project_id', $project_id) ->desc('id') diff --git a/app/Analytic/AverageTimeSpentColumnAnalytic.php b/app/Analytic/AverageTimeSpentColumnAnalytic.php index 11078323..3556fb9d 100644 --- a/app/Analytic/AverageTimeSpentColumnAnalytic.php +++ b/app/Analytic/AverageTimeSpentColumnAnalytic.php @@ -3,7 +3,7 @@ namespace Kanboard\Analytic; use Kanboard\Core\Base; -use Kanboard\Model\Task; +use Kanboard\Model\TaskModel; /** * Average Time Spent by Column @@ -40,7 +40,7 @@ class AverageTimeSpentColumnAnalytic extends Base private function initialize($project_id) { $stats = array(); - $columns = $this->column->getList($project_id); + $columns = $this->columnModel->getList($project_id); foreach ($columns as $column_id => $column_title) { $stats[$column_id] = array( @@ -110,7 +110,7 @@ class AverageTimeSpentColumnAnalytic extends Base */ private function getTaskTimeByColumns(array &$task) { - $columns = $this->transition->getTimeSpentByTask($task['id']); + $columns = $this->transitionModel->getTimeSpentByTask($task['id']); if (! isset($columns[$task['column_id']])) { $columns[$task['column_id']] = 0; @@ -144,7 +144,7 @@ class AverageTimeSpentColumnAnalytic extends Base private function getTasks($project_id) { return $this->db - ->table(Task::TABLE) + ->table(TaskModel::TABLE) ->columns('id', 'date_completed', 'date_moved', 'column_id') ->eq('project_id', $project_id) ->desc('id') diff --git a/app/Analytic/EstimatedTimeComparisonAnalytic.php b/app/Analytic/EstimatedTimeComparisonAnalytic.php index 490bcd50..d9aea32d 100644 --- a/app/Analytic/EstimatedTimeComparisonAnalytic.php +++ b/app/Analytic/EstimatedTimeComparisonAnalytic.php @@ -3,7 +3,7 @@ namespace Kanboard\Analytic; use Kanboard\Core\Base; -use Kanboard\Model\Task; +use Kanboard\Model\TaskModel; /** * Estimated/Spent Time Comparison @@ -22,7 +22,7 @@ class EstimatedTimeComparisonAnalytic extends Base */ public function build($project_id) { - $rows = $this->db->table(Task::TABLE) + $rows = $this->db->table(TaskModel::TABLE) ->columns('SUM(time_estimated) AS time_estimated', 'SUM(time_spent) AS time_spent', 'is_active') ->eq('project_id', $project_id) ->groupBy('is_active') @@ -40,7 +40,7 @@ class EstimatedTimeComparisonAnalytic extends Base ); foreach ($rows as $row) { - $key = $row['is_active'] == Task::STATUS_OPEN ? 'open' : 'closed'; + $key = $row['is_active'] == TaskModel::STATUS_OPEN ? 'open' : 'closed'; $metrics[$key]['time_spent'] = $row['time_spent']; $metrics[$key]['time_estimated'] = $row['time_estimated']; } diff --git a/app/Analytic/TaskDistributionAnalytic.php b/app/Analytic/TaskDistributionAnalytic.php index 838652e3..447d88a1 100644 --- a/app/Analytic/TaskDistributionAnalytic.php +++ b/app/Analytic/TaskDistributionAnalytic.php @@ -23,10 +23,10 @@ class TaskDistributionAnalytic extends Base { $metrics = array(); $total = 0; - $columns = $this->column->getAll($project_id); + $columns = $this->columnModel->getAll($project_id); foreach ($columns as $column) { - $nb_tasks = $this->taskFinder->countByColumnId($project_id, $column['id']); + $nb_tasks = $this->taskFinderModel->countByColumnId($project_id, $column['id']); $total += $nb_tasks; $metrics[] = array( diff --git a/app/Analytic/UserDistributionAnalytic.php b/app/Analytic/UserDistributionAnalytic.php index e1815f9c..421d4242 100644 --- a/app/Analytic/UserDistributionAnalytic.php +++ b/app/Analytic/UserDistributionAnalytic.php @@ -23,8 +23,8 @@ class UserDistributionAnalytic extends Base { $metrics = array(); $total = 0; - $tasks = $this->taskFinder->getAll($project_id); - $users = $this->projectUserRole->getAssignableUsersList($project_id); + $tasks = $this->taskFinderModel->getAll($project_id); + $users = $this->projectUserRoleModel->getAssignableUsersList($project_id); foreach ($tasks as $task) { $user = isset($users[$task['owner_id']]) ? $users[$task['owner_id']] : $users[0]; diff --git a/app/Api/ActionApi.php b/app/Api/ActionApi.php index 0647f9e8..116742d8 100644 --- a/app/Api/ActionApi.php +++ b/app/Api/ActionApi.php @@ -29,12 +29,12 @@ class ActionApi extends Base public function removeAction($action_id) { - return $this->action->remove($action_id); + return $this->actionModel->remove($action_id); } public function getActions($project_id) { - return $this->action->getAllByProject($project_id); + return $this->actionModel->getAllByProject($project_id); } public function createAction($project_id, $event_name, $action_name, array $params) @@ -82,6 +82,6 @@ class ActionApi extends Base } } - return $this->action->create($values); + return $this->actionModel->create($values); } } diff --git a/app/Api/AppApi.php b/app/Api/AppApi.php index 865ba21a..637de5c5 100644 --- a/app/Api/AppApi.php +++ b/app/Api/AppApi.php @@ -14,7 +14,7 @@ class AppApi extends Base { public function getTimezone() { - return $this->timezone->getCurrentTimezone(); + return $this->timezoneModel->getCurrentTimezone(); } public function getVersion() @@ -24,17 +24,17 @@ class AppApi extends Base public function getDefaultTaskColor() { - return $this->color->getDefaultColor(); + return $this->colorModel->getDefaultColor(); } public function getDefaultTaskColors() { - return $this->color->getDefaultColors(); + return $this->colorModel->getDefaultColors(); } public function getColorList() { - return $this->color->getList(); + return $this->colorModel->getList(); } public function getApplicationRoles() diff --git a/app/Api/AuthApi.php b/app/Api/AuthApi.php index a9ad5baf..1cbce5ae 100644 --- a/app/Api/AuthApi.php +++ b/app/Api/AuthApi.php @@ -28,7 +28,7 @@ class AuthApi extends BaseApi if ($this->isUserAuthenticated($username, $password)) { $this->checkProcedurePermission(true, $method); - $this->userSession->initialize($this->user->getByUsername($username)); + $this->userSession->initialize($this->userModel->getByUsername($username)); } elseif ($this->isAppAuthenticated($username, $password)) { $this->checkProcedurePermission(false, $method); } else { @@ -48,7 +48,7 @@ class AuthApi extends BaseApi private function isUserAuthenticated($username, $password) { return $username !== 'jsonrpc' && - ! $this->userLocking->isLocked($username) && + ! $this->userLockingModel->isLocked($username) && $this->authenticationManager->passwordAuthentication($username, $password); } @@ -77,6 +77,6 @@ class AuthApi extends BaseApi return API_AUTHENTICATION_TOKEN; } - return $this->config->get('api_token'); + return $this->configModel->get('api_token'); } } diff --git a/app/Api/BaseApi.php b/app/Api/BaseApi.php index b70356cf..ae41e5b5 100644 --- a/app/Api/BaseApi.php +++ b/app/Api/BaseApi.php @@ -60,7 +60,7 @@ abstract class BaseApi extends Base public function checkProjectPermission($project_id) { - if ($this->userSession->isLogged() && ! $this->projectPermission->isUserAllowed($project_id, $this->userSession->getId())) { + if ($this->userSession->isLogged() && ! $this->projectPermissionModel->isUserAllowed($project_id, $this->userSession->getId())) { throw new AccessDeniedException('Permission denied'); } } @@ -68,7 +68,7 @@ abstract class BaseApi extends Base public function checkTaskPermission($task_id) { if ($this->userSession->isLogged()) { - $this->checkProjectPermission($this->taskFinder->getProjectId($task_id)); + $this->checkProjectPermission($this->taskFinderModel->getProjectId($task_id)); } } @@ -76,7 +76,7 @@ abstract class BaseApi extends Base { if (! empty($task)) { $task['url'] = $this->helper->url->to('TaskViewController', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id']), '', true); - $task['color'] = $this->color->getColorProperties($task['color_id']); + $task['color'] = $this->colorModel->getColorProperties($task['color_id']); } return $task; diff --git a/app/Api/BoardApi.php b/app/Api/BoardApi.php index c7d93aa0..aa5942af 100644 --- a/app/Api/BoardApi.php +++ b/app/Api/BoardApi.php @@ -13,6 +13,6 @@ class BoardApi extends BaseApi public function getBoard($project_id) { $this->checkProjectPermission($project_id); - return $this->board->getBoard($project_id); + return $this->boardModel->getBoard($project_id); } } diff --git a/app/Api/CategoryApi.php b/app/Api/CategoryApi.php index 7c5d3bfb..c56cfb35 100644 --- a/app/Api/CategoryApi.php +++ b/app/Api/CategoryApi.php @@ -14,17 +14,17 @@ class CategoryApi extends Base { public function getCategory($category_id) { - return $this->category->getById($category_id); + return $this->categoryModel->getById($category_id); } public function getAllCategories($project_id) { - return $this->category->getAll($project_id); + return $this->categoryModel->getAll($project_id); } public function removeCategory($category_id) { - return $this->category->remove($category_id); + return $this->categoryModel->remove($category_id); } public function createCategory($project_id, $name) @@ -35,7 +35,7 @@ class CategoryApi extends Base ); list($valid, ) = $this->categoryValidator->validateCreation($values); - return $valid ? $this->category->create($values) : false; + return $valid ? $this->categoryModel->create($values) : false; } public function updateCategory($id, $name) @@ -46,6 +46,6 @@ class CategoryApi extends Base ); list($valid, ) = $this->categoryValidator->validateModification($values); - return $valid && $this->category->update($values); + return $valid && $this->categoryModel->update($values); } } diff --git a/app/Api/ColumnApi.php b/app/Api/ColumnApi.php index 45ce521d..aa4026f6 100644 --- a/app/Api/ColumnApi.php +++ b/app/Api/ColumnApi.php @@ -12,31 +12,31 @@ class ColumnApi extends BaseApi { public function getColumns($project_id) { - return $this->column->getAll($project_id); + return $this->columnModel->getAll($project_id); } public function getColumn($column_id) { - return $this->column->getById($column_id); + return $this->columnModel->getById($column_id); } public function updateColumn($column_id, $title, $task_limit = 0, $description = '') { - return $this->column->update($column_id, $title, $task_limit, $description); + return $this->columnModel->update($column_id, $title, $task_limit, $description); } public function addColumn($project_id, $title, $task_limit = 0, $description = '') { - return $this->column->create($project_id, $title, $task_limit, $description); + return $this->columnModel->create($project_id, $title, $task_limit, $description); } public function removeColumn($column_id) { - return $this->column->remove($column_id); + return $this->columnModel->remove($column_id); } public function changeColumnPosition($project_id, $column_id, $position) { - return $this->column->changePosition($project_id, $column_id, $position); + return $this->columnModel->changePosition($project_id, $column_id, $position); } } diff --git a/app/Api/CommentApi.php b/app/Api/CommentApi.php index f16b0f7f..8358efee 100644 --- a/app/Api/CommentApi.php +++ b/app/Api/CommentApi.php @@ -14,17 +14,17 @@ class CommentApi extends Base { public function getComment($comment_id) { - return $this->comment->getById($comment_id); + return $this->commentModel->getById($comment_id); } public function getAllComments($task_id) { - return $this->comment->getAll($task_id); + return $this->commentModel->getAll($task_id); } public function removeComment($comment_id) { - return $this->comment->remove($comment_id); + return $this->commentModel->remove($comment_id); } public function createComment($task_id, $user_id, $content, $reference = '') @@ -38,7 +38,7 @@ class CommentApi extends Base list($valid, ) = $this->commentValidator->validateCreation($values); - return $valid ? $this->comment->create($values) : false; + return $valid ? $this->commentModel->create($values) : false; } public function updateComment($id, $content) @@ -49,6 +49,6 @@ class CommentApi extends Base ); list($valid, ) = $this->commentValidator->validateModification($values); - return $valid && $this->comment->update($values); + return $valid && $this->commentModel->update($values); } } diff --git a/app/Api/FileApi.php b/app/Api/FileApi.php index cc2e3986..1ed3aeb9 100644 --- a/app/Api/FileApi.php +++ b/app/Api/FileApi.php @@ -14,18 +14,18 @@ class FileApi extends BaseApi { public function getTaskFile($file_id) { - return $this->taskFile->getById($file_id); + return $this->taskFileModel->getById($file_id); } public function getAllTaskFiles($task_id) { - return $this->taskFile->getAll($task_id); + return $this->taskFileModel->getAll($task_id); } public function downloadTaskFile($file_id) { try { - $file = $this->taskFile->getById($file_id); + $file = $this->taskFileModel->getById($file_id); if (! empty($file)) { return base64_encode($this->objectStorage->get($file['path'])); @@ -40,7 +40,7 @@ class FileApi extends BaseApi public function createTaskFile($project_id, $task_id, $filename, $blob) { try { - return $this->taskFile->uploadContent($task_id, $filename, $blob); + return $this->taskFileModel->uploadContent($task_id, $filename, $blob); } catch (ObjectStorageException $e) { $this->logger->error($e->getMessage()); return false; @@ -49,12 +49,12 @@ class FileApi extends BaseApi public function removeTaskFile($file_id) { - return $this->taskFile->remove($file_id); + return $this->taskFileModel->remove($file_id); } public function removeAllTaskFiles($task_id) { - return $this->taskFile->removeAll($task_id); + return $this->taskFileModel->removeAll($task_id); } // Deprecated procedures diff --git a/app/Api/GroupApi.php b/app/Api/GroupApi.php index f1841fa3..1701edc3 100644 --- a/app/Api/GroupApi.php +++ b/app/Api/GroupApi.php @@ -14,7 +14,7 @@ class GroupApi extends Base { public function createGroup($name, $external_id = '') { - return $this->group->create($name, $external_id); + return $this->groupModel->create($name, $external_id); } public function updateGroup($group_id, $name = null, $external_id = null) @@ -31,21 +31,21 @@ class GroupApi extends Base } } - return $this->group->update($values); + return $this->groupModel->update($values); } public function removeGroup($group_id) { - return $this->group->remove($group_id); + return $this->groupModel->remove($group_id); } public function getGroup($group_id) { - return $this->group->getById($group_id); + return $this->groupModel->getById($group_id); } public function getAllGroups() { - return $this->group->getAll(); + return $this->groupModel->getAll(); } } diff --git a/app/Api/GroupMemberApi.php b/app/Api/GroupMemberApi.php index f5171e23..e09f6975 100644 --- a/app/Api/GroupMemberApi.php +++ b/app/Api/GroupMemberApi.php @@ -14,26 +14,26 @@ class GroupMemberApi extends Base { public function getMemberGroups($user_id) { - return $this->groupMember->getGroups($user_id); + return $this->groupMemberModel->getGroups($user_id); } public function getGroupMembers($group_id) { - return $this->groupMember->getMembers($group_id); + return $this->groupMemberModel->getMembers($group_id); } public function addGroupMember($group_id, $user_id) { - return $this->groupMember->addUser($group_id, $user_id); + return $this->groupMemberModel->addUser($group_id, $user_id); } public function removeGroupMember($group_id, $user_id) { - return $this->groupMember->removeUser($group_id, $user_id); + return $this->groupMemberModel->removeUser($group_id, $user_id); } public function isGroupMember($group_id, $user_id) { - return $this->groupMember->isMember($group_id, $user_id); + return $this->groupMemberModel->isMember($group_id, $user_id); } } diff --git a/app/Api/LinkApi.php b/app/Api/LinkApi.php index a76cb802..d8e525e4 100644 --- a/app/Api/LinkApi.php +++ b/app/Api/LinkApi.php @@ -21,7 +21,7 @@ class LinkApi extends Base */ public function getLinkById($link_id) { - return $this->link->getById($link_id); + return $this->linkModel->getById($link_id); } /** @@ -33,7 +33,7 @@ class LinkApi extends Base */ public function getLinkByLabel($label) { - return $this->link->getByLabel($label); + return $this->linkModel->getByLabel($label); } /** @@ -45,7 +45,7 @@ class LinkApi extends Base */ public function getOppositeLinkId($link_id) { - return $this->link->getOppositeLinkId($link_id); + return $this->linkModel->getOppositeLinkId($link_id); } /** @@ -56,7 +56,7 @@ class LinkApi extends Base */ public function getAllLinks() { - return $this->link->getAll(); + return $this->linkModel->getAll(); } /** @@ -75,7 +75,7 @@ class LinkApi extends Base ); list($valid, ) = $this->linkValidator->validateCreation($values); - return $valid ? $this->link->create($label, $opposite_label) : false; + return $valid ? $this->linkModel->create($label, $opposite_label) : false; } /** @@ -96,7 +96,7 @@ class LinkApi extends Base ); list($valid, ) = $this->linkValidator->validateModification($values); - return $valid && $this->link->update($values); + return $valid && $this->linkModel->update($values); } /** @@ -108,6 +108,6 @@ class LinkApi extends Base */ public function removeLink($link_id) { - return $this->link->remove($link_id); + return $this->linkModel->remove($link_id); } } diff --git a/app/Api/MeApi.php b/app/Api/MeApi.php index 7d46a962..497749b6 100644 --- a/app/Api/MeApi.php +++ b/app/Api/MeApi.php @@ -2,7 +2,7 @@ namespace Kanboard\Api; -use Kanboard\Model\Subtask as SubtaskModel; +use Kanboard\Model\SubtaskModel; /** * Me API controller @@ -20,25 +20,25 @@ class MeApi extends BaseApi public function getMyDashboard() { $user_id = $this->userSession->getId(); - $projects = $this->project->getQueryColumnStats($this->projectPermission->getActiveProjectIds($user_id))->findAll(); - $tasks = $this->taskFinder->getUserQuery($user_id)->findAll(); + $projects = $this->projectModel->getQueryColumnStats($this->projectPermissionModel->getActiveProjectIds($user_id))->findAll(); + $tasks = $this->taskFinderModel->getUserQuery($user_id)->findAll(); return array( 'projects' => $this->formatProjects($projects), 'tasks' => $this->formatTasks($tasks), - 'subtasks' => $this->subtask->getUserQuery($user_id, array(SubTaskModel::STATUS_TODO, SubtaskModel::STATUS_INPROGRESS))->findAll(), + 'subtasks' => $this->subtaskModel->getUserQuery($user_id, array(SubtaskModel::STATUS_TODO, SubtaskModel::STATUS_INPROGRESS))->findAll(), ); } public function getMyActivityStream() { - $project_ids = $this->projectPermission->getActiveProjectIds($this->userSession->getId()); + $project_ids = $this->projectPermissionModel->getActiveProjectIds($this->userSession->getId()); return $this->helper->projectActivity->getProjectsEvents($project_ids, 100); } public function createMyPrivateProject($name, $description = null) { - if ($this->config->get('disable_private_project', 0) == 1) { + if ($this->configModel->get('disable_private_project', 0) == 1) { return false; } @@ -49,23 +49,23 @@ class MeApi extends BaseApi ); list($valid, ) = $this->projectValidator->validateCreation($values); - return $valid ? $this->project->create($values, $this->userSession->getId(), true) : false; + return $valid ? $this->projectModel->create($values, $this->userSession->getId(), true) : false; } public function getMyProjectsList() { - return $this->projectUserRole->getProjectsByUser($this->userSession->getId()); + return $this->projectUserRoleModel->getProjectsByUser($this->userSession->getId()); } public function getMyOverdueTasks() { - return $this->taskFinder->getOverdueTasksByUser($this->userSession->getId()); + return $this->taskFinderModel->getOverdueTasksByUser($this->userSession->getId()); } public function getMyProjects() { - $project_ids = $this->projectPermission->getActiveProjectIds($this->userSession->getId()); - $projects = $this->project->getAllByIds($project_ids); + $project_ids = $this->projectPermissionModel->getActiveProjectIds($this->userSession->getId()); + $projects = $this->projectModel->getAllByIds($project_ids); return $this->formatProjects($projects); } diff --git a/app/Api/ProjectApi.php b/app/Api/ProjectApi.php index 70cd8d16..29a9cd79 100644 --- a/app/Api/ProjectApi.php +++ b/app/Api/ProjectApi.php @@ -13,42 +13,42 @@ class ProjectApi extends BaseApi public function getProjectById($project_id) { $this->checkProjectPermission($project_id); - return $this->formatProject($this->project->getById($project_id)); + return $this->formatProject($this->projectModel->getById($project_id)); } public function getProjectByName($name) { - return $this->formatProject($this->project->getByName($name)); + return $this->formatProject($this->projectModel->getByName($name)); } public function getAllProjects() { - return $this->formatProjects($this->project->getAll()); + return $this->formatProjects($this->projectModel->getAll()); } public function removeProject($project_id) { - return $this->project->remove($project_id); + return $this->projectModel->remove($project_id); } public function enableProject($project_id) { - return $this->project->enable($project_id); + return $this->projectModel->enable($project_id); } public function disableProject($project_id) { - return $this->project->disable($project_id); + return $this->projectModel->disable($project_id); } public function enableProjectPublicAccess($project_id) { - return $this->project->enablePublicAccess($project_id); + return $this->projectModel->enablePublicAccess($project_id); } public function disableProjectPublicAccess($project_id) { - return $this->project->disablePublicAccess($project_id); + return $this->projectModel->disablePublicAccess($project_id); } public function getProjectActivities(array $project_ids) @@ -70,7 +70,7 @@ class ProjectApi extends BaseApi ); list($valid, ) = $this->projectValidator->validateCreation($values); - return $valid ? $this->project->create($values) : false; + return $valid ? $this->projectModel->create($values) : false; } public function updateProject($id, $name, $description = null) @@ -82,6 +82,6 @@ class ProjectApi extends BaseApi ); list($valid, ) = $this->projectValidator->validateModification($values); - return $valid && $this->project->update($values); + return $valid && $this->projectModel->update($values); } } diff --git a/app/Api/ProjectPermissionApi.php b/app/Api/ProjectPermissionApi.php index 10ee3852..703cd0f3 100644 --- a/app/Api/ProjectPermissionApi.php +++ b/app/Api/ProjectPermissionApi.php @@ -15,42 +15,42 @@ class ProjectPermissionApi extends Base { public function getProjectUsers($project_id) { - return $this->projectUserRole->getAllUsers($project_id); + return $this->projectUserRoleModel->getAllUsers($project_id); } public function getAssignableUsers($project_id, $prepend_unassigned = false) { - return $this->projectUserRole->getAssignableUsersList($project_id, $prepend_unassigned); + return $this->projectUserRoleModel->getAssignableUsersList($project_id, $prepend_unassigned); } public function addProjectUser($project_id, $user_id, $role = Role::PROJECT_MEMBER) { - return $this->projectUserRole->addUser($project_id, $user_id, $role); + return $this->projectUserRoleModel->addUser($project_id, $user_id, $role); } public function addProjectGroup($project_id, $group_id, $role = Role::PROJECT_MEMBER) { - return $this->projectGroupRole->addGroup($project_id, $group_id, $role); + return $this->projectGroupRoleModel->addGroup($project_id, $group_id, $role); } public function removeProjectUser($project_id, $user_id) { - return $this->projectUserRole->removeUser($project_id, $user_id); + return $this->projectUserRoleModel->removeUser($project_id, $user_id); } public function removeProjectGroup($project_id, $group_id) { - return $this->projectGroupRole->removeGroup($project_id, $group_id); + return $this->projectGroupRoleModel->removeGroup($project_id, $group_id); } public function changeProjectUserRole($project_id, $user_id, $role) { - return $this->projectUserRole->changeUserRole($project_id, $user_id, $role); + return $this->projectUserRoleModel->changeUserRole($project_id, $user_id, $role); } public function changeProjectGroupRole($project_id, $group_id, $role) { - return $this->projectGroupRole->changeGroupRole($project_id, $group_id, $role); + return $this->projectGroupRoleModel->changeGroupRole($project_id, $group_id, $role); } // Deprecated diff --git a/app/Api/SubtaskApi.php b/app/Api/SubtaskApi.php index 305f9ae7..5764ff7d 100644 --- a/app/Api/SubtaskApi.php +++ b/app/Api/SubtaskApi.php @@ -14,17 +14,17 @@ class SubtaskApi extends Base { public function getSubtask($subtask_id) { - return $this->subtask->getById($subtask_id); + return $this->subtaskModel->getById($subtask_id); } public function getAllSubtasks($task_id) { - return $this->subtask->getAll($task_id); + return $this->subtaskModel->getAll($task_id); } public function removeSubtask($subtask_id) { - return $this->subtask->remove($subtask_id); + return $this->subtaskModel->remove($subtask_id); } public function createSubtask($task_id, $title, $user_id = 0, $time_estimated = 0, $time_spent = 0, $status = 0) @@ -39,7 +39,7 @@ class SubtaskApi extends Base ); list($valid, ) = $this->subtaskValidator->validateCreation($values); - return $valid ? $this->subtask->create($values) : false; + return $valid ? $this->subtaskModel->create($values) : false; } public function updateSubtask($id, $task_id, $title = null, $user_id = null, $time_estimated = null, $time_spent = null, $status = null) @@ -61,6 +61,6 @@ class SubtaskApi extends Base } list($valid, ) = $this->subtaskValidator->validateApiModification($values); - return $valid && $this->subtask->update($values); + return $valid && $this->subtaskModel->update($values); } } diff --git a/app/Api/SwimlaneApi.php b/app/Api/SwimlaneApi.php index f179e11b..c3c56a71 100644 --- a/app/Api/SwimlaneApi.php +++ b/app/Api/SwimlaneApi.php @@ -14,37 +14,37 @@ class SwimlaneApi extends Base { public function getActiveSwimlanes($project_id) { - return $this->swimlane->getSwimlanes($project_id); + return $this->swimlaneModel->getSwimlanes($project_id); } public function getAllSwimlanes($project_id) { - return $this->swimlane->getAll($project_id); + return $this->swimlaneModel->getAll($project_id); } public function getSwimlaneById($swimlane_id) { - return $this->swimlane->getById($swimlane_id); + return $this->swimlaneModel->getById($swimlane_id); } public function getSwimlaneByName($project_id, $name) { - return $this->swimlane->getByName($project_id, $name); + return $this->swimlaneModel->getByName($project_id, $name); } public function getSwimlane($swimlane_id) { - return $this->swimlane->getById($swimlane_id); + return $this->swimlaneModel->getById($swimlane_id); } public function getDefaultSwimlane($project_id) { - return $this->swimlane->getDefault($project_id); + return $this->swimlaneModel->getDefault($project_id); } public function addSwimlane($project_id, $name, $description = '') { - return $this->swimlane->create(array('project_id' => $project_id, 'name' => $name, 'description' => $description)); + return $this->swimlaneModel->create(array('project_id' => $project_id, 'name' => $name, 'description' => $description)); } public function updateSwimlane($swimlane_id, $name, $description = null) @@ -55,26 +55,26 @@ class SwimlaneApi extends Base $values['description'] = $description; } - return $this->swimlane->update($values); + return $this->swimlaneModel->update($values); } public function removeSwimlane($project_id, $swimlane_id) { - return $this->swimlane->remove($project_id, $swimlane_id); + return $this->swimlaneModel->remove($project_id, $swimlane_id); } public function disableSwimlane($project_id, $swimlane_id) { - return $this->swimlane->disable($project_id, $swimlane_id); + return $this->swimlaneModel->disable($project_id, $swimlane_id); } public function enableSwimlane($project_id, $swimlane_id) { - return $this->swimlane->enable($project_id, $swimlane_id); + return $this->swimlaneModel->enable($project_id, $swimlane_id); } public function changeSwimlanePosition($project_id, $swimlane_id, $position) { - return $this->swimlane->changePosition($project_id, $swimlane_id, $position); + return $this->swimlaneModel->changePosition($project_id, $swimlane_id, $position); } } diff --git a/app/Api/TaskApi.php b/app/Api/TaskApi.php index 4d745fa6..ddb3ac54 100644 --- a/app/Api/TaskApi.php +++ b/app/Api/TaskApi.php @@ -3,7 +3,7 @@ namespace Kanboard\Api; use Kanboard\Filter\TaskProjectFilter; -use Kanboard\Model\Task as TaskModel; +use Kanboard\Model\TaskModel; /** * Task API controller @@ -22,63 +22,63 @@ class TaskApi extends BaseApi public function getTask($task_id) { $this->checkTaskPermission($task_id); - return $this->formatTask($this->taskFinder->getById($task_id)); + return $this->formatTask($this->taskFinderModel->getById($task_id)); } public function getTaskByReference($project_id, $reference) { $this->checkProjectPermission($project_id); - return $this->formatTask($this->taskFinder->getByReference($project_id, $reference)); + return $this->formatTask($this->taskFinderModel->getByReference($project_id, $reference)); } public function getAllTasks($project_id, $status_id = TaskModel::STATUS_OPEN) { $this->checkProjectPermission($project_id); - return $this->formatTasks($this->taskFinder->getAll($project_id, $status_id)); + return $this->formatTasks($this->taskFinderModel->getAll($project_id, $status_id)); } public function getOverdueTasks() { - return $this->taskFinder->getOverdueTasks(); + return $this->taskFinderModel->getOverdueTasks(); } public function getOverdueTasksByProject($project_id) { $this->checkProjectPermission($project_id); - return $this->taskFinder->getOverdueTasksByProject($project_id); + return $this->taskFinderModel->getOverdueTasksByProject($project_id); } public function openTask($task_id) { $this->checkTaskPermission($task_id); - return $this->taskStatus->open($task_id); + return $this->taskStatusModel->open($task_id); } public function closeTask($task_id) { $this->checkTaskPermission($task_id); - return $this->taskStatus->close($task_id); + return $this->taskStatusModel->close($task_id); } public function removeTask($task_id) { - return $this->task->remove($task_id); + return $this->taskModel->remove($task_id); } public function moveTaskPosition($project_id, $task_id, $column_id, $position, $swimlane_id = 0) { $this->checkProjectPermission($project_id); - return $this->taskPosition->movePosition($project_id, $task_id, $column_id, $position, $swimlane_id); + return $this->taskPositionModel->movePosition($project_id, $task_id, $column_id, $position, $swimlane_id); } public function moveTaskToProject($task_id, $project_id, $swimlane_id = null, $column_id = null, $category_id = null, $owner_id = null) { - return $this->taskDuplication->moveToProject($task_id, $project_id, $swimlane_id, $column_id, $category_id, $owner_id); + return $this->taskDuplicationModel->moveToProject($task_id, $project_id, $swimlane_id, $column_id, $category_id, $owner_id); } public function duplicateTaskToProject($task_id, $project_id, $swimlane_id = null, $column_id = null, $category_id = null, $owner_id = null) { - return $this->taskDuplication->duplicateToProject($task_id, $project_id, $swimlane_id, $column_id, $category_id, $owner_id); + return $this->taskDuplicationModel->duplicateToProject($task_id, $project_id, $swimlane_id, $column_id, $category_id, $owner_id); } public function createTask($title, $project_id, $color_id = '', $column_id = 0, $owner_id = 0, $creator_id = 0, @@ -88,7 +88,7 @@ class TaskApi extends BaseApi { $this->checkProjectPermission($project_id); - if ($owner_id !== 0 && ! $this->projectPermission->isAssignable($project_id, $owner_id)) { + if ($owner_id !== 0 && ! $this->projectPermissionModel->isAssignable($project_id, $owner_id)) { return false; } @@ -119,7 +119,7 @@ class TaskApi extends BaseApi list($valid, ) = $this->taskValidator->validateCreation($values); - return $valid ? $this->taskCreation->create($values) : false; + return $valid ? $this->taskCreationModel->create($values) : false; } public function updateTask($id, $title = null, $color_id = null, $owner_id = null, @@ -129,13 +129,13 @@ class TaskApi extends BaseApi { $this->checkTaskPermission($id); - $project_id = $this->taskFinder->getProjectId($id); + $project_id = $this->taskFinderModel->getProjectId($id); if ($project_id === 0) { return false; } - if ($owner_id !== null && $owner_id != 0 && ! $this->projectPermission->isAssignable($project_id, $owner_id)) { + if ($owner_id !== null && $owner_id != 0 && ! $this->projectPermissionModel->isAssignable($project_id, $owner_id)) { return false; } @@ -164,6 +164,6 @@ class TaskApi extends BaseApi } list($valid) = $this->taskValidator->validateApiModification($values); - return $valid && $this->taskModification->update($values); + return $valid && $this->taskModificationModel->update($values); } } diff --git a/app/Api/TaskLinkApi.php b/app/Api/TaskLinkApi.php index 8c02c524..bb809133 100644 --- a/app/Api/TaskLinkApi.php +++ b/app/Api/TaskLinkApi.php @@ -21,7 +21,7 @@ class TaskLinkApi extends Base */ public function getTaskLinkById($task_link_id) { - return $this->taskLink->getById($task_link_id); + return $this->taskLinkModel->getById($task_link_id); } /** @@ -33,7 +33,7 @@ class TaskLinkApi extends Base */ public function getAllTaskLinks($task_id) { - return $this->taskLink->getAll($task_id); + return $this->taskLinkModel->getAll($task_id); } /** @@ -47,7 +47,7 @@ class TaskLinkApi extends Base */ public function createTaskLink($task_id, $opposite_task_id, $link_id) { - return $this->taskLink->create($task_id, $opposite_task_id, $link_id); + return $this->taskLinkModel->create($task_id, $opposite_task_id, $link_id); } /** @@ -62,7 +62,7 @@ class TaskLinkApi extends Base */ public function updateTaskLink($task_link_id, $task_id, $opposite_task_id, $link_id) { - return $this->taskLink->update($task_link_id, $task_id, $opposite_task_id, $link_id); + return $this->taskLinkModel->update($task_link_id, $task_id, $opposite_task_id, $link_id); } /** @@ -74,6 +74,6 @@ class TaskLinkApi extends Base */ public function removeTaskLink($task_link_id) { - return $this->taskLink->remove($task_link_id); + return $this->taskLinkModel->remove($task_link_id); } } diff --git a/app/Api/UserApi.php b/app/Api/UserApi.php index 9786e6cf..88d75527 100644 --- a/app/Api/UserApi.php +++ b/app/Api/UserApi.php @@ -19,37 +19,37 @@ class UserApi extends Base { public function getUser($user_id) { - return $this->user->getById($user_id); + return $this->userModel->getById($user_id); } public function getUserByName($username) { - return $this->user->getByUsername($username); + return $this->userModel->getByUsername($username); } public function getAllUsers() { - return $this->user->getAll(); + return $this->userModel->getAll(); } public function removeUser($user_id) { - return $this->user->remove($user_id); + return $this->userModel->remove($user_id); } public function disableUser($user_id) { - return $this->user->disable($user_id); + return $this->userModel->disable($user_id); } public function enableUser($user_id) { - return $this->user->enable($user_id); + return $this->userModel->enable($user_id); } public function isActiveUser($user_id) { - return $this->user->isActive($user_id); + return $this->userModel->isActive($user_id); } public function createUser($username, $password, $name = '', $email = '', $role = Role::APP_USER) @@ -64,7 +64,7 @@ class UserApi extends Base ); list($valid, ) = $this->userValidator->validateCreation($values); - return $valid ? $this->user->create($values) : false; + return $valid ? $this->userModel->create($values) : false; } /** @@ -108,7 +108,7 @@ class UserApi extends Base 'is_ldap_user' => 1, ); - return $this->user->create($values); + return $this->userModel->create($values); } catch (LdapException $e) { $this->logger->error($e->getMessage()); @@ -133,6 +133,6 @@ class UserApi extends Base } list($valid, ) = $this->userValidator->validateApiModification($values); - return $valid && $this->user->update($values); + return $valid && $this->userModel->update($values); } } diff --git a/app/Auth/DatabaseAuth.php b/app/Auth/DatabaseAuth.php index c13af687..ecb42c17 100644 --- a/app/Auth/DatabaseAuth.php +++ b/app/Auth/DatabaseAuth.php @@ -5,7 +5,7 @@ namespace Kanboard\Auth; use Kanboard\Core\Base; use Kanboard\Core\Security\PasswordAuthenticationProviderInterface; use Kanboard\Core\Security\SessionCheckProviderInterface; -use Kanboard\Model\User; +use Kanboard\Model\UserModel; use Kanboard\User\DatabaseUserProvider; /** @@ -60,7 +60,7 @@ class DatabaseAuth extends Base implements PasswordAuthenticationProviderInterfa public function authenticate() { $user = $this->db - ->table(User::TABLE) + ->table(UserModel::TABLE) ->columns('id', 'password') ->eq('username', $this->username) ->eq('disable_login_form', 0) @@ -84,7 +84,7 @@ class DatabaseAuth extends Base implements PasswordAuthenticationProviderInterfa */ public function isValidSession() { - return $this->user->isActive($this->userSession->getId()); + return $this->userModel->isActive($this->userSession->getId()); } /** diff --git a/app/Auth/RememberMeAuth.php b/app/Auth/RememberMeAuth.php index 509a511d..5d0a8b2e 100644 --- a/app/Auth/RememberMeAuth.php +++ b/app/Auth/RememberMeAuth.php @@ -44,16 +44,16 @@ class RememberMeAuth extends Base implements PreAuthenticationProviderInterface $credentials = $this->rememberMeCookie->read(); if ($credentials !== false) { - $session = $this->rememberMeSession->find($credentials['token'], $credentials['sequence']); + $session = $this->rememberMeSessionModel->find($credentials['token'], $credentials['sequence']); if (! empty($session)) { $this->rememberMeCookie->write( $session['token'], - $this->rememberMeSession->updateSequence($session['token']), + $this->rememberMeSessionModel->updateSequence($session['token']), $session['expiration'] ); - $this->userInfo = $this->user->getById($session['user_id']); + $this->userInfo = $this->userModel->getById($session['user_id']); return true; } diff --git a/app/Console/BaseCommand.php b/app/Console/BaseCommand.php index ca566266..d6806d93 100644 --- a/app/Console/BaseCommand.php +++ b/app/Console/BaseCommand.php @@ -11,24 +11,24 @@ use Symfony\Component\Console\Command\Command; * @package console * @author Frederic Guillot * - * @property \Kanboard\Validator\PasswordResetValidator $passwordResetValidator - * @property \Kanboard\Export\SubtaskExport $subtaskExport - * @property \Kanboard\Export\TaskExport $taskExport - * @property \Kanboard\Export\TransitionExport $transitionExport - * @property \Kanboard\Model\Notification $notification - * @property \Kanboard\Model\Project $project - * @property \Kanboard\Model\ProjectPermission $projectPermission - * @property \Kanboard\Model\ProjectDailyColumnStats $projectDailyColumnStats - * @property \Kanboard\Model\ProjectDailyStats $projectDailyStats - * @property \Kanboard\Model\Task $task - * @property \Kanboard\Model\TaskFinder $taskFinder - * @property \Kanboard\Model\User $user - * @property \Kanboard\Model\UserNotification $userNotification - * @property \Kanboard\Model\UserNotificationFilter $userNotificationFilter - * @property \Kanboard\Model\ProjectUserRole $projectUserRole - * @property \Kanboard\Core\Plugin\Loader $pluginLoader - * @property \Kanboard\Core\Http\Client $httpClient - * @property \Symfony\Component\EventDispatcher\EventDispatcher $dispatcher + * @property \Kanboard\Validator\PasswordResetValidator $passwordResetValidator + * @property \Kanboard\Export\SubtaskExport $subtaskExport + * @property \Kanboard\Export\TaskExport $taskExport + * @property \Kanboard\Export\TransitionExport $transitionExport + * @property \Kanboard\Model\NotificationModel $notificationModel + * @property \Kanboard\Model\ProjectModel $projectModel + * @property \Kanboard\Model\ProjectPermissionModel $projectPermissionModel + * @property \Kanboard\Model\ProjectDailyColumnStatsModel $projectDailyColumnStatsModel + * @property \Kanboard\Model\ProjectDailyStatsModel $projectDailyStatsModel + * @property \Kanboard\Model\TaskModel $taskModel + * @property \Kanboard\Model\TaskFinderModel $taskFinderModel + * @property \Kanboard\Model\UserModel $userModel + * @property \Kanboard\Model\UserNotificationModel $userNotificationModel + * @property \Kanboard\Model\UserNotificationFilterModel $userNotificationFilterModel + * @property \Kanboard\Model\ProjectUserRoleModel $projectUserRoleModel + * @property \Kanboard\Core\Plugin\Loader $pluginLoader + * @property \Kanboard\Core\Http\Client $httpClient + * @property \Symfony\Component\EventDispatcher\EventDispatcher $dispatcher */ abstract class BaseCommand extends Command { diff --git a/app/Console/ProjectDailyColumnStatsExportCommand.php b/app/Console/ProjectDailyColumnStatsExportCommand.php index ced1a374..1e8af727 100644 --- a/app/Console/ProjectDailyColumnStatsExportCommand.php +++ b/app/Console/ProjectDailyColumnStatsExportCommand.php @@ -21,7 +21,7 @@ class ProjectDailyColumnStatsExportCommand extends BaseCommand protected function execute(InputInterface $input, OutputInterface $output) { - $data = $this->projectDailyColumnStats->getAggregatedMetrics( + $data = $this->projectDailyColumnStatsModel->getAggregatedMetrics( $input->getArgument('project_id'), $input->getArgument('start_date'), $input->getArgument('end_date') diff --git a/app/Console/ProjectDailyStatsCalculationCommand.php b/app/Console/ProjectDailyStatsCalculationCommand.php index 5b898f02..8dde8a79 100644 --- a/app/Console/ProjectDailyStatsCalculationCommand.php +++ b/app/Console/ProjectDailyStatsCalculationCommand.php @@ -2,7 +2,7 @@ namespace Kanboard\Console; -use Kanboard\Model\Project; +use Kanboard\Model\ProjectModel; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; @@ -17,12 +17,12 @@ class ProjectDailyStatsCalculationCommand extends BaseCommand protected function execute(InputInterface $input, OutputInterface $output) { - $projects = $this->project->getAllByStatus(Project::ACTIVE); + $projects = $this->projectModel->getAllByStatus(ProjectModel::ACTIVE); foreach ($projects as $project) { $output->writeln('Run calculation for '.$project['name']); - $this->projectDailyColumnStats->updateTotals($project['id'], date('Y-m-d')); - $this->projectDailyStats->updateTotals($project['id'], date('Y-m-d')); + $this->projectDailyColumnStatsModel->updateTotals($project['id'], date('Y-m-d')); + $this->projectDailyStatsModel->updateTotals($project['id'], date('Y-m-d')); } } } diff --git a/app/Console/ResetPasswordCommand.php b/app/Console/ResetPasswordCommand.php index 93dc3761..b483f902 100644 --- a/app/Console/ResetPasswordCommand.php +++ b/app/Console/ResetPasswordCommand.php @@ -60,14 +60,14 @@ class ResetPasswordCommand extends BaseCommand private function resetPassword(OutputInterface $output, $username, $password) { - $userId = $this->user->getIdByUsername($username); + $userId = $this->userModel->getIdByUsername($username); if (empty($userId)) { $output->writeln('<error>User not found</error>'); return false; } - if (!$this->user->update(array('id' => $userId, 'password' => $password))) { + if (!$this->userModel->update(array('id' => $userId, 'password' => $password))) { $output->writeln('<error>Unable to update password</error>'); return false; } diff --git a/app/Console/ResetTwoFactorCommand.php b/app/Console/ResetTwoFactorCommand.php index 3bf01e81..a64206b6 100644 --- a/app/Console/ResetTwoFactorCommand.php +++ b/app/Console/ResetTwoFactorCommand.php @@ -19,14 +19,14 @@ class ResetTwoFactorCommand extends BaseCommand protected function execute(InputInterface $input, OutputInterface $output) { $username = $input->getArgument('username'); - $userId = $this->user->getIdByUsername($username); + $userId = $this->userModel->getIdByUsername($username); if (empty($userId)) { $output->writeln('<error>User not found</error>'); return false; } - if (!$this->user->update(array('id' => $userId, 'twofactor_activated' => 0, 'twofactor_secret' => ''))) { + if (!$this->userModel->update(array('id' => $userId, 'twofactor_activated' => 0, 'twofactor_secret' => ''))) { $output->writeln('<error>Unable to update user profile</error>'); return false; } diff --git a/app/Console/TaskOverdueNotificationCommand.php b/app/Console/TaskOverdueNotificationCommand.php index 7e8484c8..225a6a1a 100644 --- a/app/Console/TaskOverdueNotificationCommand.php +++ b/app/Console/TaskOverdueNotificationCommand.php @@ -2,7 +2,7 @@ namespace Kanboard\Console; -use Kanboard\Model\Task; +use Kanboard\Model\TaskModel; use Kanboard\Core\Security\Role; use Symfony\Component\Console\Helper\Table; use Symfony\Component\Console\Input\InputInterface; @@ -65,10 +65,10 @@ class TaskOverdueNotificationCommand extends BaseCommand */ public function sendGroupOverdueTaskNotifications() { - $tasks = $this->taskFinder->getOverdueTasks(); + $tasks = $this->taskFinderModel->getOverdueTasks(); foreach ($this->groupByColumn($tasks, 'owner_id') as $user_tasks) { - $users = $this->userNotification->getUsersWithNotificationEnabled($user_tasks[0]['project_id']); + $users = $this->userNotificationModel->getUsersWithNotificationEnabled($user_tasks[0]['project_id']); foreach ($users as $user) { $this->sendUserOverdueTaskNotifications($user, $user_tasks); @@ -85,14 +85,14 @@ class TaskOverdueNotificationCommand extends BaseCommand */ public function sendOverdueTaskNotificationsToManagers() { - $tasks = $this->taskFinder->getOverdueTasks(); + $tasks = $this->taskFinderModel->getOverdueTasks(); foreach ($this->groupByColumn($tasks, 'project_id') as $project_id => $project_tasks) { - $users = $this->userNotification->getUsersWithNotificationEnabled($project_id); + $users = $this->userNotificationModel->getUsersWithNotificationEnabled($project_id); $managers = array(); foreach ($users as $user) { - $role = $this->projectUserRole->getUserRole($project_id, $user['id']); + $role = $this->projectUserRoleModel->getUserRole($project_id, $user['id']); if($role == Role::PROJECT_MANAGER) { $managers[] = $user; } @@ -113,10 +113,10 @@ class TaskOverdueNotificationCommand extends BaseCommand */ public function sendOverdueTaskNotifications() { - $tasks = $this->taskFinder->getOverdueTasks(); + $tasks = $this->taskFinderModel->getOverdueTasks(); foreach ($this->groupByColumn($tasks, 'project_id') as $project_id => $project_tasks) { - $users = $this->userNotification->getUsersWithNotificationEnabled($project_id); + $users = $this->userNotificationModel->getUsersWithNotificationEnabled($project_id); foreach ($users as $user) { $this->sendUserOverdueTaskNotifications($user, $project_tasks); @@ -139,16 +139,16 @@ class TaskOverdueNotificationCommand extends BaseCommand $project_names = array(); foreach ($tasks as $task) { - if ($this->userNotificationFilter->shouldReceiveNotification($user, array('task' => $task))) { + if ($this->userNotificationFilterModel->shouldReceiveNotification($user, array('task' => $task))) { $user_tasks[] = $task; $project_names[$task['project_id']] = $task['project_name']; } } if (! empty($user_tasks)) { - $this->userNotification->sendUserNotification( + $this->userNotificationModel->sendUserNotification( $user, - Task::EVENT_OVERDUE, + TaskModel::EVENT_OVERDUE, array('tasks' => $user_tasks, 'project_name' => implode(", ", $project_names)) ); } @@ -163,9 +163,9 @@ class TaskOverdueNotificationCommand extends BaseCommand */ public function sendUserOverdueTaskNotificationsToManagers(array $manager, array $tasks) { - $this->userNotification->sendUserNotification( + $this->userNotificationModel->sendUserNotification( $manager, - Task::EVENT_OVERDUE, + TaskModel::EVENT_OVERDUE, array('tasks' => $tasks, 'project_name' => $tasks[0]['project_name']) ); } diff --git a/app/Console/TaskTriggerCommand.php b/app/Console/TaskTriggerCommand.php index 9e9554f9..a1f4dccf 100644 --- a/app/Console/TaskTriggerCommand.php +++ b/app/Console/TaskTriggerCommand.php @@ -4,7 +4,7 @@ namespace Kanboard\Console; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; -use Kanboard\Model\Task; +use Kanboard\Model\TaskModel; use Kanboard\Event\TaskListEvent; class TaskTriggerCommand extends BaseCommand @@ -19,7 +19,7 @@ class TaskTriggerCommand extends BaseCommand protected function execute(InputInterface $input, OutputInterface $output) { foreach ($this->getProjectIds() as $project_id) { - $tasks = $this->taskFinder->getAll($project_id); + $tasks = $this->taskFinderModel->getAll($project_id); $nb_tasks = count($tasks); if ($nb_tasks > 0) { @@ -31,7 +31,7 @@ class TaskTriggerCommand extends BaseCommand private function getProjectIds() { - $listeners = $this->dispatcher->getListeners(Task::EVENT_DAILY_CRONJOB); + $listeners = $this->dispatcher->getListeners(TaskModel::EVENT_DAILY_CRONJOB); $project_ids = array(); foreach ($listeners as $listener) { @@ -46,6 +46,6 @@ class TaskTriggerCommand extends BaseCommand $event = new TaskListEvent(array('project_id' => $project_id)); $event->setTasks($tasks); - $this->dispatcher->dispatch(Task::EVENT_DAILY_CRONJOB, $event); + $this->dispatcher->dispatch(TaskModel::EVENT_DAILY_CRONJOB, $event); } } diff --git a/app/Controller/ActionController.php b/app/Controller/ActionController.php index 51090d22..097640f6 100644 --- a/app/Controller/ActionController.php +++ b/app/Controller/ActionController.php @@ -18,7 +18,7 @@ class ActionController extends BaseController public function index() { $project = $this->getProject(); - $actions = $this->action->getAllByProject($project['id']); + $actions = $this->actionModel->getAllByProject($project['id']); $this->response->html($this->helper->layout->project('action/index', array( 'values' => array('project_id' => $project['id']), @@ -27,12 +27,12 @@ class ActionController extends BaseController 'available_actions' => $this->actionManager->getAvailableActions(), 'available_events' => $this->eventManager->getAll(), 'available_params' => $this->actionManager->getAvailableParameters($actions), - 'columns_list' => $this->column->getList($project['id']), - 'users_list' => $this->projectUserRole->getAssignableUsersList($project['id']), - 'projects_list' => $this->projectUserRole->getProjectsByUser($this->userSession->getId()), - 'colors_list' => $this->color->getList(), - 'categories_list' => $this->category->getList($project['id']), - 'links_list' => $this->link->getList(0, false), + 'columns_list' => $this->columnModel->getList($project['id']), + 'users_list' => $this->projectUserRoleModel->getAssignableUsersList($project['id']), + 'projects_list' => $this->projectUserRoleModel->getProjectsByUser($this->userSession->getId()), + 'colors_list' => $this->colorModel->getList(), + 'categories_list' => $this->categoryModel->getList($project['id']), + 'links_list' => $this->linkModel->getList(0, false), 'title' => t('Automatic actions') ))); } @@ -47,7 +47,7 @@ class ActionController extends BaseController $project = $this->getProject(); $this->response->html($this->helper->layout->project('action/remove', array( - 'action' => $this->action->getById($this->request->getIntegerParam('action_id')), + 'action' => $this->actionModel->getById($this->request->getIntegerParam('action_id')), 'available_events' => $this->eventManager->getAll(), 'available_actions' => $this->actionManager->getAvailableActions(), 'project' => $project, @@ -64,9 +64,9 @@ class ActionController extends BaseController { $this->checkCSRFParam(); $project = $this->getProject(); - $action = $this->action->getById($this->request->getIntegerParam('action_id')); + $action = $this->actionModel->getById($this->request->getIntegerParam('action_id')); - if (! empty($action) && $this->action->remove($action['id'])) { + if (! empty($action) && $this->actionModel->remove($action['id'])) { $this->flash->success(t('Action removed successfully.')); } else { $this->flash->failure(t('Unable to remove this action.')); diff --git a/app/Controller/ActionCreationController.php b/app/Controller/ActionCreationController.php index e055f11b..e984f8d4 100644 --- a/app/Controller/ActionCreationController.php +++ b/app/Controller/ActionCreationController.php @@ -69,19 +69,19 @@ class ActionCreationController extends BaseController $this->doCreation($project, $values + array('params' => array())); } - $projects_list = $this->projectUserRole->getActiveProjectsByUser($this->userSession->getId()); + $projects_list = $this->projectUserRoleModel->getActiveProjectsByUser($this->userSession->getId()); unset($projects_list[$project['id']]); $this->response->html($this->template->render('action_creation/params', array( 'values' => $values, 'action_params' => $action_params, - 'columns_list' => $this->column->getList($project['id']), - 'users_list' => $this->projectUserRole->getAssignableUsersList($project['id']), + 'columns_list' => $this->columnModel->getList($project['id']), + 'users_list' => $this->projectUserRoleModel->getAssignableUsersList($project['id']), 'projects_list' => $projects_list, - 'colors_list' => $this->color->getList(), - 'categories_list' => $this->category->getList($project['id']), - 'links_list' => $this->link->getList(0, false), - 'priorities_list' => $this->project->getPriorities($project), + 'colors_list' => $this->colorModel->getList(), + 'categories_list' => $this->categoryModel->getList($project['id']), + 'links_list' => $this->linkModel->getList(0, false), + 'priorities_list' => $this->projectModel->getPriorities($project), 'project' => $project, 'available_actions' => $this->actionManager->getAvailableActions(), 'events' => $this->actionManager->getCompatibleEvents($values['action_name']), @@ -110,7 +110,7 @@ class ActionCreationController extends BaseController list($valid, ) = $this->actionValidator->validateCreation($values); if ($valid) { - if ($this->action->create($values) !== false) { + if ($this->actionModel->create($values) !== false) { $this->flash->success(t('Your automatic action have been created successfully.')); } else { $this->flash->failure(t('Unable to create your automatic action.')); diff --git a/app/Controller/ActivityController.php b/app/Controller/ActivityController.php index a8fc1b39..9f9841af 100644 --- a/app/Controller/ActivityController.php +++ b/app/Controller/ActivityController.php @@ -38,7 +38,7 @@ class ActivityController extends BaseController $this->response->html($this->helper->layout->task('activity/task', array( 'title' => $task['title'], 'task' => $task, - 'project' => $this->project->getById($task['project_id']), + 'project' => $this->projectModel->getById($task['project_id']), 'events' => $this->helper->projectActivity->getTaskEvents($task['id']), ))); } diff --git a/app/Controller/AnalyticController.php b/app/Controller/AnalyticController.php index 99d34c66..cf3ba034 100644 --- a/app/Controller/AnalyticController.php +++ b/app/Controller/AnalyticController.php @@ -3,7 +3,7 @@ namespace Kanboard\Controller; use Kanboard\Filter\TaskProjectFilter; -use Kanboard\Model\Task as TaskModel; +use Kanboard\Model\TaskModel; /** * Project Analytic Controller @@ -30,8 +30,8 @@ class AnalyticController extends BaseController ), 'project' => $project, 'average' => $this->averageLeadCycleTimeAnalytic->build($project['id']), - 'metrics' => $this->projectDailyStats->getRawMetrics($project['id'], $from, $to), - 'date_format' => $this->config->get('application_date_format'), + 'metrics' => $this->projectDailyStatsModel->getRawMetrics($project['id'], $from, $to), + 'date_format' => $this->configModel->get('application_date_format'), 'date_formats' => $this->dateParser->getAvailableFormats($this->dateParser->getDateFormats()), 'title' => t('Lead and Cycle time for "%s"', $project['name']), ))); @@ -145,7 +145,7 @@ class AnalyticController extends BaseController $project = $this->getProject(); list($from, $to) = $this->getDates(); - $display_graph = $this->projectDailyColumnStats->countDays($project['id'], $from, $to) >= 2; + $display_graph = $this->projectDailyColumnStatsModel->countDays($project['id'], $from, $to) >= 2; $this->response->html($this->helper->layout->analytic($template, array( 'values' => array( @@ -153,9 +153,9 @@ class AnalyticController extends BaseController 'to' => $to, ), 'display_graph' => $display_graph, - 'metrics' => $display_graph ? $this->projectDailyColumnStats->getAggregatedMetrics($project['id'], $from, $to, $column) : array(), + 'metrics' => $display_graph ? $this->projectDailyColumnStatsModel->getAggregatedMetrics($project['id'], $from, $to, $column) : array(), 'project' => $project, - 'date_format' => $this->config->get('application_date_format'), + 'date_format' => $this->configModel->get('application_date_format'), 'date_formats' => $this->dateParser->getAvailableFormats($this->dateParser->getDateFormats()), 'title' => t($title, $project['name']), ))); diff --git a/app/Controller/AuthController.php b/app/Controller/AuthController.php index 598b3ff8..dc46070c 100644 --- a/app/Controller/AuthController.php +++ b/app/Controller/AuthController.php @@ -23,7 +23,7 @@ class AuthController extends BaseController $this->response->redirect($this->helper->url->to('DashboardController', 'show')); } else { $this->response->html($this->helper->layout->app('auth/index', array( - 'captcha' => ! empty($values['username']) && $this->userLocking->hasCaptcha($values['username']), + 'captcha' => ! empty($values['username']) && $this->userLockingModel->hasCaptcha($values['username']), 'errors' => $errors, 'values' => $values, 'no_layout' => true, diff --git a/app/Controller/AvatarFileController.php b/app/Controller/AvatarFileController.php index 0e2ed1bb..6879c577 100644 --- a/app/Controller/AvatarFileController.php +++ b/app/Controller/AvatarFileController.php @@ -32,7 +32,7 @@ class AvatarFileController extends BaseController { $user = $this->getUser(); - if (! $this->avatarFile->uploadImageFile($user['id'], $this->request->getFileInfo('avatar'))) { + if (! $this->avatarFileModel->uploadImageFile($user['id'], $this->request->getFileInfo('avatar'))) { $this->flash->failure(t('Unable to upload the file.')); } @@ -46,7 +46,7 @@ class AvatarFileController extends BaseController { $this->checkCSRFParam(); $user = $this->getUser(); - $this->avatarFile->remove($user['id']); + $this->avatarFileModel->remove($user['id']); $this->userSession->refresh($user['id']); $this->response->redirect($this->helper->url->to('AvatarFileController', 'show', array('user_id' => $user['id']))); } @@ -58,7 +58,7 @@ class AvatarFileController extends BaseController { $user_id = $this->request->getIntegerParam('user_id'); $size = $this->request->getStringParam('size', 48); - $filename = $this->avatarFile->getFilename($user_id); + $filename = $this->avatarFileModel->getFilename($user_id); $etag = md5($filename.$size); $this->response->withCache(365 * 86400, $etag); diff --git a/app/Controller/BaseController.php b/app/Controller/BaseController.php index ad02f708..36871bb4 100644 --- a/app/Controller/BaseController.php +++ b/app/Controller/BaseController.php @@ -33,7 +33,7 @@ abstract class BaseController extends Base */ protected function checkWebhookToken() { - if ($this->config->get('webhook_token') !== $this->request->getStringParam('token')) { + if ($this->configModel->get('webhook_token') !== $this->request->getStringParam('token')) { $this->response->text('Not Authorized', 401); } } @@ -49,7 +49,7 @@ abstract class BaseController extends Base protected function getTask() { $project_id = $this->request->getIntegerParam('project_id'); - $task = $this->taskFinder->getDetails($this->request->getIntegerParam('task_id')); + $task = $this->taskFinderModel->getDetails($this->request->getIntegerParam('task_id')); if (empty($task)) { throw new PageNotFoundException(); @@ -78,7 +78,7 @@ abstract class BaseController extends Base if ($task_id > 0) { $model = 'taskFile'; - $project_id = $this->taskFinder->getProjectId($task_id); + $project_id = $this->taskFinderModel->getProjectId($task_id); if ($project_id !== $this->request->getIntegerParam('project_id')) { throw new AccessForbiddenException(); @@ -106,7 +106,7 @@ abstract class BaseController extends Base protected function getProject($project_id = 0) { $project_id = $this->request->getIntegerParam('project_id', $project_id); - $project = $this->project->getByIdWithOwner($project_id); + $project = $this->projectModel->getByIdWithOwner($project_id); if (empty($project)) { throw new PageNotFoundException(); @@ -125,7 +125,7 @@ abstract class BaseController extends Base */ protected function getUser() { - $user = $this->user->getById($this->request->getIntegerParam('user_id', $this->userSession->getId())); + $user = $this->userModel->getById($this->request->getIntegerParam('user_id', $this->userSession->getId())); if (empty($user)) { throw new PageNotFoundException(); @@ -147,7 +147,7 @@ abstract class BaseController extends Base */ protected function getSubtask() { - $subtask = $this->subtask->getById($this->request->getIntegerParam('subtask_id')); + $subtask = $this->subtaskModel->getById($this->request->getIntegerParam('subtask_id')); if (empty($subtask)) { throw new PageNotFoundException(); diff --git a/app/Controller/BoardAjaxController.php b/app/Controller/BoardAjaxController.php index d4714699..24914671 100644 --- a/app/Controller/BoardAjaxController.php +++ b/app/Controller/BoardAjaxController.php @@ -28,7 +28,7 @@ class BoardAjaxController extends BaseController $values = $this->request->getJson(); - $result =$this->taskPosition->movePosition( + $result =$this->taskPositionModel->movePosition( $project_id, $values['task_id'], $values['column_id'], @@ -55,7 +55,7 @@ class BoardAjaxController extends BaseController if (! $project_id || ! $this->request->isAjax()) { throw new AccessForbiddenException(); - } elseif (! $this->project->isModifiedSince($project_id, $timestamp)) { + } elseif (! $this->projectModel->isModifiedSince($project_id, $timestamp)) { $this->response->status(304); } else { $this->response->html($this->renderBoard($project_id)); @@ -129,9 +129,9 @@ class BoardAjaxController extends BaseController protected function renderBoard($project_id) { return $this->template->render('board/table_container', array( - 'project' => $this->project->getById($project_id), - 'board_private_refresh_interval' => $this->config->get('board_private_refresh_interval'), - 'board_highlight_period' => $this->config->get('board_highlight_period'), + 'project' => $this->projectModel->getById($project_id), + 'board_private_refresh_interval' => $this->configModel->get('board_private_refresh_interval'), + 'board_highlight_period' => $this->configModel->get('board_highlight_period'), 'swimlanes' => $this->taskLexer ->build($this->userSession->getFilters($project_id)) ->format(BoardFormatter::getInstance($this->container)->setProjectId($project_id)) diff --git a/app/Controller/BoardPopoverController.php b/app/Controller/BoardPopoverController.php index 2c2e5dc6..a0f5ae12 100644 --- a/app/Controller/BoardPopoverController.php +++ b/app/Controller/BoardPopoverController.php @@ -23,9 +23,9 @@ class BoardPopoverController extends BaseController $this->response->html($this->template->render('board_popover/close_all_tasks_column', array( 'project' => $project, - 'nb_tasks' => $this->taskFinder->countByColumnAndSwimlaneId($project['id'], $column_id, $swimlane_id), - 'column' => $this->column->getColumnTitleById($column_id), - 'swimlane' => $this->swimlane->getNameById($swimlane_id) ?: t($project['default_swimlane']), + 'nb_tasks' => $this->taskFinderModel->countByColumnAndSwimlaneId($project['id'], $column_id, $swimlane_id), + 'column' => $this->columnModel->getColumnTitleById($column_id), + 'swimlane' => $this->swimlaneModel->getNameById($swimlane_id) ?: t($project['default_swimlane']), 'values' => array('column_id' => $column_id, 'swimlane_id' => $swimlane_id), ))); } @@ -40,8 +40,8 @@ class BoardPopoverController extends BaseController $project = $this->getProject(); $values = $this->request->getValues(); - $this->taskStatus->closeTasksBySwimlaneAndColumn($values['swimlane_id'], $values['column_id']); - $this->flash->success(t('All tasks of the column "%s" and the swimlane "%s" have been closed successfully.', $this->column->getColumnTitleById($values['column_id']), $this->swimlane->getNameById($values['swimlane_id']) ?: t($project['default_swimlane']))); + $this->taskStatusModel->closeTasksBySwimlaneAndColumn($values['swimlane_id'], $values['column_id']); + $this->flash->success(t('All tasks of the column "%s" and the swimlane "%s" have been closed successfully.', $this->columnModel->getColumnTitleById($values['column_id']), $this->swimlaneModel->getNameById($values['swimlane_id']) ?: t($project['default_swimlane']))); $this->response->redirect($this->helper->url->to('BoardViewController', 'show', array('project_id' => $project['id']))); } } diff --git a/app/Controller/BoardTooltipController.php b/app/Controller/BoardTooltipController.php index 2f1d949e..2a947027 100644 --- a/app/Controller/BoardTooltipController.php +++ b/app/Controller/BoardTooltipController.php @@ -19,7 +19,7 @@ class BoardTooltipController extends BaseController { $task = $this->getTask(); $this->response->html($this->template->render('board/tooltip_tasklinks', array( - 'links' => $this->taskLink->getAllGroupedByLabel($task['id']), + 'links' => $this->taskLinkModel->getAllGroupedByLabel($task['id']), 'task' => $task, ))); } @@ -33,7 +33,7 @@ class BoardTooltipController extends BaseController { $task = $this->getTask(); $this->response->html($this->template->render('board/tooltip_external_links', array( - 'links' => $this->taskExternalLink->getAll($task['id']), + 'links' => $this->taskExternalLinkModel->getAll($task['id']), 'task' => $task, ))); } @@ -47,7 +47,7 @@ class BoardTooltipController extends BaseController { $task = $this->getTask(); $this->response->html($this->template->render('board/tooltip_subtasks', array( - 'subtasks' => $this->subtask->getAll($task['id']), + 'subtasks' => $this->subtaskModel->getAll($task['id']), 'task' => $task, ))); } @@ -62,7 +62,7 @@ class BoardTooltipController extends BaseController $task = $this->getTask(); $this->response->html($this->template->render('board/tooltip_files', array( - 'files' => $this->taskFile->getAll($task['id']), + 'files' => $this->taskFileModel->getAll($task['id']), 'task' => $task, ))); } @@ -78,7 +78,7 @@ class BoardTooltipController extends BaseController $this->response->html($this->template->render('board/tooltip_comments', array( 'task' => $task, - 'comments' => $this->comment->getAll($task['id'], $this->userSession->getCommentSorting()) + 'comments' => $this->commentModel->getAll($task['id'], $this->userSession->getCommentSorting()) ))); } @@ -107,9 +107,9 @@ class BoardTooltipController extends BaseController $this->response->html($this->template->render('task_recurrence/info', array( 'task' => $task, - 'recurrence_trigger_list' => $this->task->getRecurrenceTriggerList(), - 'recurrence_timeframe_list' => $this->task->getRecurrenceTimeframeList(), - 'recurrence_basedate_list' => $this->task->getRecurrenceBasedateList(), + 'recurrence_trigger_list' => $this->taskModel->getRecurrenceTriggerList(), + 'recurrence_timeframe_list' => $this->taskModel->getRecurrenceTimeframeList(), + 'recurrence_basedate_list' => $this->taskModel->getRecurrenceBasedateList(), ))); } @@ -121,7 +121,7 @@ class BoardTooltipController extends BaseController public function swimlane() { $this->getProject(); - $swimlane = $this->swimlane->getById($this->request->getIntegerParam('swimlane_id')); + $swimlane = $this->swimlaneModel->getById($this->request->getIntegerParam('swimlane_id')); $this->response->html($this->template->render('board/tooltip_description', array('task' => $swimlane))); } } diff --git a/app/Controller/BoardViewController.php b/app/Controller/BoardViewController.php index 3c96af73..496fa995 100644 --- a/app/Controller/BoardViewController.php +++ b/app/Controller/BoardViewController.php @@ -22,7 +22,7 @@ class BoardViewController extends BaseController public function readonly() { $token = $this->request->getStringParam('token'); - $project = $this->project->getByToken($token); + $project = $this->projectModel->getByToken($token); if (empty($project)) { throw AccessForbiddenException::getInstance()->withoutLayout(); @@ -30,14 +30,14 @@ class BoardViewController extends BaseController $this->response->html($this->helper->layout->app('board/view_public', array( 'project' => $project, - 'swimlanes' => $this->board->getBoard($project['id']), + 'swimlanes' => $this->boardModel->getBoard($project['id']), 'title' => $project['name'], 'description' => $project['description'], 'no_layout' => true, 'not_editable' => true, - 'board_public_refresh_interval' => $this->config->get('board_public_refresh_interval'), - 'board_private_refresh_interval' => $this->config->get('board_private_refresh_interval'), - 'board_highlight_period' => $this->config->get('board_highlight_period'), + 'board_public_refresh_interval' => $this->configModel->get('board_public_refresh_interval'), + 'board_private_refresh_interval' => $this->configModel->get('board_private_refresh_interval'), + 'board_highlight_period' => $this->configModel->get('board_highlight_period'), ))); } @@ -55,8 +55,8 @@ class BoardViewController extends BaseController 'project' => $project, 'title' => $project['name'], 'description' => $this->helper->projectHeader->getDescription($project), - 'board_private_refresh_interval' => $this->config->get('board_private_refresh_interval'), - 'board_highlight_period' => $this->config->get('board_highlight_period'), + 'board_private_refresh_interval' => $this->configModel->get('board_private_refresh_interval'), + 'board_highlight_period' => $this->configModel->get('board_highlight_period'), 'swimlanes' => $this->taskLexer ->build($search) ->format(BoardFormatter::getInstance($this->container)->setProjectId($project['id'])) diff --git a/app/Controller/CalendarController.php b/app/Controller/CalendarController.php index c875a18c..e5114f02 100644 --- a/app/Controller/CalendarController.php +++ b/app/Controller/CalendarController.php @@ -5,7 +5,7 @@ namespace Kanboard\Controller; use Kanboard\Filter\TaskAssigneeFilter; use Kanboard\Filter\TaskProjectFilter; use Kanboard\Filter\TaskStatusFilter; -use Kanboard\Model\Task as TaskModel; +use Kanboard\Model\TaskModel; /** * Calendar Controller @@ -29,7 +29,7 @@ class CalendarController extends BaseController 'project' => $project, 'title' => $project['name'], 'description' => $this->helper->projectHeader->getDescription($project), - 'check_interval' => $this->config->get('board_private_refresh_interval'), + 'check_interval' => $this->configModel->get('board_private_refresh_interval'), ))); } @@ -75,7 +75,7 @@ class CalendarController extends BaseController $events = $this->helper->calendar->getTaskDateDueEvents(clone($queryBuilder), $start, $end); $events = array_merge($events, $this->helper->calendar->getTaskEvents(clone($queryBuilder), $start, $end)); - if ($this->config->get('calendar_user_subtasks_time_tracking') == 1) { + if ($this->configModel->get('calendar_user_subtasks_time_tracking') == 1) { $events = array_merge($events, $this->helper->calendar->getSubtaskTimeTrackingEvents($user_id, $start, $end)); } @@ -98,7 +98,7 @@ class CalendarController extends BaseController if ($this->request->isAjax() && $this->request->isPost()) { $values = $this->request->getJson(); - $this->taskModification->update(array( + $this->taskModificationModel->update(array( 'id' => $values['task_id'], 'date_due' => substr($values['date_due'], 0, 10), )); diff --git a/app/Controller/CategoryController.php b/app/Controller/CategoryController.php index e7c8db54..fd1b3f94 100644 --- a/app/Controller/CategoryController.php +++ b/app/Controller/CategoryController.php @@ -21,7 +21,7 @@ class CategoryController extends BaseController */ private function getCategory() { - $category = $this->category->getById($this->request->getIntegerParam('category_id')); + $category = $this->categoryModel->getById($this->request->getIntegerParam('category_id')); if (empty($category)) { throw new PageNotFoundException(); @@ -43,7 +43,7 @@ class CategoryController extends BaseController $project = $this->getProject(); $this->response->html($this->helper->layout->project('category/index', array( - 'categories' => $this->category->getList($project['id'], false), + 'categories' => $this->categoryModel->getList($project['id'], false), 'values' => $values + array('project_id' => $project['id']), 'errors' => $errors, 'project' => $project, @@ -64,7 +64,7 @@ class CategoryController extends BaseController list($valid, $errors) = $this->categoryValidator->validateCreation($values); if ($valid) { - if ($this->category->create($values)) { + if ($this->categoryModel->create($values)) { $this->flash->success(t('Your category have been created successfully.')); return $this->response->redirect($this->helper->url->to('CategoryController', 'index', array('project_id' => $project['id']))); } else { @@ -109,7 +109,7 @@ class CategoryController extends BaseController list($valid, $errors) = $this->categoryValidator->validateModification($values); if ($valid) { - if ($this->category->update($values)) { + if ($this->categoryModel->update($values)) { $this->flash->success(t('Your category have been updated successfully.')); return $this->response->redirect($this->helper->url->to('CategoryController', 'index', array('project_id' => $project['id']))); } else { @@ -148,7 +148,7 @@ class CategoryController extends BaseController $project = $this->getProject(); $category = $this->getCategory(); - if ($this->category->remove($category['id'])) { + if ($this->categoryModel->remove($category['id'])) { $this->flash->success(t('Category removed successfully.')); } else { $this->flash->failure(t('Unable to remove this category.')); diff --git a/app/Controller/ColumnController.php b/app/Controller/ColumnController.php index 5f04f426..8bf3d562 100644 --- a/app/Controller/ColumnController.php +++ b/app/Controller/ColumnController.php @@ -20,7 +20,7 @@ class ColumnController extends BaseController public function index() { $project = $this->getProject(); - $columns = $this->column->getAll($project['id']); + $columns = $this->columnModel->getAll($project['id']); $this->response->html($this->helper->layout->project('column/index', array( 'columns' => $columns, @@ -66,7 +66,7 @@ class ColumnController extends BaseController list($valid, $errors) = $this->columnValidator->validateCreation($values); if ($valid) { - if ($this->column->create($project['id'], $values['title'], $values['task_limit'], $values['description'])) { + if ($this->columnModel->create($project['id'], $values['title'], $values['task_limit'], $values['description'])) { $this->flash->success(t('Column created successfully.')); return $this->response->redirect($this->helper->url->to('ColumnController', 'index', array('project_id' => $project['id'])), true); } else { @@ -87,7 +87,7 @@ class ColumnController extends BaseController public function edit(array $values = array(), array $errors = array()) { $project = $this->getProject(); - $column = $this->column->getById($this->request->getIntegerParam('column_id')); + $column = $this->columnModel->getById($this->request->getIntegerParam('column_id')); $this->response->html($this->helper->layout->project('column/edit', array( 'errors' => $errors, @@ -111,7 +111,7 @@ class ColumnController extends BaseController list($valid, $errors) = $this->columnValidator->validateModification($values); if ($valid) { - if ($this->column->update($values['id'], $values['title'], $values['task_limit'], $values['description'])) { + if ($this->columnModel->update($values['id'], $values['title'], $values['task_limit'], $values['description'])) { $this->flash->success(t('Board updated successfully.')); return $this->response->redirect($this->helper->url->to('ColumnController', 'index', array('project_id' => $project['id']))); } else { @@ -133,7 +133,7 @@ class ColumnController extends BaseController $values = $this->request->getJson(); if (! empty($values) && isset($values['column_id']) && isset($values['position'])) { - $result = $this->column->changePosition($project['id'], $values['column_id'], $values['position']); + $result = $this->columnModel->changePosition($project['id'], $values['column_id'], $values['position']); $this->response->json(array('result' => $result)); } else { throw new AccessForbiddenException(); @@ -150,7 +150,7 @@ class ColumnController extends BaseController $project = $this->getProject(); $this->response->html($this->helper->layout->project('column/remove', array( - 'column' => $this->column->getById($this->request->getIntegerParam('column_id')), + 'column' => $this->columnModel->getById($this->request->getIntegerParam('column_id')), 'project' => $project, 'title' => t('Remove a column from a board') ))); @@ -167,7 +167,7 @@ class ColumnController extends BaseController $this->checkCSRFParam(); $column_id = $this->request->getIntegerParam('column_id'); - if ($this->column->remove($column_id)) { + if ($this->columnModel->remove($column_id)) { $this->flash->success(t('Column removed successfully.')); } else { $this->flash->failure(t('Unable to remove this column.')); diff --git a/app/Controller/CommentController.php b/app/Controller/CommentController.php index 8d1132ae..696d240f 100644 --- a/app/Controller/CommentController.php +++ b/app/Controller/CommentController.php @@ -23,7 +23,7 @@ class CommentController extends BaseController */ private function getComment() { - $comment = $this->comment->getById($this->request->getIntegerParam('comment_id')); + $comment = $this->commentModel->getById($this->request->getIntegerParam('comment_id')); if (empty($comment)) { throw new PageNotFoundException(); @@ -76,7 +76,7 @@ class CommentController extends BaseController list($valid, $errors) = $this->commentValidator->validateCreation($values); if ($valid) { - if ($this->comment->create($values)) { + if ($this->commentModel->create($values)) { $this->flash->success(t('Comment added successfully.')); } else { $this->flash->failure(t('Unable to create your comment.')); @@ -125,7 +125,7 @@ class CommentController extends BaseController list($valid, $errors) = $this->commentValidator->validateModification($values); if ($valid) { - if ($this->comment->update($values)) { + if ($this->commentModel->update($values)) { $this->flash->success(t('Comment updated successfully.')); } else { $this->flash->failure(t('Unable to update your comment.')); @@ -165,7 +165,7 @@ class CommentController extends BaseController $task = $this->getTask(); $comment = $this->getComment(); - if ($this->comment->remove($comment['id'])) { + if ($this->commentModel->remove($comment['id'])) { $this->flash->success(t('Comment removed successfully.')); } else { $this->flash->failure(t('Unable to remove this comment.')); diff --git a/app/Controller/ConfigController.php b/app/Controller/ConfigController.php index a5af0246..8bcf4c35 100644 --- a/app/Controller/ConfigController.php +++ b/app/Controller/ConfigController.php @@ -18,7 +18,7 @@ class ConfigController extends BaseController public function index() { $this->response->html($this->helper->layout->config('config/about', array( - 'db_size' => $this->config->getDatabaseSize(), + 'db_size' => $this->configModel->getDatabaseSize(), 'db_version' => $this->db->getDriver()->getDatabaseVersion(), 'user_agent' => $this->request->getServerVariable('HTTP_USER_AGENT'), 'title' => t('Settings').' > '.t('About'), @@ -54,8 +54,8 @@ class ConfigController extends BaseController break; } - if ($this->config->save($values)) { - $this->language->loadCurrentLanguage(); + if ($this->configModel->save($values)) { + $this->languageModel->loadCurrentLanguage(); $this->flash->success(t('Settings saved successfully.')); } else { $this->flash->failure(t('Unable to save your settings.')); @@ -72,8 +72,8 @@ class ConfigController extends BaseController public function application() { $this->response->html($this->helper->layout->config('config/application', array( - 'languages' => $this->language->getLanguages(), - 'timezones' => $this->timezone->getTimezones(), + 'languages' => $this->languageModel->getLanguages(), + 'timezones' => $this->timezoneModel->getTimezones(), 'date_formats' => $this->dateParser->getAvailableFormats($this->dateParser->getDateFormats()), 'datetime_formats' => $this->dateParser->getAvailableFormats($this->dateParser->getDateTimeFormats()), 'time_formats' => $this->dateParser->getAvailableFormats($this->dateParser->getTimeFormats()), @@ -89,8 +89,8 @@ class ConfigController extends BaseController public function project() { $this->response->html($this->helper->layout->config('config/project', array( - 'colors' => $this->color->getList(), - 'default_columns' => implode(', ', $this->board->getDefaultColumns()), + 'colors' => $this->colorModel->getList(), + 'default_columns' => implode(', ', $this->boardModel->getDefaultColumns()), 'title' => t('Settings').' > '.t('Project settings'), ))); } @@ -164,7 +164,7 @@ class ConfigController extends BaseController { $this->checkCSRFParam(); $this->response->withFileDownload('db.sqlite.gz'); - $this->response->binary($this->config->downloadDatabase()); + $this->response->binary($this->configModel->downloadDatabase()); } /** @@ -175,7 +175,7 @@ class ConfigController extends BaseController public function optimizeDb() { $this->checkCSRFParam(); - $this->config->optimizeDatabase(); + $this->configModel->optimizeDatabase(); $this->flash->success(t('Database optimization done.')); $this->response->redirect($this->helper->url->to('ConfigController', 'index')); } @@ -190,7 +190,7 @@ class ConfigController extends BaseController $type = $this->request->getStringParam('type'); $this->checkCSRFParam(); - $this->config->regenerateToken($type.'_token'); + $this->configModel->regenerateToken($type.'_token'); $this->flash->success(t('Token regenerated.')); $this->response->redirect($this->helper->url->to('ConfigController', $type)); diff --git a/app/Controller/CurrencyController.php b/app/Controller/CurrencyController.php index 5a0fac37..ad590035 100644 --- a/app/Controller/CurrencyController.php +++ b/app/Controller/CurrencyController.php @@ -20,11 +20,11 @@ class CurrencyController extends BaseController public function index(array $values = array(), array $errors = array()) { $this->response->html($this->helper->layout->config('currency/index', array( - 'config_values' => array('application_currency' => $this->config->get('application_currency')), + 'config_values' => array('application_currency' => $this->configModel->get('application_currency')), 'values' => $values, 'errors' => $errors, - 'rates' => $this->currency->getAll(), - 'currencies' => $this->currency->getCurrencies(), + 'rates' => $this->currencyModel->getAll(), + 'currencies' => $this->currencyModel->getCurrencies(), 'title' => t('Settings').' > '.t('Currency rates'), ))); } @@ -40,7 +40,7 @@ class CurrencyController extends BaseController list($valid, $errors) = $this->currencyValidator->validateCreation($values); if ($valid) { - if ($this->currency->create($values['currency'], $values['rate'])) { + if ($this->currencyModel->create($values['currency'], $values['rate'])) { $this->flash->success(t('The currency rate have been added successfully.')); return $this->response->redirect($this->helper->url->to('CurrencyController', 'index')); } else { @@ -60,7 +60,7 @@ class CurrencyController extends BaseController { $values = $this->request->getValues(); - if ($this->config->save($values)) { + if ($this->configModel->save($values)) { $this->flash->success(t('Settings saved successfully.')); } else { $this->flash->failure(t('Unable to save your settings.')); diff --git a/app/Controller/CustomFilterController.php b/app/Controller/CustomFilterController.php index 8dd98764..8bba0856 100644 --- a/app/Controller/CustomFilterController.php +++ b/app/Controller/CustomFilterController.php @@ -27,7 +27,7 @@ class CustomFilterController extends BaseController 'values' => $values + array('project_id' => $project['id']), 'errors' => $errors, 'project' => $project, - 'custom_filters' => $this->customFilter->getAll($project['id'], $this->userSession->getId()), + 'custom_filters' => $this->customFilterModel->getAll($project['id'], $this->userSession->getId()), 'title' => t('Custom filters'), ))); } @@ -47,7 +47,7 @@ class CustomFilterController extends BaseController list($valid, $errors) = $this->customFilterValidator->validateCreation($values); if ($valid) { - if ($this->customFilter->create($values)) { + if ($this->customFilterModel->create($values)) { $this->flash->success(t('Your custom filter have been created successfully.')); return $this->response->redirect($this->helper->url->to('CustomFilterController', 'index', array('project_id' => $project['id']))); } else { @@ -66,7 +66,7 @@ class CustomFilterController extends BaseController public function confirm() { $project = $this->getProject(); - $filter = $this->customFilter->getById($this->request->getIntegerParam('filter_id')); + $filter = $this->customFilterModel->getById($this->request->getIntegerParam('filter_id')); $this->response->html($this->helper->layout->project('custom_filter/remove', array( 'project' => $project, @@ -84,11 +84,11 @@ class CustomFilterController extends BaseController { $this->checkCSRFParam(); $project = $this->getProject(); - $filter = $this->customFilter->getById($this->request->getIntegerParam('filter_id')); + $filter = $this->customFilterModel->getById($this->request->getIntegerParam('filter_id')); $this->checkPermission($project, $filter); - if ($this->customFilter->remove($filter['id'])) { + if ($this->customFilterModel->remove($filter['id'])) { $this->flash->success(t('Custom filter removed successfully.')); } else { $this->flash->failure(t('Unable to remove this custom filter.')); @@ -105,7 +105,7 @@ class CustomFilterController extends BaseController public function edit(array $values = array(), array $errors = array()) { $project = $this->getProject(); - $filter = $this->customFilter->getById($this->request->getIntegerParam('filter_id')); + $filter = $this->customFilterModel->getById($this->request->getIntegerParam('filter_id')); $this->checkPermission($project, $filter); @@ -126,7 +126,7 @@ class CustomFilterController extends BaseController public function update() { $project = $this->getProject(); - $filter = $this->customFilter->getById($this->request->getIntegerParam('filter_id')); + $filter = $this->customFilterModel->getById($this->request->getIntegerParam('filter_id')); $this->checkPermission($project, $filter); @@ -143,7 +143,7 @@ class CustomFilterController extends BaseController list($valid, $errors) = $this->customFilterValidator->validateModification($values); if ($valid) { - if ($this->customFilter->update($values)) { + if ($this->customFilterModel->update($values)) { $this->flash->success(t('Your custom filter have been updated successfully.')); return $this->response->redirect($this->helper->url->to('CustomFilterController', 'index', array('project_id' => $project['id']))); } else { @@ -158,7 +158,7 @@ class CustomFilterController extends BaseController { $user_id = $this->userSession->getId(); - if ($filter['user_id'] != $user_id && ($this->projectUserRole->getUserRole($project['id'], $user_id) === Role::PROJECT_MANAGER || ! $this->userSession->isAdmin())) { + if ($filter['user_id'] != $user_id && ($this->projectUserRoleModel->getUserRole($project['id'], $user_id) === Role::PROJECT_MANAGER || ! $this->userSession->isAdmin())) { throw new AccessForbiddenException(); } } diff --git a/app/Controller/DashboardController.php b/app/Controller/DashboardController.php index 145e0bff..44874546 100644 --- a/app/Controller/DashboardController.php +++ b/app/Controller/DashboardController.php @@ -2,8 +2,8 @@ namespace Kanboard\Controller; -use Kanboard\Model\Project as ProjectModel; -use Kanboard\Model\Subtask as SubtaskModel; +use Kanboard\Model\ProjectModel; +use Kanboard\Model\SubtaskModel; /** * Dashboard Controller @@ -28,7 +28,7 @@ class DashboardController extends BaseController ->setUrl('DashboardController', $action, array('pagination' => 'projects', 'user_id' => $user_id)) ->setMax($max) ->setOrder(ProjectModel::TABLE.'.name') - ->setQuery($this->project->getQueryColumnStats($this->projectPermission->getActiveProjectIds($user_id))) + ->setQuery($this->projectModel->getQueryColumnStats($this->projectPermissionModel->getActiveProjectIds($user_id))) ->calculateOnlyIf($this->request->getStringParam('pagination') === 'projects'); } @@ -47,7 +47,7 @@ class DashboardController extends BaseController ->setUrl('DashboardController', $action, array('pagination' => 'tasks', 'user_id' => $user_id)) ->setMax($max) ->setOrder('tasks.id') - ->setQuery($this->taskFinder->getUserQuery($user_id)) + ->setQuery($this->taskFinderModel->getUserQuery($user_id)) ->calculateOnlyIf($this->request->getStringParam('pagination') === 'tasks'); } @@ -66,7 +66,7 @@ class DashboardController extends BaseController ->setUrl('DashboardController', $action, array('pagination' => 'subtasks', 'user_id' => $user_id)) ->setMax($max) ->setOrder('tasks.id') - ->setQuery($this->subtask->getUserQuery($user_id, array(SubTaskModel::STATUS_TODO, SubtaskModel::STATUS_INPROGRESS))) + ->setQuery($this->subtaskModel->getUserQuery($user_id, array(SubTaskModel::STATUS_TODO, SubtaskModel::STATUS_INPROGRESS))) ->calculateOnlyIf($this->request->getStringParam('pagination') === 'subtasks'); } @@ -147,7 +147,7 @@ class DashboardController extends BaseController $this->response->html($this->helper->layout->dashboard('dashboard/activity', array( 'title' => t('My activity stream'), - 'events' => $this->helper->projectActivity->getProjectsEvents($this->projectPermission->getActiveProjectIds($user['id']), 100), + 'events' => $this->helper->projectActivity->getProjectsEvents($this->projectPermissionModel->getActiveProjectIds($user['id']), 100), 'user' => $user, ))); } @@ -176,7 +176,7 @@ class DashboardController extends BaseController $this->response->html($this->helper->layout->dashboard('dashboard/notifications', array( 'title' => t('My notifications'), - 'notifications' => $this->userUnreadNotification->getAll($user['id']), + 'notifications' => $this->userUnreadNotificationModel->getAll($user['id']), 'user' => $user, ))); } diff --git a/app/Controller/DocumentationController.php b/app/Controller/DocumentationController.php index 379e3dab..d86fb3c8 100644 --- a/app/Controller/DocumentationController.php +++ b/app/Controller/DocumentationController.php @@ -20,7 +20,7 @@ class DocumentationController extends BaseController $page = 'index'; } - if ($this->language->getCurrentLanguage() === 'fr_FR') { + if ($this->languageModel->getCurrentLanguage() === 'fr_FR') { $filename = __DIR__.'/../../doc/fr/' . $page . '.markdown'; } else { $filename = __DIR__ . '/../../doc/' . $page . '.markdown'; @@ -83,7 +83,7 @@ class DocumentationController extends BaseController */ public function replaceImageUrl(array $matches) { - if ($this->language->getCurrentLanguage() === 'fr_FR') { + if ($this->languageModel->getCurrentLanguage() === 'fr_FR') { return '('.$this->helper->url->base().'doc/fr/'.$matches[1].')'; } diff --git a/app/Controller/ExportController.php b/app/Controller/ExportController.php index 4ed9ee08..b2fe0ebd 100644 --- a/app/Controller/ExportController.php +++ b/app/Controller/ExportController.php @@ -42,7 +42,7 @@ class ExportController extends BaseController 'to' => $to, ), 'errors' => array(), - 'date_format' => $this->config->get('application_date_format'), + 'date_format' => $this->configModel->get('application_date_format'), 'date_formats' => $this->dateParser->getAvailableFormats($this->dateParser->getDateFormats()), 'project' => $project, 'title' => $page_title, diff --git a/app/Controller/FeedController.php b/app/Controller/FeedController.php index e453ecb9..cf2b1088 100644 --- a/app/Controller/FeedController.php +++ b/app/Controller/FeedController.php @@ -20,7 +20,7 @@ class FeedController extends BaseController public function user() { $token = $this->request->getStringParam('token'); - $user = $this->user->getByToken($token); + $user = $this->userModel->getByToken($token); // Token verification if (empty($user)) { @@ -28,7 +28,7 @@ class FeedController extends BaseController } $this->response->xml($this->template->render('feed/user', array( - 'events' => $this->helper->projectActivity->getProjectsEvents($this->projectPermission->getActiveProjectIds($user['id'])), + 'events' => $this->helper->projectActivity->getProjectsEvents($this->projectPermissionModel->getActiveProjectIds($user['id'])), 'user' => $user, ))); } @@ -41,7 +41,7 @@ class FeedController extends BaseController public function project() { $token = $this->request->getStringParam('token'); - $project = $this->project->getByToken($token); + $project = $this->projectModel->getByToken($token); if (empty($project)) { throw AccessForbiddenException::getInstance()->withoutLayout(); diff --git a/app/Controller/GroupCreationController.php b/app/Controller/GroupCreationController.php index 7d0bb93c..b297b19f 100644 --- a/app/Controller/GroupCreationController.php +++ b/app/Controller/GroupCreationController.php @@ -36,7 +36,7 @@ class GroupCreationController extends BaseController list($valid, $errors) = $this->groupValidator->validateCreation($values); if ($valid) { - if ($this->group->create($values['name']) !== false) { + if ($this->groupModel->create($values['name']) !== false) { $this->flash->success(t('Group created successfully.')); return $this->response->redirect($this->helper->url->to('GroupListController', 'index'), true); } else { diff --git a/app/Controller/GroupListController.php b/app/Controller/GroupListController.php index 17f3b2a9..4486bbff 100644 --- a/app/Controller/GroupListController.php +++ b/app/Controller/GroupListController.php @@ -21,7 +21,7 @@ class GroupListController extends BaseController ->setUrl('GroupListController', 'index') ->setMax(30) ->setOrder('name') - ->setQuery($this->group->getQuery()) + ->setQuery($this->groupModel->getQuery()) ->calculate(); $this->response->html($this->helper->layout->app('group/index', array( @@ -38,13 +38,13 @@ class GroupListController extends BaseController public function users() { $group_id = $this->request->getIntegerParam('group_id'); - $group = $this->group->getById($group_id); + $group = $this->groupModel->getById($group_id); $paginator = $this->paginator ->setUrl('GroupListController', 'users', array('group_id' => $group_id)) ->setMax(30) ->setOrder('username') - ->setQuery($this->groupMember->getQuery($group_id)) + ->setQuery($this->groupMemberModel->getQuery($group_id)) ->calculate(); $this->response->html($this->helper->layout->app('group/users', array( @@ -64,14 +64,14 @@ class GroupListController extends BaseController public function associate(array $values = array(), array $errors = array()) { $group_id = $this->request->getIntegerParam('group_id'); - $group = $this->group->getById($group_id); + $group = $this->groupModel->getById($group_id); if (empty($values)) { $values['group_id'] = $group_id; } $this->response->html($this->template->render('group/associate', array( - 'users' => $this->user->prepareList($this->groupMember->getNotMembers($group_id)), + 'users' => $this->userModel->prepareList($this->groupMemberModel->getNotMembers($group_id)), 'group' => $group, 'errors' => $errors, 'values' => $values, @@ -88,7 +88,7 @@ class GroupListController extends BaseController $values = $this->request->getValues(); if (isset($values['group_id']) && isset($values['user_id'])) { - if ($this->groupMember->addUser($values['group_id'], $values['user_id'])) { + if ($this->groupMemberModel->addUser($values['group_id'], $values['user_id'])) { $this->flash->success(t('Group member added successfully.')); return $this->response->redirect($this->helper->url->to('GroupListController', 'users', array('group_id' => $values['group_id'])), true); } else { @@ -108,8 +108,8 @@ class GroupListController extends BaseController { $group_id = $this->request->getIntegerParam('group_id'); $user_id = $this->request->getIntegerParam('user_id'); - $group = $this->group->getById($group_id); - $user = $this->user->getById($user_id); + $group = $this->groupModel->getById($group_id); + $user = $this->userModel->getById($user_id); $this->response->html($this->template->render('group/dissociate', array( 'group' => $group, @@ -128,7 +128,7 @@ class GroupListController extends BaseController $group_id = $this->request->getIntegerParam('group_id'); $user_id = $this->request->getIntegerParam('user_id'); - if ($this->groupMember->removeUser($group_id, $user_id)) { + if ($this->groupMemberModel->removeUser($group_id, $user_id)) { $this->flash->success(t('User removed successfully from this group.')); } else { $this->flash->failure(t('Unable to remove this user from the group.')); @@ -145,7 +145,7 @@ class GroupListController extends BaseController public function confirm() { $group_id = $this->request->getIntegerParam('group_id'); - $group = $this->group->getById($group_id); + $group = $this->groupModel->getById($group_id); $this->response->html($this->template->render('group/remove', array( 'group' => $group, @@ -162,7 +162,7 @@ class GroupListController extends BaseController $this->checkCSRFParam(); $group_id = $this->request->getIntegerParam('group_id'); - if ($this->group->remove($group_id)) { + if ($this->groupModel->remove($group_id)) { $this->flash->success(t('Group removed successfully.')); } else { $this->flash->failure(t('Unable to remove this group.')); diff --git a/app/Controller/GroupModificationController.php b/app/Controller/GroupModificationController.php index 1f225a14..bd181b74 100644 --- a/app/Controller/GroupModificationController.php +++ b/app/Controller/GroupModificationController.php @@ -20,7 +20,7 @@ class GroupModificationController extends BaseController public function show(array $values = array(), array $errors = array()) { if (empty($values)) { - $values = $this->group->getById($this->request->getIntegerParam('group_id')); + $values = $this->groupModel->getById($this->request->getIntegerParam('group_id')); } $this->response->html($this->template->render('group_modification/show', array( @@ -40,7 +40,7 @@ class GroupModificationController extends BaseController list($valid, $errors) = $this->groupValidator->validateModification($values); if ($valid) { - if ($this->group->update($values) !== false) { + if ($this->groupModel->update($values) !== false) { $this->flash->success(t('Group updated successfully.')); return $this->response->redirect($this->helper->url->to('GroupListController', 'index'), true); } else { diff --git a/app/Controller/ICalendarController.php b/app/Controller/ICalendarController.php index 78ea4d67..e354c6f1 100644 --- a/app/Controller/ICalendarController.php +++ b/app/Controller/ICalendarController.php @@ -8,7 +8,7 @@ use Kanboard\Filter\TaskAssigneeFilter; use Kanboard\Filter\TaskProjectFilter; use Kanboard\Filter\TaskStatusFilter; use Kanboard\Formatter\TaskICalFormatter; -use Kanboard\Model\Task as TaskModel; +use Kanboard\Model\TaskModel; use Eluceo\iCal\Component\Calendar as iCalendar; /** @@ -27,7 +27,7 @@ class ICalendarController extends BaseController public function user() { $token = $this->request->getStringParam('token'); - $user = $this->user->getByToken($token); + $user = $this->userModel->getByToken($token); // Token verification if (empty($user)) { @@ -37,7 +37,7 @@ class ICalendarController extends BaseController // Common filter $queryBuilder = new QueryBuilder(); $queryBuilder - ->withQuery($this->taskFinder->getICalQuery()) + ->withQuery($this->taskFinderModel->getICalQuery()) ->withFilter(new TaskStatusFilter(TaskModel::STATUS_OPEN)) ->withFilter(new TaskAssigneeFilter($user['id'])); @@ -58,7 +58,7 @@ class ICalendarController extends BaseController public function project() { $token = $this->request->getStringParam('token'); - $project = $this->project->getByToken($token); + $project = $this->projectModel->getByToken($token); // Token verification if (empty($project)) { @@ -68,7 +68,7 @@ class ICalendarController extends BaseController // Common filter $queryBuilder = new QueryBuilder(); $queryBuilder - ->withQuery($this->taskFinder->getICalQuery()) + ->withQuery($this->taskFinderModel->getICalQuery()) ->withFilter(new TaskStatusFilter(TaskModel::STATUS_OPEN)) ->withFilter(new TaskProjectFilter($project['id'])); diff --git a/app/Controller/LinkController.php b/app/Controller/LinkController.php index 08627d40..477b25a4 100644 --- a/app/Controller/LinkController.php +++ b/app/Controller/LinkController.php @@ -22,7 +22,7 @@ class LinkController extends BaseController */ private function getLink() { - $link = $this->link->getById($this->request->getIntegerParam('link_id')); + $link = $this->linkModel->getById($this->request->getIntegerParam('link_id')); if (empty($link)) { throw new PageNotFoundException(); @@ -41,7 +41,7 @@ class LinkController extends BaseController public function index(array $values = array(), array $errors = array()) { $this->response->html($this->helper->layout->config('link/index', array( - 'links' => $this->link->getMergedList(), + 'links' => $this->linkModel->getMergedList(), 'values' => $values, 'errors' => $errors, 'title' => t('Settings').' > '.t('Task\'s links'), @@ -59,7 +59,7 @@ class LinkController extends BaseController list($valid, $errors) = $this->linkValidator->validateCreation($values); if ($valid) { - if ($this->link->create($values['label'], $values['opposite_label']) !== false) { + if ($this->linkModel->create($values['label'], $values['opposite_label']) !== false) { $this->flash->success(t('Link added successfully.')); return $this->response->redirect($this->helper->url->to('LinkController', 'index')); } else { @@ -86,7 +86,7 @@ class LinkController extends BaseController $this->response->html($this->helper->layout->config('link/edit', array( 'values' => $values ?: $link, 'errors' => $errors, - 'labels' => $this->link->getList($link['id']), + 'labels' => $this->linkModel->getList($link['id']), 'link' => $link, 'title' => t('Link modification') ))); @@ -103,7 +103,7 @@ class LinkController extends BaseController list($valid, $errors) = $this->linkValidator->validateModification($values); if ($valid) { - if ($this->link->update($values)) { + if ($this->linkModel->update($values)) { $this->flash->success(t('Link updated successfully.')); return $this->response->redirect($this->helper->url->to('LinkController', 'index')); } else { @@ -139,7 +139,7 @@ class LinkController extends BaseController $this->checkCSRFParam(); $link = $this->getLink(); - if ($this->link->remove($link['id'])) { + if ($this->linkModel->remove($link['id'])) { $this->flash->success(t('Link removed successfully.')); } else { $this->flash->failure(t('Unable to remove this link.')); diff --git a/app/Controller/PasswordResetController.php b/app/Controller/PasswordResetController.php index 9036b3e7..18b4be80 100644 --- a/app/Controller/PasswordResetController.php +++ b/app/Controller/PasswordResetController.php @@ -52,7 +52,7 @@ class PasswordResetController extends BaseController $this->checkActivation(); $token = $this->request->getStringParam('token'); - $user_id = $this->passwordReset->getUserIdByToken($token); + $user_id = $this->passwordResetModel->getUserIdByToken($token); if ($user_id !== false) { $this->response->html($this->helper->layout->app('password_reset/change', array( @@ -78,11 +78,11 @@ class PasswordResetController extends BaseController list($valid, $errors) = $this->passwordResetValidator->validateModification($values); if ($valid) { - $user_id = $this->passwordReset->getUserIdByToken($token); + $user_id = $this->passwordResetModel->getUserIdByToken($token); if ($user_id !== false) { - $this->user->update(array('id' => $user_id, 'password' => $values['password'])); - $this->passwordReset->disable($user_id); + $this->userModel->update(array('id' => $user_id, 'password' => $values['password'])); + $this->passwordResetModel->disable($user_id); } return $this->response->redirect($this->helper->url->to('AuthController', 'login')); @@ -96,10 +96,10 @@ class PasswordResetController extends BaseController */ private function sendEmail($username) { - $token = $this->passwordReset->create($username); + $token = $this->passwordResetModel->create($username); if ($token !== false) { - $user = $this->user->getByUsername($username); + $user = $this->userModel->getByUsername($username); $this->emailClient->send( $user['email'], @@ -115,7 +115,7 @@ class PasswordResetController extends BaseController */ private function checkActivation() { - if ($this->config->get('password_reset', 0) == 0) { + if ($this->configModel->get('password_reset', 0) == 0) { throw AccessForbiddenException::getInstance()->withoutLayout(); } } diff --git a/app/Controller/ProjectActionDuplicationController.php b/app/Controller/ProjectActionDuplicationController.php index 790b7ed3..a4993cca 100644 --- a/app/Controller/ProjectActionDuplicationController.php +++ b/app/Controller/ProjectActionDuplicationController.php @@ -13,7 +13,7 @@ class ProjectActionDuplicationController extends BaseController public function show() { $project = $this->getProject(); - $projects = $this->projectUserRole->getProjectsByUser($this->userSession->getId()); + $projects = $this->projectUserRoleModel->getProjectsByUser($this->userSession->getId()); unset($projects[$project['id']]); $this->response->html($this->template->render('project_action_duplication/show', array( @@ -27,7 +27,7 @@ class ProjectActionDuplicationController extends BaseController $project = $this->getProject(); $src_project_id = $this->request->getValue('src_project_id'); - if ($this->action->duplicate($src_project_id, $project['id'])) { + if ($this->actionModel->duplicate($src_project_id, $project['id'])) { $this->flash->success(t('Actions duplicated successfully.')); } else { $this->flash->failure(t('Unable to duplicate actions.')); diff --git a/app/Controller/ProjectCreationController.php b/app/Controller/ProjectCreationController.php index 4166ead1..c471cfdd 100644 --- a/app/Controller/ProjectCreationController.php +++ b/app/Controller/ProjectCreationController.php @@ -20,7 +20,7 @@ class ProjectCreationController extends BaseController public function create(array $values = array(), array $errors = array()) { $is_private = isset($values['is_private']) && $values['is_private'] == 1; - $projects_list = array(0 => t('Do not duplicate anything')) + $this->projectUserRole->getActiveProjectsByUser($this->userSession->getId()); + $projects_list = array(0 => t('Do not duplicate anything')) + $this->projectUserRoleModel->getActiveProjectsByUser($this->userSession->getId()); $this->response->html($this->helper->layout->app('project_creation/create', array( 'values' => $values, @@ -98,7 +98,7 @@ class ProjectCreationController extends BaseController 'is_private' => $values['is_private'], ); - return $this->project->create($project, $this->userSession->getId(), true); + return $this->projectModel->create($project, $this->userSession->getId(), true); } /** @@ -112,13 +112,13 @@ class ProjectCreationController extends BaseController { $selection = array(); - foreach ($this->projectDuplication->getOptionalSelection() as $item) { + foreach ($this->projectDuplicationModel->getOptionalSelection() as $item) { if (isset($values[$item]) && $values[$item] == 1) { $selection[] = $item; } } - return $this->projectDuplication->duplicate( + return $this->projectDuplicationModel->duplicate( $values['src_project_id'], $selection, $this->userSession->getId(), diff --git a/app/Controller/ProjectEditController.php b/app/Controller/ProjectEditController.php index 64e02d1a..228d681c 100644 --- a/app/Controller/ProjectEditController.php +++ b/app/Controller/ProjectEditController.php @@ -73,7 +73,7 @@ class ProjectEditController extends BaseController list($valid, $errors) = $this->projectValidator->validateModification($values); if ($valid) { - if ($this->project->update($values)) { + if ($this->projectModel->update($values)) { $this->flash->success(t('Project updated successfully.')); return $this->response->redirect($this->helper->url->to('ProjectEditController', $redirect, array('project_id' => $project['id'])), true); } else { @@ -123,7 +123,7 @@ class ProjectEditController extends BaseController $project = $this->getProject(); $this->response->html($this->helper->layout->project($template, array( - 'owners' => $this->projectUserRole->getAssignableUsersList($project['id'], true), + 'owners' => $this->projectUserRoleModel->getAssignableUsersList($project['id'], true), 'values' => empty($values) ? $project : $values, 'errors' => $errors, 'project' => $project, diff --git a/app/Controller/ProjectFileController.php b/app/Controller/ProjectFileController.php index f1bce09d..cbe48679 100644 --- a/app/Controller/ProjectFileController.php +++ b/app/Controller/ProjectFileController.php @@ -34,7 +34,7 @@ class ProjectFileController extends BaseController { $project = $this->getProject(); - if (! $this->projectFile->uploadFiles($project['id'], $this->request->getFileInfo('files'))) { + if (! $this->projectFileModel->uploadFiles($project['id'], $this->request->getFileInfo('files'))) { $this->flash->failure(t('Unable to upload the file.')); } @@ -50,9 +50,9 @@ class ProjectFileController extends BaseController { $this->checkCSRFParam(); $project = $this->getProject(); - $file = $this->projectFile->getById($this->request->getIntegerParam('file_id')); + $file = $this->projectFileModel->getById($this->request->getIntegerParam('file_id')); - if ($this->projectFile->remove($file['id'])) { + if ($this->projectFileModel->remove($file['id'])) { $this->flash->success(t('File removed successfully.')); } else { $this->flash->failure(t('Unable to remove this file.')); @@ -69,7 +69,7 @@ class ProjectFileController extends BaseController public function confirm() { $project = $this->getProject(); - $file = $this->projectFile->getById($this->request->getIntegerParam('file_id')); + $file = $this->projectFileModel->getById($this->request->getIntegerParam('file_id')); $this->response->html($this->template->render('project_file/remove', array( 'project' => $project, diff --git a/app/Controller/ProjectGanttController.php b/app/Controller/ProjectGanttController.php index 1c6ace58..a70d9eee 100644 --- a/app/Controller/ProjectGanttController.php +++ b/app/Controller/ProjectGanttController.php @@ -6,7 +6,7 @@ use Kanboard\Filter\ProjectIdsFilter; use Kanboard\Filter\ProjectStatusFilter; use Kanboard\Filter\ProjectTypeFilter; use Kanboard\Formatter\ProjectGanttFormatter; -use Kanboard\Model\Project; +use Kanboard\Model\ProjectModel; /** * Projects Gantt Controller @@ -21,13 +21,13 @@ class ProjectGanttController extends BaseController */ public function show() { - $project_ids = $this->projectPermission->getActiveProjectIds($this->userSession->getId()); + $project_ids = $this->projectPermissionModel->getActiveProjectIds($this->userSession->getId()); $filter = $this->projectQuery - ->withFilter(new ProjectTypeFilter(Project::TYPE_TEAM)) - ->withFilter(new ProjectStatusFilter(Project::ACTIVE)) + ->withFilter(new ProjectTypeFilter(ProjectModel::TYPE_TEAM)) + ->withFilter(new ProjectStatusFilter(ProjectModel::ACTIVE)) ->withFilter(new ProjectIdsFilter($project_ids)); - $filter->getQuery()->asc(Project::TABLE.'.start_date'); + $filter->getQuery()->asc(ProjectModel::TABLE.'.start_date'); $this->response->html($this->helper->layout->app('project_gantt/show', array( 'projects' => $filter->format(new ProjectGanttFormatter($this->container)), @@ -42,7 +42,7 @@ class ProjectGanttController extends BaseController { $values = $this->request->getJson(); - $result = $this->project->update(array( + $result = $this->projectModel->update(array( 'id' => $values['id'], 'start_date' => $this->dateParser->getIsoDate(strtotime($values['start'])), 'end_date' => $this->dateParser->getIsoDate(strtotime($values['end'])), diff --git a/app/Controller/ProjectListController.php b/app/Controller/ProjectListController.php index 5571b3c9..e1172400 100644 --- a/app/Controller/ProjectListController.php +++ b/app/Controller/ProjectListController.php @@ -18,9 +18,9 @@ class ProjectListController extends BaseController public function show() { if ($this->userSession->isAdmin()) { - $project_ids = $this->project->getAllIds(); + $project_ids = $this->projectModel->getAllIds(); } else { - $project_ids = $this->projectPermission->getActiveProjectIds($this->userSession->getId()); + $project_ids = $this->projectPermissionModel->getActiveProjectIds($this->userSession->getId()); } $nb_projects = count($project_ids); @@ -29,7 +29,7 @@ class ProjectListController extends BaseController ->setUrl('ProjectListController', 'show') ->setMax(20) ->setOrder('name') - ->setQuery($this->project->getQueryColumnStats($project_ids)) + ->setQuery($this->projectModel->getQueryColumnStats($project_ids)) ->calculate(); $this->response->html($this->helper->layout->app('project_list/show', array( diff --git a/app/Controller/ProjectOverviewController.php b/app/Controller/ProjectOverviewController.php index 75cf25ba..abdff657 100644 --- a/app/Controller/ProjectOverviewController.php +++ b/app/Controller/ProjectOverviewController.php @@ -16,17 +16,17 @@ class ProjectOverviewController extends BaseController public function show() { $project = $this->getProject(); - $this->project->getColumnStats($project); + $this->projectModel->getColumnStats($project); $this->response->html($this->helper->layout->app('project_overview/show', array( 'project' => $project, 'title' => $project['name'], 'description' => $this->helper->projectHeader->getDescription($project), - 'users' => $this->projectUserRole->getAllUsersGroupedByRole($project['id']), + 'users' => $this->projectUserRoleModel->getAllUsersGroupedByRole($project['id']), 'roles' => $this->role->getProjectRoles(), 'events' => $this->helper->projectActivity->getProjectEvents($project['id'], 10), - 'images' => $this->projectFile->getAllImages($project['id']), - 'files' => $this->projectFile->getAllDocuments($project['id']), + 'images' => $this->projectFileModel->getAllImages($project['id']), + 'files' => $this->projectFileModel->getAllDocuments($project['id']), ))); } } diff --git a/app/Controller/ProjectPermissionController.php b/app/Controller/ProjectPermissionController.php index d27681b1..f3ca6ed9 100644 --- a/app/Controller/ProjectPermissionController.php +++ b/app/Controller/ProjectPermissionController.php @@ -50,8 +50,8 @@ class ProjectPermissionController extends BaseController $this->response->html($this->helper->layout->project('project_permission/index', array( 'project' => $project, - 'users' => $this->projectUserRole->getUsers($project['id']), - 'groups' => $this->projectGroupRole->getGroups($project['id']), + 'users' => $this->projectUserRoleModel->getUsers($project['id']), + 'groups' => $this->projectGroupRoleModel->getGroups($project['id']), 'roles' => $this->role->getProjectRoles(), 'values' => $values, 'errors' => $errors, @@ -69,7 +69,7 @@ class ProjectPermissionController extends BaseController $project = $this->getProject(); $values = $this->request->getValues() + array('is_everybody_allowed' => 0); - if ($this->project->update($values)) { + if ($this->projectModel->update($values)) { $this->flash->success(t('Project updated successfully.')); } else { $this->flash->failure(t('Unable to update this project.')); @@ -90,7 +90,7 @@ class ProjectPermissionController extends BaseController if (empty($values['user_id'])) { $this->flash->failure(t('User not found.')); - } elseif ($this->projectUserRole->addUser($values['project_id'], $values['user_id'], $values['role'])) { + } elseif ($this->projectUserRoleModel->addUser($values['project_id'], $values['user_id'], $values['role'])) { $this->flash->success(t('Project updated successfully.')); } else { $this->flash->failure(t('Unable to update this project.')); @@ -110,7 +110,7 @@ class ProjectPermissionController extends BaseController $project = $this->getProject(); $user_id = $this->request->getIntegerParam('user_id'); - if ($this->projectUserRole->removeUser($project['id'], $user_id)) { + if ($this->projectUserRoleModel->removeUser($project['id'], $user_id)) { $this->flash->success(t('Project updated successfully.')); } else { $this->flash->failure(t('Unable to update this project.')); @@ -129,7 +129,7 @@ class ProjectPermissionController extends BaseController $project = $this->getProject(); $values = $this->request->getJson(); - if (! empty($project) && ! empty($values) && $this->projectUserRole->changeUserRole($project['id'], $values['id'], $values['role'])) { + if (! empty($project) && ! empty($values) && $this->projectUserRoleModel->changeUserRole($project['id'], $values['id'], $values['role'])) { $this->response->json(array('status' => 'ok')); } else { $this->response->json(array('status' => 'error')); @@ -147,10 +147,10 @@ class ProjectPermissionController extends BaseController $values = $this->request->getValues(); if (empty($values['group_id']) && ! empty($values['external_id'])) { - $values['group_id'] = $this->group->create($values['name'], $values['external_id']); + $values['group_id'] = $this->groupModel->create($values['name'], $values['external_id']); } - if ($this->projectGroupRole->addGroup($project['id'], $values['group_id'], $values['role'])) { + if ($this->projectGroupRoleModel->addGroup($project['id'], $values['group_id'], $values['role'])) { $this->flash->success(t('Project updated successfully.')); } else { $this->flash->failure(t('Unable to update this project.')); @@ -170,7 +170,7 @@ class ProjectPermissionController extends BaseController $project = $this->getProject(); $group_id = $this->request->getIntegerParam('group_id'); - if ($this->projectGroupRole->removeGroup($project['id'], $group_id)) { + if ($this->projectGroupRoleModel->removeGroup($project['id'], $group_id)) { $this->flash->success(t('Project updated successfully.')); } else { $this->flash->failure(t('Unable to update this project.')); @@ -189,7 +189,7 @@ class ProjectPermissionController extends BaseController $project = $this->getProject(); $values = $this->request->getJson(); - if (! empty($project) && ! empty($values) && $this->projectGroupRole->changeGroupRole($project['id'], $values['id'], $values['role'])) { + if (! empty($project) && ! empty($values) && $this->projectGroupRoleModel->changeGroupRole($project['id'], $values['id'], $values['role'])) { $this->response->json(array('status' => 'ok')); } else { $this->response->json(array('status' => 'error')); diff --git a/app/Controller/ProjectStatusController.php b/app/Controller/ProjectStatusController.php index 16ac32b8..78e77870 100644 --- a/app/Controller/ProjectStatusController.php +++ b/app/Controller/ProjectStatusController.php @@ -31,7 +31,7 @@ class ProjectStatusController extends BaseController $project = $this->getProject(); $this->checkCSRFParam(); - if ($this->project->enable($project['id'])) { + if ($this->projectModel->enable($project['id'])) { $this->flash->success(t('Project activated successfully.')); } else { $this->flash->failure(t('Unable to activate this project.')); @@ -61,7 +61,7 @@ class ProjectStatusController extends BaseController $project = $this->getProject(); $this->checkCSRFParam(); - if ($this->project->disable($project['id'])) { + if ($this->projectModel->disable($project['id'])) { $this->flash->success(t('Project disabled successfully.')); } else { $this->flash->failure(t('Unable to disable this project.')); @@ -91,7 +91,7 @@ class ProjectStatusController extends BaseController $project = $this->getProject(); $this->checkCSRFParam(); - if ($this->project->remove($project['id'])) { + if ($this->projectModel->remove($project['id'])) { $this->flash->success(t('Project removed successfully.')); } else { $this->flash->failure(t('Unable to remove this project.')); diff --git a/app/Controller/ProjectUserOverviewController.php b/app/Controller/ProjectUserOverviewController.php index 90887a8a..686de830 100644 --- a/app/Controller/ProjectUserOverviewController.php +++ b/app/Controller/ProjectUserOverviewController.php @@ -2,8 +2,8 @@ namespace Kanboard\Controller; -use Kanboard\Model\User as UserModel; -use Kanboard\Model\Task as TaskModel; +use Kanboard\Model\UserModel; +use Kanboard\Model\TaskModel; use Kanboard\Core\Security\Role; /** @@ -19,19 +19,19 @@ class ProjectUserOverviewController extends BaseController $user_id = $this->request->getIntegerParam('user_id', UserModel::EVERYBODY_ID); if ($this->userSession->isAdmin()) { - $project_ids = $this->project->getAllIds(); + $project_ids = $this->projectModel->getAllIds(); } else { - $project_ids = $this->projectPermission->getActiveProjectIds($this->userSession->getId()); + $project_ids = $this->projectPermissionModel->getActiveProjectIds($this->userSession->getId()); } - return array($user_id, $project_ids, $this->user->getActiveUsersList(true)); + return array($user_id, $project_ids, $this->userModel->getActiveUsersList(true)); } private function role($role, $action, $title, $title_user) { list($user_id, $project_ids, $users) = $this->common(); - $query = $this->projectPermission->getQueryByRole($project_ids, $role)->callback(array($this->project, 'applyColumnStats')); + $query = $this->projectPermissionModel->getQueryByRole($project_ids, $role)->callback(array($this->projectModel, 'applyColumnStats')); if ($user_id !== UserModel::EVERYBODY_ID && isset($users[$user_id])) { $query->eq(UserModel::TABLE.'.id', $user_id); @@ -57,7 +57,7 @@ class ProjectUserOverviewController extends BaseController { list($user_id, $project_ids, $users) = $this->common(); - $query = $this->taskFinder->getProjectUserOverviewQuery($project_ids, $is_active); + $query = $this->taskFinderModel->getProjectUserOverviewQuery($project_ids, $is_active); if ($user_id !== UserModel::EVERYBODY_ID && isset($users[$user_id])) { $query->eq(TaskModel::TABLE.'.owner_id', $user_id); @@ -123,7 +123,7 @@ class ProjectUserOverviewController extends BaseController $project = $this->getProject(); return $this->response->html($this->template->render('project_user_overview/tooltip_users', array( - 'users' => $this->projectUserRole->getAllUsersGroupedByRole($project['id']), + 'users' => $this->projectUserRoleModel->getAllUsersGroupedByRole($project['id']), 'roles' => $this->role->getProjectRoles(), ))); } diff --git a/app/Controller/ProjectViewController.php b/app/Controller/ProjectViewController.php index ca112a41..92b93804 100644 --- a/app/Controller/ProjectViewController.php +++ b/app/Controller/ProjectViewController.php @@ -21,7 +21,7 @@ class ProjectViewController extends BaseController $this->response->html($this->helper->layout->project('project_view/show', array( 'project' => $project, - 'stats' => $this->project->getTaskStats($project['id']), + 'stats' => $this->projectModel->getTaskStats($project['id']), 'title' => $project['name'], ))); } @@ -53,7 +53,7 @@ class ProjectViewController extends BaseController $this->checkCSRFParam(); $switch = $this->request->getStringParam('switch'); - if ($this->project->{$switch.'PublicAccess'}($project['id'])) { + if ($this->projectModel->{$switch.'PublicAccess'}($project['id'])) { $this->flash->success(t('Project updated successfully.')); } else { $this->flash->failure(t('Unable to update this project.')); @@ -74,8 +74,8 @@ class ProjectViewController extends BaseController $this->response->html($this->helper->layout->project('project_view/integrations', array( 'project' => $project, 'title' => t('Integrations'), - 'webhook_token' => $this->config->get('webhook_token'), - 'values' => $this->projectMetadata->getAll($project['id']), + 'webhook_token' => $this->configModel->get('webhook_token'), + 'values' => $this->projectMetadataModel->getAll($project['id']), 'errors' => array(), ))); } @@ -89,7 +89,7 @@ class ProjectViewController extends BaseController { $project = $this->getProject(); - $this->projectMetadata->save($project['id'], $this->request->getValues()); + $this->projectMetadataModel->save($project['id'], $this->request->getValues()); $this->flash->success(t('Project updated successfully.')); $this->response->redirect($this->helper->url->to('ProjectViewController', 'integrations', array('project_id' => $project['id']))); } @@ -104,8 +104,8 @@ class ProjectViewController extends BaseController $project = $this->getProject(); $this->response->html($this->helper->layout->project('project_view/notifications', array( - 'notifications' => $this->projectNotification->readSettings($project['id']), - 'types' => $this->projectNotificationType->getTypes(), + 'notifications' => $this->projectNotificationModel->readSettings($project['id']), + 'types' => $this->projectNotificationTypeModel->getTypes(), 'project' => $project, 'title' => t('Notifications'), ))); @@ -121,7 +121,7 @@ class ProjectViewController extends BaseController $project = $this->getProject(); $values = $this->request->getValues(); - $this->projectNotification->saveSettings($project['id'], $values); + $this->projectNotificationModel->saveSettings($project['id'], $values); $this->flash->success(t('Project updated successfully.')); $this->response->redirect($this->helper->url->to('ProjectViewController', 'notifications', array('project_id' => $project['id']))); } @@ -149,7 +149,7 @@ class ProjectViewController extends BaseController public function doDuplication() { $project = $this->getProject(); - $project_id = $this->projectDuplication->duplicate($project['id'], array_keys($this->request->getValues()), $this->userSession->getId()); + $project_id = $this->projectDuplicationModel->duplicate($project['id'], array_keys($this->request->getValues()), $this->userSession->getId()); if ($project_id !== false) { $this->flash->success(t('Project cloned successfully.')); diff --git a/app/Controller/SearchController.php b/app/Controller/SearchController.php index 88718cf7..8557b182 100644 --- a/app/Controller/SearchController.php +++ b/app/Controller/SearchController.php @@ -14,7 +14,7 @@ class SearchController extends BaseController { public function index() { - $projects = $this->projectUserRole->getProjectsByUser($this->userSession->getId()); + $projects = $this->projectUserRoleModel->getProjectsByUser($this->userSession->getId()); $search = urldecode($this->request->getStringParam('search')); $nb_tasks = 0; diff --git a/app/Controller/SubtaskController.php b/app/Controller/SubtaskController.php index 26659fb4..46061122 100644 --- a/app/Controller/SubtaskController.php +++ b/app/Controller/SubtaskController.php @@ -36,7 +36,7 @@ class SubtaskController extends BaseController $this->response->html($this->template->render('subtask/create', array( 'values' => $values, 'errors' => $errors, - 'users_list' => $this->projectUserRole->getAssignableUsersList($task['project_id']), + 'users_list' => $this->projectUserRoleModel->getAssignableUsersList($task['project_id']), 'task' => $task, ))); } @@ -54,7 +54,7 @@ class SubtaskController extends BaseController list($valid, $errors) = $this->subtaskValidator->validateCreation($values); if ($valid) { - if ($this->subtask->create($values)) { + if ($this->subtaskModel->create($values)) { $this->flash->success(t('Sub-task added successfully.')); } else { $this->flash->failure(t('Unable to create your sub-task.')); @@ -87,8 +87,8 @@ class SubtaskController extends BaseController $this->response->html($this->template->render('subtask/edit', array( 'values' => empty($values) ? $subtask : $values, 'errors' => $errors, - 'users_list' => $this->projectUserRole->getAssignableUsersList($task['project_id']), - 'status_list' => $this->subtask->getStatusList(), + 'users_list' => $this->projectUserRoleModel->getAssignableUsersList($task['project_id']), + 'status_list' => $this->subtaskModel->getStatusList(), 'subtask' => $subtask, 'task' => $task, ))); @@ -108,7 +108,7 @@ class SubtaskController extends BaseController list($valid, $errors) = $this->subtaskValidator->validateModification($values); if ($valid) { - if ($this->subtask->update($values)) { + if ($this->subtaskModel->update($values)) { $this->flash->success(t('Sub-task updated successfully.')); } else { $this->flash->failure(t('Unable to update your sub-task.')); @@ -147,7 +147,7 @@ class SubtaskController extends BaseController $task = $this->getTask(); $subtask = $this->getSubtask(); - if ($this->subtask->remove($subtask['id'])) { + if ($this->subtaskModel->remove($subtask['id'])) { $this->flash->success(t('Sub-task removed successfully.')); } else { $this->flash->failure(t('Unable to remove this sub-task.')); @@ -168,7 +168,7 @@ class SubtaskController extends BaseController $values = $this->request->getJson(); if (! empty($values) && $this->helper->user->hasProjectAccess('SubtaskController', 'movePosition', $project_id)) { - $result = $this->subtask->changePosition($task_id, $values['subtask_id'], $values['position']); + $result = $this->subtaskModel->changePosition($task_id, $values['subtask_id'], $values['position']); $this->response->json(array('result' => $result)); } else { throw new AccessForbiddenException(); diff --git a/app/Controller/SubtaskConverterController.php b/app/Controller/SubtaskConverterController.php index 8a3021e2..65bcd2da 100644 --- a/app/Controller/SubtaskConverterController.php +++ b/app/Controller/SubtaskConverterController.php @@ -26,7 +26,7 @@ class SubtaskConverterController extends BaseController $project = $this->getProject(); $subtask = $this->getSubtask(); - $task_id = $this->subtask->convertToTask($project['id'], $subtask['id']); + $task_id = $this->subtaskModel->convertToTask($project['id'], $subtask['id']); if ($task_id !== false) { $this->flash->success(t('Subtask converted to task successfully.')); diff --git a/app/Controller/SubtaskRestrictionController.php b/app/Controller/SubtaskRestrictionController.php index 77626ba9..084fc0d9 100644 --- a/app/Controller/SubtaskRestrictionController.php +++ b/app/Controller/SubtaskRestrictionController.php @@ -2,7 +2,7 @@ namespace Kanboard\Controller; -use Kanboard\Model\Subtask as SubtaskModel; +use Kanboard\Model\SubtaskModel; /** * Subtask Restriction @@ -27,7 +27,7 @@ class SubtaskRestrictionController extends BaseController SubtaskModel::STATUS_TODO => t('Todo'), SubtaskModel::STATUS_DONE => t('Done'), ), - 'subtask_inprogress' => $this->subtask->getSubtaskInProgress($this->userSession->getId()), + 'subtask_inprogress' => $this->subtaskModel->getSubtaskInProgress($this->userSession->getId()), 'subtask' => $subtask, 'task' => $task, ))); @@ -45,13 +45,13 @@ class SubtaskRestrictionController extends BaseController $values = $this->request->getValues(); // Change status of the previous "in progress" subtask - $this->subtask->update(array( + $this->subtaskModel->update(array( 'id' => $values['id'], 'status' => $values['status'], )); // Set the current subtask to "in progress" - $this->subtask->update(array( + $this->subtaskModel->update(array( 'id' => $subtask['id'], 'status' => SubtaskModel::STATUS_INPROGRESS, )); diff --git a/app/Controller/SubtaskStatusController.php b/app/Controller/SubtaskStatusController.php index 909123ec..699951fe 100644 --- a/app/Controller/SubtaskStatusController.php +++ b/app/Controller/SubtaskStatusController.php @@ -20,7 +20,7 @@ class SubtaskStatusController extends BaseController $task = $this->getTask(); $subtask = $this->getSubtask(); - $status = $this->subtask->toggleStatus($subtask['id']); + $status = $this->subtaskModel->toggleStatus($subtask['id']); if ($this->request->getIntegerParam('refresh-table') === 0) { $subtask['status'] = $status; @@ -44,10 +44,10 @@ class SubtaskStatusController extends BaseController $timer = $this->request->getStringParam('timer'); if ($timer === 'start') { - $this->subtaskTimeTracking->logStartTime($subtask_id, $this->userSession->getId()); + $this->subtaskTimeTrackingModel->logStartTime($subtask_id, $this->userSession->getId()); } elseif ($timer === 'stop') { - $this->subtaskTimeTracking->logEndTime($subtask_id, $this->userSession->getId()); - $this->subtaskTimeTracking->updateTaskTimeTracking($task['id']); + $this->subtaskTimeTrackingModel->logEndTime($subtask_id, $this->userSession->getId()); + $this->subtaskTimeTrackingModel->updateTaskTimeTracking($task['id']); } $this->response->html($this->renderTable($task)); @@ -64,7 +64,7 @@ class SubtaskStatusController extends BaseController { return $this->template->render('subtask/table', array( 'task' => $task, - 'subtasks' => $this->subtask->getAll($task['id']), + 'subtasks' => $this->subtaskModel->getAll($task['id']), 'editable' => true, )); } diff --git a/app/Controller/SwimlaneController.php b/app/Controller/SwimlaneController.php index 13a64d40..4b9567e6 100644 --- a/app/Controller/SwimlaneController.php +++ b/app/Controller/SwimlaneController.php @@ -4,7 +4,7 @@ namespace Kanboard\Controller; use Kanboard\Core\Controller\AccessForbiddenException; use Kanboard\Core\Controller\PageNotFoundException; -use Kanboard\Model\Swimlane as SwimlaneModel; +use Kanboard\Model\SwimlaneModel; /** * Swimlanes Controller @@ -23,7 +23,7 @@ class SwimlaneController extends BaseController */ private function getSwimlane() { - $swimlane = $this->swimlane->getById($this->request->getIntegerParam('swimlane_id')); + $swimlane = $this->swimlaneModel->getById($this->request->getIntegerParam('swimlane_id')); if (empty($swimlane)) { throw new PageNotFoundException(); @@ -42,9 +42,9 @@ class SwimlaneController extends BaseController $project = $this->getProject(); $this->response->html($this->helper->layout->project('swimlane/index', array( - 'default_swimlane' => $this->swimlane->getDefault($project['id']), - 'active_swimlanes' => $this->swimlane->getAllByStatus($project['id'], SwimlaneModel::ACTIVE), - 'inactive_swimlanes' => $this->swimlane->getAllByStatus($project['id'], SwimlaneModel::INACTIVE), + 'default_swimlane' => $this->swimlaneModel->getDefault($project['id']), + 'active_swimlanes' => $this->swimlaneModel->getAllByStatus($project['id'], SwimlaneModel::ACTIVE), + 'inactive_swimlanes' => $this->swimlaneModel->getAllByStatus($project['id'], SwimlaneModel::INACTIVE), 'project' => $project, 'title' => t('Swimlanes') ))); @@ -81,7 +81,7 @@ class SwimlaneController extends BaseController list($valid, $errors) = $this->swimlaneValidator->validateCreation($values); if ($valid) { - if ($this->swimlane->create($values)) { + if ($this->swimlaneModel->create($values)) { $this->flash->success(t('Your swimlane have been created successfully.')); return $this->response->redirect($this->helper->url->to('SwimlaneController', 'index', array('project_id' => $project['id']))); } else { @@ -103,7 +103,7 @@ class SwimlaneController extends BaseController public function editDefault(array $values = array(), array $errors = array()) { $project = $this->getProject(); - $swimlane = $this->swimlane->getDefault($project['id']); + $swimlane = $this->swimlaneModel->getDefault($project['id']); $this->response->html($this->helper->layout->project('swimlane/edit_default', array( 'values' => empty($values) ? $swimlane : $values, @@ -125,7 +125,7 @@ class SwimlaneController extends BaseController list($valid, $errors) = $this->swimlaneValidator->validateDefaultModification($values); if ($valid) { - if ($this->swimlane->updateDefault($values)) { + if ($this->swimlaneModel->updateDefault($values)) { $this->flash->success(t('The default swimlane have been updated successfully.')); return $this->response->redirect($this->helper->url->to('SwimlaneController', 'index', array('project_id' => $project['id'])), true); } else { @@ -169,7 +169,7 @@ class SwimlaneController extends BaseController list($valid, $errors) = $this->swimlaneValidator->validateModification($values); if ($valid) { - if ($this->swimlane->update($values)) { + if ($this->swimlaneModel->update($values)) { $this->flash->success(t('Swimlane updated successfully.')); return $this->response->redirect($this->helper->url->to('SwimlaneController', 'index', array('project_id' => $project['id']))); } else { @@ -207,7 +207,7 @@ class SwimlaneController extends BaseController $project = $this->getProject(); $swimlane_id = $this->request->getIntegerParam('swimlane_id'); - if ($this->swimlane->remove($project['id'], $swimlane_id)) { + if ($this->swimlaneModel->remove($project['id'], $swimlane_id)) { $this->flash->success(t('Swimlane removed successfully.')); } else { $this->flash->failure(t('Unable to remove this swimlane.')); @@ -227,7 +227,7 @@ class SwimlaneController extends BaseController $project = $this->getProject(); $swimlane_id = $this->request->getIntegerParam('swimlane_id'); - if ($this->swimlane->disable($project['id'], $swimlane_id)) { + if ($this->swimlaneModel->disable($project['id'], $swimlane_id)) { $this->flash->success(t('Swimlane updated successfully.')); } else { $this->flash->failure(t('Unable to update this swimlane.')); @@ -246,7 +246,7 @@ class SwimlaneController extends BaseController $this->checkCSRFParam(); $project = $this->getProject(); - if ($this->swimlane->disableDefault($project['id'])) { + if ($this->swimlaneModel->disableDefault($project['id'])) { $this->flash->success(t('Swimlane updated successfully.')); } else { $this->flash->failure(t('Unable to update this swimlane.')); @@ -266,7 +266,7 @@ class SwimlaneController extends BaseController $project = $this->getProject(); $swimlane_id = $this->request->getIntegerParam('swimlane_id'); - if ($this->swimlane->enable($project['id'], $swimlane_id)) { + if ($this->swimlaneModel->enable($project['id'], $swimlane_id)) { $this->flash->success(t('Swimlane updated successfully.')); } else { $this->flash->failure(t('Unable to update this swimlane.')); @@ -285,7 +285,7 @@ class SwimlaneController extends BaseController $this->checkCSRFParam(); $project = $this->getProject(); - if ($this->swimlane->enableDefault($project['id'])) { + if ($this->swimlaneModel->enableDefault($project['id'])) { $this->flash->success(t('Swimlane updated successfully.')); } else { $this->flash->failure(t('Unable to update this swimlane.')); @@ -305,7 +305,7 @@ class SwimlaneController extends BaseController $values = $this->request->getJson(); if (! empty($values) && isset($values['swimlane_id']) && isset($values['position'])) { - $result = $this->swimlane->changePosition($project['id'], $values['swimlane_id'], $values['position']); + $result = $this->swimlaneModel->changePosition($project['id'], $values['swimlane_id'], $values['position']); $this->response->json(array('result' => $result)); } else { throw new AccessForbiddenException(); diff --git a/app/Controller/TaskAjaxController.php b/app/Controller/TaskAjaxController.php index d630b962..f9feff15 100644 --- a/app/Controller/TaskAjaxController.php +++ b/app/Controller/TaskAjaxController.php @@ -24,7 +24,7 @@ class TaskAjaxController extends BaseController public function autocomplete() { $search = $this->request->getStringParam('term'); - $project_ids = $this->projectPermission->getActiveProjectIds($this->userSession->getId()); + $project_ids = $this->projectPermissionModel->getActiveProjectIds($this->userSession->getId()); $exclude_task_id = $this->request->getIntegerParam('exclude_task_id'); if (empty($project_ids)) { diff --git a/app/Controller/TaskBulkController.php b/app/Controller/TaskBulkController.php index 528ae7a3..df7f589b 100644 --- a/app/Controller/TaskBulkController.php +++ b/app/Controller/TaskBulkController.php @@ -32,9 +32,9 @@ class TaskBulkController extends BaseController 'project' => $project, 'values' => $values, 'errors' => $errors, - 'users_list' => $this->projectUserRole->getAssignableUsersList($project['id'], true, false, true), - 'colors_list' => $this->color->getList(), - 'categories_list' => $this->category->getList($project['id']), + 'users_list' => $this->projectUserRoleModel->getAssignableUsersList($project['id'], true, false, true), + 'colors_list' => $this->colorModel->getList(), + 'categories_list' => $this->categoryModel->getList($project['id']), ))); } @@ -74,7 +74,7 @@ class TaskBulkController extends BaseController $title = trim($title); if (! empty($title)) { - $this->taskCreation->create(array( + $this->taskCreationModel->create(array( 'title' => $title, 'column_id' => $values['column_id'], 'swimlane_id' => $values['swimlane_id'], diff --git a/app/Controller/TaskCreationController.php b/app/Controller/TaskCreationController.php index b7af6d87..819de96e 100644 --- a/app/Controller/TaskCreationController.php +++ b/app/Controller/TaskCreationController.php @@ -21,13 +21,13 @@ class TaskCreationController extends BaseController public function show(array $values = array(), array $errors = array()) { $project = $this->getProject(); - $swimlanes_list = $this->swimlane->getList($project['id'], false, true); + $swimlanes_list = $this->swimlaneModel->getList($project['id'], false, true); if (empty($values)) { $values = array( 'swimlane_id' => $this->request->getIntegerParam('swimlane_id', key($swimlanes_list)), 'column_id' => $this->request->getIntegerParam('column_id'), - 'color_id' => $this->color->getDefaultColor(), + 'color_id' => $this->colorModel->getDefaultColor(), 'owner_id' => $this->userSession->getId(), ); @@ -39,10 +39,10 @@ class TaskCreationController extends BaseController 'project' => $project, 'errors' => $errors, 'values' => $values + array('project_id' => $project['id']), - 'columns_list' => $this->column->getList($project['id']), - 'users_list' => $this->projectUserRole->getAssignableUsersList($project['id'], true, false, true), - 'colors_list' => $this->color->getList(), - 'categories_list' => $this->category->getList($project['id']), + 'columns_list' => $this->columnModel->getList($project['id']), + 'users_list' => $this->projectUserRoleModel->getAssignableUsersList($project['id'], true, false, true), + 'colors_list' => $this->colorModel->getList(), + 'categories_list' => $this->categoryModel->getList($project['id']), 'swimlanes_list' => $swimlanes_list, 'title' => $project['name'].' > '.t('New task') ))); @@ -60,7 +60,7 @@ class TaskCreationController extends BaseController list($valid, $errors) = $this->taskValidator->validateCreation($values); - if ($valid && $this->taskCreation->create($values)) { + if ($valid && $this->taskCreationModel->create($values)) { $this->flash->success(t('Task created successfully.')); return $this->afterSave($project, $values); } diff --git a/app/Controller/TaskDuplicationController.php b/app/Controller/TaskDuplicationController.php index ab7b6b42..6a475374 100644 --- a/app/Controller/TaskDuplicationController.php +++ b/app/Controller/TaskDuplicationController.php @@ -21,7 +21,7 @@ class TaskDuplicationController extends BaseController if ($this->request->getStringParam('confirmation') === 'yes') { $this->checkCSRFParam(); - $task_id = $this->taskDuplication->duplicate($task['id']); + $task_id = $this->taskDuplicationModel->duplicate($task['id']); if ($task_id > 0) { $this->flash->success(t('Task created successfully.')); @@ -50,7 +50,7 @@ class TaskDuplicationController extends BaseController $values = $this->request->getValues(); list($valid, ) = $this->taskValidator->validateProjectModification($values); - if ($valid && $this->taskDuplication->moveToProject($task['id'], + if ($valid && $this->taskDuplicationModel->moveToProject($task['id'], $values['project_id'], $values['swimlane_id'], $values['column_id'], @@ -80,7 +80,7 @@ class TaskDuplicationController extends BaseController list($valid, ) = $this->taskValidator->validateProjectModification($values); if ($valid) { - $task_id = $this->taskDuplication->duplicateToProject( + $task_id = $this->taskDuplicationModel->duplicateToProject( $task['id'], $values['project_id'], $values['swimlane_id'], $values['column_id'], $values['category_id'], $values['owner_id'] ); @@ -107,19 +107,19 @@ class TaskDuplicationController extends BaseController private function chooseDestination(array $task, $template) { $values = array(); - $projects_list = $this->projectUserRole->getActiveProjectsByUser($this->userSession->getId()); + $projects_list = $this->projectUserRoleModel->getActiveProjectsByUser($this->userSession->getId()); unset($projects_list[$task['project_id']]); if (! empty($projects_list)) { $dst_project_id = $this->request->getIntegerParam('dst_project_id', key($projects_list)); - $swimlanes_list = $this->swimlane->getList($dst_project_id, false, true); - $columns_list = $this->column->getList($dst_project_id); - $categories_list = $this->category->getList($dst_project_id); - $users_list = $this->projectUserRole->getAssignableUsersList($dst_project_id); + $swimlanes_list = $this->swimlaneModel->getList($dst_project_id, false, true); + $columns_list = $this->columnModel->getList($dst_project_id); + $categories_list = $this->categoryModel->getList($dst_project_id); + $users_list = $this->projectUserRoleModel->getAssignableUsersList($dst_project_id); - $values = $this->taskDuplication->checkDestinationProjectValues($task); + $values = $this->taskDuplicationModel->checkDestinationProjectValues($task); $values['project_id'] = $dst_project_id; } else { $swimlanes_list = array(); diff --git a/app/Controller/TaskExternalLinkController.php b/app/Controller/TaskExternalLinkController.php index 91dc734a..f3c6050d 100644 --- a/app/Controller/TaskExternalLinkController.php +++ b/app/Controller/TaskExternalLinkController.php @@ -76,7 +76,7 @@ class TaskExternalLinkController extends BaseController $values = $this->request->getValues(); list($valid, $errors) = $this->externalLinkValidator->validateCreation($values); - if ($valid && $this->taskExternalLink->create($values)) { + if ($valid && $this->taskExternalLinkModel->create($values)) { $this->flash->success(t('Link added successfully.')); return $this->response->redirect($this->helper->url->to('TaskViewController', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])), true); } @@ -100,7 +100,7 @@ class TaskExternalLinkController extends BaseController $link_id = $this->request->getIntegerParam('link_id'); if ($link_id > 0) { - $values = $this->taskExternalLink->getById($link_id); + $values = $this->taskExternalLinkModel->getById($link_id); } if (empty($values)) { @@ -128,7 +128,7 @@ class TaskExternalLinkController extends BaseController $values = $this->request->getValues(); list($valid, $errors) = $this->externalLinkValidator->validateModification($values); - if ($valid && $this->taskExternalLink->update($values)) { + if ($valid && $this->taskExternalLinkModel->update($values)) { $this->flash->success(t('Link updated successfully.')); return $this->response->redirect($this->helper->url->to('TaskViewController', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])), true); } @@ -145,7 +145,7 @@ class TaskExternalLinkController extends BaseController { $task = $this->getTask(); $link_id = $this->request->getIntegerParam('link_id'); - $link = $this->taskExternalLink->getById($link_id); + $link = $this->taskExternalLinkModel->getById($link_id); if (empty($link)) { throw new PageNotFoundException(); @@ -167,7 +167,7 @@ class TaskExternalLinkController extends BaseController $this->checkCSRFParam(); $task = $this->getTask(); - if ($this->taskExternalLink->remove($this->request->getIntegerParam('link_id'))) { + if ($this->taskExternalLinkModel->remove($this->request->getIntegerParam('link_id'))) { $this->flash->success(t('Link removed successfully.')); } else { $this->flash->failure(t('Unable to remove this link.')); diff --git a/app/Controller/TaskFileController.php b/app/Controller/TaskFileController.php index 44c19c27..77c0c026 100644 --- a/app/Controller/TaskFileController.php +++ b/app/Controller/TaskFileController.php @@ -19,7 +19,7 @@ class TaskFileController extends BaseController { $task = $this->getTask(); - if ($this->request->isPost() && $this->taskFile->uploadScreenshot($task['id'], $this->request->getValue('screenshot')) !== false) { + if ($this->request->isPost() && $this->taskFileModel->uploadScreenshot($task['id'], $this->request->getValue('screenshot')) !== false) { $this->flash->success(t('Screenshot uploaded successfully.')); return $this->response->redirect($this->helper->url->to('TaskViewController', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])), true); } @@ -53,7 +53,7 @@ class TaskFileController extends BaseController { $task = $this->getTask(); - if (! $this->taskFile->uploadFiles($task['id'], $this->request->getFileInfo('files'))) { + if (! $this->taskFileModel->uploadFiles($task['id'], $this->request->getFileInfo('files'))) { $this->flash->failure(t('Unable to upload the file.')); } @@ -69,9 +69,9 @@ class TaskFileController extends BaseController { $this->checkCSRFParam(); $task = $this->getTask(); - $file = $this->taskFile->getById($this->request->getIntegerParam('file_id')); + $file = $this->taskFileModel->getById($this->request->getIntegerParam('file_id')); - if ($file['task_id'] == $task['id'] && $this->taskFile->remove($file['id'])) { + if ($file['task_id'] == $task['id'] && $this->taskFileModel->remove($file['id'])) { $this->flash->success(t('File removed successfully.')); } else { $this->flash->failure(t('Unable to remove this file.')); @@ -88,7 +88,7 @@ class TaskFileController extends BaseController public function confirm() { $task = $this->getTask(); - $file = $this->taskFile->getById($this->request->getIntegerParam('file_id')); + $file = $this->taskFileModel->getById($this->request->getIntegerParam('file_id')); $this->response->html($this->template->render('task_file/remove', array( 'task' => $task, diff --git a/app/Controller/TaskGanttController.php b/app/Controller/TaskGanttController.php index 3d0c5f50..868368e1 100644 --- a/app/Controller/TaskGanttController.php +++ b/app/Controller/TaskGanttController.php @@ -4,7 +4,7 @@ namespace Kanboard\Controller; use Kanboard\Filter\TaskProjectFilter; use Kanboard\Formatter\TaskGanttFormatter; -use Kanboard\Model\Task as TaskModel; +use Kanboard\Model\TaskModel; /** * Tasks Gantt Controller @@ -47,7 +47,7 @@ class TaskGanttController extends BaseController $this->getProject(); $values = $this->request->getJson(); - $result = $this->taskModification->update(array( + $result = $this->taskModificationModel->update(array( 'id' => $values['id'], 'date_started' => strtotime($values['start']), 'date_due' => strtotime($values['end']), diff --git a/app/Controller/TaskGanttCreationController.php b/app/Controller/TaskGanttCreationController.php index 0ae4ab3b..c2998a3e 100644 --- a/app/Controller/TaskGanttCreationController.php +++ b/app/Controller/TaskGanttCreationController.php @@ -24,7 +24,7 @@ class TaskGanttCreationController extends BaseController $values = $values + array( 'project_id' => $project['id'], - 'column_id' => $this->column->getFirstColumnId($project['id']), + 'column_id' => $this->columnModel->getFirstColumnId($project['id']), 'position' => 1 ); @@ -35,10 +35,10 @@ class TaskGanttCreationController extends BaseController 'project' => $project, 'errors' => $errors, 'values' => $values, - 'users_list' => $this->projectUserRole->getAssignableUsersList($project['id'], true, false, true), - 'colors_list' => $this->color->getList(), - 'categories_list' => $this->category->getList($project['id']), - 'swimlanes_list' => $this->swimlane->getList($project['id'], false, true), + 'users_list' => $this->projectUserRoleModel->getAssignableUsersList($project['id'], true, false, true), + 'colors_list' => $this->colorModel->getList(), + 'categories_list' => $this->categoryModel->getList($project['id']), + 'swimlanes_list' => $this->swimlaneModel->getList($project['id'], false, true), 'title' => $project['name'].' > '.t('New task') ))); } @@ -56,7 +56,7 @@ class TaskGanttCreationController extends BaseController list($valid, $errors) = $this->taskValidator->validateCreation($values); if ($valid) { - $task_id = $this->taskCreation->create($values); + $task_id = $this->taskCreationModel->create($values); if ($task_id !== false) { $this->flash->success(t('Task created successfully.')); diff --git a/app/Controller/TaskInternalLinkController.php b/app/Controller/TaskInternalLinkController.php index 4018c3a5..a140f1ff 100644 --- a/app/Controller/TaskInternalLinkController.php +++ b/app/Controller/TaskInternalLinkController.php @@ -22,7 +22,7 @@ class TaskInternalLinkController extends BaseController */ private function getTaskLink() { - $link = $this->taskLink->getById($this->request->getIntegerParam('link_id')); + $link = $this->taskLinkModel->getById($this->request->getIntegerParam('link_id')); if (empty($link)) { throw new PageNotFoundException(); @@ -48,7 +48,7 @@ class TaskInternalLinkController extends BaseController 'values' => $values, 'errors' => $errors, 'task' => $task, - 'labels' => $this->link->getList(0, false), + 'labels' => $this->linkModel->getList(0, false), ))); } @@ -65,7 +65,7 @@ class TaskInternalLinkController extends BaseController list($valid, $errors) = $this->taskLinkValidator->validateCreation($values); if ($valid) { - if ($this->taskLink->create($values['task_id'], $values['opposite_task_id'], $values['link_id'])) { + if ($this->taskLinkModel->create($values['task_id'], $values['opposite_task_id'], $values['link_id'])) { $this->flash->success(t('Link added successfully.')); return $this->response->redirect($this->helper->url->to('TaskViewController', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])), true); } @@ -92,7 +92,7 @@ class TaskInternalLinkController extends BaseController $task_link = $this->getTaskLink(); if (empty($values)) { - $opposite_task = $this->taskFinder->getById($task_link['opposite_task_id']); + $opposite_task = $this->taskFinderModel->getById($task_link['opposite_task_id']); $values = $task_link; $values['title'] = '#'.$opposite_task['id'].' - '.$opposite_task['title']; } @@ -102,7 +102,7 @@ class TaskInternalLinkController extends BaseController 'errors' => $errors, 'task_link' => $task_link, 'task' => $task, - 'labels' => $this->link->getList(0, false) + 'labels' => $this->linkModel->getList(0, false) ))); } @@ -119,7 +119,7 @@ class TaskInternalLinkController extends BaseController list($valid, $errors) = $this->taskLinkValidator->validateModification($values); if ($valid) { - if ($this->taskLink->update($values['id'], $values['task_id'], $values['opposite_task_id'], $values['link_id'])) { + if ($this->taskLinkModel->update($values['id'], $values['task_id'], $values['opposite_task_id'], $values['link_id'])) { $this->flash->success(t('Link updated successfully.')); return $this->response->redirect($this->helper->url->to('TaskViewController', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])).'#links'); } @@ -156,7 +156,7 @@ class TaskInternalLinkController extends BaseController $this->checkCSRFParam(); $task = $this->getTask(); - if ($this->taskLink->remove($this->request->getIntegerParam('link_id'))) { + if ($this->taskLinkModel->remove($this->request->getIntegerParam('link_id'))) { $this->flash->success(t('Link removed successfully.')); } else { $this->flash->failure(t('Unable to remove this link.')); diff --git a/app/Controller/TaskListController.php b/app/Controller/TaskListController.php index 898c14c8..c6d1fa92 100644 --- a/app/Controller/TaskListController.php +++ b/app/Controller/TaskListController.php @@ -3,7 +3,7 @@ namespace Kanboard\Controller; use Kanboard\Filter\TaskProjectFilter; -use Kanboard\Model\Task as TaskModel; +use Kanboard\Model\TaskModel; /** * Task List Controller diff --git a/app/Controller/TaskModificationController.php b/app/Controller/TaskModificationController.php index 09a8fabe..fc9113dd 100644 --- a/app/Controller/TaskModificationController.php +++ b/app/Controller/TaskModificationController.php @@ -20,7 +20,7 @@ class TaskModificationController extends BaseController public function start() { $task = $this->getTask(); - $this->taskModification->update(array('id' => $task['id'], 'date_started' => time())); + $this->taskModificationModel->update(array('id' => $task['id'], 'date_started' => time())); $this->response->redirect($this->helper->url->to('TaskViewController', 'show', array('project_id' => $task['project_id'], 'task_id' => $task['id']))); } @@ -61,7 +61,7 @@ class TaskModificationController extends BaseController list($valid, $errors) = $this->taskValidator->validateDescriptionCreation($values); if ($valid) { - if ($this->taskModification->update($values)) { + if ($this->taskModificationModel->update($values)) { $this->flash->success(t('Task updated successfully.')); } else { $this->flash->failure(t('Unable to update your task.')); @@ -85,7 +85,7 @@ class TaskModificationController extends BaseController public function edit(array $values = array(), array $errors = array()) { $task = $this->getTask(); - $project = $this->project->getById($task['project_id']); + $project = $this->projectModel->getById($task['project_id']); if (empty($values)) { $values = $task; @@ -93,17 +93,17 @@ class TaskModificationController extends BaseController $values = $this->hook->merge('controller:task-modification:form:default', $values, array('default_values' => $values)); } - $values = $this->dateParser->format($values, array('date_due'), $this->config->get('application_date_format', DateParser::DATE_FORMAT)); - $values = $this->dateParser->format($values, array('date_started'), $this->config->get('application_datetime_format', DateParser::DATE_TIME_FORMAT)); + $values = $this->dateParser->format($values, array('date_due'), $this->configModel->get('application_date_format', DateParser::DATE_FORMAT)); + $values = $this->dateParser->format($values, array('date_started'), $this->configModel->get('application_datetime_format', DateParser::DATE_TIME_FORMAT)); $this->response->html($this->template->render('task_modification/edit_task', array( 'project' => $project, 'values' => $values, 'errors' => $errors, 'task' => $task, - 'users_list' => $this->projectUserRole->getAssignableUsersList($task['project_id']), - 'colors_list' => $this->color->getList(), - 'categories_list' => $this->category->getList($task['project_id']), + 'users_list' => $this->projectUserRoleModel->getAssignableUsersList($task['project_id']), + 'colors_list' => $this->colorModel->getList(), + 'categories_list' => $this->categoryModel->getList($task['project_id']), ))); } @@ -119,7 +119,7 @@ class TaskModificationController extends BaseController list($valid, $errors) = $this->taskValidator->validateModification($values); - if ($valid && $this->taskModification->update($values)) { + if ($valid && $this->taskModificationModel->update($values)) { $this->flash->success(t('Task updated successfully.')); $this->response->redirect($this->helper->url->to('TaskViewController', 'show', array('project_id' => $task['project_id'], 'task_id' => $task['id'])), true); } else { diff --git a/app/Controller/TaskPopoverController.php b/app/Controller/TaskPopoverController.php index 9916a5d1..bf4e23d5 100644 --- a/app/Controller/TaskPopoverController.php +++ b/app/Controller/TaskPopoverController.php @@ -18,11 +18,11 @@ class TaskPopoverController extends BaseController public function changeAssignee() { $task = $this->getTask(); - $project = $this->project->getById($task['project_id']); + $project = $this->projectModel->getById($task['project_id']); $this->response->html($this->template->render('task_popover/change_assignee', array( 'values' => $task, - 'users_list' => $this->projectUserRole->getAssignableUsersList($project['id']), + 'users_list' => $this->projectUserRoleModel->getAssignableUsersList($project['id']), 'project' => $project, ))); } @@ -38,7 +38,7 @@ class TaskPopoverController extends BaseController list($valid,) = $this->taskValidator->validateAssigneeModification($values); - if ($valid && $this->taskModification->update($values)) { + if ($valid && $this->taskModificationModel->update($values)) { $this->flash->success(t('Task updated successfully.')); } else { $this->flash->failure(t('Unable to update your task.')); @@ -55,11 +55,11 @@ class TaskPopoverController extends BaseController public function changeCategory() { $task = $this->getTask(); - $project = $this->project->getById($task['project_id']); + $project = $this->projectModel->getById($task['project_id']); $this->response->html($this->template->render('task_popover/change_category', array( 'values' => $task, - 'categories_list' => $this->category->getList($project['id']), + 'categories_list' => $this->categoryModel->getList($project['id']), 'project' => $project, ))); } @@ -75,7 +75,7 @@ class TaskPopoverController extends BaseController list($valid,) = $this->taskValidator->validateCategoryModification($values); - if ($valid && $this->taskModification->update($values)) { + if ($valid && $this->taskModificationModel->update($values)) { $this->flash->success(t('Task updated successfully.')); } else { $this->flash->failure(t('Unable to update your task.')); diff --git a/app/Controller/TaskRecurrenceController.php b/app/Controller/TaskRecurrenceController.php index cd9a2c92..dc7a0e1b 100644 --- a/app/Controller/TaskRecurrenceController.php +++ b/app/Controller/TaskRecurrenceController.php @@ -31,10 +31,10 @@ class TaskRecurrenceController extends BaseController 'values' => $values, 'errors' => $errors, 'task' => $task, - 'recurrence_status_list' => $this->task->getRecurrenceStatusList(), - 'recurrence_trigger_list' => $this->task->getRecurrenceTriggerList(), - 'recurrence_timeframe_list' => $this->task->getRecurrenceTimeframeList(), - 'recurrence_basedate_list' => $this->task->getRecurrenceBasedateList(), + 'recurrence_status_list' => $this->taskModel->getRecurrenceStatusList(), + 'recurrence_trigger_list' => $this->taskModel->getRecurrenceTriggerList(), + 'recurrence_timeframe_list' => $this->taskModel->getRecurrenceTimeframeList(), + 'recurrence_basedate_list' => $this->taskModel->getRecurrenceBasedateList(), ))); } @@ -51,7 +51,7 @@ class TaskRecurrenceController extends BaseController list($valid, $errors) = $this->taskValidator->validateEditRecurrence($values); if ($valid) { - if ($this->taskModification->update($values)) { + if ($this->taskModificationModel->update($values)) { $this->flash->success(t('Task updated successfully.')); } else { $this->flash->failure(t('Unable to update your task.')); diff --git a/app/Controller/TaskStatusController.php b/app/Controller/TaskStatusController.php index 98ab4e1e..82b4f9c4 100644 --- a/app/Controller/TaskStatusController.php +++ b/app/Controller/TaskStatusController.php @@ -46,7 +46,7 @@ class TaskStatusController extends BaseController if ($this->request->getStringParam('confirmation') === 'yes') { $this->checkCSRFParam(); - if ($this->taskStatus->$method($task['id'])) { + if ($this->taskStatusModel->$method($task['id'])) { $this->flash->success($success_message); } else { $this->flash->failure($failure_message); diff --git a/app/Controller/TaskSuppressionController.php b/app/Controller/TaskSuppressionController.php index 7c9165eb..600107c9 100644 --- a/app/Controller/TaskSuppressionController.php +++ b/app/Controller/TaskSuppressionController.php @@ -41,7 +41,7 @@ class TaskSuppressionController extends BaseController throw new AccessForbiddenException(); } - if ($this->task->remove($task['id'])) { + if ($this->taskModel->remove($task['id'])) { $this->flash->success(t('Task removed successfully.')); } else { $this->flash->failure(t('Unable to remove this task.')); diff --git a/app/Controller/TaskViewController.php b/app/Controller/TaskViewController.php index b16c15de..2a79ee45 100644 --- a/app/Controller/TaskViewController.php +++ b/app/Controller/TaskViewController.php @@ -21,14 +21,14 @@ class TaskViewController extends BaseController */ public function readonly() { - $project = $this->project->getByToken($this->request->getStringParam('token')); + $project = $this->projectModel->getByToken($this->request->getStringParam('token')); // Token verification if (empty($project)) { throw AccessForbiddenException::getInstance()->withoutLayout(); } - $task = $this->taskFinder->getDetails($this->request->getIntegerParam('task_id')); + $task = $this->taskFinderModel->getDetails($this->request->getIntegerParam('task_id')); if (empty($task)) { throw PageNotFoundException::getInstance()->withoutLayout(); @@ -40,12 +40,12 @@ class TaskViewController extends BaseController $this->response->html($this->helper->layout->app('task/public', array( 'project' => $project, - 'comments' => $this->comment->getAll($task['id']), - 'subtasks' => $this->subtask->getAll($task['id']), - 'links' => $this->taskLink->getAllGroupedByLabel($task['id']), + 'comments' => $this->commentModel->getAll($task['id']), + 'subtasks' => $this->subtaskModel->getAll($task['id']), + 'links' => $this->taskLinkModel->getAllGroupedByLabel($task['id']), 'task' => $task, - 'columns_list' => $this->column->getList($task['project_id']), - 'colors_list' => $this->color->getList(), + 'columns_list' => $this->columnModel->getList($task['project_id']), + 'colors_list' => $this->colorModel->getList(), 'title' => $task['title'], 'no_layout' => true, 'auto_refresh' => true, @@ -61,7 +61,7 @@ class TaskViewController extends BaseController public function show() { $task = $this->getTask(); - $subtasks = $this->subtask->getAll($task['id']); + $subtasks = $this->subtaskModel->getAll($task['id']); $values = array( 'id' => $task['id'], @@ -70,19 +70,19 @@ class TaskViewController extends BaseController 'time_spent' => $task['time_spent'] ?: '', ); - $values = $this->dateParser->format($values, array('date_started'), $this->config->get('application_datetime_format', DateParser::DATE_TIME_FORMAT)); + $values = $this->dateParser->format($values, array('date_started'), $this->configModel->get('application_datetime_format', DateParser::DATE_TIME_FORMAT)); $this->response->html($this->helper->layout->task('task/show', array( 'task' => $task, - 'project' => $this->project->getById($task['project_id']), + 'project' => $this->projectModel->getById($task['project_id']), 'values' => $values, - 'files' => $this->taskFile->getAllDocuments($task['id']), - 'images' => $this->taskFile->getAllImages($task['id']), - 'comments' => $this->comment->getAll($task['id'], $this->userSession->getCommentSorting()), + 'files' => $this->taskFileModel->getAllDocuments($task['id']), + 'images' => $this->taskFileModel->getAllImages($task['id']), + 'comments' => $this->commentModel->getAll($task['id'], $this->userSession->getCommentSorting()), 'subtasks' => $subtasks, - 'internal_links' => $this->taskLink->getAllGroupedByLabel($task['id']), - 'external_links' => $this->taskExternalLink->getAll($task['id']), - 'link_label_list' => $this->link->getList(0, false), + 'internal_links' => $this->taskLinkModel->getAllGroupedByLabel($task['id']), + 'external_links' => $this->taskExternalLinkModel->getAll($task['id']), + 'link_label_list' => $this->linkModel->getList(0, false), ))); } @@ -97,10 +97,10 @@ class TaskViewController extends BaseController $this->response->html($this->helper->layout->task('task/analytics', array( 'task' => $task, - 'project' => $this->project->getById($task['project_id']), - 'lead_time' => $this->taskAnalytic->getLeadTime($task), - 'cycle_time' => $this->taskAnalytic->getCycleTime($task), - 'time_spent_columns' => $this->taskAnalytic->getTimeSpentByColumn($task), + 'project' => $this->projectModel->getById($task['project_id']), + 'lead_time' => $this->taskAnalyticModel->getLeadTime($task), + 'cycle_time' => $this->taskAnalyticModel->getCycleTime($task), + 'time_spent_columns' => $this->taskAnalyticModel->getTimeSpentByColumn($task), ))); } @@ -118,12 +118,12 @@ class TaskViewController extends BaseController ->setMax(15) ->setOrder('start') ->setDirection('DESC') - ->setQuery($this->subtaskTimeTracking->getTaskQuery($task['id'])) + ->setQuery($this->subtaskTimeTrackingModel->getTaskQuery($task['id'])) ->calculateOnlyIf($this->request->getStringParam('pagination') === 'subtasks'); $this->response->html($this->helper->layout->task('task/time_tracking_details', array( 'task' => $task, - 'project' => $this->project->getById($task['project_id']), + 'project' => $this->projectModel->getById($task['project_id']), 'subtask_paginator' => $subtask_paginator, ))); } @@ -139,8 +139,8 @@ class TaskViewController extends BaseController $this->response->html($this->helper->layout->task('task/transitions', array( 'task' => $task, - 'project' => $this->project->getById($task['project_id']), - 'transitions' => $this->transition->getAllByTask($task['id']), + 'project' => $this->projectModel->getById($task['project_id']), + 'transitions' => $this->transitionModel->getAllByTask($task['id']), ))); } } diff --git a/app/Controller/TwoFactorController.php b/app/Controller/TwoFactorController.php index c8540f85..d02c8950 100644 --- a/app/Controller/TwoFactorController.php +++ b/app/Controller/TwoFactorController.php @@ -91,7 +91,7 @@ class TwoFactorController extends UserViewController if ($provider->authenticate()) { $this->flash->success(t('The two factor authentication code is valid.')); - $this->user->update(array( + $this->userModel->update(array( 'id' => $user['id'], 'twofactor_activated' => 1, 'twofactor_secret' => $this->authenticationManager->getPostAuthenticationProvider()->getSecret(), @@ -117,7 +117,7 @@ class TwoFactorController extends UserViewController $user = $this->getUser(); $this->checkCurrentUser($user); - $this->user->update(array( + $this->userModel->update(array( 'id' => $user['id'], 'twofactor_activated' => 0, 'twofactor_secret' => '', @@ -186,7 +186,7 @@ class TwoFactorController extends UserViewController if ($this->request->getStringParam('disable') === 'yes') { $this->checkCSRFParam(); - $this->user->update(array( + $this->userModel->update(array( 'id' => $user['id'], 'twofactor_activated' => 0, 'twofactor_secret' => '', diff --git a/app/Controller/UserAjaxController.php b/app/Controller/UserAjaxController.php index 7b365667..ed180471 100644 --- a/app/Controller/UserAjaxController.php +++ b/app/Controller/UserAjaxController.php @@ -4,7 +4,7 @@ namespace Kanboard\Controller; use Kanboard\Filter\UserNameFilter; use Kanboard\Formatter\UserAutoCompleteFormatter; -use Kanboard\Model\User as UserModel; +use Kanboard\Model\UserModel; /** * User Ajax Controller @@ -36,7 +36,7 @@ class UserAjaxController extends BaseController { $project_id = $this->request->getStringParam('project_id'); $query = $this->request->getStringParam('q'); - $users = $this->projectPermission->findUsernames($project_id, $query); + $users = $this->projectPermissionModel->findUsernames($project_id, $query); $this->response->json($users); } diff --git a/app/Controller/UserCreationController.php b/app/Controller/UserCreationController.php index 4ae170e0..9c873f85 100644 --- a/app/Controller/UserCreationController.php +++ b/app/Controller/UserCreationController.php @@ -26,10 +26,10 @@ class UserCreationController extends BaseController $template = $isRemote ? 'user_creation/remote' : 'user_creation/local'; $this->response->html($this->template->render($template, array( - 'timezones' => $this->timezone->getTimezones(true), - 'languages' => $this->language->getLanguages(true), + 'timezones' => $this->timezoneModel->getTimezones(true), + 'languages' => $this->languageModel->getLanguages(true), 'roles' => $this->role->getApplicationRoles(), - 'projects' => $this->project->getList(), + 'projects' => $this->projectModel->getList(), 'errors' => $errors, 'values' => $values + array('role' => Role::APP_USER), ))); @@ -62,15 +62,15 @@ class UserCreationController extends BaseController $project_id = empty($values['project_id']) ? 0 : $values['project_id']; unset($values['project_id']); - $user_id = $this->user->create($values); + $user_id = $this->userModel->create($values); if ($user_id !== false) { if ($project_id !== 0) { - $this->projectUserRole->addUser($project_id, $user_id, Role::PROJECT_MEMBER); + $this->projectUserRoleModel->addUser($project_id, $user_id, Role::PROJECT_MEMBER); } if (! empty($values['notifications_enabled'])) { - $this->userNotificationType->saveSelectedTypes($user_id, array(MailNotification::TYPE)); + $this->userNotificationTypeModel->saveSelectedTypes($user_id, array(MailNotification::TYPE)); } $this->flash->success(t('User created successfully.')); diff --git a/app/Controller/UserCredentialController.php b/app/Controller/UserCredentialController.php index 3310aaa8..4021dc37 100644 --- a/app/Controller/UserCredentialController.php +++ b/app/Controller/UserCredentialController.php @@ -44,9 +44,9 @@ class UserCredentialController extends BaseController list($valid, $errors) = $this->userValidator->validatePasswordModification($values); if ($valid) { - if ($this->user->update($values)) { + if ($this->userModel->update($values)) { $this->flash->success(t('Password modified successfully.')); - $this->userLocking->resetFailedLogin($user['username']); + $this->userLockingModel->resetFailedLogin($user['username']); } else { $this->flash->failure(t('Unable to change the password.')); } @@ -95,7 +95,7 @@ class UserCredentialController extends BaseController list($valid, $errors) = $this->userValidator->validateModification($values); if ($valid) { - if ($this->user->update($values)) { + if ($this->userModel->update($values)) { $this->flash->success(t('User updated successfully.')); } else { $this->flash->failure(t('Unable to update your user.')); diff --git a/app/Controller/UserListController.php b/app/Controller/UserListController.php index 685746fb..31fcdd44 100644 --- a/app/Controller/UserListController.php +++ b/app/Controller/UserListController.php @@ -21,7 +21,7 @@ class UserListController extends BaseController ->setUrl('UserListController', 'show') ->setMax(30) ->setOrder('username') - ->setQuery($this->user->getQuery()) + ->setQuery($this->userModel->getQuery()) ->calculate(); $this->response->html($this->helper->layout->app('user_list/show', array( diff --git a/app/Controller/UserModificationController.php b/app/Controller/UserModificationController.php index 0a50eb5b..d339fd9a 100644 --- a/app/Controller/UserModificationController.php +++ b/app/Controller/UserModificationController.php @@ -32,8 +32,8 @@ class UserModificationController extends BaseController 'values' => $values, 'errors' => $errors, 'user' => $user, - 'timezones' => $this->timezone->getTimezones(true), - 'languages' => $this->language->getLanguages(true), + 'timezones' => $this->timezoneModel->getTimezones(true), + 'languages' => $this->languageModel->getLanguages(true), 'roles' => $this->role->getApplicationRoles(), ))); } @@ -55,7 +55,7 @@ class UserModificationController extends BaseController list($valid, $errors) = $this->userValidator->validateModification($values); if ($valid) { - if ($this->user->update($values)) { + if ($this->userModel->update($values)) { $this->flash->success(t('User updated successfully.')); } else { $this->flash->failure(t('Unable to update your user.')); diff --git a/app/Controller/UserStatusController.php b/app/Controller/UserStatusController.php index bc40a7dd..070fb6fc 100644 --- a/app/Controller/UserStatusController.php +++ b/app/Controller/UserStatusController.php @@ -34,7 +34,7 @@ class UserStatusController extends BaseController $user = $this->getUser(); $this->checkCSRFParam(); - if ($this->user->remove($user['id'])) { + if ($this->userModel->remove($user['id'])) { $this->flash->success(t('User removed successfully.')); } else { $this->flash->failure(t('Unable to remove this user.')); @@ -67,7 +67,7 @@ class UserStatusController extends BaseController $user = $this->getUser(); $this->checkCSRFParam(); - if ($this->user->enable($user['id'])) { + if ($this->userModel->enable($user['id'])) { $this->flash->success(t('User activated successfully.')); } else { $this->flash->failure(t('Unable to enable this user.')); @@ -100,7 +100,7 @@ class UserStatusController extends BaseController $user = $this->getUser(); $this->checkCSRFParam(); - if ($this->user->disable($user['id'])) { + if ($this->userModel->disable($user['id'])) { $this->flash->success(t('User disabled successfully.')); } else { $this->flash->failure(t('Unable to disable this user.')); diff --git a/app/Controller/UserViewController.php b/app/Controller/UserViewController.php index b299e35b..a73c5c51 100644 --- a/app/Controller/UserViewController.php +++ b/app/Controller/UserViewController.php @@ -3,7 +3,7 @@ namespace Kanboard\Controller; use Kanboard\Core\Controller\PageNotFoundException; -use Kanboard\Model\Project as ProjectModel; +use Kanboard\Model\ProjectModel; /** * Class UserViewController @@ -21,7 +21,7 @@ class UserViewController extends BaseController */ public function profile() { - $user = $this->user->getById($this->request->getIntegerParam('user_id')); + $user = $this->userModel->getById($this->request->getIntegerParam('user_id')); if (empty($user)) { throw new PageNotFoundException(); @@ -43,8 +43,8 @@ class UserViewController extends BaseController $user = $this->getUser(); $this->response->html($this->helper->layout->user('user_view/show', array( 'user' => $user, - 'timezones' => $this->timezone->getTimezones(true), - 'languages' => $this->language->getLanguages(true), + 'timezones' => $this->timezoneModel->getTimezones(true), + 'languages' => $this->languageModel->getLanguages(true), ))); } @@ -62,7 +62,7 @@ class UserViewController extends BaseController ->setMax(20) ->setOrder('start') ->setDirection('DESC') - ->setQuery($this->subtaskTimeTracking->getUserQuery($user['id'])) + ->setQuery($this->subtaskTimeTrackingModel->getUserQuery($user['id'])) ->calculateOnlyIf($this->request->getStringParam('pagination') === 'subtasks'); $this->response->html($this->helper->layout->user('user_view/timesheet', array( @@ -80,7 +80,7 @@ class UserViewController extends BaseController { $user = $this->getUser(); $this->response->html($this->helper->layout->user('user_view/password_reset', array( - 'tokens' => $this->passwordReset->getAll($user['id']), + 'tokens' => $this->passwordResetModel->getAll($user['id']), 'user' => $user, ))); } @@ -94,7 +94,7 @@ class UserViewController extends BaseController { $user = $this->getUser(); $this->response->html($this->helper->layout->user('user_view/last', array( - 'last_logins' => $this->lastLogin->getAll($user['id']), + 'last_logins' => $this->lastLoginModel->getAll($user['id']), 'user' => $user, ))); } @@ -108,7 +108,7 @@ class UserViewController extends BaseController { $user = $this->getUser(); $this->response->html($this->helper->layout->user('user_view/sessions', array( - 'sessions' => $this->rememberMeSession->getAll($user['id']), + 'sessions' => $this->rememberMeSessionModel->getAll($user['id']), 'user' => $user, ))); } @@ -122,7 +122,7 @@ class UserViewController extends BaseController { $this->checkCSRFParam(); $user = $this->getUser(); - $this->rememberMeSession->remove($this->request->getIntegerParam('id')); + $this->rememberMeSessionModel->remove($this->request->getIntegerParam('id')); $this->response->redirect($this->helper->url->to('UserViewController', 'sessions', array('user_id' => $user['id']))); } @@ -137,16 +137,16 @@ class UserViewController extends BaseController if ($this->request->isPost()) { $values = $this->request->getValues(); - $this->userNotification->saveSettings($user['id'], $values); + $this->userNotificationModel->saveSettings($user['id'], $values); $this->flash->success(t('User updated successfully.')); return $this->response->redirect($this->helper->url->to('UserViewController', 'notifications', array('user_id' => $user['id']))); } return $this->response->html($this->helper->layout->user('user_view/notifications', array( - 'projects' => $this->projectUserRole->getProjectsByUser($user['id'], array(ProjectModel::ACTIVE)), - 'notifications' => $this->userNotification->readSettings($user['id']), - 'types' => $this->userNotificationType->getTypes(), - 'filters' => $this->userNotificationFilter->getFilters(), + 'projects' => $this->projectUserRoleModel->getProjectsByUser($user['id'], array(ProjectModel::ACTIVE)), + 'notifications' => $this->userNotificationModel->readSettings($user['id']), + 'types' => $this->userNotificationTypeModel->getTypes(), + 'filters' => $this->userNotificationFilterModel->getFilters(), 'user' => $user, ))); } @@ -162,14 +162,14 @@ class UserViewController extends BaseController if ($this->request->isPost()) { $values = $this->request->getValues(); - $this->userMetadata->save($user['id'], $values); + $this->userMetadataModel->save($user['id'], $values); $this->flash->success(t('User updated successfully.')); $this->response->redirect($this->helper->url->to('UserViewController', 'integrations', array('user_id' => $user['id']))); } $this->response->html($this->helper->layout->user('user_view/integrations', array( 'user' => $user, - 'values' => $this->userMetadata->getAll($user['id']), + 'values' => $this->userMetadataModel->getAll($user['id']), ))); } @@ -182,7 +182,7 @@ class UserViewController extends BaseController { $user = $this->getUser(); $this->response->html($this->helper->layout->user('user_view/external', array( - 'last_logins' => $this->lastLogin->getAll($user['id']), + 'last_logins' => $this->lastLoginModel->getAll($user['id']), 'user' => $user, ))); } @@ -200,7 +200,7 @@ class UserViewController extends BaseController if ($switch === 'enable' || $switch === 'disable') { $this->checkCSRFParam(); - if ($this->user->{$switch . 'PublicAccess'}($user['id'])) { + if ($this->userModel->{$switch . 'PublicAccess'}($user['id'])) { $this->flash->success(t('User updated successfully.')); } else { $this->flash->failure(t('Unable to update this user.')); diff --git a/app/Controller/WebNotificationController.php b/app/Controller/WebNotificationController.php index 263d6d9e..46a42063 100644 --- a/app/Controller/WebNotificationController.php +++ b/app/Controller/WebNotificationController.php @@ -19,7 +19,7 @@ class WebNotificationController extends BaseController { $user_id = $this->getUserId(); - $this->userUnreadNotification->markAllAsRead($user_id); + $this->userUnreadNotificationModel->markAllAsRead($user_id); $this->response->redirect($this->helper->url->to('DashboardController', 'notifications', array('user_id' => $user_id))); } @@ -33,7 +33,7 @@ class WebNotificationController extends BaseController $user_id = $this->getUserId(); $notification_id = $this->request->getIntegerParam('notification_id'); - $this->userUnreadNotification->markAsRead($user_id, $notification_id); + $this->userUnreadNotificationModel->markAsRead($user_id, $notification_id); $this->response->redirect($this->helper->url->to('DashboardController', 'notifications', array('user_id' => $user_id))); } @@ -45,8 +45,8 @@ class WebNotificationController extends BaseController $user_id = $this->getUserId(); $notification_id = $this->request->getIntegerParam('notification_id'); - $notification = $this->userUnreadNotification->getById($notification_id); - $this->userUnreadNotification->markAsRead($user_id, $notification_id); + $notification = $this->userUnreadNotificationModel->getById($notification_id); + $this->userUnreadNotificationModel->markAsRead($user_id, $notification_id); if (empty($notification)) { $this->response->redirect($this->helper->url->to('DashboardController', 'notifications', array('user_id' => $user_id))); diff --git a/app/Core/Action/ActionManager.php b/app/Core/Action/ActionManager.php index dfa5a140..1dfd820c 100644 --- a/app/Core/Action/ActionManager.php +++ b/app/Core/Action/ActionManager.php @@ -121,9 +121,9 @@ class ActionManager extends Base public function attachEvents() { if ($this->userSession->isLogged()) { - $actions = $this->action->getAllByUser($this->userSession->getId()); + $actions = $this->actionModel->getAllByUser($this->userSession->getId()); } else { - $actions = $this->action->getAll(); + $actions = $this->actionModel->getAll(); } foreach ($actions as $action) { diff --git a/app/Core/Base.php b/app/Core/Base.php index e490484c..99c093e4 100644 --- a/app/Core/Base.php +++ b/app/Core/Base.php @@ -10,136 +10,136 @@ use Pimple\Container; * @package core * @author Frederic Guillot * - * @property \Kanboard\Analytic\TaskDistributionAnalytic $taskDistributionAnalytic - * @property \Kanboard\Analytic\UserDistributionAnalytic $userDistributionAnalytic - * @property \Kanboard\Analytic\EstimatedTimeComparisonAnalytic $estimatedTimeComparisonAnalytic - * @property \Kanboard\Analytic\AverageLeadCycleTimeAnalytic $averageLeadCycleTimeAnalytic - * @property \Kanboard\Analytic\AverageTimeSpentColumnAnalytic $averageTimeSpentColumnAnalytic - * @property \Kanboard\Core\Action\ActionManager $actionManager - * @property \Kanboard\Core\ExternalLink\ExternalLinkManager $externalLinkManager - * @property \Kanboard\Core\Cache\MemoryCache $memoryCache - * @property \Kanboard\Core\Event\EventManager $eventManager - * @property \Kanboard\Core\Group\GroupManager $groupManager - * @property \Kanboard\Core\Http\Client $httpClient - * @property \Kanboard\Core\Http\OAuth2 $oauth - * @property \Kanboard\Core\Http\RememberMeCookie $rememberMeCookie - * @property \Kanboard\Core\Http\Request $request - * @property \Kanboard\Core\Http\Response $response - * @property \Kanboard\Core\Http\Router $router - * @property \Kanboard\Core\Http\Route $route - * @property \Kanboard\Core\Queue\QueueManager $queueManager - * @property \Kanboard\Core\Mail\Client $emailClient - * @property \Kanboard\Core\ObjectStorage\ObjectStorageInterface $objectStorage - * @property \Kanboard\Core\Plugin\Hook $hook - * @property \Kanboard\Core\Plugin\Loader $pluginLoader - * @property \Kanboard\Core\Security\AuthenticationManager $authenticationManager - * @property \Kanboard\Core\Security\AccessMap $applicationAccessMap - * @property \Kanboard\Core\Security\AccessMap $projectAccessMap - * @property \Kanboard\Core\Security\Authorization $applicationAuthorization - * @property \Kanboard\Core\Security\Authorization $projectAuthorization - * @property \Kanboard\Core\Security\Role $role - * @property \Kanboard\Core\Security\Token $token - * @property \Kanboard\Core\Session\FlashMessage $flash - * @property \Kanboard\Core\Session\SessionManager $sessionManager - * @property \Kanboard\Core\Session\SessionStorage $sessionStorage - * @property \Kanboard\Core\User\Avatar\AvatarManager $avatarManager - * @property \Kanboard\Core\User\GroupSync $groupSync - * @property \Kanboard\Core\User\UserProfile $userProfile - * @property \Kanboard\Core\User\UserSync $userSync - * @property \Kanboard\Core\User\UserSession $userSession - * @property \Kanboard\Core\DateParser $dateParser - * @property \Kanboard\Core\Helper $helper - * @property \Kanboard\Core\Paginator $paginator - * @property \Kanboard\Core\Template $template - * @property \Kanboard\Model\Action $action - * @property \Kanboard\Model\ActionParameter $actionParameter - * @property \Kanboard\Model\AvatarFile $avatarFile - * @property \Kanboard\Model\Board $board - * @property \Kanboard\Model\Category $category - * @property \Kanboard\Model\Color $color - * @property \Kanboard\Model\Column $column - * @property \Kanboard\Model\Comment $comment - * @property \Kanboard\Model\Config $config - * @property \Kanboard\Model\Currency $currency - * @property \Kanboard\Model\CustomFilter $customFilter - * @property \Kanboard\Model\TaskFile $taskFile - * @property \Kanboard\Model\ProjectFile $projectFile - * @property \Kanboard\Model\Group $group - * @property \Kanboard\Model\GroupMember $groupMember - * @property \Kanboard\Model\Language $language - * @property \Kanboard\Model\LastLogin $lastLogin - * @property \Kanboard\Model\Link $link - * @property \Kanboard\Model\Notification $notification - * @property \Kanboard\Model\PasswordReset $passwordReset - * @property \Kanboard\Model\Project $project - * @property \Kanboard\Model\ProjectActivity $projectActivity - * @property \Kanboard\Model\ProjectDuplication $projectDuplication - * @property \Kanboard\Model\ProjectDailyColumnStats $projectDailyColumnStats - * @property \Kanboard\Model\ProjectDailyStats $projectDailyStats - * @property \Kanboard\Model\ProjectMetadata $projectMetadata - * @property \Kanboard\Model\ProjectPermission $projectPermission - * @property \Kanboard\Model\ProjectUserRole $projectUserRole - * @property \Kanboard\Model\ProjectGroupRole $projectGroupRole - * @property \Kanboard\Model\ProjectNotification $projectNotification - * @property \Kanboard\Model\ProjectNotificationType $projectNotificationType - * @property \Kanboard\Model\RememberMeSession $rememberMeSession - * @property \Kanboard\Model\Subtask $subtask - * @property \Kanboard\Model\SubtaskTimeTracking $subtaskTimeTracking - * @property \Kanboard\Model\Swimlane $swimlane - * @property \Kanboard\Model\Task $task - * @property \Kanboard\Model\TaskAnalytic $taskAnalytic - * @property \Kanboard\Model\TaskCreation $taskCreation - * @property \Kanboard\Model\TaskDuplication $taskDuplication - * @property \Kanboard\Model\TaskExternalLink $taskExternalLink - * @property \Kanboard\Model\TaskFinder $taskFinder - * @property \Kanboard\Model\TaskLink $taskLink - * @property \Kanboard\Model\TaskModification $taskModification - * @property \Kanboard\Model\TaskPosition $taskPosition - * @property \Kanboard\Model\TaskStatus $taskStatus - * @property \Kanboard\Model\TaskMetadata $taskMetadata - * @property \Kanboard\Model\Timezone $timezone - * @property \Kanboard\Model\Transition $transition - * @property \Kanboard\Model\User $user - * @property \Kanboard\Model\UserLocking $userLocking - * @property \Kanboard\Model\UserMention $userMention - * @property \Kanboard\Model\UserNotification $userNotification - * @property \Kanboard\Model\UserNotificationType $userNotificationType - * @property \Kanboard\Model\UserNotificationFilter $userNotificationFilter - * @property \Kanboard\Model\UserUnreadNotification $userUnreadNotification - * @property \Kanboard\Model\UserMetadata $userMetadata - * @property \Kanboard\Validator\ActionValidator $actionValidator - * @property \Kanboard\Validator\AuthValidator $authValidator - * @property \Kanboard\Validator\ColumnValidator $columnValidator - * @property \Kanboard\Validator\CategoryValidator $categoryValidator - * @property \Kanboard\Validator\CommentValidator $commentValidator - * @property \Kanboard\Validator\CurrencyValidator $currencyValidator - * @property \Kanboard\Validator\CustomFilterValidator $customFilterValidator - * @property \Kanboard\Validator\GroupValidator $groupValidator - * @property \Kanboard\Validator\LinkValidator $linkValidator - * @property \Kanboard\Validator\PasswordResetValidator $passwordResetValidator - * @property \Kanboard\Validator\ProjectValidator $projectValidator - * @property \Kanboard\Validator\SubtaskValidator $subtaskValidator - * @property \Kanboard\Validator\SwimlaneValidator $swimlaneValidator - * @property \Kanboard\Validator\TaskLinkValidator $taskLinkValidator - * @property \Kanboard\Validator\ExternalLinkValidator $externalLinkValidator - * @property \Kanboard\Validator\TaskValidator $taskValidator - * @property \Kanboard\Validator\UserValidator $userValidator - * @property \Kanboard\Import\TaskImport $taskImport - * @property \Kanboard\Import\UserImport $userImport - * @property \Kanboard\Export\SubtaskExport $subtaskExport - * @property \Kanboard\Export\TaskExport $taskExport - * @property \Kanboard\Export\TransitionExport $transitionExport - * @property \Kanboard\Core\Filter\QueryBuilder $projectGroupRoleQuery - * @property \Kanboard\Core\Filter\QueryBuilder $projectUserRoleQuery - * @property \Kanboard\Core\Filter\QueryBuilder $projectActivityQuery - * @property \Kanboard\Core\Filter\QueryBuilder $userQuery - * @property \Kanboard\Core\Filter\QueryBuilder $projectQuery - * @property \Kanboard\Core\Filter\QueryBuilder $taskQuery - * @property \Kanboard\Core\Filter\LexerBuilder $taskLexer - * @property \Kanboard\Core\Filter\LexerBuilder $projectActivityLexer - * @property \Psr\Log\LoggerInterface $logger - * @property \PicoDb\Database $db - * @property \Symfony\Component\EventDispatcher\EventDispatcher $dispatcher + * @property \Kanboard\Analytic\TaskDistributionAnalytic $taskDistributionAnalytic + * @property \Kanboard\Analytic\UserDistributionAnalytic $userDistributionAnalytic + * @property \Kanboard\Analytic\EstimatedTimeComparisonAnalytic $estimatedTimeComparisonAnalytic + * @property \Kanboard\Analytic\AverageLeadCycleTimeAnalytic $averageLeadCycleTimeAnalytic + * @property \Kanboard\Analytic\AverageTimeSpentColumnAnalytic $averageTimeSpentColumnAnalytic + * @property \Kanboard\Core\Action\ActionManager $actionManager + * @property \Kanboard\Core\ExternalLink\ExternalLinkManager $externalLinkManager + * @property \Kanboard\Core\Cache\MemoryCache $memoryCache + * @property \Kanboard\Core\Event\EventManager $eventManager + * @property \Kanboard\Core\Group\GroupManager $groupManager + * @property \Kanboard\Core\Http\Client $httpClient + * @property \Kanboard\Core\Http\OAuth2 $oauth + * @property \Kanboard\Core\Http\RememberMeCookie $rememberMeCookie + * @property \Kanboard\Core\Http\Request $request + * @property \Kanboard\Core\Http\Response $response + * @property \Kanboard\Core\Http\Router $router + * @property \Kanboard\Core\Http\Route $route + * @property \Kanboard\Core\Queue\QueueManager $queueManager + * @property \Kanboard\Core\Mail\Client $emailClient + * @property \Kanboard\Core\ObjectStorage\ObjectStorageInterface $objectStorage + * @property \Kanboard\Core\Plugin\Hook $hook + * @property \Kanboard\Core\Plugin\Loader $pluginLoader + * @property \Kanboard\Core\Security\AuthenticationManager $authenticationManager + * @property \Kanboard\Core\Security\AccessMap $applicationAccessMap + * @property \Kanboard\Core\Security\AccessMap $projectAccessMap + * @property \Kanboard\Core\Security\Authorization $applicationAuthorization + * @property \Kanboard\Core\Security\Authorization $projectAuthorization + * @property \Kanboard\Core\Security\Role $role + * @property \Kanboard\Core\Security\Token $token + * @property \Kanboard\Core\Session\FlashMessage $flash + * @property \Kanboard\Core\Session\SessionManager $sessionManager + * @property \Kanboard\Core\Session\SessionStorage $sessionStorage + * @property \Kanboard\Core\User\Avatar\AvatarManager $avatarManager + * @property \Kanboard\Core\User\GroupSync $groupSync + * @property \Kanboard\Core\User\UserProfile $userProfile + * @property \Kanboard\Core\User\UserSync $userSync + * @property \Kanboard\Core\User\UserSession $userSession + * @property \Kanboard\Core\DateParser $dateParser + * @property \Kanboard\Core\Helper $helper + * @property \Kanboard\Core\Paginator $paginator + * @property \Kanboard\Core\Template $template + * @property \Kanboard\Model\ActionModel $actionModel + * @property \Kanboard\Model\ActionParameterModel $actionParameterModel + * @property \Kanboard\Model\AvatarFileModel $avatarFileModel + * @property \Kanboard\Model\BoardModel $boardModel + * @property \Kanboard\Model\CategoryModel $categoryModel + * @property \Kanboard\Model\ColorModel $colorModel + * @property \Kanboard\Model\ColumnModel $columnModel + * @property \Kanboard\Model\CommentModel $commentModel + * @property \Kanboard\Model\ConfigModel $configModel + * @property \Kanboard\Model\CurrencyModel $currencyModel + * @property \Kanboard\Model\CustomFilterModel $customFilterModel + * @property \Kanboard\Model\TaskFileModel $taskFileModel + * @property \Kanboard\Model\ProjectFileModel $projectFileModel + * @property \Kanboard\Model\GroupModel $groupModel + * @property \Kanboard\Model\GroupMemberModel $groupMemberModel + * @property \Kanboard\Model\LanguageModel $languageModel + * @property \Kanboard\Model\LastLoginModel $lastLoginModel + * @property \Kanboard\Model\LinkModel $linkModel + * @property \Kanboard\Model\NotificationModel $notificationModel + * @property \Kanboard\Model\PasswordResetModel $passwordResetModel + * @property \Kanboard\Model\ProjectModel $projectModel + * @property \Kanboard\Model\ProjectActivityModel $projectActivityModel + * @property \Kanboard\Model\ProjectDuplicationModel $projectDuplicationModel + * @property \Kanboard\Model\ProjectDailyColumnStatsModel $projectDailyColumnStatsModel + * @property \Kanboard\Model\ProjectDailyStatsModel $projectDailyStatsModel + * @property \Kanboard\Model\ProjectMetadataModel $projectMetadataModel + * @property \Kanboard\Model\ProjectPermissionModel $projectPermissionModel + * @property \Kanboard\Model\ProjectUserRoleModel $projectUserRoleModel + * @property \Kanboard\Model\ProjectGroupRoleModel $projectGroupRoleModel + * @property \Kanboard\Model\ProjectNotificationModel $projectNotificationModel + * @property \Kanboard\Model\ProjectNotificationTypeModel $projectNotificationTypeModel + * @property \Kanboard\Model\RememberMeSessionModel $rememberMeSessionModel + * @property \Kanboard\Model\SubtaskModel $subtaskModel + * @property \Kanboard\Model\SubtaskTimeTrackingModel $subtaskTimeTrackingModel + * @property \Kanboard\Model\SwimlaneModel $swimlaneModel + * @property \Kanboard\Model\TaskModel $taskModel + * @property \Kanboard\Model\TaskAnalyticModel $taskAnalyticModel + * @property \Kanboard\Model\TaskCreationModel $taskCreationModel + * @property \Kanboard\Model\TaskDuplicationModel $taskDuplicationModel + * @property \Kanboard\Model\TaskExternalLinkModel $taskExternalLinkModel + * @property \Kanboard\Model\TaskFinderModel $taskFinderModel + * @property \Kanboard\Model\TaskLinkModel $taskLinkModel + * @property \Kanboard\Model\TaskModificationModel $taskModificationModel + * @property \Kanboard\Model\TaskPositionModel $taskPositionModel + * @property \Kanboard\Model\TaskStatusModel $taskStatusModel + * @property \Kanboard\Model\TaskMetadataModel $taskMetadataModel + * @property \Kanboard\Model\TimezoneModel $timezoneModel + * @property \Kanboard\Model\TransitionModel $transitionModel + * @property \Kanboard\Model\UserModel $userModel + * @property \Kanboard\Model\UserLockingModel $userLockingModel + * @property \Kanboard\Model\UserMentionModel $userMentionModel + * @property \Kanboard\Model\UserNotificationModel $userNotificationModel + * @property \Kanboard\Model\UserNotificationTypeModel $userNotificationTypeModel + * @property \Kanboard\Model\UserNotificationFilterModel $userNotificationFilterModel + * @property \Kanboard\Model\UserUnreadNotificationModel $userUnreadNotificationModel + * @property \Kanboard\Model\UserMetadataModel $userMetadataModel + * @property \Kanboard\Validator\ActionValidator $actionValidator + * @property \Kanboard\Validator\AuthValidator $authValidator + * @property \Kanboard\Validator\ColumnValidator $columnValidator + * @property \Kanboard\Validator\CategoryValidator $categoryValidator + * @property \Kanboard\Validator\CommentValidator $commentValidator + * @property \Kanboard\Validator\CurrencyValidator $currencyValidator + * @property \Kanboard\Validator\CustomFilterValidator $customFilterValidator + * @property \Kanboard\Validator\GroupValidator $groupValidator + * @property \Kanboard\Validator\LinkValidator $linkValidator + * @property \Kanboard\Validator\PasswordResetValidator $passwordResetValidator + * @property \Kanboard\Validator\ProjectValidator $projectValidator + * @property \Kanboard\Validator\SubtaskValidator $subtaskValidator + * @property \Kanboard\Validator\SwimlaneValidator $swimlaneValidator + * @property \Kanboard\Validator\TaskLinkValidator $taskLinkValidator + * @property \Kanboard\Validator\ExternalLinkValidator $externalLinkValidator + * @property \Kanboard\Validator\TaskValidator $taskValidator + * @property \Kanboard\Validator\UserValidator $userValidator + * @property \Kanboard\Import\TaskImport $taskImport + * @property \Kanboard\Import\UserImport $userImport + * @property \Kanboard\Export\SubtaskExport $subtaskExport + * @property \Kanboard\Export\TaskExport $taskExport + * @property \Kanboard\Export\TransitionExport $transitionExport + * @property \Kanboard\Core\Filter\QueryBuilder $projectGroupRoleQuery + * @property \Kanboard\Core\Filter\QueryBuilder $projectUserRoleQuery + * @property \Kanboard\Core\Filter\QueryBuilder $projectActivityQuery + * @property \Kanboard\Core\Filter\QueryBuilder $userQuery + * @property \Kanboard\Core\Filter\QueryBuilder $projectQuery + * @property \Kanboard\Core\Filter\QueryBuilder $taskQuery + * @property \Kanboard\Core\Filter\LexerBuilder $taskLexer + * @property \Kanboard\Core\Filter\LexerBuilder $projectActivityLexer + * @property \Psr\Log\LoggerInterface $logger + * @property \PicoDb\Database $db + * @property \Symfony\Component\EventDispatcher\EventDispatcher $dispatcher */ abstract class Base { diff --git a/app/Core/Event/EventManager.php b/app/Core/Event/EventManager.php index 162d23e8..9ae43170 100644 --- a/app/Core/Event/EventManager.php +++ b/app/Core/Event/EventManager.php @@ -2,8 +2,8 @@ namespace Kanboard\Core\Event; -use Kanboard\Model\Task; -use Kanboard\Model\TaskLink; +use Kanboard\Model\TaskModel; +use Kanboard\Model\TaskLinkModel; /** * Event Manager @@ -44,15 +44,15 @@ class EventManager public function getAll() { $events = array( - TaskLink::EVENT_CREATE_UPDATE => t('Task link creation or modification'), - Task::EVENT_MOVE_COLUMN => t('Move a task to another column'), - Task::EVENT_UPDATE => t('Task modification'), - Task::EVENT_CREATE => t('Task creation'), - Task::EVENT_OPEN => t('Reopen a task'), - Task::EVENT_CLOSE => t('Closing a task'), - Task::EVENT_CREATE_UPDATE => t('Task creation or modification'), - Task::EVENT_ASSIGNEE_CHANGE => t('Task assignee change'), - Task::EVENT_DAILY_CRONJOB => t('Daily background job for tasks'), + TaskLinkModel::EVENT_CREATE_UPDATE => t('Task link creation or modification'), + TaskModel::EVENT_MOVE_COLUMN => t('Move a task to another column'), + TaskModel::EVENT_UPDATE => t('Task modification'), + TaskModel::EVENT_CREATE => t('Task creation'), + TaskModel::EVENT_OPEN => t('Reopen a task'), + TaskModel::EVENT_CLOSE => t('Closing a task'), + TaskModel::EVENT_CREATE_UPDATE => t('Task creation or modification'), + TaskModel::EVENT_ASSIGNEE_CHANGE => t('Task assignee change'), + TaskModel::EVENT_DAILY_CRONJOB => t('Daily background job for tasks'), ); $events = array_merge($events, $this->events); diff --git a/app/Core/Markdown.php b/app/Core/Markdown.php index 592c29b1..b5abe5ed 100644 --- a/app/Core/Markdown.php +++ b/app/Core/Markdown.php @@ -87,7 +87,7 @@ class Markdown extends Parsedown protected function inlineUserLink(array $Excerpt) { if (! $this->isPublicLink && preg_match('/^@([^\s]+)/', $Excerpt['text'], $matches)) { - $user_id = $this->container['user']->getIdByUsername($matches[1]); + $user_id = $this->container['userModel']->getIdByUsername($matches[1]); if (! empty($user_id)) { $url = $this->container['helper']->url->href('UserViewController', 'profile', array('user_id' => $user_id)); @@ -116,7 +116,7 @@ class Markdown extends Parsedown private function buildTaskLink($task_id) { if ($this->isPublicLink) { - $token = $this->container['memoryCache']->proxy($this->container['taskFinder'], 'getProjectToken', $task_id); + $token = $this->container['memoryCache']->proxy($this->container['taskFinderModel'], 'getProjectToken', $task_id); if (! empty($token)) { return $this->container['helper']->url->href( diff --git a/app/Core/User/GroupSync.php b/app/Core/User/GroupSync.php index 4e08d574..d0bb647b 100644 --- a/app/Core/User/GroupSync.php +++ b/app/Core/User/GroupSync.php @@ -21,7 +21,7 @@ class GroupSync extends Base */ public function synchronize($userId, array $externalGroupIds) { - $userGroups = $this->groupMember->getGroups($userId); + $userGroups = $this->groupMemberModel->getGroups($userId); $this->addGroups($userId, $userGroups, $externalGroupIds); $this->removeGroups($userId, $userGroups, $externalGroupIds); } @@ -40,10 +40,10 @@ class GroupSync extends Base foreach ($externalGroupIds as $externalGroupId) { if (! isset($userGroupIds[$externalGroupId])) { - $group = $this->group->getByExternalId($externalGroupId); + $group = $this->groupModel->getByExternalId($externalGroupId); if (! empty($group)) { - $this->groupMember->addUser($group['id'], $userId); + $this->groupMemberModel->addUser($group['id'], $userId); } } } @@ -61,7 +61,7 @@ class GroupSync extends Base { foreach ($userGroups as $userGroup) { if (! empty($userGroup['external_id']) && ! in_array($userGroup['external_id'], $externalGroupIds)) { - $this->groupMember->removeUser($userGroup['id'], $userId); + $this->groupMemberModel->removeUser($userGroup['id'], $userId); } } } diff --git a/app/Core/User/UserProfile.php b/app/Core/User/UserProfile.php index 4f873390..8b9ebb71 100644 --- a/app/Core/User/UserProfile.php +++ b/app/Core/User/UserProfile.php @@ -25,12 +25,12 @@ class UserProfile extends Base */ public function assign($userId, UserProviderInterface $user) { - $profile = $this->user->getById($userId); + $profile = $this->userModel->getById($userId); $values = UserProperty::filterProperties($profile, UserProperty::getProperties($user)); $values['id'] = $userId; - if ($this->user->update($values)) { + if ($this->userModel->update($values)) { $profile = array_merge($profile, $values); $this->userSession->initialize($profile); return true; @@ -49,7 +49,7 @@ class UserProfile extends Base public function initialize(UserProviderInterface $user) { if ($user->getInternalId()) { - $profile = $this->user->getById($user->getInternalId()); + $profile = $this->userModel->getById($user->getInternalId()); } elseif ($user->getExternalIdColumn() && $user->getExternalId()) { $profile = $this->userSync->synchronize($user); $this->groupSync->synchronize($profile['id'], $user->getExternalGroupIds()); diff --git a/app/Core/User/UserSession.php b/app/Core/User/UserSession.php index 0034c47a..9c63f07a 100644 --- a/app/Core/User/UserSession.php +++ b/app/Core/User/UserSession.php @@ -22,7 +22,7 @@ class UserSession extends Base public function refresh($user_id) { if ($this->getId() == $user_id) { - $this->initialize($this->user->getById($user_id)); + $this->initialize($this->userModel->getById($user_id)); } } diff --git a/app/Core/User/UserSync.php b/app/Core/User/UserSync.php index 055c7106..c2f85498 100644 --- a/app/Core/User/UserSync.php +++ b/app/Core/User/UserSync.php @@ -21,7 +21,7 @@ class UserSync extends Base */ public function synchronize(UserProviderInterface $user) { - $profile = $this->user->getByExternalId($user->getExternalIdColumn(), $user->getExternalId()); + $profile = $this->userModel->getByExternalId($user->getExternalIdColumn(), $user->getExternalId()); $properties = UserProperty::getProperties($user); if (! empty($profile)) { @@ -47,7 +47,7 @@ class UserSync extends Base if (! empty($values)) { $values['id'] = $profile['id']; - $result = $this->user->update($values); + $result = $this->userModel->update($values); return $result ? array_merge($profile, $properties) : $profile; } @@ -64,13 +64,13 @@ class UserSync extends Base */ private function createUser(UserProviderInterface $user, array $properties) { - $userId = $this->user->create($properties); + $userId = $this->userModel->create($properties); if ($userId === false) { $this->logger->error('Unable to create user profile: '.$user->getExternalId()); return array(); } - return $this->user->getById($userId); + return $this->userModel->getById($userId); } } diff --git a/app/Export/SubtaskExport.php b/app/Export/SubtaskExport.php index 386c566b..0939838f 100644 --- a/app/Export/SubtaskExport.php +++ b/app/Export/SubtaskExport.php @@ -3,9 +3,9 @@ namespace Kanboard\Export; use Kanboard\Core\Base; -use Kanboard\Model\Task; -use Kanboard\Model\Subtask; -use Kanboard\Model\User; +use Kanboard\Model\TaskModel; +use Kanboard\Model\SubtaskModel; +use Kanboard\Model\UserModel; /** * Subtask Export @@ -34,7 +34,7 @@ class SubtaskExport extends Base */ public function export($project_id, $from, $to) { - $this->subtask_status = $this->subtask->getStatusList(); + $this->subtask_status = $this->subtaskModel->getStatusList(); $subtasks = $this->getSubtasks($project_id, $from, $to); $results = array($this->getColumns()); @@ -106,19 +106,19 @@ class SubtaskExport extends Base $to = $this->dateParser->removeTimeFromTimestamp(strtotime('+1 day', $this->dateParser->getTimestamp($to))); } - return $this->db->table(Subtask::TABLE) + return $this->db->table(SubtaskModel::TABLE) ->eq('project_id', $project_id) ->columns( - Subtask::TABLE.'.*', - User::TABLE.'.username AS assignee_username', - User::TABLE.'.name AS assignee_name', - Task::TABLE.'.title AS task_title' + SubtaskModel::TABLE.'.*', + UserModel::TABLE.'.username AS assignee_username', + UserModel::TABLE.'.name AS assignee_name', + TaskModel::TABLE.'.title AS task_title' ) ->gte('date_creation', $from) ->lte('date_creation', $to) - ->join(Task::TABLE, 'id', 'task_id') - ->join(User::TABLE, 'id', 'user_id') - ->asc(Subtask::TABLE.'.id') + ->join(TaskModel::TABLE, 'id', 'task_id') + ->join(UserModel::TABLE, 'id', 'user_id') + ->asc(SubtaskModel::TABLE.'.id') ->findAll(); } } diff --git a/app/Export/TaskExport.php b/app/Export/TaskExport.php index b98582aa..0e576d33 100644 --- a/app/Export/TaskExport.php +++ b/app/Export/TaskExport.php @@ -4,7 +4,7 @@ namespace Kanboard\Export; use Kanboard\Core\Base; use Kanboard\Core\DateParser; -use Kanboard\Model\Task; +use Kanboard\Model\TaskModel; use PDO; /** @@ -27,7 +27,7 @@ class TaskExport extends Base public function export($project_id, $from, $to) { $tasks = $this->getTasks($project_id, $from, $to); - $swimlanes = $this->swimlane->getList($project_id); + $swimlanes = $this->swimlaneModel->getList($project_id); $results = array($this->getColumns()); foreach ($tasks as &$task) { @@ -102,9 +102,9 @@ class TaskExport extends Base */ public function format(array &$task, array &$swimlanes) { - $colors = $this->color->getList(); + $colors = $this->colorModel->getList(); - $task['is_active'] = $task['is_active'] == Task::STATUS_OPEN ? e('Open') : e('Closed'); + $task['is_active'] = $task['is_active'] == TaskModel::STATUS_OPEN ? e('Open') : e('Closed'); $task['color_id'] = $colors[$task['color_id']]; $task['score'] = $task['score'] ?: 0; $task['swimlane_id'] = isset($swimlanes[$task['swimlane_id']]) ? $swimlanes[$task['swimlane_id']] : '?'; diff --git a/app/Export/TransitionExport.php b/app/Export/TransitionExport.php index 97dc28a7..0df1f70e 100644 --- a/app/Export/TransitionExport.php +++ b/app/Export/TransitionExport.php @@ -25,7 +25,7 @@ class TransitionExport extends Base public function export($project_id, $from, $to) { $results = array($this->getColumns()); - $transitions = $this->transition->getAllByProjectAndDate($project_id, $from, $to); + $transitions = $this->transitionModel->getAllByProjectAndDate($project_id, $from, $to); foreach ($transitions as $transition) { $results[] = $this->format($transition); @@ -68,7 +68,7 @@ class TransitionExport extends Base $transition['src_column'], $transition['dst_column'], $transition['name'] ?: $transition['username'], - date($this->config->get('application_datetime_format', DateParser::DATE_TIME_FORMAT), $transition['date']), + date($this->configModel->get('application_datetime_format', DateParser::DATE_TIME_FORMAT), $transition['date']), round($transition['time_spent'] / 3600, 2) ); diff --git a/app/Filter/ProjectActivityCreationDateFilter.php b/app/Filter/ProjectActivityCreationDateFilter.php index d0b7f754..451f6548 100644 --- a/app/Filter/ProjectActivityCreationDateFilter.php +++ b/app/Filter/ProjectActivityCreationDateFilter.php @@ -3,7 +3,7 @@ namespace Kanboard\Filter; use Kanboard\Core\Filter\FilterInterface; -use Kanboard\Model\ProjectActivity; +use Kanboard\Model\ProjectActivityModel; /** * Filter activity events by creation date @@ -32,7 +32,7 @@ class ProjectActivityCreationDateFilter extends BaseDateFilter implements Filter */ public function apply() { - $this->applyDateFilter(ProjectActivity::TABLE.'.date_creation'); + $this->applyDateFilter(ProjectActivityModel::TABLE.'.date_creation'); return $this; } } diff --git a/app/Filter/ProjectActivityCreatorFilter.php b/app/Filter/ProjectActivityCreatorFilter.php index c95569d6..573238d8 100644 --- a/app/Filter/ProjectActivityCreatorFilter.php +++ b/app/Filter/ProjectActivityCreatorFilter.php @@ -3,7 +3,7 @@ namespace Kanboard\Filter; use Kanboard\Core\Filter\FilterInterface; -use Kanboard\Model\ProjectActivity; +use Kanboard\Model\ProjectActivityModel; /** * Filter activity events by creator @@ -54,7 +54,7 @@ class ProjectActivityCreatorFilter extends BaseFilter implements FilterInterface public function apply() { if ($this->value === 'me') { - $this->query->eq(ProjectActivity::TABLE . '.creator_id', $this->currentUserId); + $this->query->eq(ProjectActivityModel::TABLE . '.creator_id', $this->currentUserId); } else { $this->query->beginOr(); $this->query->ilike('uc.username', '%'.$this->value.'%'); diff --git a/app/Filter/ProjectActivityProjectIdFilter.php b/app/Filter/ProjectActivityProjectIdFilter.php index bb4d8bd1..7146a057 100644 --- a/app/Filter/ProjectActivityProjectIdFilter.php +++ b/app/Filter/ProjectActivityProjectIdFilter.php @@ -3,7 +3,7 @@ namespace Kanboard\Filter; use Kanboard\Core\Filter\FilterInterface; -use Kanboard\Model\ProjectActivity; +use Kanboard\Model\ProjectActivityModel; /** * Filter activity events by projectId @@ -32,7 +32,7 @@ class ProjectActivityProjectIdFilter extends BaseFilter implements FilterInterfa */ public function apply() { - $this->query->eq(ProjectActivity::TABLE.'.project_id', $this->value); + $this->query->eq(ProjectActivityModel::TABLE.'.project_id', $this->value); return $this; } } diff --git a/app/Filter/ProjectActivityProjectIdsFilter.php b/app/Filter/ProjectActivityProjectIdsFilter.php index 47cf0c25..70968f79 100644 --- a/app/Filter/ProjectActivityProjectIdsFilter.php +++ b/app/Filter/ProjectActivityProjectIdsFilter.php @@ -3,7 +3,7 @@ namespace Kanboard\Filter; use Kanboard\Core\Filter\FilterInterface; -use Kanboard\Model\ProjectActivity; +use Kanboard\Model\ProjectActivityModel; /** * Filter activity events by projectIds @@ -33,9 +33,9 @@ class ProjectActivityProjectIdsFilter extends BaseFilter implements FilterInterf public function apply() { if (empty($this->value)) { - $this->query->eq(ProjectActivity::TABLE.'.project_id', 0); + $this->query->eq(ProjectActivityModel::TABLE.'.project_id', 0); } else { - $this->query->in(ProjectActivity::TABLE.'.project_id', $this->value); + $this->query->in(ProjectActivityModel::TABLE.'.project_id', $this->value); } return $this; diff --git a/app/Filter/ProjectActivityProjectNameFilter.php b/app/Filter/ProjectActivityProjectNameFilter.php index 0cf73657..b4872182 100644 --- a/app/Filter/ProjectActivityProjectNameFilter.php +++ b/app/Filter/ProjectActivityProjectNameFilter.php @@ -3,7 +3,7 @@ namespace Kanboard\Filter; use Kanboard\Core\Filter\FilterInterface; -use Kanboard\Model\Project; +use Kanboard\Model\ProjectModel; /** * Filter activity events by project name @@ -32,7 +32,7 @@ class ProjectActivityProjectNameFilter extends BaseFilter implements FilterInter */ public function apply() { - $this->query->ilike(Project::TABLE.'.name', '%'.$this->value.'%'); + $this->query->ilike(ProjectModel::TABLE.'.name', '%'.$this->value.'%'); return $this; } } diff --git a/app/Filter/ProjectActivityTaskIdFilter.php b/app/Filter/ProjectActivityTaskIdFilter.php index e99efe09..b8e074db 100644 --- a/app/Filter/ProjectActivityTaskIdFilter.php +++ b/app/Filter/ProjectActivityTaskIdFilter.php @@ -3,7 +3,7 @@ namespace Kanboard\Filter; use Kanboard\Core\Filter\FilterInterface; -use Kanboard\Model\ProjectActivity; +use Kanboard\Model\ProjectActivityModel; /** * Filter activity events by taskId @@ -32,7 +32,7 @@ class ProjectActivityTaskIdFilter extends BaseFilter implements FilterInterface */ public function apply() { - $this->query->eq(ProjectActivity::TABLE.'.task_id', $this->value); + $this->query->eq(ProjectActivityModel::TABLE.'.task_id', $this->value); return $this; } } diff --git a/app/Filter/ProjectActivityTaskStatusFilter.php b/app/Filter/ProjectActivityTaskStatusFilter.php index 69e2c52d..2c98cabf 100644 --- a/app/Filter/ProjectActivityTaskStatusFilter.php +++ b/app/Filter/ProjectActivityTaskStatusFilter.php @@ -3,7 +3,7 @@ namespace Kanboard\Filter; use Kanboard\Core\Filter\FilterInterface; -use Kanboard\Model\Task; +use Kanboard\Model\TaskModel; /** * Filter activity events by task status @@ -33,9 +33,9 @@ class ProjectActivityTaskStatusFilter extends BaseFilter implements FilterInterf public function apply() { if ($this->value === 'open') { - $this->query->eq(Task::TABLE.'.is_active', Task::STATUS_OPEN); + $this->query->eq(TaskModel::TABLE.'.is_active', TaskModel::STATUS_OPEN); } elseif ($this->value === 'closed') { - $this->query->eq(Task::TABLE.'.is_active', Task::STATUS_CLOSED); + $this->query->eq(TaskModel::TABLE.'.is_active', TaskModel::STATUS_CLOSED); } return $this; diff --git a/app/Filter/ProjectGroupRoleProjectFilter.php b/app/Filter/ProjectGroupRoleProjectFilter.php index b0950868..035931b3 100644 --- a/app/Filter/ProjectGroupRoleProjectFilter.php +++ b/app/Filter/ProjectGroupRoleProjectFilter.php @@ -3,7 +3,7 @@ namespace Kanboard\Filter; use Kanboard\Core\Filter\FilterInterface; -use Kanboard\Model\ProjectGroupRole; +use Kanboard\Model\ProjectGroupRoleModel; /** * Filter ProjectGroupRole users by project @@ -32,7 +32,7 @@ class ProjectGroupRoleProjectFilter extends BaseFilter implements FilterInterfac */ public function apply() { - $this->query->eq(ProjectGroupRole::TABLE.'.project_id', $this->value); + $this->query->eq(ProjectGroupRoleModel::TABLE.'.project_id', $this->value); return $this; } } diff --git a/app/Filter/ProjectGroupRoleUsernameFilter.php b/app/Filter/ProjectGroupRoleUsernameFilter.php index c10855bc..9feac33f 100644 --- a/app/Filter/ProjectGroupRoleUsernameFilter.php +++ b/app/Filter/ProjectGroupRoleUsernameFilter.php @@ -3,9 +3,9 @@ namespace Kanboard\Filter; use Kanboard\Core\Filter\FilterInterface; -use Kanboard\Model\GroupMember; -use Kanboard\Model\ProjectGroupRole; -use Kanboard\Model\User; +use Kanboard\Model\GroupMemberModel; +use Kanboard\Model\ProjectGroupRoleModel; +use Kanboard\Model\UserModel; /** * Filter ProjectGroupRole users by username @@ -35,9 +35,9 @@ class ProjectGroupRoleUsernameFilter extends BaseFilter implements FilterInterfa public function apply() { $this->query - ->join(GroupMember::TABLE, 'group_id', 'group_id', ProjectGroupRole::TABLE) - ->join(User::TABLE, 'id', 'user_id', GroupMember::TABLE) - ->ilike(User::TABLE.'.username', $this->value.'%'); + ->join(GroupMemberModel::TABLE, 'group_id', 'group_id', ProjectGroupRoleModel::TABLE) + ->join(UserModel::TABLE, 'id', 'user_id', GroupMemberModel::TABLE) + ->ilike(UserModel::TABLE.'.username', $this->value.'%'); return $this; } diff --git a/app/Filter/ProjectIdsFilter.php b/app/Filter/ProjectIdsFilter.php index 641f7f18..9af9db5a 100644 --- a/app/Filter/ProjectIdsFilter.php +++ b/app/Filter/ProjectIdsFilter.php @@ -3,7 +3,7 @@ namespace Kanboard\Filter; use Kanboard\Core\Filter\FilterInterface; -use Kanboard\Model\Project; +use Kanboard\Model\ProjectModel; /** * Filter project by ids @@ -33,9 +33,9 @@ class ProjectIdsFilter extends BaseFilter implements FilterInterface public function apply() { if (empty($this->value)) { - $this->query->eq(Project::TABLE.'.id', 0); + $this->query->eq(ProjectModel::TABLE.'.id', 0); } else { - $this->query->in(Project::TABLE.'.id', $this->value); + $this->query->in(ProjectModel::TABLE.'.id', $this->value); } return $this; diff --git a/app/Filter/ProjectStatusFilter.php b/app/Filter/ProjectStatusFilter.php index a994600c..c1a06eff 100644 --- a/app/Filter/ProjectStatusFilter.php +++ b/app/Filter/ProjectStatusFilter.php @@ -3,7 +3,7 @@ namespace Kanboard\Filter; use Kanboard\Core\Filter\FilterInterface; -use Kanboard\Model\Project; +use Kanboard\Model\ProjectModel; /** * Filter project by status @@ -33,11 +33,11 @@ class ProjectStatusFilter extends BaseFilter implements FilterInterface public function apply() { if (is_int($this->value) || ctype_digit($this->value)) { - $this->query->eq(Project::TABLE.'.is_active', $this->value); + $this->query->eq(ProjectModel::TABLE.'.is_active', $this->value); } elseif ($this->value === 'inactive' || $this->value === 'closed' || $this->value === 'disabled') { - $this->query->eq(Project::TABLE.'.is_active', 0); + $this->query->eq(ProjectModel::TABLE.'.is_active', 0); } else { - $this->query->eq(Project::TABLE.'.is_active', 1); + $this->query->eq(ProjectModel::TABLE.'.is_active', 1); } return $this; diff --git a/app/Filter/ProjectTypeFilter.php b/app/Filter/ProjectTypeFilter.php index e085e2f6..6afcd293 100644 --- a/app/Filter/ProjectTypeFilter.php +++ b/app/Filter/ProjectTypeFilter.php @@ -3,7 +3,7 @@ namespace Kanboard\Filter; use Kanboard\Core\Filter\FilterInterface; -use Kanboard\Model\Project; +use Kanboard\Model\ProjectModel; /** * Filter project by type @@ -33,11 +33,11 @@ class ProjectTypeFilter extends BaseFilter implements FilterInterface public function apply() { if (is_int($this->value) || ctype_digit($this->value)) { - $this->query->eq(Project::TABLE.'.is_private', $this->value); + $this->query->eq(ProjectModel::TABLE.'.is_private', $this->value); } elseif ($this->value === 'private') { - $this->query->eq(Project::TABLE.'.is_private', Project::TYPE_PRIVATE); + $this->query->eq(ProjectModel::TABLE.'.is_private', ProjectModel::TYPE_PRIVATE); } else { - $this->query->eq(Project::TABLE.'.is_private', Project::TYPE_TEAM); + $this->query->eq(ProjectModel::TABLE.'.is_private', ProjectModel::TYPE_TEAM); } return $this; diff --git a/app/Filter/ProjectUserRoleProjectFilter.php b/app/Filter/ProjectUserRoleProjectFilter.php index 3b880df5..6952364e 100644 --- a/app/Filter/ProjectUserRoleProjectFilter.php +++ b/app/Filter/ProjectUserRoleProjectFilter.php @@ -3,7 +3,7 @@ namespace Kanboard\Filter; use Kanboard\Core\Filter\FilterInterface; -use Kanboard\Model\ProjectUserRole; +use Kanboard\Model\ProjectUserRoleModel; /** * Filter ProjectUserRole users by project @@ -32,7 +32,7 @@ class ProjectUserRoleProjectFilter extends BaseFilter implements FilterInterface */ public function apply() { - $this->query->eq(ProjectUserRole::TABLE.'.project_id', $this->value); + $this->query->eq(ProjectUserRoleModel::TABLE.'.project_id', $this->value); return $this; } } diff --git a/app/Filter/ProjectUserRoleUsernameFilter.php b/app/Filter/ProjectUserRoleUsernameFilter.php index c00493a3..327d3d57 100644 --- a/app/Filter/ProjectUserRoleUsernameFilter.php +++ b/app/Filter/ProjectUserRoleUsernameFilter.php @@ -3,7 +3,7 @@ namespace Kanboard\Filter; use Kanboard\Core\Filter\FilterInterface; -use Kanboard\Model\User; +use Kanboard\Model\UserModel; /** * Filter ProjectUserRole users by username @@ -33,8 +33,8 @@ class ProjectUserRoleUsernameFilter extends BaseFilter implements FilterInterfac public function apply() { $this->query - ->join(User::TABLE, 'id', 'user_id') - ->ilike(User::TABLE.'.username', $this->value.'%'); + ->join(UserModel::TABLE, 'id', 'user_id') + ->ilike(UserModel::TABLE.'.username', $this->value.'%'); return $this; } diff --git a/app/Filter/TaskAssigneeFilter.php b/app/Filter/TaskAssigneeFilter.php index 783d6a12..d6962a93 100644 --- a/app/Filter/TaskAssigneeFilter.php +++ b/app/Filter/TaskAssigneeFilter.php @@ -3,8 +3,8 @@ namespace Kanboard\Filter; use Kanboard\Core\Filter\FilterInterface; -use Kanboard\Model\Task; -use Kanboard\Model\User; +use Kanboard\Model\TaskModel; +use Kanboard\Model\UserModel; /** * Filter tasks by assignee @@ -55,19 +55,19 @@ class TaskAssigneeFilter extends BaseFilter implements FilterInterface public function apply() { if (is_int($this->value) || ctype_digit($this->value)) { - $this->query->eq(Task::TABLE.'.owner_id', $this->value); + $this->query->eq(TaskModel::TABLE.'.owner_id', $this->value); } else { switch ($this->value) { case 'me': - $this->query->eq(Task::TABLE.'.owner_id', $this->currentUserId); + $this->query->eq(TaskModel::TABLE.'.owner_id', $this->currentUserId); break; case 'nobody': - $this->query->eq(Task::TABLE.'.owner_id', 0); + $this->query->eq(TaskModel::TABLE.'.owner_id', 0); break; default: $this->query->beginOr(); - $this->query->ilike(User::TABLE.'.username', '%'.$this->value.'%'); - $this->query->ilike(User::TABLE.'.name', '%'.$this->value.'%'); + $this->query->ilike(UserModel::TABLE.'.username', '%'.$this->value.'%'); + $this->query->ilike(UserModel::TABLE.'.name', '%'.$this->value.'%'); $this->query->closeOr(); } } diff --git a/app/Filter/TaskCategoryFilter.php b/app/Filter/TaskCategoryFilter.php index 517f24d9..35c52f69 100644 --- a/app/Filter/TaskCategoryFilter.php +++ b/app/Filter/TaskCategoryFilter.php @@ -3,8 +3,8 @@ namespace Kanboard\Filter; use Kanboard\Core\Filter\FilterInterface; -use Kanboard\Model\Category; -use Kanboard\Model\Task; +use Kanboard\Model\CategoryModel; +use Kanboard\Model\TaskModel; /** * Filter tasks by category @@ -34,11 +34,11 @@ class TaskCategoryFilter extends BaseFilter implements FilterInterface public function apply() { if (is_int($this->value) || ctype_digit($this->value)) { - $this->query->eq(Task::TABLE.'.category_id', $this->value); + $this->query->eq(TaskModel::TABLE.'.category_id', $this->value); } elseif ($this->value === 'none') { - $this->query->eq(Task::TABLE.'.category_id', 0); + $this->query->eq(TaskModel::TABLE.'.category_id', 0); } else { - $this->query->eq(Category::TABLE.'.name', $this->value); + $this->query->eq(CategoryModel::TABLE.'.name', $this->value); } return $this; diff --git a/app/Filter/TaskColorFilter.php b/app/Filter/TaskColorFilter.php index 784162d4..2ddb47ce 100644 --- a/app/Filter/TaskColorFilter.php +++ b/app/Filter/TaskColorFilter.php @@ -3,8 +3,8 @@ namespace Kanboard\Filter; use Kanboard\Core\Filter\FilterInterface; -use Kanboard\Model\Color; -use Kanboard\Model\Task; +use Kanboard\Model\ColorModel; +use Kanboard\Model\TaskModel; /** * Filter tasks by color @@ -18,7 +18,7 @@ class TaskColorFilter extends BaseFilter implements FilterInterface * Color object * * @access private - * @var Color + * @var ColorModel */ private $colorModel; @@ -26,10 +26,10 @@ class TaskColorFilter extends BaseFilter implements FilterInterface * Set color model object * * @access public - * @param Color $colorModel + * @param ColorModel $colorModel * @return TaskColorFilter */ - public function setColorModel(Color $colorModel) + public function setColorModel(ColorModel $colorModel) { $this->colorModel = $colorModel; return $this; @@ -54,7 +54,7 @@ class TaskColorFilter extends BaseFilter implements FilterInterface */ public function apply() { - $this->query->eq(Task::TABLE.'.color_id', $this->colorModel->find($this->value)); + $this->query->eq(TaskModel::TABLE.'.color_id', $this->colorModel->find($this->value)); return $this; } } diff --git a/app/Filter/TaskColumnFilter.php b/app/Filter/TaskColumnFilter.php index 9a4d4253..fa925b79 100644 --- a/app/Filter/TaskColumnFilter.php +++ b/app/Filter/TaskColumnFilter.php @@ -3,8 +3,8 @@ namespace Kanboard\Filter; use Kanboard\Core\Filter\FilterInterface; -use Kanboard\Model\Column; -use Kanboard\Model\Task; +use Kanboard\Model\ColumnModel; +use Kanboard\Model\TaskModel; /** * Filter tasks by column @@ -34,9 +34,9 @@ class TaskColumnFilter extends BaseFilter implements FilterInterface public function apply() { if (is_int($this->value) || ctype_digit($this->value)) { - $this->query->eq(Task::TABLE.'.column_id', $this->value); + $this->query->eq(TaskModel::TABLE.'.column_id', $this->value); } else { - $this->query->eq(Column::TABLE.'.title', $this->value); + $this->query->eq(ColumnModel::TABLE.'.title', $this->value); } return $this; diff --git a/app/Filter/TaskCommentFilter.php b/app/Filter/TaskCommentFilter.php index 455098c2..52db5581 100644 --- a/app/Filter/TaskCommentFilter.php +++ b/app/Filter/TaskCommentFilter.php @@ -3,8 +3,8 @@ namespace Kanboard\Filter; use Kanboard\Core\Filter\FilterInterface; -use Kanboard\Model\Comment; -use Kanboard\Model\Task; +use Kanboard\Model\CommentModel; +use Kanboard\Model\TaskModel; /** * Filter tasks by comment @@ -33,8 +33,8 @@ class TaskCommentFilter extends BaseFilter implements FilterInterface */ public function apply() { - $this->query->ilike(Comment::TABLE.'.comment', '%'.$this->value.'%'); - $this->query->join(Comment::TABLE, 'task_id', 'id', Task::TABLE); + $this->query->ilike(CommentModel::TABLE.'.comment', '%'.$this->value.'%'); + $this->query->join(CommentModel::TABLE, 'task_id', 'id', TaskModel::TABLE); return $this; } diff --git a/app/Filter/TaskCompletionDateFilter.php b/app/Filter/TaskCompletionDateFilter.php index f206a3e2..79b5e7d8 100644 --- a/app/Filter/TaskCompletionDateFilter.php +++ b/app/Filter/TaskCompletionDateFilter.php @@ -3,7 +3,7 @@ namespace Kanboard\Filter; use Kanboard\Core\Filter\FilterInterface; -use Kanboard\Model\Task; +use Kanboard\Model\TaskModel; /** * Filter tasks by completion date @@ -32,7 +32,7 @@ class TaskCompletionDateFilter extends BaseDateFilter implements FilterInterface */ public function apply() { - $this->applyDateFilter(Task::TABLE.'.date_completed'); + $this->applyDateFilter(TaskModel::TABLE.'.date_completed'); return $this; } } diff --git a/app/Filter/TaskCreationDateFilter.php b/app/Filter/TaskCreationDateFilter.php index bb6efad6..db28ac88 100644 --- a/app/Filter/TaskCreationDateFilter.php +++ b/app/Filter/TaskCreationDateFilter.php @@ -3,7 +3,7 @@ namespace Kanboard\Filter; use Kanboard\Core\Filter\FilterInterface; -use Kanboard\Model\Task; +use Kanboard\Model\TaskModel; /** * Filter tasks by creation date @@ -32,7 +32,7 @@ class TaskCreationDateFilter extends BaseDateFilter implements FilterInterface */ public function apply() { - $this->applyDateFilter(Task::TABLE.'.date_creation'); + $this->applyDateFilter(TaskModel::TABLE.'.date_creation'); return $this; } } diff --git a/app/Filter/TaskCreatorFilter.php b/app/Filter/TaskCreatorFilter.php index af35e6bc..611db189 100644 --- a/app/Filter/TaskCreatorFilter.php +++ b/app/Filter/TaskCreatorFilter.php @@ -3,7 +3,7 @@ namespace Kanboard\Filter; use Kanboard\Core\Filter\FilterInterface; -use Kanboard\Model\Task; +use Kanboard\Model\TaskModel; /** * Filter tasks by creator @@ -54,14 +54,14 @@ class TaskCreatorFilter extends BaseFilter implements FilterInterface public function apply() { if (is_int($this->value) || ctype_digit($this->value)) { - $this->query->eq(Task::TABLE.'.creator_id', $this->value); + $this->query->eq(TaskModel::TABLE.'.creator_id', $this->value); } else { switch ($this->value) { case 'me': - $this->query->eq(Task::TABLE.'.creator_id', $this->currentUserId); + $this->query->eq(TaskModel::TABLE.'.creator_id', $this->currentUserId); break; case 'nobody': - $this->query->eq(Task::TABLE.'.creator_id', 0); + $this->query->eq(TaskModel::TABLE.'.creator_id', 0); break; default: $this->query->beginOr(); diff --git a/app/Filter/TaskDescriptionFilter.php b/app/Filter/TaskDescriptionFilter.php index 6dda58ae..c73c2f56 100644 --- a/app/Filter/TaskDescriptionFilter.php +++ b/app/Filter/TaskDescriptionFilter.php @@ -3,7 +3,7 @@ namespace Kanboard\Filter; use Kanboard\Core\Filter\FilterInterface; -use Kanboard\Model\Task; +use Kanboard\Model\TaskModel; /** * Filter tasks by description @@ -32,7 +32,7 @@ class TaskDescriptionFilter extends BaseFilter implements FilterInterface */ public function apply() { - $this->query->ilike(Task::TABLE.'.description', '%'.$this->value.'%'); + $this->query->ilike(TaskModel::TABLE.'.description', '%'.$this->value.'%'); return $this; } } diff --git a/app/Filter/TaskDueDateFilter.php b/app/Filter/TaskDueDateFilter.php index e36efdd0..0de055bf 100644 --- a/app/Filter/TaskDueDateFilter.php +++ b/app/Filter/TaskDueDateFilter.php @@ -3,7 +3,7 @@ namespace Kanboard\Filter; use Kanboard\Core\Filter\FilterInterface; -use Kanboard\Model\Task; +use Kanboard\Model\TaskModel; /** * Filter tasks by due date @@ -32,9 +32,9 @@ class TaskDueDateFilter extends BaseDateFilter implements FilterInterface */ public function apply() { - $this->query->neq(Task::TABLE.'.date_due', 0); - $this->query->notNull(Task::TABLE.'.date_due'); - $this->applyDateFilter(Task::TABLE.'.date_due'); + $this->query->neq(TaskModel::TABLE.'.date_due', 0); + $this->query->notNull(TaskModel::TABLE.'.date_due'); + $this->applyDateFilter(TaskModel::TABLE.'.date_due'); return $this; } diff --git a/app/Filter/TaskDueDateRangeFilter.php b/app/Filter/TaskDueDateRangeFilter.php index 10deb0d3..a6aefbe2 100644 --- a/app/Filter/TaskDueDateRangeFilter.php +++ b/app/Filter/TaskDueDateRangeFilter.php @@ -3,7 +3,7 @@ namespace Kanboard\Filter; use Kanboard\Core\Filter\FilterInterface; -use Kanboard\Model\Task; +use Kanboard\Model\TaskModel; /** * Filter tasks by due date range @@ -32,8 +32,8 @@ class TaskDueDateRangeFilter extends BaseFilter implements FilterInterface */ public function apply() { - $this->query->gte(Task::TABLE.'.date_due', is_numeric($this->value[0]) ? $this->value[0] : strtotime($this->value[0])); - $this->query->lte(Task::TABLE.'.date_due', is_numeric($this->value[1]) ? $this->value[1] : strtotime($this->value[1])); + $this->query->gte(TaskModel::TABLE.'.date_due', is_numeric($this->value[0]) ? $this->value[0] : strtotime($this->value[0])); + $this->query->lte(TaskModel::TABLE.'.date_due', is_numeric($this->value[1]) ? $this->value[1] : strtotime($this->value[1])); return $this; } } diff --git a/app/Filter/TaskIdExclusionFilter.php b/app/Filter/TaskIdExclusionFilter.php index 8bfefb2b..20177b29 100644 --- a/app/Filter/TaskIdExclusionFilter.php +++ b/app/Filter/TaskIdExclusionFilter.php @@ -3,7 +3,7 @@ namespace Kanboard\Filter; use Kanboard\Core\Filter\FilterInterface; -use Kanboard\Model\Task; +use Kanboard\Model\TaskModel; /** * Exclude task ids @@ -32,7 +32,7 @@ class TaskIdExclusionFilter extends BaseFilter implements FilterInterface */ public function apply() { - $this->query->notin(Task::TABLE.'.id', $this->value); + $this->query->notin(TaskModel::TABLE.'.id', $this->value); return $this; } } diff --git a/app/Filter/TaskIdFilter.php b/app/Filter/TaskIdFilter.php index 87bac794..fdf668b6 100644 --- a/app/Filter/TaskIdFilter.php +++ b/app/Filter/TaskIdFilter.php @@ -3,7 +3,7 @@ namespace Kanboard\Filter; use Kanboard\Core\Filter\FilterInterface; -use Kanboard\Model\Task; +use Kanboard\Model\TaskModel; /** * Filter tasks by id @@ -32,7 +32,7 @@ class TaskIdFilter extends BaseFilter implements FilterInterface */ public function apply() { - $this->query->eq(Task::TABLE.'.id', $this->value); + $this->query->eq(TaskModel::TABLE.'.id', $this->value); return $this; } } diff --git a/app/Filter/TaskLinkFilter.php b/app/Filter/TaskLinkFilter.php index 18a13a09..98cd597f 100644 --- a/app/Filter/TaskLinkFilter.php +++ b/app/Filter/TaskLinkFilter.php @@ -3,9 +3,9 @@ namespace Kanboard\Filter; use Kanboard\Core\Filter\FilterInterface; -use Kanboard\Model\Link; -use Kanboard\Model\Task; -use Kanboard\Model\TaskLink; +use Kanboard\Model\LinkModel; +use Kanboard\Model\TaskModel; +use Kanboard\Model\TaskLinkModel; use PicoDb\Database; use PicoDb\Table; @@ -60,9 +60,9 @@ class TaskLinkFilter extends BaseFilter implements FilterInterface $task_ids = $this->getSubQuery()->findAllByColumn('task_id'); if (! empty($task_ids)) { - $this->query->in(Task::TABLE.'.id', $task_ids); + $this->query->in(TaskModel::TABLE.'.id', $task_ids); } else { - $this->query->eq(Task::TABLE.'.id', 0); // No match + $this->query->eq(TaskModel::TABLE.'.id', 0); // No match } } @@ -74,12 +74,12 @@ class TaskLinkFilter extends BaseFilter implements FilterInterface */ protected function getSubQuery() { - return $this->db->table(TaskLink::TABLE) + return $this->db->table(TaskLinkModel::TABLE) ->columns( - TaskLink::TABLE.'.task_id', - Link::TABLE.'.label' + TaskLinkModel::TABLE.'.task_id', + LinkModel::TABLE.'.label' ) - ->join(Link::TABLE, 'id', 'link_id', TaskLink::TABLE) - ->ilike(Link::TABLE.'.label', $this->value); + ->join(LinkModel::TABLE, 'id', 'link_id', TaskLinkModel::TABLE) + ->ilike(LinkModel::TABLE.'.label', $this->value); } } diff --git a/app/Filter/TaskModificationDateFilter.php b/app/Filter/TaskModificationDateFilter.php index 5036e9c1..316f1835 100644 --- a/app/Filter/TaskModificationDateFilter.php +++ b/app/Filter/TaskModificationDateFilter.php @@ -3,7 +3,7 @@ namespace Kanboard\Filter; use Kanboard\Core\Filter\FilterInterface; -use Kanboard\Model\Task; +use Kanboard\Model\TaskModel; /** * Filter tasks by modification date @@ -32,7 +32,7 @@ class TaskModificationDateFilter extends BaseDateFilter implements FilterInterfa */ public function apply() { - $this->applyDateFilter(Task::TABLE.'.date_modification'); + $this->applyDateFilter(TaskModel::TABLE.'.date_modification'); return $this; } } diff --git a/app/Filter/TaskProjectFilter.php b/app/Filter/TaskProjectFilter.php index e432efee..0b5a336b 100644 --- a/app/Filter/TaskProjectFilter.php +++ b/app/Filter/TaskProjectFilter.php @@ -3,8 +3,8 @@ namespace Kanboard\Filter; use Kanboard\Core\Filter\FilterInterface; -use Kanboard\Model\Project; -use Kanboard\Model\Task; +use Kanboard\Model\ProjectModel; +use Kanboard\Model\TaskModel; /** * Filter tasks by project @@ -34,9 +34,9 @@ class TaskProjectFilter extends BaseFilter implements FilterInterface public function apply() { if (is_int($this->value) || ctype_digit($this->value)) { - $this->query->eq(Task::TABLE.'.project_id', $this->value); + $this->query->eq(TaskModel::TABLE.'.project_id', $this->value); } else { - $this->query->ilike(Project::TABLE.'.name', $this->value); + $this->query->ilike(ProjectModel::TABLE.'.name', $this->value); } return $this; diff --git a/app/Filter/TaskProjectsFilter.php b/app/Filter/TaskProjectsFilter.php index 47636b1d..2b6b16cb 100644 --- a/app/Filter/TaskProjectsFilter.php +++ b/app/Filter/TaskProjectsFilter.php @@ -3,7 +3,7 @@ namespace Kanboard\Filter; use Kanboard\Core\Filter\FilterInterface; -use Kanboard\Model\Task; +use Kanboard\Model\TaskModel; /** * Filter tasks by project ids @@ -33,9 +33,9 @@ class TaskProjectsFilter extends BaseFilter implements FilterInterface public function apply() { if (empty($this->value)) { - $this->query->eq(Task::TABLE.'.project_id', 0); + $this->query->eq(TaskModel::TABLE.'.project_id', 0); } else { - $this->query->in(Task::TABLE.'.project_id', $this->value); + $this->query->in(TaskModel::TABLE.'.project_id', $this->value); } return $this; diff --git a/app/Filter/TaskReferenceFilter.php b/app/Filter/TaskReferenceFilter.php index 4ad47dd5..27c838f8 100644 --- a/app/Filter/TaskReferenceFilter.php +++ b/app/Filter/TaskReferenceFilter.php @@ -3,7 +3,7 @@ namespace Kanboard\Filter; use Kanboard\Core\Filter\FilterInterface; -use Kanboard\Model\Task; +use Kanboard\Model\TaskModel; /** * Filter tasks by reference @@ -32,7 +32,7 @@ class TaskReferenceFilter extends BaseFilter implements FilterInterface */ public function apply() { - $this->query->eq(Task::TABLE.'.reference', $this->value); + $this->query->eq(TaskModel::TABLE.'.reference', $this->value); return $this; } } diff --git a/app/Filter/TaskStartDateFilter.php b/app/Filter/TaskStartDateFilter.php index dd30762b..d5abedb5 100644 --- a/app/Filter/TaskStartDateFilter.php +++ b/app/Filter/TaskStartDateFilter.php @@ -3,7 +3,7 @@ namespace Kanboard\Filter; use Kanboard\Core\Filter\FilterInterface; -use Kanboard\Model\Task; +use Kanboard\Model\TaskModel; /** * Filter tasks by start date @@ -32,7 +32,7 @@ class TaskStartDateFilter extends BaseDateFilter implements FilterInterface */ public function apply() { - $this->applyDateFilter(Task::TABLE.'.date_started'); + $this->applyDateFilter(TaskModel::TABLE.'.date_started'); return $this; } } diff --git a/app/Filter/TaskStatusFilter.php b/app/Filter/TaskStatusFilter.php index 0ba4361e..a55532cb 100644 --- a/app/Filter/TaskStatusFilter.php +++ b/app/Filter/TaskStatusFilter.php @@ -3,7 +3,7 @@ namespace Kanboard\Filter; use Kanboard\Core\Filter\FilterInterface; -use Kanboard\Model\Task; +use Kanboard\Model\TaskModel; /** * Filter tasks by status @@ -33,9 +33,9 @@ class TaskStatusFilter extends BaseFilter implements FilterInterface public function apply() { if ($this->value === 'open' || $this->value === 'closed') { - $this->query->eq(Task::TABLE.'.is_active', $this->value === 'open' ? Task::STATUS_OPEN : Task::STATUS_CLOSED); + $this->query->eq(TaskModel::TABLE.'.is_active', $this->value === 'open' ? TaskModel::STATUS_OPEN : TaskModel::STATUS_CLOSED); } else { - $this->query->eq(Task::TABLE.'.is_active', $this->value); + $this->query->eq(TaskModel::TABLE.'.is_active', $this->value); } return $this; diff --git a/app/Filter/TaskSubtaskAssigneeFilter.php b/app/Filter/TaskSubtaskAssigneeFilter.php index 4c757315..46553a3d 100644 --- a/app/Filter/TaskSubtaskAssigneeFilter.php +++ b/app/Filter/TaskSubtaskAssigneeFilter.php @@ -3,9 +3,9 @@ namespace Kanboard\Filter; use Kanboard\Core\Filter\FilterInterface; -use Kanboard\Model\Subtask; -use Kanboard\Model\Task; -use Kanboard\Model\User; +use Kanboard\Model\SubtaskModel; +use Kanboard\Model\TaskModel; +use Kanboard\Model\UserModel; use PicoDb\Database; use PicoDb\Table; @@ -81,9 +81,9 @@ class TaskSubtaskAssigneeFilter extends BaseFilter implements FilterInterface $task_ids = $this->getSubQuery()->findAllByColumn('task_id'); if (! empty($task_ids)) { - $this->query->in(Task::TABLE.'.id', $task_ids); + $this->query->in(TaskModel::TABLE.'.id', $task_ids); } else { - $this->query->eq(Task::TABLE.'.id', 0); // No match + $this->query->eq(TaskModel::TABLE.'.id', 0); // No match } } @@ -95,15 +95,15 @@ class TaskSubtaskAssigneeFilter extends BaseFilter implements FilterInterface */ protected function getSubQuery() { - $subquery = $this->db->table(Subtask::TABLE) + $subquery = $this->db->table(SubtaskModel::TABLE) ->columns( - Subtask::TABLE.'.user_id', - Subtask::TABLE.'.task_id', - User::TABLE.'.name', - User::TABLE.'.username' + SubtaskModel::TABLE.'.user_id', + SubtaskModel::TABLE.'.task_id', + UserModel::TABLE.'.name', + UserModel::TABLE.'.username' ) - ->join(User::TABLE, 'id', 'user_id', Subtask::TABLE) - ->neq(Subtask::TABLE.'.status', Subtask::STATUS_DONE); + ->join(UserModel::TABLE, 'id', 'user_id', SubtaskModel::TABLE) + ->neq(SubtaskModel::TABLE.'.status', SubtaskModel::STATUS_DONE); return $this->applySubQueryFilter($subquery); } @@ -118,19 +118,19 @@ class TaskSubtaskAssigneeFilter extends BaseFilter implements FilterInterface protected function applySubQueryFilter(Table $subquery) { if (is_int($this->value) || ctype_digit($this->value)) { - $subquery->eq(Subtask::TABLE.'.user_id', $this->value); + $subquery->eq(SubtaskModel::TABLE.'.user_id', $this->value); } else { switch ($this->value) { case 'me': - $subquery->eq(Subtask::TABLE.'.user_id', $this->currentUserId); + $subquery->eq(SubtaskModel::TABLE.'.user_id', $this->currentUserId); break; case 'nobody': - $subquery->eq(Subtask::TABLE.'.user_id', 0); + $subquery->eq(SubtaskModel::TABLE.'.user_id', 0); break; default: $subquery->beginOr(); - $subquery->ilike(User::TABLE.'.username', $this->value.'%'); - $subquery->ilike(User::TABLE.'.name', '%'.$this->value.'%'); + $subquery->ilike(UserModel::TABLE.'.username', $this->value.'%'); + $subquery->ilike(UserModel::TABLE.'.name', '%'.$this->value.'%'); $subquery->closeOr(); } } diff --git a/app/Filter/TaskSwimlaneFilter.php b/app/Filter/TaskSwimlaneFilter.php index 4e030244..07243969 100644 --- a/app/Filter/TaskSwimlaneFilter.php +++ b/app/Filter/TaskSwimlaneFilter.php @@ -3,9 +3,9 @@ namespace Kanboard\Filter; use Kanboard\Core\Filter\FilterInterface; -use Kanboard\Model\Project; -use Kanboard\Model\Swimlane; -use Kanboard\Model\Task; +use Kanboard\Model\ProjectModel; +use Kanboard\Model\SwimlaneModel; +use Kanboard\Model\TaskModel; /** * Filter tasks by swimlane @@ -35,13 +35,13 @@ class TaskSwimlaneFilter extends BaseFilter implements FilterInterface public function apply() { if (is_int($this->value) || ctype_digit($this->value)) { - $this->query->eq(Task::TABLE.'.swimlane_id', $this->value); + $this->query->eq(TaskModel::TABLE.'.swimlane_id', $this->value); } elseif ($this->value === 'default') { - $this->query->eq(Task::TABLE.'.swimlane_id', 0); + $this->query->eq(TaskModel::TABLE.'.swimlane_id', 0); } else { $this->query->beginOr(); - $this->query->ilike(Swimlane::TABLE.'.name', $this->value); - $this->query->ilike(Project::TABLE.'.default_swimlane', $this->value); + $this->query->ilike(SwimlaneModel::TABLE.'.name', $this->value); + $this->query->ilike(ProjectModel::TABLE.'.default_swimlane', $this->value); $this->query->closeOr(); } diff --git a/app/Filter/TaskTitleFilter.php b/app/Filter/TaskTitleFilter.php index 9853369c..4e3a2df1 100644 --- a/app/Filter/TaskTitleFilter.php +++ b/app/Filter/TaskTitleFilter.php @@ -3,7 +3,7 @@ namespace Kanboard\Filter; use Kanboard\Core\Filter\FilterInterface; -use Kanboard\Model\Task; +use Kanboard\Model\TaskModel; /** * Filter tasks by title @@ -34,11 +34,11 @@ class TaskTitleFilter extends BaseFilter implements FilterInterface { if (ctype_digit($this->value) || (strlen($this->value) > 1 && $this->value{0} === '#' && ctype_digit(substr($this->value, 1)))) { $this->query->beginOr(); - $this->query->eq(Task::TABLE.'.id', str_replace('#', '', $this->value)); - $this->query->ilike(Task::TABLE.'.title', '%'.$this->value.'%'); + $this->query->eq(TaskModel::TABLE.'.id', str_replace('#', '', $this->value)); + $this->query->ilike(TaskModel::TABLE.'.title', '%'.$this->value.'%'); $this->query->closeOr(); } else { - $this->query->ilike(Task::TABLE.'.title', '%'.$this->value.'%'); + $this->query->ilike(TaskModel::TABLE.'.title', '%'.$this->value.'%'); } return $this; diff --git a/app/Formatter/BoardFormatter.php b/app/Formatter/BoardFormatter.php index 6a96b3e6..dbc7cf21 100644 --- a/app/Formatter/BoardFormatter.php +++ b/app/Formatter/BoardFormatter.php @@ -3,7 +3,7 @@ namespace Kanboard\Formatter; use Kanboard\Core\Filter\FormatterInterface; -use Kanboard\Model\Task; +use Kanboard\Model\TaskModel; /** * Board Formatter @@ -43,11 +43,11 @@ class BoardFormatter extends BaseFormatter implements FormatterInterface public function format() { $tasks = $this->query - ->eq(Task::TABLE.'.project_id', $this->projectId) - ->asc(Task::TABLE.'.position') + ->eq(TaskModel::TABLE.'.project_id', $this->projectId) + ->asc(TaskModel::TABLE.'.position') ->findAll(); - return $this->board->getBoard($this->projectId, function ($project_id, $column_id, $swimlane_id) use ($tasks) { + return $this->boardModel->getBoard($this->projectId, function ($project_id, $column_id, $swimlane_id) use ($tasks) { return array_filter($tasks, function (array $task) use ($column_id, $swimlane_id) { return $task['column_id'] == $column_id && $task['swimlane_id'] == $swimlane_id; }); diff --git a/app/Formatter/ProjectActivityEventFormatter.php b/app/Formatter/ProjectActivityEventFormatter.php index ae80e5e7..aa0ea7cd 100644 --- a/app/Formatter/ProjectActivityEventFormatter.php +++ b/app/Formatter/ProjectActivityEventFormatter.php @@ -21,7 +21,7 @@ class ProjectActivityEventFormatter extends BaseFormatter implements FormatterIn unset($event['data']); $event['author'] = $event['author_name'] ?: $event['author_username']; - $event['event_title'] = $this->notification->getTitleWithAuthor($event['author'], $event['event_name'], $event); + $event['event_title'] = $this->notificationModel->getTitleWithAuthor($event['author'], $event['event_name'], $event); $event['event_content'] = $this->renderEvent($event); } diff --git a/app/Formatter/ProjectGanttFormatter.php b/app/Formatter/ProjectGanttFormatter.php index 2400ed70..af04f498 100644 --- a/app/Formatter/ProjectGanttFormatter.php +++ b/app/Formatter/ProjectGanttFormatter.php @@ -21,7 +21,7 @@ class ProjectGanttFormatter extends BaseFormatter implements FormatterInterface public function format() { $projects = $this->query->findAll(); - $colors = $this->color->getDefaultColors(); + $colors = $this->colorModel->getDefaultColors(); $bars = array(); foreach ($projects as $project) { @@ -48,7 +48,7 @@ class ProjectGanttFormatter extends BaseFormatter implements FormatterInterface 'gantt_link' => $this->helper->url->href('TaskGanttController', 'show', array('project_id' => $project['id'])), 'color' => $color, 'not_defined' => empty($project['start_date']) || empty($project['end_date']), - 'users' => $this->projectUserRole->getAllUsersGroupedByRole($project['id']), + 'users' => $this->projectUserRoleModel->getAllUsersGroupedByRole($project['id']), ); } diff --git a/app/Formatter/SubtaskTimeTrackingCalendarFormatter.php b/app/Formatter/SubtaskTimeTrackingCalendarFormatter.php index 047a39b9..b7b81d87 100644 --- a/app/Formatter/SubtaskTimeTrackingCalendarFormatter.php +++ b/app/Formatter/SubtaskTimeTrackingCalendarFormatter.php @@ -25,8 +25,8 @@ class SubtaskTimeTrackingCalendarFormatter extends BaseFormatter implements Form 'title' => t('#%d', $row['task_id']).' '.$row['subtask_title'].$user, 'start' => date('Y-m-d\TH:i:s', $row['start']), 'end' => date('Y-m-d\TH:i:s', $row['end'] ?: time()), - 'backgroundColor' => $this->color->getBackgroundColor($row['color_id']), - 'borderColor' => $this->color->getBorderColor($row['color_id']), + 'backgroundColor' => $this->colorModel->getBackgroundColor($row['color_id']), + 'borderColor' => $this->colorModel->getBorderColor($row['color_id']), 'textColor' => 'black', 'url' => $this->helper->url->to('TaskViewController', 'show', array('task_id' => $row['task_id'], 'project_id' => $row['project_id'])), 'editable' => false, diff --git a/app/Formatter/TaskAutoCompleteFormatter.php b/app/Formatter/TaskAutoCompleteFormatter.php index 480ee797..4f1c4c69 100644 --- a/app/Formatter/TaskAutoCompleteFormatter.php +++ b/app/Formatter/TaskAutoCompleteFormatter.php @@ -3,7 +3,7 @@ namespace Kanboard\Formatter; use Kanboard\Core\Filter\FormatterInterface; -use Kanboard\Model\Task; +use Kanboard\Model\TaskModel; /** * Task AutoComplete Formatter @@ -21,7 +21,7 @@ class TaskAutoCompleteFormatter extends BaseFormatter implements FormatterInterf */ public function format() { - $tasks = $this->query->columns(Task::TABLE.'.id', Task::TABLE.'.title')->findAll(); + $tasks = $this->query->columns(TaskModel::TABLE.'.id', TaskModel::TABLE.'.title')->findAll(); foreach ($tasks as &$task) { $task['value'] = $task['title']; diff --git a/app/Formatter/TaskCalendarFormatter.php b/app/Formatter/TaskCalendarFormatter.php index d478d2bd..75d2a83e 100644 --- a/app/Formatter/TaskCalendarFormatter.php +++ b/app/Formatter/TaskCalendarFormatter.php @@ -44,11 +44,11 @@ class TaskCalendarFormatter extends BaseTaskCalendarFormatter implements Formatt foreach ($this->query->findAll() as $task) { $events[] = array( - 'timezoneParam' => $this->timezone->getCurrentTimezone(), + 'timezoneParam' => $this->timezoneModel->getCurrentTimezone(), 'id' => $task['id'], 'title' => t('#%d', $task['id']).' '.$task['title'], - 'backgroundColor' => $this->color->getBackgroundColor($task['color_id']), - 'borderColor' => $this->color->getBorderColor($task['color_id']), + 'backgroundColor' => $this->colorModel->getBackgroundColor($task['color_id']), + 'borderColor' => $this->colorModel->getBorderColor($task['color_id']), 'textColor' => 'black', 'url' => $this->helper->url->to('TaskViewController', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])), 'start' => date($this->getDateTimeFormat(), $task[$this->startColumn]), diff --git a/app/Formatter/TaskGanttFormatter.php b/app/Formatter/TaskGanttFormatter.php index 4ff5c019..ddb3f93a 100644 --- a/app/Formatter/TaskGanttFormatter.php +++ b/app/Formatter/TaskGanttFormatter.php @@ -47,7 +47,7 @@ class TaskGanttFormatter extends BaseFormatter implements FormatterInterface private function formatTask(array $task) { if (! isset($this->columns[$task['project_id']])) { - $this->columns[$task['project_id']] = $this->column->getList($task['project_id']); + $this->columns[$task['project_id']] = $this->columnModel->getList($task['project_id']); } $start = $task['date_started'] ?: time(); @@ -69,9 +69,9 @@ class TaskGanttFormatter extends BaseFormatter implements FormatterInterface ), 'column_title' => $task['column_name'], 'assignee' => $task['assignee_name'] ?: $task['assignee_username'], - 'progress' => $this->task->getProgress($task, $this->columns[$task['project_id']]).'%', + 'progress' => $this->taskModel->getProgress($task, $this->columns[$task['project_id']]).'%', 'link' => $this->helper->url->href('TaskViewController', 'show', array('project_id' => $task['project_id'], 'task_id' => $task['id'])), - 'color' => $this->color->getColorProperties($task['color_id']), + 'color' => $this->colorModel->getColorProperties($task['color_id']), 'not_defined' => empty($task['date_due']) || empty($task['date_started']), ); } diff --git a/app/Formatter/UserAutoCompleteFormatter.php b/app/Formatter/UserAutoCompleteFormatter.php index c46a24d0..cd23a2a4 100644 --- a/app/Formatter/UserAutoCompleteFormatter.php +++ b/app/Formatter/UserAutoCompleteFormatter.php @@ -2,7 +2,7 @@ namespace Kanboard\Formatter; -use Kanboard\Model\User; +use Kanboard\Model\UserModel; use Kanboard\Core\Filter\FormatterInterface; /** @@ -21,7 +21,7 @@ class UserAutoCompleteFormatter extends BaseFormatter implements FormatterInterf */ public function format() { - $users = $this->query->columns(User::TABLE.'.id', User::TABLE.'.username', User::TABLE.'.name')->findAll(); + $users = $this->query->columns(UserModel::TABLE.'.id', UserModel::TABLE.'.username', UserModel::TABLE.'.name')->findAll(); foreach ($users as &$user) { $user['value'] = $user['username'].' (#'.$user['id'].')'; diff --git a/app/Group/DatabaseBackendGroupProvider.php b/app/Group/DatabaseBackendGroupProvider.php index 6dbaa43c..29d04d57 100644 --- a/app/Group/DatabaseBackendGroupProvider.php +++ b/app/Group/DatabaseBackendGroupProvider.php @@ -23,7 +23,7 @@ class DatabaseBackendGroupProvider extends Base implements GroupBackendProviderI public function find($input) { $result = array(); - $groups = $this->group->search($input); + $groups = $this->groupModel->search($input); foreach ($groups as $group) { $result[] = new DatabaseGroupProvider($group); diff --git a/app/Helper/AppHelper.php b/app/Helper/AppHelper.php index 1f497929..b738f85c 100644 --- a/app/Helper/AppHelper.php +++ b/app/Helper/AppHelper.php @@ -22,7 +22,7 @@ class AppHelper extends Base */ public function config($param, $default_value = '') { - return $this->config->get($param, $default_value); + return $this->configModel->get($param, $default_value); } /** @@ -90,7 +90,7 @@ class AppHelper extends Base */ public function jsLang() { - return $this->language->getJsLanguageCode(); + return $this->languageModel->getJsLanguageCode(); } /** @@ -101,7 +101,7 @@ class AppHelper extends Base */ public function getTimezone() { - return $this->timezone->getCurrentTimezone(); + return $this->timezoneModel->getCurrentTimezone(); } /** diff --git a/app/Helper/AssetHelper.php b/app/Helper/AssetHelper.php index b3dc711f..dad1448a 100644 --- a/app/Helper/AssetHelper.php +++ b/app/Helper/AssetHelper.php @@ -45,8 +45,8 @@ class AssetHelper extends Base */ public function customCss() { - if ($this->config->get('application_stylesheet')) { - return '<style>'.$this->config->get('application_stylesheet').'</style>'; + if ($this->configModel->get('application_stylesheet')) { + return '<style>'.$this->configModel->get('application_stylesheet').'</style>'; } return ''; @@ -60,6 +60,6 @@ class AssetHelper extends Base */ public function colorCss() { - return '<style>'.$this->color->getCss().'</style>'; + return '<style>'.$this->colorModel->getCss().'</style>'; } } diff --git a/app/Helper/CalendarHelper.php b/app/Helper/CalendarHelper.php index d5f4af21..b35c40f7 100644 --- a/app/Helper/CalendarHelper.php +++ b/app/Helper/CalendarHelper.php @@ -47,7 +47,7 @@ class CalendarHelper extends Base */ public function getTaskEvents(QueryBuilder $queryBuilder, $start, $end) { - $startColumn = $this->config->get('calendar_project_tasks', 'date_started'); + $startColumn = $this->configModel->get('calendar_project_tasks', 'date_started'); $queryBuilder->getQuery()->addCondition($this->getCalendarCondition( $this->dateParser->getTimestampFromIsoFormat($start), @@ -75,7 +75,7 @@ class CalendarHelper extends Base { $formatter = new SubtaskTimeTrackingCalendarFormatter($this->container); return $formatter - ->withQuery($this->subtaskTimeTracking->getUserQuery($user_id) + ->withQuery($this->subtaskTimeTrackingModel->getUserQuery($user_id) ->addCondition($this->getCalendarCondition( $this->dateParser->getTimestampFromIsoFormat($start), $this->dateParser->getTimestampFromIsoFormat($end), diff --git a/app/Helper/DateHelper.php b/app/Helper/DateHelper.php index 3844ce64..7e2ec79c 100644 --- a/app/Helper/DateHelper.php +++ b/app/Helper/DateHelper.php @@ -22,7 +22,7 @@ class DateHelper extends Base */ public function time($value) { - return date($this->config->get('application_time_format', 'H:i'), $value); + return date($this->configModel->get('application_time_format', 'H:i'), $value); } /** @@ -42,7 +42,7 @@ class DateHelper extends Base $value = strtotime($value); } - return date($this->config->get('application_date_format', 'm/d/Y'), $value); + return date($this->configModel->get('application_date_format', 'm/d/Y'), $value); } /** @@ -54,7 +54,7 @@ class DateHelper extends Base */ public function datetime($value) { - return date($this->config->get('application_datetime_format', 'm/d/Y H:i'), $value); + return date($this->configModel->get('application_datetime_format', 'm/d/Y H:i'), $value); } /** diff --git a/app/Helper/LayoutHelper.php b/app/Helper/LayoutHelper.php index 42047dd9..8ebb05d4 100644 --- a/app/Helper/LayoutHelper.php +++ b/app/Helper/LayoutHelper.php @@ -27,7 +27,7 @@ class LayoutHelper extends Base } if (! isset($params['no_layout']) && ! isset($params['board_selector'])) { - $params['board_selector'] = $this->projectUserRole->getActiveProjectsByUser($this->userSession->getId()); + $params['board_selector'] = $this->projectUserRoleModel->getActiveProjectsByUser($this->userSession->getId()); } return $this->pageLayout($template, $params); @@ -110,7 +110,7 @@ class LayoutHelper extends Base public function config($template, array $params) { if (! isset($params['values'])) { - $params['values'] = $this->config->getAll(); + $params['values'] = $this->configModel->getAll(); } if (! isset($params['errors'])) { diff --git a/app/Helper/ProjectActivityHelper.php b/app/Helper/ProjectActivityHelper.php index 0638a978..40f386db 100644 --- a/app/Helper/ProjectActivityHelper.php +++ b/app/Helper/ProjectActivityHelper.php @@ -7,7 +7,7 @@ use Kanboard\Filter\ProjectActivityProjectIdFilter; use Kanboard\Filter\ProjectActivityProjectIdsFilter; use Kanboard\Filter\ProjectActivityTaskIdFilter; use Kanboard\Formatter\ProjectActivityEventFormatter; -use Kanboard\Model\ProjectActivity; +use Kanboard\Model\ProjectActivityModel; /** * Project Activity Helper @@ -26,7 +26,7 @@ class ProjectActivityHelper extends Base */ public function searchEvents($search) { - $projects = $this->projectUserRole->getProjectsByUser($this->userSession->getId()); + $projects = $this->projectUserRoleModel->getProjectsByUser($this->userSession->getId()); $events = array(); if ($search !== '') { @@ -34,7 +34,7 @@ class ProjectActivityHelper extends Base $queryBuilder ->withFilter(new ProjectActivityProjectIdsFilter(array_keys($projects))) ->getQuery() - ->desc(ProjectActivity::TABLE.'.id') + ->desc(ProjectActivityModel::TABLE.'.id') ->limit(500) ; @@ -58,7 +58,7 @@ class ProjectActivityHelper extends Base ->withFilter(new ProjectActivityProjectIdFilter($project_id)); $queryBuilder->getQuery() - ->desc(ProjectActivity::TABLE.'.id') + ->desc(ProjectActivityModel::TABLE.'.id') ->limit($limit) ; @@ -79,7 +79,7 @@ class ProjectActivityHelper extends Base ->withFilter(new ProjectActivityProjectIdsFilter($project_ids)); $queryBuilder->getQuery() - ->desc(ProjectActivity::TABLE.'.id') + ->desc(ProjectActivityModel::TABLE.'.id') ->limit($limit) ; @@ -98,7 +98,7 @@ class ProjectActivityHelper extends Base $queryBuilder = $this->projectActivityQuery ->withFilter(new ProjectActivityTaskIdFilter($task_id)); - $queryBuilder->getQuery()->desc(ProjectActivity::TABLE.'.id'); + $queryBuilder->getQuery()->desc(ProjectActivityModel::TABLE.'.id'); return $queryBuilder->format(new ProjectActivityEventFormatter($this->container)); } diff --git a/app/Helper/ProjectHeaderHelper.php b/app/Helper/ProjectHeaderHelper.php index 19570059..9514f4f2 100644 --- a/app/Helper/ProjectHeaderHelper.php +++ b/app/Helper/ProjectHeaderHelper.php @@ -48,9 +48,9 @@ class ProjectHeaderHelper extends Base return $this->template->render('project_header/header', array( 'project' => $project, 'filters' => $filters, - 'categories_list' => $this->category->getList($project['id'], false), - 'users_list' => $this->projectUserRole->getAssignableUsersList($project['id'], false), - 'custom_filters_list' => $this->customFilter->getAll($project['id'], $this->userSession->getId()), + 'categories_list' => $this->categoryModel->getList($project['id'], false), + 'users_list' => $this->projectUserRoleModel->getAssignableUsersList($project['id'], false), + 'custom_filters_list' => $this->customFilterModel->getAll($project['id'], $this->userSession->getId()), 'board_view' => $boardView, )); } diff --git a/app/Helper/TaskHelper.php b/app/Helper/TaskHelper.php index 4857d0ee..1b510d2a 100644 --- a/app/Helper/TaskHelper.php +++ b/app/Helper/TaskHelper.php @@ -22,22 +22,22 @@ class TaskHelper extends Base public function getColors() { - return $this->color->getList(); + return $this->colorModel->getList(); } public function recurrenceTriggers() { - return $this->task->getRecurrenceTriggerList(); + return $this->taskModel->getRecurrenceTriggerList(); } public function recurrenceTimeframes() { - return $this->task->getRecurrenceTimeframeList(); + return $this->taskModel->getRecurrenceTimeframeList(); } public function recurrenceBasedates() { - return $this->task->getRecurrenceBasedateList(); + return $this->taskModel->getRecurrenceBasedateList(); } public function canRemove(array $task) @@ -142,7 +142,7 @@ class TaskHelper extends Base public function selectStartDate(array $values, array $errors = array(), array $attributes = array()) { - $placeholder = date($this->config->get('application_date_format', 'm/d/Y H:i')); + $placeholder = date($this->configModel->get('application_date_format', 'm/d/Y H:i')); $attributes = array_merge(array('tabindex="11"', 'placeholder="'.$placeholder.'"'), $attributes); $html = $this->helper->form->label(t('Start Date'), 'date_started'); @@ -153,7 +153,7 @@ class TaskHelper extends Base public function selectDueDate(array $values, array $errors = array(), array $attributes = array()) { - $placeholder = date($this->config->get('application_date_format', 'm/d/Y')); + $placeholder = date($this->configModel->get('application_date_format', 'm/d/Y')); $attributes = array_merge(array('tabindex="12"', 'placeholder="'.$placeholder.'"'), $attributes); $html = $this->helper->form->label(t('Due Date'), 'date_due'); @@ -178,9 +178,9 @@ class TaskHelper extends Base public function getProgress($task) { if (! isset($this->columns[$task['project_id']])) { - $this->columns[$task['project_id']] = $this->column->getList($task['project_id']); + $this->columns[$task['project_id']] = $this->columnModel->getList($task['project_id']); } - return $this->task->getProgress($task, $this->columns[$task['project_id']]); + return $this->taskModel->getProgress($task, $this->columns[$task['project_id']]); } } diff --git a/app/Helper/UrlHelper.php b/app/Helper/UrlHelper.php index ab642c62..2127c69e 100644 --- a/app/Helper/UrlHelper.php +++ b/app/Helper/UrlHelper.php @@ -109,7 +109,7 @@ class UrlHelper extends Base public function base() { if (empty($this->base)) { - $this->base = $this->config->get('application_url') ?: $this->server(); + $this->base = $this->configModel->get('application_url') ?: $this->server(); } return $this->base; diff --git a/app/Helper/UserHelper.php b/app/Helper/UserHelper.php index b39d7b62..5c466df3 100644 --- a/app/Helper/UserHelper.php +++ b/app/Helper/UserHelper.php @@ -21,7 +21,7 @@ class UserHelper extends Base */ public function hasNotifications() { - return $this->userUnreadNotification->hasNotifications($this->userSession->getId()); + return $this->userUnreadNotificationModel->hasNotifications($this->userSession->getId()); } /** @@ -50,7 +50,7 @@ class UserHelper extends Base */ public function getFullname(array $user = array()) { - return $this->user->getFullname(empty($user) ? $this->userSession->getAll() : $user); + return $this->userModel->getFullname(empty($user) ? $this->userSession->getAll() : $user); } /** @@ -157,7 +157,7 @@ class UserHelper extends Base */ public function getProjectUserRole($project_id) { - return $this->memoryCache->proxy($this->projectUserRole, 'getUserRole', $project_id, $this->userSession->getId()); + return $this->memoryCache->proxy($this->projectUserRoleModel, 'getUserRole', $project_id, $this->userSession->getId()); } /** diff --git a/app/Import/TaskImport.php b/app/Import/TaskImport.php index 2abafe14..f5ca9b0e 100644 --- a/app/Import/TaskImport.php +++ b/app/Import/TaskImport.php @@ -69,7 +69,7 @@ class TaskImport extends Base $row = $this->prepare($row); if ($this->validateCreation($row)) { - if ($this->taskCreation->create($row) > 0) { + if ($this->taskCreationModel->create($row) > 0) { $this->logger->debug('TaskImport: imported successfully line '.$line_number); $this->counter++; } else { @@ -100,27 +100,27 @@ class TaskImport extends Base $values['time_spent'] = (float) $row['time_spent']; if (! empty($row['assignee'])) { - $values['owner_id'] = $this->user->getIdByUsername($row['assignee']); + $values['owner_id'] = $this->userModel->getIdByUsername($row['assignee']); } if (! empty($row['creator'])) { - $values['creator_id'] = $this->user->getIdByUsername($row['creator']); + $values['creator_id'] = $this->userModel->getIdByUsername($row['creator']); } if (! empty($row['color'])) { - $values['color_id'] = $this->color->find($row['color']); + $values['color_id'] = $this->colorModel->find($row['color']); } if (! empty($row['column'])) { - $values['column_id'] = $this->column->getColumnIdByTitle($this->projectId, $row['column']); + $values['column_id'] = $this->columnModel->getColumnIdByTitle($this->projectId, $row['column']); } if (! empty($row['category'])) { - $values['category_id'] = $this->category->getIdByName($this->projectId, $row['category']); + $values['category_id'] = $this->categoryModel->getIdByName($this->projectId, $row['category']); } if (! empty($row['swimlane'])) { - $values['swimlane_id'] = $this->swimlane->getIdByName($this->projectId, $row['swimlane']); + $values['swimlane_id'] = $this->swimlaneModel->getIdByName($this->projectId, $row['swimlane']); } if (! empty($row['date_due'])) { diff --git a/app/Import/UserImport.php b/app/Import/UserImport.php index 64300d77..c877e82a 100644 --- a/app/Import/UserImport.php +++ b/app/Import/UserImport.php @@ -2,7 +2,7 @@ namespace Kanboard\Import; -use Kanboard\Model\User; +use Kanboard\Model\UserModel; use SimpleValidator\Validator; use SimpleValidator\Validators; use Kanboard\Core\Security\Role; @@ -56,7 +56,7 @@ class UserImport extends Base $row = $this->prepare($row); if ($this->validateCreation($row)) { - if ($this->user->create($row)) { + if ($this->userModel->create($row)) { $this->logger->debug('UserImport: imported successfully line '.$line_number); $this->counter++; } else { @@ -109,7 +109,7 @@ class UserImport extends Base { $v = new Validator($values, array( new Validators\MaxLength('username', t('The maximum length is %d characters', 50), 50), - new Validators\Unique('username', t('The username must be unique'), $this->db->getConnection(), User::TABLE, 'id'), + new Validators\Unique('username', t('The username must be unique'), $this->db->getConnection(), UserModel::TABLE, 'id'), new Validators\MinLength('password', t('The minimum length is %d characters', 6), 6), new Validators\Email('email', t('Email address invalid')), new Validators\Integer('is_ldap_user', t('This value must be an integer')), diff --git a/app/Job/NotificationJob.php b/app/Job/NotificationJob.php index d5fce222..904a9273 100644 --- a/app/Job/NotificationJob.php +++ b/app/Job/NotificationJob.php @@ -39,10 +39,10 @@ class NotificationJob extends BaseJob if (! empty($eventData)) { if (! empty($event['mention'])) { - $this->userNotification->sendUserNotification($event['mention'], $eventName, $eventData); + $this->userNotificationModel->sendUserNotification($event['mention'], $eventName, $eventData); } else { - $this->userNotification->sendNotifications($eventName, $eventData); - $this->projectNotification->sendNotifications($eventData['task']['project_id'], $eventName, $eventData); + $this->userNotificationModel->sendNotifications($eventName, $eventData); + $this->projectNotificationModel->sendNotifications($eventData['task']['project_id'], $eventName, $eventData); } } } @@ -64,19 +64,19 @@ class NotificationJob extends BaseJob switch ($eventObjectName) { case 'Kanboard\Event\TaskEvent': - $values['task'] = $this->taskFinder->getDetails($event['task_id']); + $values['task'] = $this->taskFinderModel->getDetails($event['task_id']); break; case 'Kanboard\Event\SubtaskEvent': - $values['subtask'] = $this->subtask->getById($event['id'], true); - $values['task'] = $this->taskFinder->getDetails($values['subtask']['task_id']); + $values['subtask'] = $this->subtaskModel->getById($event['id'], true); + $values['task'] = $this->taskFinderModel->getDetails($values['subtask']['task_id']); break; case 'Kanboard\Event\FileEvent': $values['file'] = $event; - $values['task'] = $this->taskFinder->getDetails($values['file']['task_id']); + $values['task'] = $this->taskFinderModel->getDetails($values['file']['task_id']); break; case 'Kanboard\Event\CommentEvent': - $values['comment'] = $this->comment->getById($event['id']); - $values['task'] = $this->taskFinder->getDetails($values['comment']['task_id']); + $values['comment'] = $this->commentModel->getById($event['id']); + $values['task'] = $this->taskFinderModel->getDetails($values['comment']['task_id']); break; } diff --git a/app/Job/ProjectMetricJob.php b/app/Job/ProjectMetricJob.php index 2c3e589c..6330bd4c 100644 --- a/app/Job/ProjectMetricJob.php +++ b/app/Job/ProjectMetricJob.php @@ -34,7 +34,7 @@ class ProjectMetricJob extends BaseJob $this->logger->debug(__METHOD__.' Run project metrics calculation'); $now = date('Y-m-d'); - $this->projectDailyColumnStats->updateTotals($projectId, $now); - $this->projectDailyStats->updateTotals($projectId, $now); + $this->projectDailyColumnStatsModel->updateTotals($projectId, $now); + $this->projectDailyStatsModel->updateTotals($projectId, $now); } } diff --git a/app/Middleware/ProjectAuthorizationMiddleware.php b/app/Middleware/ProjectAuthorizationMiddleware.php index 6000ee0e..704491b7 100644 --- a/app/Middleware/ProjectAuthorizationMiddleware.php +++ b/app/Middleware/ProjectAuthorizationMiddleware.php @@ -22,7 +22,7 @@ class ProjectAuthorizationMiddleware extends BaseMiddleware $task_id = $this->request->getIntegerParam('task_id'); if ($task_id > 0 && $project_id === 0) { - $project_id = $this->taskFinder->getProjectId($task_id); + $project_id = $this->taskFinderModel->getProjectId($task_id); } if ($project_id > 0 && ! $this->helper->user->hasProjectAccess($this->router->getController(), $this->router->getAction(), $project_id)) { diff --git a/app/Model/Action.php b/app/Model/ActionModel.php index 568ac85a..53393ed5 100644 --- a/app/Model/Action.php +++ b/app/Model/ActionModel.php @@ -7,10 +7,10 @@ use Kanboard\Core\Base; /** * Action Model * - * @package model + * @package Kanboard\Model * @author Frederic Guillot */ -class Action extends Base +class ActionModel extends Base { /** * SQL table name for actions @@ -28,12 +28,12 @@ class Action extends Base */ public function getAllByUser($user_id) { - $project_ids = $this->projectPermission->getActiveProjectIds($user_id); + $project_ids = $this->projectPermissionModel->getActiveProjectIds($user_id); $actions = array(); if (! empty($project_ids)) { $actions = $this->db->table(self::TABLE)->in('project_id', $project_ids)->findAll(); - $params = $this->actionParameter->getAllByActions(array_column($actions, 'id')); + $params = $this->actionParameterModel->getAllByActions(array_column($actions, 'id')); $this->attachParamsToActions($actions, $params); } @@ -50,7 +50,7 @@ class Action extends Base public function getAllByProject($project_id) { $actions = $this->db->table(self::TABLE)->eq('project_id', $project_id)->findAll(); - $params = $this->actionParameter->getAllByActions(array_column($actions, 'id')); + $params = $this->actionParameterModel->getAllByActions(array_column($actions, 'id')); return $this->attachParamsToActions($actions, $params); } @@ -63,7 +63,7 @@ class Action extends Base public function getAll() { $actions = $this->db->table(self::TABLE)->findAll(); - $params = $this->actionParameter->getAll(); + $params = $this->actionParameterModel->getAll(); return $this->attachParamsToActions($actions, $params); } @@ -79,7 +79,7 @@ class Action extends Base $action = $this->db->table(self::TABLE)->eq('id', $action_id)->findOne(); if (! empty($action)) { - $action['params'] = $this->actionParameter->getAllByAction($action_id); + $action['params'] = $this->actionParameterModel->getAllByAction($action_id); } return $action; @@ -138,7 +138,7 @@ class Action extends Base $action_id = $this->db->getLastId(); - if (! $this->actionParameter->create($action_id, $values)) { + if (! $this->actionParameterModel->create($action_id, $values)) { $this->db->cancelTransaction(); return false; } @@ -158,7 +158,7 @@ class Action extends Base */ public function duplicate($src_project_id, $dst_project_id) { - $actions = $this->action->getAllByProject($src_project_id); + $actions = $this->actionModel->getAllByProject($src_project_id); foreach ($actions as $action) { $this->db->startTransaction(); @@ -176,7 +176,7 @@ class Action extends Base $action_id = $this->db->getLastId(); - if (! $this->actionParameter->duplicateParameters($dst_project_id, $action_id, $action['params'])) { + if (! $this->actionParameterModel->duplicateParameters($dst_project_id, $action_id, $action['params'])) { $this->logger->error('Action::duplicate => skip action '.$action['action_name'].' '.$action['id']); $this->db->cancelTransaction(); continue; diff --git a/app/Model/ActionParameter.php b/app/Model/ActionParameterModel.php index a2fe74e5..9895da0f 100644 --- a/app/Model/ActionParameter.php +++ b/app/Model/ActionParameterModel.php @@ -7,10 +7,10 @@ use Kanboard\Core\Base; /** * Action Parameter Model * - * @package model + * @package Kanboard\Model * @author Frederic Guillot */ -class ActionParameter extends Base +class ActionParameterModel extends Base { /** * SQL table name @@ -147,16 +147,16 @@ class ActionParameter extends Base case 'project_id': return $value != $project_id ? $value : false; case 'category_id': - return $this->category->getIdByName($project_id, $this->category->getNameById($value)) ?: false; + return $this->categoryModel->getIdByName($project_id, $this->categoryModel->getNameById($value)) ?: false; case 'src_column_id': case 'dest_column_id': case 'dst_column_id': case 'column_id': - $column = $this->column->getById($value); - return empty($column) ? false : $this->column->getColumnIdByTitle($project_id, $column['title']) ?: false; + $column = $this->columnModel->getById($value); + return empty($column) ? false : $this->columnModel->getColumnIdByTitle($project_id, $column['title']) ?: false; case 'user_id': case 'owner_id': - return $this->projectPermission->isAssignable($project_id, $value) ? $value : false; + return $this->projectPermissionModel->isAssignable($project_id, $value) ? $value : false; default: return $value; } diff --git a/app/Model/AvatarFile.php b/app/Model/AvatarFileModel.php index cfb9e713..6e36d83f 100644 --- a/app/Model/AvatarFile.php +++ b/app/Model/AvatarFileModel.php @@ -8,10 +8,10 @@ use Kanboard\Core\Base; /** * Avatar File * - * @package model + * @package Kanboard\Model * @author Frederic Guillot */ -class AvatarFile extends Base +class AvatarFileModel extends Base { /** * Path prefix @@ -29,7 +29,7 @@ class AvatarFile extends Base */ public function getFilename($user_id) { - return $this->db->table(User::TABLE)->eq('id', $user_id)->findOneColumn('avatar_path'); + return $this->db->table(UserModel::TABLE)->eq('id', $user_id)->findOneColumn('avatar_path'); } /** @@ -42,7 +42,7 @@ class AvatarFile extends Base */ public function create($user_id, $path) { - $result = $this->db->table(User::TABLE)->eq('id', $user_id)->update(array( + $result = $this->db->table(UserModel::TABLE)->eq('id', $user_id)->update(array( 'avatar_path' => $path, )); @@ -65,7 +65,7 @@ class AvatarFile extends Base if (! empty($filename)) { $this->objectStorage->remove($filename); - return $this->db->table(User::TABLE)->eq('id', $user_id)->update(array('avatar_path' => '')); + return $this->db->table(UserModel::TABLE)->eq('id', $user_id)->update(array('avatar_path' => '')); } } catch (Exception $e) { $this->logger->error($e->getMessage()); diff --git a/app/Model/Board.php b/app/Model/BoardModel.php index 91acfb1b..d2718b47 100644 --- a/app/Model/Board.php +++ b/app/Model/BoardModel.php @@ -7,10 +7,10 @@ use Kanboard\Core\Base; /** * Board model * - * @package model + * @package Kanboard\Model * @author Frederic Guillot */ -class Board extends Base +class BoardModel extends Base { /** * Get Kanboard default columns @@ -31,7 +31,7 @@ class Board extends Base */ public function getUserColumns() { - $column_names = explode(',', $this->config->get('board_columns', implode(',', $this->getDefaultColumns()))); + $column_names = explode(',', $this->configModel->get('board_columns', implode(',', $this->getDefaultColumns()))); $columns = array(); foreach ($column_names as $column_name) { @@ -66,7 +66,7 @@ class Board extends Base 'description' => $column['description'], ); - if (! $this->db->table(Column::TABLE)->save($values)) { + if (! $this->db->table(ColumnModel::TABLE)->save($values)) { return false; } } @@ -84,13 +84,13 @@ class Board extends Base */ public function duplicate($project_from, $project_to) { - $columns = $this->db->table(Column::TABLE) + $columns = $this->db->table(ColumnModel::TABLE) ->columns('title', 'task_limit', 'description') ->eq('project_id', $project_from) ->asc('position') ->findAll(); - return $this->board->create($project_to, $columns); + return $this->boardModel->create($project_to, $columns); } /** @@ -103,8 +103,8 @@ class Board extends Base */ public function getBoard($project_id, $callback = null) { - $swimlanes = $this->swimlane->getSwimlanes($project_id); - $columns = $this->column->getAll($project_id); + $swimlanes = $this->swimlaneModel->getSwimlanes($project_id); + $columns = $this->columnModel->getAll($project_id); $nb_columns = count($columns); for ($i = 0, $ilen = count($swimlanes); $i < $ilen; $i++) { @@ -122,7 +122,7 @@ class Board extends Base $swimlanes[0]['columns'][$j]['total_score'] = 0; } - $swimlanes[$i]['columns'][$j]['tasks'] = $callback === null ? $this->taskFinder->getTasksByColumnAndSwimlane($project_id, $column_id, $swimlane_id) : $callback($project_id, $column_id, $swimlane_id); + $swimlanes[$i]['columns'][$j]['tasks'] = $callback === null ? $this->taskFinderModel->getTasksByColumnAndSwimlane($project_id, $column_id, $swimlane_id) : $callback($project_id, $column_id, $swimlane_id); $swimlanes[$i]['columns'][$j]['nb_tasks'] = count($swimlanes[$i]['columns'][$j]['tasks']); $swimlanes[$i]['columns'][$j]['score'] = $this->getColumnSum($swimlanes[$i]['columns'][$j]['tasks'], 'score'); $swimlanes[$i]['nb_tasks'] += $swimlanes[$i]['columns'][$j]['nb_tasks']; @@ -164,7 +164,7 @@ class Board extends Base public function getColumnStats($project_id, $prepend = false) { $listing = $this->db - ->hashtable(Task::TABLE) + ->hashtable(TaskModel::TABLE) ->eq('project_id', $project_id) ->eq('is_active', 1) ->groupBy('column_id') diff --git a/app/Model/Category.php b/app/Model/CategoryModel.php index 00690a41..62fb5611 100644 --- a/app/Model/Category.php +++ b/app/Model/CategoryModel.php @@ -7,10 +7,10 @@ use Kanboard\Core\Base; /** * Category model * - * @package model + * @package Kanboard\Model * @author Frederic Guillot */ -class Category extends Base +class CategoryModel extends Base { /** * SQL table name @@ -125,7 +125,7 @@ class Category extends Base public function createDefaultCategories($project_id) { $results = array(); - $categories = explode(',', $this->config->get('project_categories')); + $categories = explode(',', $this->configModel->get('project_categories')); foreach ($categories as $category) { $category = trim($category); @@ -176,7 +176,7 @@ class Category extends Base { $this->db->startTransaction(); - $this->db->table(Task::TABLE)->eq('category_id', $category_id)->update(array('category_id' => 0)); + $this->db->table(TaskModel::TABLE)->eq('category_id', $category_id)->update(array('category_id' => 0)); if (! $this->db->table(self::TABLE)->eq('id', $category_id)->remove()) { $this->db->cancelTransaction(); diff --git a/app/Model/Color.php b/app/Model/ColorModel.php index 025ca669..9e69dda2 100644 --- a/app/Model/Color.php +++ b/app/Model/ColorModel.php @@ -7,10 +7,10 @@ use Kanboard\Core\Base; /** * Color model * - * @package model + * @package Kanboard\Model * @author Frederic Guillot */ -class Color extends Base +class ColorModel extends Base { /** * Default colors @@ -165,7 +165,7 @@ class Color extends Base */ public function getDefaultColor() { - return $this->config->get('default_color', 'yellow'); + return $this->configModel->get('default_color', 'yellow'); } /** diff --git a/app/Model/Column.php b/app/Model/ColumnModel.php index 329ff2d0..1adac0f2 100644 --- a/app/Model/Column.php +++ b/app/Model/ColumnModel.php @@ -7,10 +7,10 @@ use Kanboard\Core\Base; /** * Column Model * - * @package model + * @package Kanboard\Model * @author Frederic Guillot */ -class Column extends Base +class ColumnModel extends Base { /** * SQL table name diff --git a/app/Model/Comment.php b/app/Model/CommentModel.php index 7d3e1d6e..6e5fd9d8 100644 --- a/app/Model/Comment.php +++ b/app/Model/CommentModel.php @@ -9,10 +9,10 @@ use Kanboard\Core\Base; /** * Comment model * - * @package model + * @package Kanboard\Model * @author Frederic Guillot */ -class Comment extends Base +class CommentModel extends Base { /** * SQL table name @@ -48,12 +48,12 @@ class Comment extends Base self::TABLE.'.task_id', self::TABLE.'.user_id', self::TABLE.'.comment', - User::TABLE.'.username', - User::TABLE.'.name', - User::TABLE.'.email', - User::TABLE.'.avatar_path' + UserModel::TABLE.'.username', + UserModel::TABLE.'.name', + UserModel::TABLE.'.email', + UserModel::TABLE.'.avatar_path' ) - ->join(User::TABLE, 'id', 'user_id') + ->join(UserModel::TABLE, 'id', 'user_id') ->orderBy(self::TABLE.'.date_creation', $sorting) ->eq(self::TABLE.'.task_id', $task_id) ->findAll(); @@ -77,12 +77,12 @@ class Comment extends Base self::TABLE.'.date_creation', self::TABLE.'.comment', self::TABLE.'.reference', - User::TABLE.'.username', - User::TABLE.'.name', - User::TABLE.'.email', - User::TABLE.'.avatar_path' + UserModel::TABLE.'.username', + UserModel::TABLE.'.name', + UserModel::TABLE.'.email', + UserModel::TABLE.'.avatar_path' ) - ->join(User::TABLE, 'id', 'user_id') + ->join(UserModel::TABLE, 'id', 'user_id') ->eq(self::TABLE.'.id', $comment_id) ->findOne(); } @@ -117,7 +117,7 @@ class Comment extends Base if ($comment_id) { $event = new CommentEvent(array('id' => $comment_id) + $values); $this->dispatcher->dispatch(self::EVENT_CREATE, $event); - $this->userMention->fireEvents($values['comment'], self::EVENT_USER_MENTION, $event); + $this->userMentionModel->fireEvents($values['comment'], self::EVENT_USER_MENTION, $event); } return $comment_id; diff --git a/app/Model/Config.php b/app/Model/ConfigModel.php index 1b14efa1..945c5e6f 100644 --- a/app/Model/Config.php +++ b/app/Model/ConfigModel.php @@ -7,10 +7,10 @@ use Kanboard\Core\Security\Token; /** * Config model * - * @package model + * @package Kanboard\Model * @author Frederic Guillot */ -class Config extends Setting +class ConfigModel extends SettingModel { /** * Get a config variable with in-memory caching diff --git a/app/Model/Currency.php b/app/Model/CurrencyModel.php index 7c8cadd4..bfd9697c 100644 --- a/app/Model/Currency.php +++ b/app/Model/CurrencyModel.php @@ -7,10 +7,10 @@ use Kanboard\Core\Base; /** * Currency * - * @package model + * @package Kanboard\Model * @author Frederic Guillot */ -class Currency extends Base +class CurrencyModel extends Base { /** * SQL table name @@ -67,7 +67,7 @@ class Currency extends Base public function getPrice($currency, $price) { static $rates = null; - $reference = $this->config->get('application_currency', 'USD'); + $reference = $this->configModel->get('application_currency', 'USD'); if ($reference !== $currency) { $rates = $rates === null ? $this->db->hashtable(self::TABLE)->getAll('currency', 'rate') : $rates; diff --git a/app/Model/CustomFilter.php b/app/Model/CustomFilterModel.php index 9d409bd4..a4c23b5c 100644 --- a/app/Model/CustomFilter.php +++ b/app/Model/CustomFilterModel.php @@ -7,10 +7,10 @@ use Kanboard\Core\Base; /** * Custom Filter model * - * @package model + * @package Kanboard\Model * @author Timo Litzbarski */ -class CustomFilter extends Base +class CustomFilterModel extends Base { /** * SQL table name @@ -32,8 +32,8 @@ class CustomFilter extends Base return $this->db ->table(self::TABLE) ->columns( - User::TABLE.'.name as owner_name', - User::TABLE.'.username as owner_username', + UserModel::TABLE.'.name as owner_name', + UserModel::TABLE.'.username as owner_username', self::TABLE.'.id', self::TABLE.'.user_id', self::TABLE.'.project_id', @@ -43,7 +43,7 @@ class CustomFilter extends Base self::TABLE.'.append' ) ->asc(self::TABLE.'.name') - ->join(User::TABLE, 'id', 'user_id') + ->join(UserModel::TABLE, 'id', 'user_id') ->beginOr() ->eq('is_shared', 1) ->eq('user_id', $user_id) diff --git a/app/Model/File.php b/app/Model/FileModel.php index 92032110..ad839799 100644 --- a/app/Model/File.php +++ b/app/Model/FileModel.php @@ -11,10 +11,10 @@ use Kanboard\Core\ObjectStorage\ObjectStorageException; /** * Base File Model * - * @package model + * @package Kanboard\Model * @author Frederic Guillot */ -abstract class File extends Base +abstract class FileModel extends Base { /** * Get PicoDb query to get all files @@ -35,10 +35,10 @@ abstract class File extends Base static::TABLE.'.date', static::TABLE.'.user_id', static::TABLE.'.size', - User::TABLE.'.username', - User::TABLE.'.name as user_name' + UserModel::TABLE.'.username', + UserModel::TABLE.'.name as user_name' ) - ->join(User::TABLE, 'id', 'user_id') + ->join(UserModel::TABLE, 'id', 'user_id') ->asc(static::TABLE.'.name'); } diff --git a/app/Model/GroupMember.php b/app/Model/GroupMemberModel.php index a0bbb9f8..a2077789 100644 --- a/app/Model/GroupMember.php +++ b/app/Model/GroupMemberModel.php @@ -7,10 +7,10 @@ use Kanboard\Core\Base; /** * Group Member Model * - * @package model + * @package Kanboard\Model * @author Frederic Guillot */ -class GroupMember extends Base +class GroupMemberModel extends Base { /** * SQL table name @@ -29,7 +29,7 @@ class GroupMember extends Base public function getQuery($group_id) { return $this->db->table(self::TABLE) - ->join(User::TABLE, 'id', 'user_id') + ->join(UserModel::TABLE, 'id', 'user_id') ->eq('group_id', $group_id); } @@ -58,7 +58,7 @@ class GroupMember extends Base ->columns('user_id') ->eq('group_id', $group_id); - return $this->db->table(User::TABLE) + return $this->db->table(UserModel::TABLE) ->notInSubquery('id', $subquery) ->findAll(); } @@ -121,10 +121,10 @@ class GroupMember extends Base public function getGroups($user_id) { return $this->db->table(self::TABLE) - ->columns(Group::TABLE.'.id', Group::TABLE.'.external_id', Group::TABLE.'.name') - ->join(Group::TABLE, 'id', 'group_id') + ->columns(GroupModel::TABLE.'.id', GroupModel::TABLE.'.external_id', GroupModel::TABLE.'.name') + ->join(GroupModel::TABLE, 'id', 'group_id') ->eq(self::TABLE.'.user_id', $user_id) - ->asc(Group::TABLE.'.name') + ->asc(GroupModel::TABLE.'.name') ->findAll(); } } diff --git a/app/Model/Group.php b/app/Model/GroupModel.php index 25579206..0a975570 100644 --- a/app/Model/Group.php +++ b/app/Model/GroupModel.php @@ -7,10 +7,10 @@ use Kanboard\Core\Base; /** * Group Model * - * @package model + * @package Kanboard\Model * @author Frederic Guillot */ -class Group extends Base +class GroupModel extends Base { /** * SQL table name diff --git a/app/Model/Language.php b/app/Model/LanguageModel.php index 126dc5c0..eb6de004 100644 --- a/app/Model/Language.php +++ b/app/Model/LanguageModel.php @@ -11,7 +11,7 @@ use Kanboard\Core\Translator; * @package Kanboard\Model * @author Frederic Guillot */ -class Language extends Base +class LanguageModel extends Base { /** * Get all language codes @@ -164,7 +164,7 @@ class Language extends Base return $this->sessionStorage->user['language']; } - return $this->config->get('application_language', 'en_US'); + return $this->configModel->get('application_language', 'en_US'); } /** diff --git a/app/Model/LastLogin.php b/app/Model/LastLoginModel.php index 35c7afc9..16821392 100644 --- a/app/Model/LastLogin.php +++ b/app/Model/LastLoginModel.php @@ -7,10 +7,10 @@ use Kanboard\Core\Base; /** * LastLogin model * - * @package model + * @package Kanboard\Model * @author Frederic Guillot */ -class LastLogin extends Base +class LastLoginModel extends Base { /** * SQL table name diff --git a/app/Model/Link.php b/app/Model/LinkModel.php index f275edae..b72c7532 100644 --- a/app/Model/Link.php +++ b/app/Model/LinkModel.php @@ -8,11 +8,11 @@ use Kanboard\Core\Base; /** * Link model * - * @package model + * @package Kanboard\Model * @author Olivier Maridat * @author Frederic Guillot */ -class Link extends Base +class LinkModel extends Base { /** * SQL table name diff --git a/app/Model/Metadata.php b/app/Model/MetadataModel.php index b39ce098..6177e5f3 100644 --- a/app/Model/Metadata.php +++ b/app/Model/MetadataModel.php @@ -7,10 +7,10 @@ use Kanboard\Core\Base; /** * Metadata * - * @package model + * @package Kanboard\Model * @author Frederic Guillot */ -abstract class Metadata extends Base +abstract class MetadataModel extends Base { /** * Get the table diff --git a/app/Model/Notification.php b/app/Model/NotificationModel.php index 1e96a8b4..8937b77e 100644 --- a/app/Model/Notification.php +++ b/app/Model/NotificationModel.php @@ -7,10 +7,10 @@ use Kanboard\Core\Base; /** * Notification * - * @package model + * @package Kanboard\Model * @author Frederic Guillot */ -class Notification extends Base +class NotificationModel extends Base { /** * Get the event title with author @@ -24,7 +24,7 @@ class Notification extends Base public function getTitleWithAuthor($event_author, $event_name, array $event_data) { switch ($event_name) { - case Task::EVENT_ASSIGNEE_CHANGE: + case TaskModel::EVENT_ASSIGNEE_CHANGE: $assignee = $event_data['task']['assignee_name'] ?: $event_data['task']['assignee_username']; if (! empty($assignee)) { @@ -32,22 +32,22 @@ class Notification extends Base } return e('%s remove the assignee of the task %s', $event_author, e('#%d', $event_data['task']['id'])); - case Task::EVENT_UPDATE: + case TaskModel::EVENT_UPDATE: return e('%s updated the task #%d', $event_author, $event_data['task']['id']); - case Task::EVENT_CREATE: + case TaskModel::EVENT_CREATE: return e('%s created the task #%d', $event_author, $event_data['task']['id']); - case Task::EVENT_CLOSE: + case TaskModel::EVENT_CLOSE: return e('%s closed the task #%d', $event_author, $event_data['task']['id']); - case Task::EVENT_OPEN: + case TaskModel::EVENT_OPEN: return e('%s open the task #%d', $event_author, $event_data['task']['id']); - case Task::EVENT_MOVE_COLUMN: + case TaskModel::EVENT_MOVE_COLUMN: return e( '%s moved the task #%d to the column "%s"', $event_author, $event_data['task']['id'], $event_data['task']['column_title'] ); - case Task::EVENT_MOVE_POSITION: + case TaskModel::EVENT_MOVE_POSITION: return e( '%s moved the task #%d to the position %d in the column "%s"', $event_author, @@ -55,7 +55,7 @@ class Notification extends Base $event_data['task']['position'], $event_data['task']['column_title'] ); - case Task::EVENT_MOVE_SWIMLANE: + case TaskModel::EVENT_MOVE_SWIMLANE: if ($event_data['task']['swimlane_id'] == 0) { return e('%s moved the task #%d to the first swimlane', $event_author, $event_data['task']['id']); } @@ -66,19 +66,19 @@ class Notification extends Base $event_data['task']['id'], $event_data['task']['swimlane_name'] ); - case Subtask::EVENT_UPDATE: + case SubtaskModel::EVENT_UPDATE: return e('%s updated a subtask for the task #%d', $event_author, $event_data['task']['id']); - case Subtask::EVENT_CREATE: + case SubtaskModel::EVENT_CREATE: return e('%s created a subtask for the task #%d', $event_author, $event_data['task']['id']); - case Comment::EVENT_UPDATE: + case CommentModel::EVENT_UPDATE: return e('%s updated a comment on the task #%d', $event_author, $event_data['task']['id']); - case Comment::EVENT_CREATE: + case CommentModel::EVENT_CREATE: return e('%s commented on the task #%d', $event_author, $event_data['task']['id']); - case TaskFile::EVENT_CREATE: + case TaskFileModel::EVENT_CREATE: return e('%s attached a file to the task #%d', $event_author, $event_data['task']['id']); - case Task::EVENT_USER_MENTION: + case TaskModel::EVENT_USER_MENTION: return e('%s mentioned you in the task #%d', $event_author, $event_data['task']['id']); - case Comment::EVENT_USER_MENTION: + case CommentModel::EVENT_USER_MENTION: return e('%s mentioned you in a comment on the task #%d', $event_author, $event_data['task']['id']); default: return e('Notification'); @@ -96,38 +96,38 @@ class Notification extends Base public function getTitleWithoutAuthor($event_name, array $event_data) { switch ($event_name) { - case TaskFile::EVENT_CREATE: + case TaskFileModel::EVENT_CREATE: return e('New attachment on task #%d: %s', $event_data['file']['task_id'], $event_data['file']['name']); - case Comment::EVENT_CREATE: + case CommentModel::EVENT_CREATE: return e('New comment on task #%d', $event_data['comment']['task_id']); - case Comment::EVENT_UPDATE: + case CommentModel::EVENT_UPDATE: return e('Comment updated on task #%d', $event_data['comment']['task_id']); - case Subtask::EVENT_CREATE: + case SubtaskModel::EVENT_CREATE: return e('New subtask on task #%d', $event_data['subtask']['task_id']); - case Subtask::EVENT_UPDATE: + case SubtaskModel::EVENT_UPDATE: return e('Subtask updated on task #%d', $event_data['subtask']['task_id']); - case Task::EVENT_CREATE: + case TaskModel::EVENT_CREATE: return e('New task #%d: %s', $event_data['task']['id'], $event_data['task']['title']); - case Task::EVENT_UPDATE: + case TaskModel::EVENT_UPDATE: return e('Task updated #%d', $event_data['task']['id']); - case Task::EVENT_CLOSE: + case TaskModel::EVENT_CLOSE: return e('Task #%d closed', $event_data['task']['id']); - case Task::EVENT_OPEN: + case TaskModel::EVENT_OPEN: return e('Task #%d opened', $event_data['task']['id']); - case Task::EVENT_MOVE_COLUMN: + case TaskModel::EVENT_MOVE_COLUMN: return e('Column changed for task #%d', $event_data['task']['id']); - case Task::EVENT_MOVE_POSITION: + case TaskModel::EVENT_MOVE_POSITION: return e('New position for task #%d', $event_data['task']['id']); - case Task::EVENT_MOVE_SWIMLANE: + case TaskModel::EVENT_MOVE_SWIMLANE: return e('Swimlane changed for task #%d', $event_data['task']['id']); - case Task::EVENT_ASSIGNEE_CHANGE: + case TaskModel::EVENT_ASSIGNEE_CHANGE: return e('Assignee changed on task #%d', $event_data['task']['id']); - case Task::EVENT_OVERDUE: + case TaskModel::EVENT_OVERDUE: $nb = count($event_data['tasks']); return $nb > 1 ? e('%d overdue tasks', $nb) : e('Task #%d is overdue', $event_data['tasks'][0]['id']); - case Task::EVENT_USER_MENTION: + case TaskModel::EVENT_USER_MENTION: return e('You were mentioned in the task #%d', $event_data['task']['id']); - case Comment::EVENT_USER_MENTION: + case CommentModel::EVENT_USER_MENTION: return e('You were mentioned in a comment on the task #%d', $event_data['task']['id']); default: return e('Notification'); diff --git a/app/Model/NotificationType.php b/app/Model/NotificationTypeModel.php index a4dffa09..432832ee 100644 --- a/app/Model/NotificationType.php +++ b/app/Model/NotificationTypeModel.php @@ -11,7 +11,7 @@ use Kanboard\Core\Base; * @package model * @author Frederic Guillot */ -abstract class NotificationType extends Base +abstract class NotificationTypeModel extends Base { /** * Container @@ -57,7 +57,7 @@ abstract class NotificationType extends Base * @param string $label * @param string $class * @param boolean $hidden - * @return NotificationType + * @return NotificationTypeModel */ public function setType($type, $label, $class, $hidden = false) { @@ -81,7 +81,7 @@ abstract class NotificationType extends Base * * @access public * @param string $type - * @return \Kanboard\Notification\NotificationInterface + * @return \Kanboard\Core\Notification\NotificationInterface */ public function getType($type) { diff --git a/app/Model/PasswordReset.php b/app/Model/PasswordResetModel.php index 895acb07..d7c74969 100644 --- a/app/Model/PasswordReset.php +++ b/app/Model/PasswordResetModel.php @@ -7,10 +7,10 @@ use Kanboard\Core\Base; /** * Password Reset Model * - * @package model + * @package Kanboard\Model * @author Frederic Guillot */ -class PasswordReset extends Base +class PasswordResetModel extends Base { /** * SQL table name @@ -48,7 +48,7 @@ class PasswordReset extends Base */ public function create($username, $expiration = 0) { - $user_id = $this->db->table(User::TABLE)->eq('username', $username)->neq('email', '')->notNull('email')->findOneColumn('id'); + $user_id = $this->db->table(UserModel::TABLE)->eq('username', $username)->neq('email', '')->notNull('email')->findOneColumn('id'); if (! $user_id) { return false; diff --git a/app/Model/ProjectActivity.php b/app/Model/ProjectActivityModel.php index f6bdbf92..380ea125 100644 --- a/app/Model/ProjectActivity.php +++ b/app/Model/ProjectActivityModel.php @@ -8,10 +8,10 @@ use PicoDb\Table; /** * Project activity model * - * @package model + * @package Kanboard\Model * @author Frederic Guillot */ -class ProjectActivity extends Base +class ProjectActivityModel extends Base { /** * SQL table name @@ -63,17 +63,17 @@ class ProjectActivity extends Base { return $this ->db - ->table(ProjectActivity::TABLE) + ->table(ProjectActivityModel::TABLE) ->columns( - ProjectActivity::TABLE.'.*', + ProjectActivityModel::TABLE.'.*', 'uc.username AS author_username', 'uc.name AS author_name', 'uc.email', 'uc.avatar_path' ) - ->join(Task::TABLE, 'id', 'task_id') - ->join(Project::TABLE, 'id', 'project_id') - ->left(User::TABLE, 'uc', 'id', ProjectActivity::TABLE, 'creator_id'); + ->join(TaskModel::TABLE, 'id', 'task_id') + ->join(ProjectModel::TABLE, 'id', 'project_id') + ->left(UserModel::TABLE, 'uc', 'id', ProjectActivityModel::TABLE, 'creator_id'); } /** diff --git a/app/Model/ProjectDailyColumnStats.php b/app/Model/ProjectDailyColumnStatsModel.php index 38487c76..a0f14cf4 100644 --- a/app/Model/ProjectDailyColumnStats.php +++ b/app/Model/ProjectDailyColumnStatsModel.php @@ -7,10 +7,10 @@ use Kanboard\Core\Base; /** * Project Daily Column Stats * - * @package model + * @package Kanboard\Model * @author Frederic Guillot */ -class ProjectDailyColumnStats extends Base +class ProjectDailyColumnStatsModel extends Base { /** * SQL table name @@ -86,7 +86,7 @@ class ProjectDailyColumnStats extends Base */ public function getAggregatedMetrics($project_id, $from, $to, $field = 'total') { - $columns = $this->column->getList($project_id); + $columns = $this->columnModel->getList($project_id); $metrics = $this->getMetrics($project_id, $from, $to); return $this->buildAggregate($metrics, $columns, $field); } @@ -207,10 +207,10 @@ class ProjectDailyColumnStats extends Base */ private function getScoreByColumns($project_id) { - $stats = $this->db->table(Task::TABLE) + $stats = $this->db->table(TaskModel::TABLE) ->columns('column_id', 'SUM(score) AS score') ->eq('project_id', $project_id) - ->eq('is_active', Task::STATUS_OPEN) + ->eq('is_active', TaskModel::STATUS_OPEN) ->notNull('score') ->groupBy('column_id') ->findAll(); @@ -227,7 +227,7 @@ class ProjectDailyColumnStats extends Base */ private function getTotalByColumns($project_id) { - $stats = $this->db->table(Task::TABLE) + $stats = $this->db->table(TaskModel::TABLE) ->columns('column_id', 'COUNT(*) AS total') ->eq('project_id', $project_id) ->in('is_active', $this->getTaskStatusConfig()) @@ -245,10 +245,10 @@ class ProjectDailyColumnStats extends Base */ private function getTaskStatusConfig() { - if ($this->config->get('cfd_include_closed_tasks') == 1) { - return array(Task::STATUS_OPEN, Task::STATUS_CLOSED); + if ($this->configModel->get('cfd_include_closed_tasks') == 1) { + return array(TaskModel::STATUS_OPEN, TaskModel::STATUS_CLOSED); } - return array(Task::STATUS_OPEN); + return array(TaskModel::STATUS_OPEN); } } diff --git a/app/Model/ProjectDailyStats.php b/app/Model/ProjectDailyStatsModel.php index 08a0039e..0754d263 100644 --- a/app/Model/ProjectDailyStats.php +++ b/app/Model/ProjectDailyStatsModel.php @@ -7,10 +7,10 @@ use Kanboard\Core\Base; /** * Project Daily Stats * - * @package model + * @package Kanboard\Model * @author Frederic Guillot */ -class ProjectDailyStats extends Base +class ProjectDailyStatsModel extends Base { /** * SQL table name diff --git a/app/Model/ProjectDuplication.php b/app/Model/ProjectDuplicationModel.php index 871cadc8..b67f8302 100644 --- a/app/Model/ProjectDuplication.php +++ b/app/Model/ProjectDuplicationModel.php @@ -8,11 +8,11 @@ use Kanboard\Core\Security\Role; /** * Project Duplication * - * @package model + * @package Kanboard\Model * @author Frederic Guillot * @author Antonio Rabelo */ -class ProjectDuplication extends Base +class ProjectDuplicationModel extends Base { /** * Get list of optional models to duplicate @@ -22,7 +22,7 @@ class ProjectDuplication extends Base */ public function getOptionalSelection() { - return array('category', 'projectPermission', 'action', 'swimlane', 'task', 'projectMetadata'); + return array('categoryModel', 'projectPermissionModel', 'actionModel', 'swimlaneModel', 'taskModel', 'projectMetadataModel'); } /** @@ -33,7 +33,7 @@ class ProjectDuplication extends Base */ public function getPossibleSelection() { - return array('board', 'category', 'projectPermission', 'action', 'swimlane', 'task', 'projectMetadata'); + return array('boardModel', 'categoryModel', 'projectPermissionModel', 'actionModel', 'swimlaneModel', 'taskModel', 'projectMetadataModel'); } /** @@ -65,7 +65,7 @@ class ProjectDuplication extends Base * @param boolean $private Force the project to be private * @return integer Cloned Project Id */ - public function duplicate($src_project_id, $selection = array('projectPermission', 'category', 'action'), $owner_id = 0, $name = null, $private = null) + public function duplicate($src_project_id, $selection = array('projectPermissionModel', 'categoryModel', 'actionModel'), $owner_id = 0, $name = null, $private = null) { $this->db->startTransaction(); @@ -86,7 +86,7 @@ class ProjectDuplication extends Base } // Skip permissions for private projects - if ($private && $model === 'projectPermission') { + if ($private && $model === 'projectPermissionModel') { continue; } @@ -118,7 +118,7 @@ class ProjectDuplication extends Base */ private function copy($src_project_id, $owner_id = 0, $name = null, $private = null) { - $project = $this->project->getById($src_project_id); + $project = $this->projectModel->getById($src_project_id); $is_private = empty($project['is_private']) ? 0 : 1; $values = array( @@ -131,7 +131,7 @@ class ProjectDuplication extends Base 'owner_id' => $owner_id, ); - if (! $this->db->table(Project::TABLE)->save($values)) { + if (! $this->db->table(ProjectModel::TABLE)->save($values)) { return false; } @@ -149,9 +149,9 @@ class ProjectDuplication extends Base private function makeOwnerManager($dst_project_id, $owner_id) { if ($owner_id > 0) { - $this->projectUserRole->removeUser($dst_project_id, $owner_id); + $this->projectUserRoleModel->removeUser($dst_project_id, $owner_id); - if (! $this->projectUserRole->addUser($dst_project_id, $owner_id, Role::PROJECT_MANAGER)) { + if (! $this->projectUserRoleModel->addUser($dst_project_id, $owner_id, Role::PROJECT_MANAGER)) { return false; } } diff --git a/app/Model/ProjectFile.php b/app/Model/ProjectFileModel.php index 75348e0c..2177df27 100644 --- a/app/Model/ProjectFile.php +++ b/app/Model/ProjectFileModel.php @@ -2,15 +2,13 @@ namespace Kanboard\Model; -use Kanboard\Core\Base; - /** * Project File Model * - * @package model + * @package Kanboard\Model * @author Frederic Guillot */ -class ProjectFile extends File +class ProjectFileModel extends FileModel { /** * SQL table name diff --git a/app/Model/ProjectGroupRole.php b/app/Model/ProjectGroupRoleModel.php index 3ce2b1dc..2729d5a6 100644 --- a/app/Model/ProjectGroupRole.php +++ b/app/Model/ProjectGroupRoleModel.php @@ -8,10 +8,10 @@ use Kanboard\Core\Security\Role; /** * Project Group Role * - * @package model + * @package Kanboard\Model * @author Frederic Guillot */ -class ProjectGroupRole extends Base +class ProjectGroupRoleModel extends Base { /** * SQL table name @@ -28,15 +28,15 @@ class ProjectGroupRole extends Base * @param array $status * @return array */ - public function getProjectsByUser($user_id, $status = array(Project::ACTIVE, Project::INACTIVE)) + public function getProjectsByUser($user_id, $status = array(ProjectModel::ACTIVE, ProjectModel::INACTIVE)) { return $this->db - ->hashtable(Project::TABLE) + ->hashtable(ProjectModel::TABLE) ->join(self::TABLE, 'project_id', 'id') - ->join(GroupMember::TABLE, 'group_id', 'group_id', self::TABLE) - ->eq(GroupMember::TABLE.'.user_id', $user_id) - ->in(Project::TABLE.'.is_active', $status) - ->getAll(Project::TABLE.'.id', Project::TABLE.'.name'); + ->join(GroupMemberModel::TABLE, 'group_id', 'group_id', self::TABLE) + ->eq(GroupMemberModel::TABLE.'.user_id', $user_id) + ->in(ProjectModel::TABLE.'.is_active', $status) + ->getAll(ProjectModel::TABLE.'.id', ProjectModel::TABLE.'.name'); } /** @@ -50,8 +50,8 @@ class ProjectGroupRole extends Base public function getUserRole($project_id, $user_id) { $roles = $this->db->table(self::TABLE) - ->join(GroupMember::TABLE, 'group_id', 'group_id', self::TABLE) - ->eq(GroupMember::TABLE.'.user_id', $user_id) + ->join(GroupMemberModel::TABLE, 'group_id', 'group_id', self::TABLE) + ->eq(GroupMemberModel::TABLE.'.user_id', $user_id) ->eq(self::TABLE.'.project_id', $project_id) ->findAllByColumn('role'); @@ -68,8 +68,8 @@ class ProjectGroupRole extends Base public function getGroups($project_id) { return $this->db->table(self::TABLE) - ->columns(Group::TABLE.'.id', Group::TABLE.'.name', self::TABLE.'.role') - ->join(Group::TABLE, 'id', 'group_id') + ->columns(GroupModel::TABLE.'.id', GroupModel::TABLE.'.name', self::TABLE.'.role') + ->join(GroupModel::TABLE, 'id', 'group_id') ->eq('project_id', $project_id) ->asc('name') ->findAll(); @@ -85,11 +85,11 @@ class ProjectGroupRole extends Base public function getUsers($project_id) { return $this->db->table(self::TABLE) - ->columns(User::TABLE.'.id', User::TABLE.'.username', User::TABLE.'.name', self::TABLE.'.role') - ->join(GroupMember::TABLE, 'group_id', 'group_id', self::TABLE) - ->join(User::TABLE, 'id', 'user_id', GroupMember::TABLE) + ->columns(UserModel::TABLE.'.id', UserModel::TABLE.'.username', UserModel::TABLE.'.name', self::TABLE.'.role') + ->join(GroupMemberModel::TABLE, 'group_id', 'group_id', self::TABLE) + ->join(UserModel::TABLE, 'id', 'user_id', GroupMemberModel::TABLE) ->eq(self::TABLE.'.project_id', $project_id) - ->asc(User::TABLE.'.username') + ->asc(UserModel::TABLE.'.username') ->findAll(); } @@ -102,14 +102,14 @@ class ProjectGroupRole extends Base */ public function getAssignableUsers($project_id) { - return $this->db->table(User::TABLE) - ->columns(User::TABLE.'.id', User::TABLE.'.username', User::TABLE.'.name') - ->join(GroupMember::TABLE, 'user_id', 'id', User::TABLE) - ->join(self::TABLE, 'group_id', 'group_id', GroupMember::TABLE) + return $this->db->table(UserModel::TABLE) + ->columns(UserModel::TABLE.'.id', UserModel::TABLE.'.username', UserModel::TABLE.'.name') + ->join(GroupMemberModel::TABLE, 'user_id', 'id', UserModel::TABLE) + ->join(self::TABLE, 'group_id', 'group_id', GroupMemberModel::TABLE) ->eq(self::TABLE.'.project_id', $project_id) - ->eq(User::TABLE.'.is_active', 1) + ->eq(UserModel::TABLE.'.is_active', 1) ->in(self::TABLE.'.role', array(Role::PROJECT_MANAGER, Role::PROJECT_MEMBER)) - ->asc(User::TABLE.'.username') + ->asc(UserModel::TABLE.'.username') ->findAll(); } diff --git a/app/Model/ProjectMetadata.php b/app/Model/ProjectMetadataModel.php index c8e4fe63..760acd7d 100644 --- a/app/Model/ProjectMetadata.php +++ b/app/Model/ProjectMetadataModel.php @@ -2,15 +2,13 @@ namespace Kanboard\Model; -use Kanboard\Core\Base; - /** * Project Metadata * - * @package model + * @package Kanboard\Model * @author Frederic Guillot */ -class ProjectMetadata extends Metadata +class ProjectMetadataModel extends MetadataModel { /** * Get the table diff --git a/app/Model/Project.php b/app/Model/ProjectModel.php index 2cb0a431..34e11c13 100644 --- a/app/Model/Project.php +++ b/app/Model/ProjectModel.php @@ -9,10 +9,10 @@ use Kanboard\Core\Security\Role; /** * Project model * - * @package model + * @package Kanboard\Model * @author Frederic Guillot */ -class Project extends Base +class ProjectModel extends Base { /** * SQL table name for projects @@ -71,9 +71,9 @@ class Project extends Base public function getByIdWithOwner($project_id) { return $this->db->table(self::TABLE) - ->columns(self::TABLE.'.*', User::TABLE.'.username AS owner_username', User::TABLE.'.name AS owner_name') + ->columns(self::TABLE.'.*', UserModel::TABLE.'.username AS owner_username', UserModel::TABLE.'.name AS owner_name') ->eq(self::TABLE.'.id', $project_id) - ->join(User::TABLE, 'id', 'owner_id') + ->join(UserModel::TABLE, 'id', 'owner_id') ->findOne(); } @@ -269,8 +269,8 @@ class Project extends Base { $stats = array(); $stats['nb_active_tasks'] = 0; - $columns = $this->column->getAll($project_id); - $column_stats = $this->board->getColumnStats($project_id); + $columns = $this->columnModel->getAll($project_id); + $column_stats = $this->boardModel->getColumnStats($project_id); foreach ($columns as &$column) { $column['nb_active_tasks'] = isset($column_stats[$column['id']]) ? $column_stats[$column['id']] : 0; @@ -278,7 +278,7 @@ class Project extends Base } $stats['columns'] = $columns; - $stats['nb_tasks'] = $this->taskFinder->countByProjectId($project_id); + $stats['nb_tasks'] = $this->taskFinderModel->countByProjectId($project_id); $stats['nb_inactive_tasks'] = $stats['nb_tasks'] - $stats['nb_active_tasks']; return $stats; @@ -293,8 +293,8 @@ class Project extends Base */ public function getColumnStats(array &$project) { - $project['columns'] = $this->column->getAll($project['id']); - $stats = $this->board->getColumnStats($project['id']); + $project['columns'] = $this->columnModel->getAll($project['id']); + $stats = $this->boardModel->getColumnStats($project['id']); foreach ($project['columns'] as &$column) { $column['nb_tasks'] = isset($stats[$column['id']]) ? $stats[$column['id']] : 0; @@ -329,13 +329,13 @@ class Project extends Base public function getQueryColumnStats(array $project_ids) { if (empty($project_ids)) { - return $this->db->table(Project::TABLE)->limit(0); + return $this->db->table(ProjectModel::TABLE)->limit(0); } return $this->db - ->table(Project::TABLE) - ->columns(self::TABLE.'.*', User::TABLE.'.username AS owner_username', User::TABLE.'.name AS owner_name') - ->join(User::TABLE, 'id', 'owner_id') + ->table(ProjectModel::TABLE) + ->columns(self::TABLE.'.*', UserModel::TABLE.'.username AS owner_username', UserModel::TABLE.'.name AS owner_name') + ->join(UserModel::TABLE, 'id', 'owner_id') ->in(self::TABLE.'.id', $project_ids) ->callback(array($this, 'applyColumnStats')); } @@ -371,16 +371,16 @@ class Project extends Base $project_id = $this->db->getLastId(); - if (! $this->board->create($project_id, $this->board->getUserColumns())) { + if (! $this->boardModel->create($project_id, $this->boardModel->getUserColumns())) { $this->db->cancelTransaction(); return false; } if ($add_user && $user_id) { - $this->projectUserRole->addUser($project_id, $user_id, Role::PROJECT_MANAGER); + $this->projectUserRoleModel->addUser($project_id, $user_id, Role::PROJECT_MANAGER); } - $this->category->createDefaultCategories($project_id); + $this->categoryModel->createDefaultCategories($project_id); $this->db->closeTransaction(); diff --git a/app/Model/ProjectNotification.php b/app/Model/ProjectNotificationModel.php index 5df042ca..aeeee4cd 100644 --- a/app/Model/ProjectNotification.php +++ b/app/Model/ProjectNotificationModel.php @@ -7,10 +7,10 @@ use Kanboard\Core\Base; /** * Project Notification * - * @package model + * @package Kanboard\Model * @author Frederic Guillot */ -class ProjectNotification extends Base +class ProjectNotificationModel extends Base { /** * Send notifications @@ -22,15 +22,15 @@ class ProjectNotification extends Base */ public function sendNotifications($project_id, $event_name, array $event_data) { - $project = $this->project->getById($project_id); + $project = $this->projectModel->getById($project_id); $types = array_merge( - $this->projectNotificationType->getHiddenTypes(), - $this->projectNotificationType->getSelectedTypes($project_id) + $this->projectNotificationTypeModel->getHiddenTypes(), + $this->projectNotificationTypeModel->getSelectedTypes($project_id) ); foreach ($types as $type) { - $this->projectNotificationType->getType($type)->notifyProject($project, $event_name, $event_data); + $this->projectNotificationTypeModel->getType($type)->notifyProject($project, $event_name, $event_data); } } @@ -46,7 +46,7 @@ class ProjectNotification extends Base $this->db->startTransaction(); $types = empty($values['notification_types']) ? array() : array_keys($values['notification_types']); - $this->projectNotificationType->saveSelectedTypes($project_id, $types); + $this->projectNotificationTypeModel->saveSelectedTypes($project_id, $types); $this->db->closeTransaction(); } @@ -61,7 +61,7 @@ class ProjectNotification extends Base public function readSettings($project_id) { return array( - 'notification_types' => $this->projectNotificationType->getSelectedTypes($project_id), + 'notification_types' => $this->projectNotificationTypeModel->getSelectedTypes($project_id), ); } } diff --git a/app/Model/ProjectNotificationType.php b/app/Model/ProjectNotificationTypeModel.php index a00e465c..aeec77f2 100644 --- a/app/Model/ProjectNotificationType.php +++ b/app/Model/ProjectNotificationTypeModel.php @@ -2,15 +2,13 @@ namespace Kanboard\Model; -use Kanboard\Core\Base; - /** * Project Notification Type * - * @package model + * @package Kanboard\Model * @author Frederic Guillot */ -class ProjectNotificationType extends NotificationType +class ProjectNotificationTypeModel extends NotificationTypeModel { /** * SQL table name diff --git a/app/Model/ProjectPermission.php b/app/Model/ProjectPermissionModel.php index bc35c956..a7c1857c 100644 --- a/app/Model/ProjectPermission.php +++ b/app/Model/ProjectPermissionModel.php @@ -12,10 +12,10 @@ use Kanboard\Filter\ProjectUserRoleUsernameFilter; /** * Project Permission * - * @package model + * @package Kanboard\Model * @author Frederic Guillot */ -class ProjectPermission extends Base +class ProjectPermissionModel extends Base { /** * Get query for project users overview @@ -33,18 +33,18 @@ class ProjectPermission extends Base return $this ->db - ->table(ProjectUserRole::TABLE) - ->join(User::TABLE, 'id', 'user_id') - ->join(Project::TABLE, 'id', 'project_id') - ->eq(ProjectUserRole::TABLE.'.role', $role) - ->eq(Project::TABLE.'.is_private', 0) - ->in(Project::TABLE.'.id', $project_ids) + ->table(ProjectUserRoleModel::TABLE) + ->join(UserModel::TABLE, 'id', 'user_id') + ->join(ProjectModel::TABLE, 'id', 'project_id') + ->eq(ProjectUserRoleModel::TABLE.'.role', $role) + ->eq(ProjectModel::TABLE.'.is_private', 0) + ->in(ProjectModel::TABLE.'.id', $project_ids) ->columns( - User::TABLE.'.id', - User::TABLE.'.username', - User::TABLE.'.name', - Project::TABLE.'.name AS project_name', - Project::TABLE.'.id' + UserModel::TABLE.'.id', + UserModel::TABLE.'.username', + UserModel::TABLE.'.name', + ProjectModel::TABLE.'.name AS project_name', + ProjectModel::TABLE.'.id' ); } @@ -87,7 +87,7 @@ class ProjectPermission extends Base public function isEverybodyAllowed($project_id) { return $this->db - ->table(Project::TABLE) + ->table(ProjectModel::TABLE) ->eq('id', $project_id) ->eq('is_everybody_allowed', 1) ->exists(); @@ -107,7 +107,7 @@ class ProjectPermission extends Base } return in_array( - $this->projectUserRole->getUserRole($project_id, $user_id), + $this->projectUserRoleModel->getUserRole($project_id, $user_id), array(Role::PROJECT_MANAGER, Role::PROJECT_MEMBER, Role::PROJECT_VIEWER) ); } @@ -122,8 +122,8 @@ class ProjectPermission extends Base */ public function isAssignable($project_id, $user_id) { - return $this->user->isActive($user_id) && - in_array($this->projectUserRole->getUserRole($project_id, $user_id), array(Role::PROJECT_MEMBER, Role::PROJECT_MANAGER)); + return $this->userModel->isActive($user_id) && + in_array($this->projectUserRoleModel->getUserRole($project_id, $user_id), array(Role::PROJECT_MEMBER, Role::PROJECT_MANAGER)); } /** @@ -136,7 +136,7 @@ class ProjectPermission extends Base */ public function isMember($project_id, $user_id) { - return in_array($this->projectUserRole->getUserRole($project_id, $user_id), array(Role::PROJECT_MEMBER, Role::PROJECT_MANAGER, Role::PROJECT_VIEWER)); + return in_array($this->projectUserRoleModel->getUserRole($project_id, $user_id), array(Role::PROJECT_MEMBER, Role::PROJECT_MANAGER, Role::PROJECT_VIEWER)); } /** @@ -148,7 +148,7 @@ class ProjectPermission extends Base */ public function getActiveProjectIds($user_id) { - return array_keys($this->projectUserRole->getActiveProjectsByUser($user_id)); + return array_keys($this->projectUserRoleModel->getActiveProjectsByUser($user_id)); } /** @@ -160,7 +160,7 @@ class ProjectPermission extends Base */ public function duplicate($project_src_id, $project_dst_id) { - return $this->projectUserRole->duplicate($project_src_id, $project_dst_id) && - $this->projectGroupRole->duplicate($project_src_id, $project_dst_id); + return $this->projectUserRoleModel->duplicate($project_src_id, $project_dst_id) && + $this->projectGroupRoleModel->duplicate($project_src_id, $project_dst_id); } } diff --git a/app/Model/ProjectUserRole.php b/app/Model/ProjectUserRoleModel.php index 05f96c6e..a0df0cfa 100644 --- a/app/Model/ProjectUserRole.php +++ b/app/Model/ProjectUserRoleModel.php @@ -8,10 +8,10 @@ use Kanboard\Core\Security\Role; /** * Project User Role * - * @package model + * @package Kanboard\Model * @author Frederic Guillot */ -class ProjectUserRole extends Base +class ProjectUserRoleModel extends Base { /** * SQL table name @@ -29,7 +29,7 @@ class ProjectUserRole extends Base */ public function getActiveProjectsByUser($user_id) { - return $this->getProjectsByUser($user_id, array(Project::ACTIVE)); + return $this->getProjectsByUser($user_id, array(ProjectModel::ACTIVE)); } /** @@ -40,19 +40,19 @@ class ProjectUserRole extends Base * @param array $status * @return array */ - public function getProjectsByUser($user_id, $status = array(Project::ACTIVE, Project::INACTIVE)) + public function getProjectsByUser($user_id, $status = array(ProjectModel::ACTIVE, ProjectModel::INACTIVE)) { $userProjects = $this->db - ->hashtable(Project::TABLE) + ->hashtable(ProjectModel::TABLE) ->beginOr() ->eq(self::TABLE.'.user_id', $user_id) - ->eq(Project::TABLE.'.is_everybody_allowed', 1) + ->eq(ProjectModel::TABLE.'.is_everybody_allowed', 1) ->closeOr() - ->in(Project::TABLE.'.is_active', $status) + ->in(ProjectModel::TABLE.'.is_active', $status) ->join(self::TABLE, 'project_id', 'id') - ->getAll(Project::TABLE.'.id', Project::TABLE.'.name'); + ->getAll(ProjectModel::TABLE.'.id', ProjectModel::TABLE.'.name'); - $groupProjects = $this->projectGroupRole->getProjectsByUser($user_id, $status); + $groupProjects = $this->projectGroupRoleModel->getProjectsByUser($user_id, $status); $projects = $userProjects + $groupProjects; asort($projects); @@ -70,7 +70,7 @@ class ProjectUserRole extends Base */ public function getUserRole($project_id, $user_id) { - $projectInfo = $this->db->table(Project::TABLE) + $projectInfo = $this->db->table(ProjectModel::TABLE) ->eq('id', $project_id) ->columns('owner_id', 'is_everybody_allowed') ->findOne(); @@ -82,7 +82,7 @@ class ProjectUserRole extends Base $role = $this->db->table(self::TABLE)->eq('user_id', $user_id)->eq('project_id', $project_id)->findOneColumn('role'); if (empty($role)) { - $role = $this->projectGroupRole->getUserRole($project_id, $user_id); + $role = $this->projectGroupRoleModel->getUserRole($project_id, $user_id); } return $role; @@ -98,11 +98,11 @@ class ProjectUserRole extends Base public function getUsers($project_id) { return $this->db->table(self::TABLE) - ->columns(User::TABLE.'.id', User::TABLE.'.username', User::TABLE.'.name', self::TABLE.'.role') - ->join(User::TABLE, 'id', 'user_id') + ->columns(UserModel::TABLE.'.id', UserModel::TABLE.'.username', UserModel::TABLE.'.name', self::TABLE.'.role') + ->join(UserModel::TABLE, 'id', 'user_id') ->eq('project_id', $project_id) - ->asc(User::TABLE.'.username') - ->asc(User::TABLE.'.name') + ->asc(UserModel::TABLE.'.username') + ->asc(UserModel::TABLE.'.name') ->findAll(); } @@ -116,10 +116,10 @@ class ProjectUserRole extends Base public function getAllUsers($project_id) { $userMembers = $this->getUsers($project_id); - $groupMembers = $this->projectGroupRole->getUsers($project_id); + $groupMembers = $this->projectGroupRoleModel->getUsers($project_id); $members = array_merge($userMembers, $groupMembers); - return $this->user->prepareList($members); + return $this->userModel->prepareList($members); } /** @@ -134,7 +134,7 @@ class ProjectUserRole extends Base $users = array(); $userMembers = $this->getUsers($project_id); - $groupMembers = $this->projectGroupRole->getUsers($project_id); + $groupMembers = $this->projectGroupRoleModel->getUsers($project_id); $members = array_merge($userMembers, $groupMembers); foreach ($members as $user) { @@ -157,22 +157,22 @@ class ProjectUserRole extends Base */ public function getAssignableUsers($project_id) { - if ($this->projectPermission->isEverybodyAllowed($project_id)) { - return $this->user->getActiveUsersList(); + if ($this->projectPermissionModel->isEverybodyAllowed($project_id)) { + return $this->userModel->getActiveUsersList(); } $userMembers = $this->db->table(self::TABLE) - ->columns(User::TABLE.'.id', User::TABLE.'.username', User::TABLE.'.name') - ->join(User::TABLE, 'id', 'user_id') - ->eq(User::TABLE.'.is_active', 1) + ->columns(UserModel::TABLE.'.id', UserModel::TABLE.'.username', UserModel::TABLE.'.name') + ->join(UserModel::TABLE, 'id', 'user_id') + ->eq(UserModel::TABLE.'.is_active', 1) ->eq(self::TABLE.'.project_id', $project_id) ->in(self::TABLE.'.role', array(Role::PROJECT_MANAGER, Role::PROJECT_MEMBER)) ->findAll(); - $groupMembers = $this->projectGroupRole->getAssignableUsers($project_id); + $groupMembers = $this->projectGroupRoleModel->getAssignableUsers($project_id); $members = array_merge($userMembers, $groupMembers); - return $this->user->prepareList($members); + return $this->userModel->prepareList($members); } /** @@ -198,7 +198,7 @@ class ProjectUserRole extends Base } if ($everybody) { - $users = array(User::EVERYBODY_ID => t('Everybody')) + $users; + $users = array(UserModel::EVERYBODY_ID => t('Everybody')) + $users; } return $users; diff --git a/app/Model/RememberMeSession.php b/app/Model/RememberMeSessionModel.php index e3f2f132..f6c8d648 100644 --- a/app/Model/RememberMeSession.php +++ b/app/Model/RememberMeSessionModel.php @@ -8,10 +8,10 @@ use Kanboard\Core\Security\Token; /** * Remember Me Model * - * @package model + * @package Kanboard\Model * @author Frederic Guillot */ -class RememberMeSession extends Base +class RememberMeSessionModel extends Base { /** * SQL table name diff --git a/app/Model/Setting.php b/app/Model/SettingModel.php index 38af22e0..5b2ee54f 100644 --- a/app/Model/Setting.php +++ b/app/Model/SettingModel.php @@ -7,10 +7,10 @@ use Kanboard\Core\Base; /** * Application Settings * - * @package model + * @package Kanboard\Model * @author Frederic Guillot */ -abstract class Setting extends Base +abstract class SettingModel extends Base { /** * SQL table name diff --git a/app/Model/Subtask.php b/app/Model/SubtaskModel.php index 1d53d6de..b63cf0a1 100644 --- a/app/Model/Subtask.php +++ b/app/Model/SubtaskModel.php @@ -9,10 +9,10 @@ use Kanboard\Event\SubtaskEvent; /** * Subtask Model * - * @package model + * @package Kanboard\Model * @author Frederic Guillot */ -class Subtask extends Base +class SubtaskModel extends Base { /** * SQL table name @@ -96,20 +96,20 @@ class Subtask extends Base */ public function getUserQuery($user_id, array $status) { - return $this->db->table(Subtask::TABLE) + return $this->db->table(SubtaskModel::TABLE) ->columns( - Subtask::TABLE.'.*', - Task::TABLE.'.project_id', - Task::TABLE.'.color_id', - Task::TABLE.'.title AS task_name', - Project::TABLE.'.name AS project_name' + SubtaskModel::TABLE.'.*', + TaskModel::TABLE.'.project_id', + TaskModel::TABLE.'.color_id', + TaskModel::TABLE.'.title AS task_name', + ProjectModel::TABLE.'.name AS project_name' ) - ->subquery($this->subtaskTimeTracking->getTimerQuery($user_id), 'timer_start_date') + ->subquery($this->subtaskTimeTrackingModel->getTimerQuery($user_id), 'timer_start_date') ->eq('user_id', $user_id) - ->eq(Project::TABLE.'.is_active', Project::ACTIVE) - ->in(Subtask::TABLE.'.status', $status) - ->join(Task::TABLE, 'id', 'task_id') - ->join(Project::TABLE, 'id', 'project_id', Task::TABLE) + ->eq(ProjectModel::TABLE.'.is_active', ProjectModel::ACTIVE) + ->in(SubtaskModel::TABLE.'.status', $status) + ->join(TaskModel::TABLE, 'id', 'task_id') + ->join(ProjectModel::TABLE, 'id', 'project_id', TaskModel::TABLE) ->callback(array($this, 'addStatusName')); } @@ -127,11 +127,11 @@ class Subtask extends Base ->eq('task_id', $task_id) ->columns( self::TABLE.'.*', - User::TABLE.'.username', - User::TABLE.'.name' + UserModel::TABLE.'.username', + UserModel::TABLE.'.name' ) - ->subquery($this->subtaskTimeTracking->getTimerQuery($this->userSession->getId()), 'timer_start_date') - ->join(User::TABLE, 'id', 'user_id') + ->subquery($this->subtaskTimeTrackingModel->getTimerQuery($this->userSession->getId()), 'timer_start_date') + ->join(UserModel::TABLE, 'id', 'user_id') ->asc(self::TABLE.'.position') ->callback(array($this, 'addStatusName')) ->findAll(); @@ -151,9 +151,9 @@ class Subtask extends Base return $this->db ->table(self::TABLE) ->eq(self::TABLE.'.id', $subtask_id) - ->columns(self::TABLE.'.*', User::TABLE.'.username', User::TABLE.'.name') - ->subquery($this->subtaskTimeTracking->getTimerQuery($this->userSession->getId()), 'timer_start_date') - ->join(User::TABLE, 'id', 'user_id') + ->columns(self::TABLE.'.*', UserModel::TABLE.'.username', UserModel::TABLE.'.name') + ->subquery($this->subtaskTimeTrackingModel->getTimerQuery($this->userSession->getId()), 'timer_start_date') + ->join(UserModel::TABLE, 'id', 'user_id') ->callback(array($this, 'addStatusName')) ->findOne(); } @@ -345,7 +345,7 @@ class Subtask extends Base */ public function hasSubtaskInProgress($user_id) { - return $this->config->get('subtask_restriction') == 1 && + return $this->configModel->get('subtask_restriction') == 1 && $this->db->table(self::TABLE) ->eq('status', self::STATUS_INPROGRESS) ->eq('user_id', $user_id) @@ -383,7 +383,7 @@ class Subtask extends Base { return $this->db->transaction(function (Database $db) use ($src_task_id, $dst_task_id) { - $subtasks = $db->table(Subtask::TABLE) + $subtasks = $db->table(SubtaskModel::TABLE) ->columns('title', 'time_estimated', 'position') ->eq('task_id', $src_task_id) ->asc('position') @@ -392,7 +392,7 @@ class Subtask extends Base foreach ($subtasks as &$subtask) { $subtask['task_id'] = $dst_task_id; - if (! $db->table(Subtask::TABLE)->save($subtask)) { + if (! $db->table(SubtaskModel::TABLE)->save($subtask)) { return false; } } @@ -411,7 +411,7 @@ class Subtask extends Base { $subtask = $this->getById($subtask_id); - $task_id = $this->taskCreation->create(array( + $task_id = $this->taskCreationModel->create(array( 'project_id' => $project_id, 'title' => $subtask['title'], 'time_estimated' => $subtask['time_estimated'], diff --git a/app/Model/SubtaskTimeTracking.php b/app/Model/SubtaskTimeTrackingModel.php index 8b5d2545..062e594a 100644 --- a/app/Model/SubtaskTimeTracking.php +++ b/app/Model/SubtaskTimeTrackingModel.php @@ -6,12 +6,12 @@ use DateTime; use Kanboard\Core\Base; /** - * Subtask timesheet + * Subtask time tracking * - * @package model + * @package Kanboard\Model * @author Frederic Guillot */ -class SubtaskTimeTracking extends Base +class SubtaskTimeTrackingModel extends Base { /** * SQL table name @@ -37,7 +37,7 @@ class SubtaskTimeTracking extends Base $user_id, $this->db->escapeIdentifier('end'), $this->db->escapeIdentifier('subtask_id'), - Subtask::TABLE.'.id' + SubtaskModel::TABLE.'.id' ); } @@ -58,14 +58,14 @@ class SubtaskTimeTracking extends Base self::TABLE.'.end', self::TABLE.'.start', self::TABLE.'.time_spent', - Subtask::TABLE.'.task_id', - Subtask::TABLE.'.title AS subtask_title', - Task::TABLE.'.title AS task_title', - Task::TABLE.'.project_id', - Task::TABLE.'.color_id' + SubtaskModel::TABLE.'.task_id', + SubtaskModel::TABLE.'.title AS subtask_title', + TaskModel::TABLE.'.title AS task_title', + TaskModel::TABLE.'.project_id', + TaskModel::TABLE.'.color_id' ) - ->join(Subtask::TABLE, 'id', 'subtask_id') - ->join(Task::TABLE, 'id', 'task_id', Subtask::TABLE) + ->join(SubtaskModel::TABLE, 'id', 'subtask_id') + ->join(TaskModel::TABLE, 'id', 'task_id', SubtaskModel::TABLE) ->eq(self::TABLE.'.user_id', $user_id); } @@ -87,16 +87,16 @@ class SubtaskTimeTracking extends Base self::TABLE.'.start', self::TABLE.'.time_spent', self::TABLE.'.user_id', - Subtask::TABLE.'.task_id', - Subtask::TABLE.'.title AS subtask_title', - Task::TABLE.'.project_id', - User::TABLE.'.username', - User::TABLE.'.name AS user_fullname' + SubtaskModel::TABLE.'.task_id', + SubtaskModel::TABLE.'.title AS subtask_title', + TaskModel::TABLE.'.project_id', + UserModel::TABLE.'.username', + UserModel::TABLE.'.name AS user_fullname' ) - ->join(Subtask::TABLE, 'id', 'subtask_id') - ->join(Task::TABLE, 'id', 'task_id', Subtask::TABLE) - ->join(User::TABLE, 'id', 'user_id', self::TABLE) - ->eq(Task::TABLE.'.id', $task_id); + ->join(SubtaskModel::TABLE, 'id', 'subtask_id') + ->join(TaskModel::TABLE, 'id', 'task_id', SubtaskModel::TABLE) + ->join(UserModel::TABLE, 'id', 'user_id', self::TABLE) + ->eq(TaskModel::TABLE.'.id', $task_id); } /** @@ -117,17 +117,17 @@ class SubtaskTimeTracking extends Base self::TABLE.'.start', self::TABLE.'.time_spent', self::TABLE.'.user_id', - Subtask::TABLE.'.task_id', - Subtask::TABLE.'.title AS subtask_title', - Task::TABLE.'.project_id', - Task::TABLE.'.color_id', - User::TABLE.'.username', - User::TABLE.'.name AS user_fullname' + SubtaskModel::TABLE.'.task_id', + SubtaskModel::TABLE.'.title AS subtask_title', + TaskModel::TABLE.'.project_id', + TaskModel::TABLE.'.color_id', + UserModel::TABLE.'.username', + UserModel::TABLE.'.name AS user_fullname' ) - ->join(Subtask::TABLE, 'id', 'subtask_id') - ->join(Task::TABLE, 'id', 'task_id', Subtask::TABLE) - ->join(User::TABLE, 'id', 'user_id', self::TABLE) - ->eq(Task::TABLE.'.project_id', $project_id) + ->join(SubtaskModel::TABLE, 'id', 'subtask_id') + ->join(TaskModel::TABLE, 'id', 'task_id', SubtaskModel::TABLE) + ->join(UserModel::TABLE, 'id', 'user_id', self::TABLE) + ->eq(TaskModel::TABLE.'.project_id', $project_id) ->asc(self::TABLE.'.id'); } @@ -250,10 +250,10 @@ class SubtaskTimeTracking extends Base */ public function updateSubtaskTimeSpent($subtask_id, $time_spent) { - $subtask = $this->subtask->getById($subtask_id); + $subtask = $this->subtaskModel->getById($subtask_id); // Fire the event subtask.update - return $this->subtask->update(array( + return $this->subtaskModel->update(array( 'id' => $subtask['id'], 'time_spent' => $subtask['time_spent'] + $time_spent, 'task_id' => $subtask['task_id'], @@ -272,7 +272,7 @@ class SubtaskTimeTracking extends Base $values = $this->calculateSubtaskTime($task_id); return $this->db - ->table(Task::TABLE) + ->table(TaskModel::TABLE) ->eq('id', $task_id) ->update($values); } @@ -287,7 +287,7 @@ class SubtaskTimeTracking extends Base public function calculateSubtaskTime($task_id) { return $this->db - ->table(Subtask::TABLE) + ->table(SubtaskModel::TABLE) ->eq('task_id', $task_id) ->columns( 'SUM(time_spent) AS time_spent', diff --git a/app/Model/Swimlane.php b/app/Model/SwimlaneModel.php index 8efe68da..87591b99 100644 --- a/app/Model/Swimlane.php +++ b/app/Model/SwimlaneModel.php @@ -7,10 +7,10 @@ use Kanboard\Core\Base; /** * Swimlanes * - * @package model + * @package Kanboard\Model * @author Frederic Guillot */ -class Swimlane extends Base +class SwimlaneModel extends Base { /** * SQL table name @@ -99,7 +99,7 @@ class Swimlane extends Base public function getDefault($project_id) { $result = $this->db - ->table(Project::TABLE) + ->table(ProjectModel::TABLE) ->eq('id', $project_id) ->columns('id', 'default_swimlane', 'show_default_swimlane') ->findOne(); @@ -169,7 +169,7 @@ class Swimlane extends Base ->findAll(); $default_swimlane = $this->db - ->table(Project::TABLE) + ->table(ProjectModel::TABLE) ->eq('id', $project_id) ->eq('show_default_swimlane', 1) ->findOneColumn('default_swimlane'); @@ -197,7 +197,7 @@ class Swimlane extends Base public function getList($project_id, $prepend = false, $only_active = false) { $swimlanes = array(); - $default = $this->db->table(Project::TABLE)->eq('id', $project_id)->eq('show_default_swimlane', 1)->findOneColumn('default_swimlane'); + $default = $this->db->table(ProjectModel::TABLE)->eq('id', $project_id)->eq('show_default_swimlane', 1)->findOneColumn('default_swimlane'); if ($prepend) { $swimlanes[-1] = t('All swimlanes'); @@ -224,7 +224,7 @@ class Swimlane extends Base */ public function create($values) { - if (! $this->project->exists($values['project_id'])) { + if (! $this->projectModel->exists($values['project_id'])) { return 0; } @@ -257,7 +257,7 @@ class Swimlane extends Base public function updateDefault(array $values) { return $this->db - ->table(Project::TABLE) + ->table(ProjectModel::TABLE) ->eq('id', $values['id']) ->update(array( 'default_swimlane' => $values['default_swimlane'], @@ -275,7 +275,7 @@ class Swimlane extends Base public function enableDefault($project_id) { return $this->db - ->table(Project::TABLE) + ->table(ProjectModel::TABLE) ->eq('id', $project_id) ->update(array( 'show_default_swimlane' => 1, @@ -292,7 +292,7 @@ class Swimlane extends Base public function disableDefault($project_id) { return $this->db - ->table(Project::TABLE) + ->table(ProjectModel::TABLE) ->eq('id', $project_id) ->update(array( 'show_default_swimlane' => 0, @@ -373,7 +373,7 @@ class Swimlane extends Base $this->db->startTransaction(); // Tasks should not be assigned anymore to this swimlane - $this->db->table(Task::TABLE)->eq('swimlane_id', $swimlane_id)->update(array('swimlane_id' => 0)); + $this->db->table(TaskModel::TABLE)->eq('swimlane_id', $swimlane_id)->update(array('swimlane_id' => 0)); if (! $this->db->table(self::TABLE)->eq('id', $swimlane_id)->remove()) { $this->db->cancelTransaction(); diff --git a/app/Model/TaskAnalytic.php b/app/Model/TaskAnalyticModel.php index bf118b4e..3d6fe8a8 100644 --- a/app/Model/TaskAnalytic.php +++ b/app/Model/TaskAnalyticModel.php @@ -7,10 +7,10 @@ use Kanboard\Core\Base; /** * Task Analytic * - * @package model + * @package Kanboard\Model * @author Frederic Guillot */ -class TaskAnalytic extends Base +class TaskAnalyticModel extends Base { /** * Get the time between date_creation and date_completed or now if empty @@ -50,8 +50,8 @@ class TaskAnalytic extends Base public function getTimeSpentByColumn(array $task) { $result = array(); - $columns = $this->column->getList($task['project_id']); - $sums = $this->transition->getTimeSpentByTask($task['id']); + $columns = $this->columnModel->getList($task['project_id']); + $sums = $this->transitionModel->getTimeSpentByTask($task['id']); foreach ($columns as $column_id => $column_title) { $time_spent = isset($sums[$column_id]) ? $sums[$column_id] : 0; diff --git a/app/Model/TaskCreation.php b/app/Model/TaskCreationModel.php index 2abfd95c..3800f831 100644 --- a/app/Model/TaskCreation.php +++ b/app/Model/TaskCreationModel.php @@ -8,10 +8,10 @@ use Kanboard\Event\TaskEvent; /** * Task Creation * - * @package model + * @package Kanboard\Model * @author Frederic Guillot */ -class TaskCreation extends Base +class TaskCreationModel extends Base { /** * Create a task @@ -22,18 +22,18 @@ class TaskCreation extends Base */ public function create(array $values) { - if (! $this->project->exists($values['project_id'])) { + if (! $this->projectModel->exists($values['project_id'])) { return 0; } $position = empty($values['position']) ? 0 : $values['position']; $this->prepare($values); - $task_id = $this->db->table(Task::TABLE)->persist($values); + $task_id = $this->db->table(TaskModel::TABLE)->persist($values); if ($task_id !== false) { if ($position > 0 && $values['position'] > 1) { - $this->taskPosition->movePosition($values['project_id'], $task_id, $values['column_id'], $position, $values['swimlane_id'], false); + $this->taskPositionModel->movePosition($values['project_id'], $task_id, $values['column_id'], $position, $values['swimlane_id'], false); } $this->fireEvents($task_id, $values); @@ -57,11 +57,11 @@ class TaskCreation extends Base $this->helper->model->resetFields($values, array('date_started', 'creator_id', 'owner_id', 'swimlane_id', 'date_due', 'score', 'category_id', 'time_estimated')); if (empty($values['column_id'])) { - $values['column_id'] = $this->column->getFirstColumnId($values['project_id']); + $values['column_id'] = $this->columnModel->getFirstColumnId($values['project_id']); } if (empty($values['color_id'])) { - $values['color_id'] = $this->color->getDefaultColor(); + $values['color_id'] = $this->colorModel->getDefaultColor(); } if (empty($values['title'])) { @@ -76,7 +76,7 @@ class TaskCreation extends Base $values['date_creation'] = time(); $values['date_modification'] = $values['date_creation']; $values['date_moved'] = $values['date_creation']; - $values['position'] = $this->taskFinder->countByColumnAndSwimlaneId($values['project_id'], $values['column_id'], $values['swimlane_id']) + 1; + $values['position'] = $this->taskFinderModel->countByColumnAndSwimlaneId($values['project_id'], $values['column_id'], $values['swimlane_id']) + 1; } /** @@ -90,14 +90,14 @@ class TaskCreation extends Base { $event = new TaskEvent(array('task_id' => $task_id) + $values); - $this->logger->debug('Event fired: '.Task::EVENT_CREATE_UPDATE); - $this->logger->debug('Event fired: '.Task::EVENT_CREATE); + $this->logger->debug('Event fired: '.TaskModel::EVENT_CREATE_UPDATE); + $this->logger->debug('Event fired: '.TaskModel::EVENT_CREATE); - $this->dispatcher->dispatch(Task::EVENT_CREATE_UPDATE, $event); - $this->dispatcher->dispatch(Task::EVENT_CREATE, $event); + $this->dispatcher->dispatch(TaskModel::EVENT_CREATE_UPDATE, $event); + $this->dispatcher->dispatch(TaskModel::EVENT_CREATE, $event); if (! empty($values['description'])) { - $this->userMention->fireEvents($values['description'], Task::EVENT_USER_MENTION, $event); + $this->userMentionModel->fireEvents($values['description'], TaskModel::EVENT_USER_MENTION, $event); } } } diff --git a/app/Model/TaskDuplication.php b/app/Model/TaskDuplicationModel.php index 56457a01..9a4613e2 100644 --- a/app/Model/TaskDuplication.php +++ b/app/Model/TaskDuplicationModel.php @@ -10,10 +10,10 @@ use Kanboard\Event\TaskEvent; /** * Task Duplication * - * @package model + * @package Kanboard\Model * @author Frederic Guillot */ -class TaskDuplication extends Base +class TaskDuplicationModel extends Base { /** * Fields to copy when duplicating a task @@ -63,19 +63,19 @@ class TaskDuplication extends Base { $values = $this->copyFields($task_id); - if ($values['recurrence_status'] == Task::RECURRING_STATUS_PENDING) { + if ($values['recurrence_status'] == TaskModel::RECURRING_STATUS_PENDING) { $values['recurrence_parent'] = $task_id; - $values['column_id'] = $this->column->getFirstColumnId($values['project_id']); + $values['column_id'] = $this->columnModel->getFirstColumnId($values['project_id']); $this->calculateRecurringTaskDueDate($values); $recurring_task_id = $this->save($task_id, $values); if ($recurring_task_id > 0) { $parent_update = $this->db - ->table(Task::TABLE) + ->table(TaskModel::TABLE) ->eq('id', $task_id) ->update(array( - 'recurrence_status' => Task::RECURRING_STATUS_PROCESSED, + 'recurrence_status' => TaskModel::RECURRING_STATUS_PROCESSED, 'recurrence_child' => $recurring_task_id, )); @@ -128,22 +128,22 @@ class TaskDuplication extends Base */ public function moveToProject($task_id, $project_id, $swimlane_id = null, $column_id = null, $category_id = null, $owner_id = null) { - $task = $this->taskFinder->getById($task_id); + $task = $this->taskFinderModel->getById($task_id); $values = array(); $values['is_active'] = 1; $values['project_id'] = $project_id; $values['column_id'] = $column_id !== null ? $column_id : $task['column_id']; - $values['position'] = $this->taskFinder->countByColumnId($project_id, $values['column_id']) + 1; + $values['position'] = $this->taskFinderModel->countByColumnId($project_id, $values['column_id']) + 1; $values['swimlane_id'] = $swimlane_id !== null ? $swimlane_id : $task['swimlane_id']; $values['category_id'] = $category_id !== null ? $category_id : $task['category_id']; $values['owner_id'] = $owner_id !== null ? $owner_id : $task['owner_id']; $this->checkDestinationProjectValues($values); - if ($this->db->table(Task::TABLE)->eq('id', $task['id'])->update($values)) { + if ($this->db->table(TaskModel::TABLE)->eq('id', $task['id'])->update($values)) { $this->container['dispatcher']->dispatch( - Task::EVENT_MOVE_PROJECT, + TaskModel::EVENT_MOVE_PROJECT, new TaskEvent(array_merge($task, $values, array('task_id' => $task['id']))) ); } @@ -161,34 +161,34 @@ class TaskDuplication extends Base public function checkDestinationProjectValues(array &$values) { // Check if the assigned user is allowed for the destination project - if ($values['owner_id'] > 0 && ! $this->projectPermission->isUserAllowed($values['project_id'], $values['owner_id'])) { + if ($values['owner_id'] > 0 && ! $this->projectPermissionModel->isUserAllowed($values['project_id'], $values['owner_id'])) { $values['owner_id'] = 0; } // Check if the category exists for the destination project if ($values['category_id'] > 0) { - $values['category_id'] = $this->category->getIdByName( + $values['category_id'] = $this->categoryModel->getIdByName( $values['project_id'], - $this->category->getNameById($values['category_id']) + $this->categoryModel->getNameById($values['category_id']) ); } // Check if the swimlane exists for the destination project if ($values['swimlane_id'] > 0) { - $values['swimlane_id'] = $this->swimlane->getIdByName( + $values['swimlane_id'] = $this->swimlaneModel->getIdByName( $values['project_id'], - $this->swimlane->getNameById($values['swimlane_id']) + $this->swimlaneModel->getNameById($values['swimlane_id']) ); } // Check if the column exists for the destination project if ($values['column_id'] > 0) { - $values['column_id'] = $this->column->getColumnIdByTitle( + $values['column_id'] = $this->columnModel->getColumnIdByTitle( $values['project_id'], - $this->column->getColumnTitleById($values['column_id']) + $this->columnModel->getColumnTitleById($values['column_id']) ); - $values['column_id'] = $values['column_id'] ?: $this->column->getFirstColumnId($values['project_id']); + $values['column_id'] = $values['column_id'] ?: $this->columnModel->getFirstColumnId($values['project_id']); } return $values; @@ -203,7 +203,7 @@ class TaskDuplication extends Base public function calculateRecurringTaskDueDate(array &$values) { if (! empty($values['date_due']) && $values['recurrence_factor'] != 0) { - if ($values['recurrence_basedate'] == Task::RECURRING_BASEDATE_TRIGGERDATE) { + if ($values['recurrence_basedate'] == TaskModel::RECURRING_BASEDATE_TRIGGERDATE) { $values['date_due'] = time(); } @@ -211,10 +211,10 @@ class TaskDuplication extends Base $subtract = $values['recurrence_factor'] < 0; switch ($values['recurrence_timeframe']) { - case Task::RECURRING_TIMEFRAME_MONTHS: + case TaskModel::RECURRING_TIMEFRAME_MONTHS: $interval = 'P' . $factor . 'M'; break; - case Task::RECURRING_TIMEFRAME_YEARS: + case TaskModel::RECURRING_TIMEFRAME_YEARS: $interval = 'P' . $factor . 'Y'; break; default: @@ -239,7 +239,7 @@ class TaskDuplication extends Base */ private function copyFields($task_id) { - $task = $this->taskFinder->getById($task_id); + $task = $this->taskFinderModel->getById($task_id); $values = array(); foreach ($this->fields_to_duplicate as $field) { @@ -259,10 +259,10 @@ class TaskDuplication extends Base */ private function save($task_id, array $values) { - $new_task_id = $this->taskCreation->create($values); + $new_task_id = $this->taskCreationModel->create($values); if ($new_task_id) { - $this->subtask->duplicate($task_id, $new_task_id); + $this->subtaskModel->duplicate($task_id, $new_task_id); } return $new_task_id; diff --git a/app/Model/TaskExternalLink.php b/app/Model/TaskExternalLinkModel.php index f77a72bf..220b9c6f 100644 --- a/app/Model/TaskExternalLink.php +++ b/app/Model/TaskExternalLinkModel.php @@ -7,10 +7,10 @@ use Kanboard\Core\Base; /** * Task External Link Model * - * @package model + * @package Kanboard\Model * @author Frederic Guillot */ -class TaskExternalLink extends Base +class TaskExternalLinkModel extends Base { /** * SQL table name @@ -31,10 +31,10 @@ class TaskExternalLink extends Base $types = $this->externalLinkManager->getTypes(); $links = $this->db->table(self::TABLE) - ->columns(self::TABLE.'.*', User::TABLE.'.name AS creator_name', User::TABLE.'.username AS creator_username') + ->columns(self::TABLE.'.*', UserModel::TABLE.'.name AS creator_name', UserModel::TABLE.'.username AS creator_username') ->eq('task_id', $task_id) ->asc('title') - ->join(User::TABLE, 'id', 'creator_id') + ->join(UserModel::TABLE, 'id', 'creator_id') ->findAll(); foreach ($links as &$link) { diff --git a/app/Model/TaskFile.php b/app/Model/TaskFileModel.php index 45a3b97f..21d319b0 100644 --- a/app/Model/TaskFile.php +++ b/app/Model/TaskFileModel.php @@ -5,10 +5,10 @@ namespace Kanboard\Model; /** * Task File Model * - * @package model + * @package Kanboard\Model * @author Frederic Guillot */ -class TaskFile extends File +class TaskFileModel extends FileModel { /** * SQL table name diff --git a/app/Model/TaskFinder.php b/app/Model/TaskFinderModel.php index fed3a580..8b636e28 100644 --- a/app/Model/TaskFinder.php +++ b/app/Model/TaskFinderModel.php @@ -8,10 +8,10 @@ use Kanboard\Core\Base; /** * Task Finder model * - * @package model + * @package Kanboard\Model * @author Frederic Guillot */ -class TaskFinder extends Base +class TaskFinderModel extends Base { /** * Get query for project user overview @@ -28,27 +28,27 @@ class TaskFinder extends Base } return $this->db - ->table(Task::TABLE) + ->table(TaskModel::TABLE) ->columns( - Task::TABLE.'.id', - Task::TABLE.'.title', - Task::TABLE.'.date_due', - Task::TABLE.'.date_started', - Task::TABLE.'.project_id', - Task::TABLE.'.color_id', - Task::TABLE.'.priority', - Task::TABLE.'.time_spent', - Task::TABLE.'.time_estimated', - Project::TABLE.'.name AS project_name', - Column::TABLE.'.title AS column_name', - User::TABLE.'.username AS assignee_username', - User::TABLE.'.name AS assignee_name' + TaskModel::TABLE.'.id', + TaskModel::TABLE.'.title', + TaskModel::TABLE.'.date_due', + TaskModel::TABLE.'.date_started', + TaskModel::TABLE.'.project_id', + TaskModel::TABLE.'.color_id', + TaskModel::TABLE.'.priority', + TaskModel::TABLE.'.time_spent', + TaskModel::TABLE.'.time_estimated', + ProjectModel::TABLE.'.name AS project_name', + ColumnModel::TABLE.'.title AS column_name', + UserModel::TABLE.'.username AS assignee_username', + UserModel::TABLE.'.name AS assignee_name' ) - ->eq(Task::TABLE.'.is_active', $is_active) - ->in(Project::TABLE.'.id', $project_ids) - ->join(Project::TABLE, 'id', 'project_id') - ->join(Column::TABLE, 'id', 'column_id', Task::TABLE) - ->join(User::TABLE, 'id', 'owner_id', Task::TABLE); + ->eq(TaskModel::TABLE.'.is_active', $is_active) + ->in(ProjectModel::TABLE.'.id', $project_ids) + ->join(ProjectModel::TABLE, 'id', 'project_id') + ->join(ColumnModel::TABLE, 'id', 'column_id', TaskModel::TABLE) + ->join(UserModel::TABLE, 'id', 'owner_id', TaskModel::TABLE); } /** @@ -61,7 +61,7 @@ class TaskFinder extends Base public function getUserQuery($user_id) { return $this->db - ->table(Task::TABLE) + ->table(TaskModel::TABLE) ->columns( 'tasks.id', 'tasks.title', @@ -77,11 +77,11 @@ class TaskFinder extends Base 'projects.name AS project_name', 'columns.title AS column_title' ) - ->join(Project::TABLE, 'id', 'project_id') - ->join(Column::TABLE, 'id', 'column_id') - ->eq(Task::TABLE.'.owner_id', $user_id) - ->eq(Task::TABLE.'.is_active', Task::STATUS_OPEN) - ->eq(Project::TABLE.'.is_active', Project::ACTIVE); + ->join(ProjectModel::TABLE, 'id', 'project_id') + ->join(ColumnModel::TABLE, 'id', 'column_id') + ->eq(TaskModel::TABLE.'.owner_id', $user_id) + ->eq(TaskModel::TABLE.'.is_active', TaskModel::STATUS_OPEN) + ->eq(ProjectModel::TABLE.'.is_active', ProjectModel::ACTIVE); } /** @@ -93,15 +93,15 @@ class TaskFinder extends Base public function getExtendedQuery() { return $this->db - ->table(Task::TABLE) + ->table(TaskModel::TABLE) ->columns( - '(SELECT COUNT(*) FROM '.Comment::TABLE.' WHERE task_id=tasks.id) AS nb_comments', - '(SELECT COUNT(*) FROM '.TaskFile::TABLE.' WHERE task_id=tasks.id) AS nb_files', - '(SELECT COUNT(*) FROM '.Subtask::TABLE.' WHERE '.Subtask::TABLE.'.task_id=tasks.id) AS nb_subtasks', - '(SELECT COUNT(*) FROM '.Subtask::TABLE.' WHERE '.Subtask::TABLE.'.task_id=tasks.id AND status=2) AS nb_completed_subtasks', - '(SELECT COUNT(*) FROM '.TaskLink::TABLE.' WHERE '.TaskLink::TABLE.'.task_id = tasks.id) AS nb_links', - '(SELECT COUNT(*) FROM '.TaskExternalLink::TABLE.' WHERE '.TaskExternalLink::TABLE.'.task_id = tasks.id) AS nb_external_links', - '(SELECT DISTINCT 1 FROM '.TaskLink::TABLE.' WHERE '.TaskLink::TABLE.'.task_id = tasks.id AND '.TaskLink::TABLE.'.link_id = 9) AS is_milestone', + '(SELECT COUNT(*) FROM '.CommentModel::TABLE.' WHERE task_id=tasks.id) AS nb_comments', + '(SELECT COUNT(*) FROM '.TaskFileModel::TABLE.' WHERE task_id=tasks.id) AS nb_files', + '(SELECT COUNT(*) FROM '.SubtaskModel::TABLE.' WHERE '.SubtaskModel::TABLE.'.task_id=tasks.id) AS nb_subtasks', + '(SELECT COUNT(*) FROM '.SubtaskModel::TABLE.' WHERE '.SubtaskModel::TABLE.'.task_id=tasks.id AND status=2) AS nb_completed_subtasks', + '(SELECT COUNT(*) FROM '.TaskLinkModel::TABLE.' WHERE '.TaskLinkModel::TABLE.'.task_id = tasks.id) AS nb_links', + '(SELECT COUNT(*) FROM '.TaskExternalLinkModel::TABLE.' WHERE '.TaskExternalLinkModel::TABLE.'.task_id = tasks.id) AS nb_external_links', + '(SELECT DISTINCT 1 FROM '.TaskLinkModel::TABLE.' WHERE '.TaskLinkModel::TABLE.'.task_id = tasks.id AND '.TaskLinkModel::TABLE.'.link_id = 9) AS is_milestone', 'tasks.id', 'tasks.reference', 'tasks.title', @@ -132,24 +132,24 @@ class TaskFinder extends Base 'tasks.recurrence_child', 'tasks.time_estimated', 'tasks.time_spent', - User::TABLE.'.username AS assignee_username', - User::TABLE.'.name AS assignee_name', - User::TABLE.'.email AS assignee_email', - User::TABLE.'.avatar_path AS assignee_avatar_path', - Category::TABLE.'.name AS category_name', - Category::TABLE.'.description AS category_description', - Column::TABLE.'.title AS column_name', - Column::TABLE.'.position AS column_position', - Swimlane::TABLE.'.name AS swimlane_name', - Project::TABLE.'.default_swimlane', - Project::TABLE.'.name AS project_name' + UserModel::TABLE.'.username AS assignee_username', + UserModel::TABLE.'.name AS assignee_name', + UserModel::TABLE.'.email AS assignee_email', + UserModel::TABLE.'.avatar_path AS assignee_avatar_path', + CategoryModel::TABLE.'.name AS category_name', + CategoryModel::TABLE.'.description AS category_description', + ColumnModel::TABLE.'.title AS column_name', + ColumnModel::TABLE.'.position AS column_position', + SwimlaneModel::TABLE.'.name AS swimlane_name', + ProjectModel::TABLE.'.default_swimlane', + ProjectModel::TABLE.'.name AS project_name' ) - ->join(User::TABLE, 'id', 'owner_id', Task::TABLE) - ->left(User::TABLE, 'uc', 'id', Task::TABLE, 'creator_id') - ->join(Category::TABLE, 'id', 'category_id', Task::TABLE) - ->join(Column::TABLE, 'id', 'column_id', Task::TABLE) - ->join(Swimlane::TABLE, 'id', 'swimlane_id', Task::TABLE) - ->join(Project::TABLE, 'id', 'project_id', Task::TABLE); + ->join(UserModel::TABLE, 'id', 'owner_id', TaskModel::TABLE) + ->left(UserModel::TABLE, 'uc', 'id', TaskModel::TABLE, 'creator_id') + ->join(CategoryModel::TABLE, 'id', 'category_id', TaskModel::TABLE) + ->join(ColumnModel::TABLE, 'id', 'column_id', TaskModel::TABLE) + ->join(SwimlaneModel::TABLE, 'id', 'swimlane_id', TaskModel::TABLE) + ->join(ProjectModel::TABLE, 'id', 'project_id', TaskModel::TABLE); } /** @@ -164,11 +164,11 @@ class TaskFinder extends Base public function getTasksByColumnAndSwimlane($project_id, $column_id, $swimlane_id = 0) { return $this->getExtendedQuery() - ->eq(Task::TABLE.'.project_id', $project_id) - ->eq(Task::TABLE.'.column_id', $column_id) - ->eq(Task::TABLE.'.swimlane_id', $swimlane_id) - ->eq(Task::TABLE.'.is_active', Task::STATUS_OPEN) - ->asc(Task::TABLE.'.position') + ->eq(TaskModel::TABLE.'.project_id', $project_id) + ->eq(TaskModel::TABLE.'.column_id', $column_id) + ->eq(TaskModel::TABLE.'.swimlane_id', $swimlane_id) + ->eq(TaskModel::TABLE.'.is_active', TaskModel::STATUS_OPEN) + ->asc(TaskModel::TABLE.'.position') ->findAll(); } @@ -180,12 +180,12 @@ class TaskFinder extends Base * @param integer $status_id Status id * @return array */ - public function getAll($project_id, $status_id = Task::STATUS_OPEN) + public function getAll($project_id, $status_id = TaskModel::STATUS_OPEN) { return $this->db - ->table(Task::TABLE) - ->eq(Task::TABLE.'.project_id', $project_id) - ->eq(Task::TABLE.'.is_active', $status_id) + ->table(TaskModel::TABLE) + ->eq(TaskModel::TABLE.'.project_id', $project_id) + ->eq(TaskModel::TABLE.'.is_active', $status_id) ->findAll(); } @@ -197,12 +197,12 @@ class TaskFinder extends Base * @param array $status * @return array */ - public function getAllIds($project_id, array $status = array(Task::STATUS_OPEN)) + public function getAllIds($project_id, array $status = array(TaskModel::STATUS_OPEN)) { return $this->db - ->table(Task::TABLE) - ->eq(Task::TABLE.'.project_id', $project_id) - ->in(Task::TABLE.'.is_active', $status) + ->table(TaskModel::TABLE) + ->eq(TaskModel::TABLE.'.project_id', $project_id) + ->in(TaskModel::TABLE.'.is_active', $status) ->findAllByColumn('id'); } @@ -214,24 +214,24 @@ class TaskFinder extends Base */ public function getOverdueTasksQuery() { - return $this->db->table(Task::TABLE) + return $this->db->table(TaskModel::TABLE) ->columns( - Task::TABLE.'.id', - Task::TABLE.'.title', - Task::TABLE.'.date_due', - Task::TABLE.'.project_id', - Task::TABLE.'.creator_id', - Task::TABLE.'.owner_id', - Project::TABLE.'.name AS project_name', - User::TABLE.'.username AS assignee_username', - User::TABLE.'.name AS assignee_name' + TaskModel::TABLE.'.id', + TaskModel::TABLE.'.title', + TaskModel::TABLE.'.date_due', + TaskModel::TABLE.'.project_id', + TaskModel::TABLE.'.creator_id', + TaskModel::TABLE.'.owner_id', + ProjectModel::TABLE.'.name AS project_name', + UserModel::TABLE.'.username AS assignee_username', + UserModel::TABLE.'.name AS assignee_name' ) - ->join(Project::TABLE, 'id', 'project_id') - ->join(User::TABLE, 'id', 'owner_id') - ->eq(Project::TABLE.'.is_active', 1) - ->eq(Task::TABLE.'.is_active', 1) - ->neq(Task::TABLE.'.date_due', 0) - ->lte(Task::TABLE.'.date_due', mktime(23, 59, 59)); + ->join(ProjectModel::TABLE, 'id', 'project_id') + ->join(UserModel::TABLE, 'id', 'owner_id') + ->eq(ProjectModel::TABLE.'.is_active', 1) + ->eq(TaskModel::TABLE.'.is_active', 1) + ->neq(TaskModel::TABLE.'.date_due', 0) + ->lte(TaskModel::TABLE.'.date_due', mktime(23, 59, 59)); } /** @@ -254,7 +254,7 @@ class TaskFinder extends Base */ public function getOverdueTasksByProject($project_id) { - return $this->getOverdueTasksQuery()->eq(Task::TABLE.'.project_id', $project_id)->findAll(); + return $this->getOverdueTasksQuery()->eq(TaskModel::TABLE.'.project_id', $project_id)->findAll(); } /** @@ -266,7 +266,7 @@ class TaskFinder extends Base */ public function getOverdueTasksByUser($user_id) { - return $this->getOverdueTasksQuery()->eq(Task::TABLE.'.owner_id', $user_id)->findAll(); + return $this->getOverdueTasksQuery()->eq(TaskModel::TABLE.'.owner_id', $user_id)->findAll(); } /** @@ -278,7 +278,7 @@ class TaskFinder extends Base */ public function getProjectId($task_id) { - return (int) $this->db->table(Task::TABLE)->eq('id', $task_id)->findOneColumn('project_id') ?: 0; + return (int) $this->db->table(TaskModel::TABLE)->eq('id', $task_id)->findOneColumn('project_id') ?: 0; } /** @@ -290,7 +290,7 @@ class TaskFinder extends Base */ public function getById($task_id) { - return $this->db->table(Task::TABLE)->eq('id', $task_id)->findOne(); + return $this->db->table(TaskModel::TABLE)->eq('id', $task_id)->findOne(); } /** @@ -303,7 +303,7 @@ class TaskFinder extends Base */ public function getByReference($project_id, $reference) { - return $this->db->table(Task::TABLE)->eq('project_id', $project_id)->eq('reference', $reference)->findOne(); + return $this->db->table(TaskModel::TABLE)->eq('project_id', $project_id)->eq('reference', $reference)->findOne(); } /** @@ -378,11 +378,11 @@ class TaskFinder extends Base */ public function getICalQuery() { - return $this->db->table(Task::TABLE) - ->left(User::TABLE, 'ua', 'id', Task::TABLE, 'owner_id') - ->left(User::TABLE, 'uc', 'id', Task::TABLE, 'creator_id') + return $this->db->table(TaskModel::TABLE) + ->left(UserModel::TABLE, 'ua', 'id', TaskModel::TABLE, 'owner_id') + ->left(UserModel::TABLE, 'uc', 'id', TaskModel::TABLE, 'creator_id') ->columns( - Task::TABLE.'.*', + TaskModel::TABLE.'.*', 'ua.email AS assignee_email', 'ua.name AS assignee_name', 'ua.username AS assignee_username', @@ -399,10 +399,10 @@ class TaskFinder extends Base * @param array $status List of status id * @return integer */ - public function countByProjectId($project_id, array $status = array(Task::STATUS_OPEN, Task::STATUS_CLOSED)) + public function countByProjectId($project_id, array $status = array(TaskModel::STATUS_OPEN, TaskModel::STATUS_CLOSED)) { return $this->db - ->table(Task::TABLE) + ->table(TaskModel::TABLE) ->eq('project_id', $project_id) ->in('is_active', $status) ->count(); @@ -419,7 +419,7 @@ class TaskFinder extends Base public function countByColumnId($project_id, $column_id) { return $this->db - ->table(Task::TABLE) + ->table(TaskModel::TABLE) ->eq('project_id', $project_id) ->eq('column_id', $column_id) ->eq('is_active', 1) @@ -438,7 +438,7 @@ class TaskFinder extends Base public function countByColumnAndSwimlaneId($project_id, $column_id, $swimlane_id) { return $this->db - ->table(Task::TABLE) + ->table(TaskModel::TABLE) ->eq('project_id', $project_id) ->eq('column_id', $column_id) ->eq('swimlane_id', $swimlane_id) @@ -455,7 +455,7 @@ class TaskFinder extends Base */ public function exists($task_id) { - return $this->db->table(Task::TABLE)->eq('id', $task_id)->exists(); + return $this->db->table(TaskModel::TABLE)->eq('id', $task_id)->exists(); } /** @@ -468,9 +468,9 @@ class TaskFinder extends Base public function getProjectToken($task_id) { return $this->db - ->table(Task::TABLE) - ->eq(Task::TABLE.'.id', $task_id) - ->join(Project::TABLE, 'id', 'project_id') - ->findOneColumn(Project::TABLE.'.token'); + ->table(TaskModel::TABLE) + ->eq(TaskModel::TABLE.'.id', $task_id) + ->join(ProjectModel::TABLE, 'id', 'project_id') + ->findOneColumn(ProjectModel::TABLE.'.token'); } } diff --git a/app/Model/TaskLink.php b/app/Model/TaskLinkModel.php index 9c5b3ca3..45225e35 100644 --- a/app/Model/TaskLink.php +++ b/app/Model/TaskLinkModel.php @@ -8,11 +8,11 @@ use Kanboard\Event\TaskLinkEvent; /** * TaskLink model * - * @package model + * @package Kanboard\Model * @author Olivier Maridat * @author Frederic Guillot */ -class TaskLink extends Base +class TaskLinkModel extends Base { /** * SQL table name @@ -49,7 +49,7 @@ class TaskLink extends Base */ public function getOppositeTaskLink(array $task_link) { - $opposite_link_id = $this->link->getOppositeLinkId($task_link['link_id']); + $opposite_link_id = $this->linkModel->getOppositeLinkId($task_link['link_id']); return $this->db->table(self::TABLE) ->eq('opposite_task_id', $task_link['task_id']) @@ -72,31 +72,31 @@ class TaskLink extends Base ->columns( self::TABLE.'.id', self::TABLE.'.opposite_task_id AS task_id', - Link::TABLE.'.label', - Task::TABLE.'.title', - Task::TABLE.'.is_active', - Task::TABLE.'.project_id', - Task::TABLE.'.column_id', - Task::TABLE.'.color_id', - Task::TABLE.'.time_spent AS task_time_spent', - Task::TABLE.'.time_estimated AS task_time_estimated', - Task::TABLE.'.owner_id AS task_assignee_id', - User::TABLE.'.username AS task_assignee_username', - User::TABLE.'.name AS task_assignee_name', - Column::TABLE.'.title AS column_title', - Project::TABLE.'.name AS project_name' + LinkModel::TABLE.'.label', + TaskModel::TABLE.'.title', + TaskModel::TABLE.'.is_active', + TaskModel::TABLE.'.project_id', + TaskModel::TABLE.'.column_id', + TaskModel::TABLE.'.color_id', + TaskModel::TABLE.'.time_spent AS task_time_spent', + TaskModel::TABLE.'.time_estimated AS task_time_estimated', + TaskModel::TABLE.'.owner_id AS task_assignee_id', + UserModel::TABLE.'.username AS task_assignee_username', + UserModel::TABLE.'.name AS task_assignee_name', + ColumnModel::TABLE.'.title AS column_title', + ProjectModel::TABLE.'.name AS project_name' ) ->eq(self::TABLE.'.task_id', $task_id) - ->join(Link::TABLE, 'id', 'link_id') - ->join(Task::TABLE, 'id', 'opposite_task_id') - ->join(Column::TABLE, 'id', 'column_id', Task::TABLE) - ->join(User::TABLE, 'id', 'owner_id', Task::TABLE) - ->join(Project::TABLE, 'id', 'project_id', Task::TABLE) - ->asc(Link::TABLE.'.id') - ->desc(Column::TABLE.'.position') - ->desc(Task::TABLE.'.is_active') - ->asc(Task::TABLE.'.position') - ->asc(Task::TABLE.'.id') + ->join(LinkModel::TABLE, 'id', 'link_id') + ->join(TaskModel::TABLE, 'id', 'opposite_task_id') + ->join(ColumnModel::TABLE, 'id', 'column_id', TaskModel::TABLE) + ->join(UserModel::TABLE, 'id', 'owner_id', TaskModel::TABLE) + ->join(ProjectModel::TABLE, 'id', 'project_id', TaskModel::TABLE) + ->asc(LinkModel::TABLE.'.id') + ->desc(ColumnModel::TABLE.'.position') + ->desc(TaskModel::TABLE.'.is_active') + ->asc(TaskModel::TABLE.'.position') + ->asc(TaskModel::TABLE.'.id') ->findAll(); } @@ -132,7 +132,7 @@ class TaskLink extends Base private function fireEvents(array $events) { foreach ($events as $event) { - $event['project_id'] = $this->taskFinder->getProjectId($event['task_id']); + $event['project_id'] = $this->taskFinderModel->getProjectId($event['task_id']); $this->container['dispatcher']->dispatch(self::EVENT_CREATE_UPDATE, new TaskLinkEvent($event)); } } @@ -152,7 +152,7 @@ class TaskLink extends Base $this->db->startTransaction(); // Get opposite link - $opposite_link_id = $this->link->getOppositeLinkId($link_id); + $opposite_link_id = $this->linkModel->getOppositeLinkId($link_id); $values = array( 'task_id' => $task_id, @@ -204,7 +204,7 @@ class TaskLink extends Base $opposite_task_link = $this->getOppositeTaskLink($task_link); // Get opposite link - $opposite_link_id = $this->link->getOppositeLinkId($link_id); + $opposite_link_id = $this->linkModel->getOppositeLinkId($link_id); // Update the original task link $values = array( @@ -248,7 +248,7 @@ class TaskLink extends Base $this->db->startTransaction(); $link = $this->getById($task_link_id); - $link_id = $this->link->getOppositeLinkId($link['link_id']); + $link_id = $this->linkModel->getOppositeLinkId($link['link_id']); $this->db->table(self::TABLE)->eq('id', $task_link_id)->remove(); diff --git a/app/Model/TaskMetadata.php b/app/Model/TaskMetadataModel.php index d9d024bf..dc3f56ec 100644 --- a/app/Model/TaskMetadata.php +++ b/app/Model/TaskMetadataModel.php @@ -5,10 +5,10 @@ namespace Kanboard\Model; /** * Task Metadata * - * @package model + * @package Kanboard\Model * @author Frederic Guillot */ -class TaskMetadata extends Metadata +class TaskMetadataModel extends MetadataModel { /** * Get the table diff --git a/app/Model/Task.php b/app/Model/TaskModel.php index bdb55c46..b0e7772a 100644 --- a/app/Model/Task.php +++ b/app/Model/TaskModel.php @@ -7,10 +7,10 @@ use Kanboard\Core\Base; /** * Task model * - * @package model + * @package Kanboard\Model * @author Frederic Guillot */ -class Task extends Base +class TaskModel extends Base { /** * SQL table name @@ -90,11 +90,11 @@ class Task extends Base */ public function remove($task_id) { - if (! $this->taskFinder->exists($task_id)) { + if (! $this->taskFinderModel->exists($task_id)) { return false; } - $this->taskFile->removeAll($task_id); + $this->taskFileModel->removeAll($task_id); return $this->db->table(self::TABLE)->eq('id', $task_id)->remove(); } @@ -126,8 +126,8 @@ class Task extends Base public function getRecurrenceStatusList() { return array( - Task::RECURRING_STATUS_NONE => t('No'), - Task::RECURRING_STATUS_PENDING => t('Yes'), + TaskModel::RECURRING_STATUS_NONE => t('No'), + TaskModel::RECURRING_STATUS_PENDING => t('Yes'), ); } @@ -140,9 +140,9 @@ class Task extends Base public function getRecurrenceTriggerList() { return array( - Task::RECURRING_TRIGGER_FIRST_COLUMN => t('When task is moved from first column'), - Task::RECURRING_TRIGGER_LAST_COLUMN => t('When task is moved to last column'), - Task::RECURRING_TRIGGER_CLOSE => t('When task is closed'), + TaskModel::RECURRING_TRIGGER_FIRST_COLUMN => t('When task is moved from first column'), + TaskModel::RECURRING_TRIGGER_LAST_COLUMN => t('When task is moved to last column'), + TaskModel::RECURRING_TRIGGER_CLOSE => t('When task is closed'), ); } @@ -155,8 +155,8 @@ class Task extends Base public function getRecurrenceBasedateList() { return array( - Task::RECURRING_BASEDATE_DUEDATE => t('Existing due date'), - Task::RECURRING_BASEDATE_TRIGGERDATE => t('Action date'), + TaskModel::RECURRING_BASEDATE_DUEDATE => t('Existing due date'), + TaskModel::RECURRING_BASEDATE_TRIGGERDATE => t('Action date'), ); } @@ -169,9 +169,9 @@ class Task extends Base public function getRecurrenceTimeframeList() { return array( - Task::RECURRING_TIMEFRAME_DAYS => t('Day(s)'), - Task::RECURRING_TIMEFRAME_MONTHS => t('Month(s)'), - Task::RECURRING_TIMEFRAME_YEARS => t('Year(s)'), + TaskModel::RECURRING_TIMEFRAME_DAYS => t('Day(s)'), + TaskModel::RECURRING_TIMEFRAME_MONTHS => t('Month(s)'), + TaskModel::RECURRING_TIMEFRAME_YEARS => t('Year(s)'), ); } @@ -212,10 +212,10 @@ class Task extends Base */ public function duplicate($src_project_id, $dst_project_id) { - $task_ids = $this->taskFinder->getAllIds($src_project_id, array(Task::STATUS_OPEN, Task::STATUS_CLOSED)); + $task_ids = $this->taskFinderModel->getAllIds($src_project_id, array(TaskModel::STATUS_OPEN, TaskModel::STATUS_CLOSED)); foreach ($task_ids as $task_id) { - if (! $this->taskDuplication->duplicateToProject($task_id, $dst_project_id)) { + if (! $this->taskDuplicationModel->duplicateToProject($task_id, $dst_project_id)) { return false; } } diff --git a/app/Model/TaskModification.php b/app/Model/TaskModificationModel.php index 7e0ea8b2..762af2c5 100644 --- a/app/Model/TaskModification.php +++ b/app/Model/TaskModificationModel.php @@ -8,10 +8,10 @@ use Kanboard\Event\TaskEvent; /** * Task Modification * - * @package model + * @package Kanboard\Model * @author Frederic Guillot */ -class TaskModification extends Base +class TaskModificationModel extends Base { /** * Update a task @@ -23,10 +23,10 @@ class TaskModification extends Base */ public function update(array $values, $fire_events = true) { - $original_task = $this->taskFinder->getById($values['id']); + $original_task = $this->taskFinderModel->getById($values['id']); $this->prepare($values); - $result = $this->db->table(Task::TABLE)->eq('id', $original_task['id'])->update($values); + $result = $this->db->table(TaskModel::TABLE)->eq('id', $original_task['id'])->update($values); if ($fire_events && $result) { $this->fireEvents($original_task, $values); @@ -52,10 +52,10 @@ class TaskModification extends Base unset($event_data['changes']['date_modification']); if ($this->isFieldModified('owner_id', $event_data['changes'])) { - $events[] = Task::EVENT_ASSIGNEE_CHANGE; + $events[] = TaskModel::EVENT_ASSIGNEE_CHANGE; } elseif (! empty($event_data['changes'])) { - $events[] = Task::EVENT_CREATE_UPDATE; - $events[] = Task::EVENT_UPDATE; + $events[] = TaskModel::EVENT_CREATE_UPDATE; + $events[] = TaskModel::EVENT_UPDATE; } foreach ($events as $event) { diff --git a/app/Model/TaskPosition.php b/app/Model/TaskPositionModel.php index 5b794795..9fdb8f7d 100644 --- a/app/Model/TaskPosition.php +++ b/app/Model/TaskPositionModel.php @@ -8,10 +8,10 @@ use Kanboard\Event\TaskEvent; /** * Task Position * - * @package model + * @package Kanboard\Model * @author Frederic Guillot */ -class TaskPosition extends Base +class TaskPositionModel extends Base { /** * Move a task to another column or to another position @@ -31,9 +31,9 @@ class TaskPosition extends Base return false; } - $task = $this->taskFinder->getById($task_id); + $task = $this->taskFinderModel->getById($task_id); - if ($task['is_active'] == Task::STATUS_CLOSED) { + if ($task['is_active'] == TaskModel::STATUS_CLOSED) { return true; } @@ -132,7 +132,7 @@ class TaskPosition extends Base */ private function saveTaskPositions($project_id, $task_id, $position, $column_id, $swimlane_id) { - $tasks_ids = $this->db->table(Task::TABLE) + $tasks_ids = $this->db->table(TaskModel::TABLE) ->eq('is_active', 1) ->eq('swimlane_id', $swimlane_id) ->eq('project_id', $project_id) @@ -169,7 +169,7 @@ class TaskPosition extends Base $now = time(); - return $this->db->table(Task::TABLE)->eq('id', $task_id)->update(array( + return $this->db->table(TaskModel::TABLE)->eq('id', $task_id)->update(array( 'date_moved' => $now, 'date_modification' => $now, )); @@ -187,7 +187,7 @@ class TaskPosition extends Base */ private function saveTaskPosition($task_id, $position, $column_id, $swimlane_id) { - $result = $this->db->table(Task::TABLE)->eq('id', $task_id)->update(array( + $result = $this->db->table(TaskModel::TABLE)->eq('id', $task_id)->update(array( 'position' => $position, 'column_id' => $column_id, 'swimlane_id' => $swimlane_id, @@ -226,14 +226,14 @@ class TaskPosition extends Base ); if ($task['swimlane_id'] != $new_swimlane_id) { - $this->logger->debug('Event fired: '.Task::EVENT_MOVE_SWIMLANE); - $this->dispatcher->dispatch(Task::EVENT_MOVE_SWIMLANE, new TaskEvent($event_data)); + $this->logger->debug('Event fired: '.TaskModel::EVENT_MOVE_SWIMLANE); + $this->dispatcher->dispatch(TaskModel::EVENT_MOVE_SWIMLANE, new TaskEvent($event_data)); } elseif ($task['column_id'] != $new_column_id) { - $this->logger->debug('Event fired: '.Task::EVENT_MOVE_COLUMN); - $this->dispatcher->dispatch(Task::EVENT_MOVE_COLUMN, new TaskEvent($event_data)); + $this->logger->debug('Event fired: '.TaskModel::EVENT_MOVE_COLUMN); + $this->dispatcher->dispatch(TaskModel::EVENT_MOVE_COLUMN, new TaskEvent($event_data)); } elseif ($task['position'] != $new_position) { - $this->logger->debug('Event fired: '.Task::EVENT_MOVE_POSITION); - $this->dispatcher->dispatch(Task::EVENT_MOVE_POSITION, new TaskEvent($event_data)); + $this->logger->debug('Event fired: '.TaskModel::EVENT_MOVE_POSITION); + $this->dispatcher->dispatch(TaskModel::EVENT_MOVE_POSITION, new TaskEvent($event_data)); } } } diff --git a/app/Model/TaskStatus.php b/app/Model/TaskStatusModel.php index 4ba13a60..4d573f0e 100644 --- a/app/Model/TaskStatus.php +++ b/app/Model/TaskStatusModel.php @@ -8,10 +8,10 @@ use Kanboard\Event\TaskEvent; /** * Task Status * - * @package model + * @package Kanboard\Model * @author Frederic Guillot */ -class TaskStatus extends Base +class TaskStatusModel extends Base { /** * Return true if the task is closed @@ -22,7 +22,7 @@ class TaskStatus extends Base */ public function isClosed($task_id) { - return $this->checkStatus($task_id, Task::STATUS_CLOSED); + return $this->checkStatus($task_id, TaskModel::STATUS_CLOSED); } /** @@ -34,7 +34,7 @@ class TaskStatus extends Base */ public function isOpen($task_id) { - return $this->checkStatus($task_id, Task::STATUS_OPEN); + return $this->checkStatus($task_id, TaskModel::STATUS_OPEN); } /** @@ -46,8 +46,8 @@ class TaskStatus extends Base */ public function close($task_id) { - $this->subtask->closeAll($task_id); - return $this->changeStatus($task_id, Task::STATUS_CLOSED, time(), Task::EVENT_CLOSE); + $this->subtaskModel->closeAll($task_id); + return $this->changeStatus($task_id, TaskModel::STATUS_CLOSED, time(), TaskModel::EVENT_CLOSE); } /** @@ -59,7 +59,7 @@ class TaskStatus extends Base */ public function open($task_id) { - return $this->changeStatus($task_id, Task::STATUS_OPEN, 0, Task::EVENT_OPEN); + return $this->changeStatus($task_id, TaskModel::STATUS_OPEN, 0, TaskModel::EVENT_OPEN); } /** @@ -85,10 +85,10 @@ class TaskStatus extends Base public function closeTasksBySwimlaneAndColumn($swimlane_id, $column_id) { $task_ids = $this->db - ->table(Task::TABLE) + ->table(TaskModel::TABLE) ->eq('swimlane_id', $swimlane_id) ->eq('column_id', $column_id) - ->eq(Task::TABLE.'.is_active', Task::STATUS_OPEN) + ->eq(TaskModel::TABLE.'.is_active', TaskModel::STATUS_OPEN) ->findAllByColumn('id'); $this->closeMultipleTasks($task_ids); @@ -106,12 +106,12 @@ class TaskStatus extends Base */ private function changeStatus($task_id, $status, $date_completed, $event) { - if (! $this->taskFinder->exists($task_id)) { + if (! $this->taskFinderModel->exists($task_id)) { return false; } $result = $this->db - ->table(Task::TABLE) + ->table(TaskModel::TABLE) ->eq('id', $task_id) ->update(array( 'is_active' => $status, @@ -121,7 +121,7 @@ class TaskStatus extends Base if ($result) { $this->logger->debug('Event fired: '.$event); - $this->dispatcher->dispatch($event, new TaskEvent(array('task_id' => $task_id) + $this->taskFinder->getById($task_id))); + $this->dispatcher->dispatch($event, new TaskEvent(array('task_id' => $task_id) + $this->taskFinderModel->getById($task_id))); } return $result; @@ -138,7 +138,7 @@ class TaskStatus extends Base private function checkStatus($task_id, $status) { return $this->db - ->table(Task::TABLE) + ->table(TaskModel::TABLE) ->eq('id', $task_id) ->eq('is_active', $status) ->count() === 1; diff --git a/app/Model/Timezone.php b/app/Model/TimezoneModel.php index de426e79..8b3e895a 100644 --- a/app/Model/Timezone.php +++ b/app/Model/TimezoneModel.php @@ -10,7 +10,7 @@ use Kanboard\Core\Base; * @package Kanboard\Model * @author Frederic Guillot */ -class Timezone extends Base +class TimezoneModel extends Base { /** * Get available timezones @@ -43,7 +43,7 @@ class Timezone extends Base return $this->sessionStorage->user['timezone']; } - return $this->config->get('application_timezone', 'UTC'); + return $this->configModel->get('application_timezone', 'UTC'); } /** diff --git a/app/Model/Transition.php b/app/Model/TransitionModel.php index 2bc622b0..a4a58472 100644 --- a/app/Model/Transition.php +++ b/app/Model/TransitionModel.php @@ -7,10 +7,10 @@ use Kanboard\Core\Base; /** * Transition * - * @package model + * @package Kanboard\Model * @author Frederic Guillot */ -class Transition extends Base +class TransitionModel extends Base { /** * SQL table name @@ -71,17 +71,17 @@ class Transition extends Base ->columns( 'src.title as src_column', 'dst.title as dst_column', - User::TABLE.'.name', - User::TABLE.'.username', + UserModel::TABLE.'.name', + UserModel::TABLE.'.username', self::TABLE.'.user_id', self::TABLE.'.date', self::TABLE.'.time_spent' ) ->eq('task_id', $task_id) ->desc('date') - ->join(User::TABLE, 'id', 'user_id') - ->join(Column::TABLE.' as src', 'id', 'src_column_id', self::TABLE, 'src') - ->join(Column::TABLE.' as dst', 'id', 'dst_column_id', self::TABLE, 'dst') + ->join(UserModel::TABLE, 'id', 'user_id') + ->join(ColumnModel::TABLE.' as src', 'id', 'src_column_id', self::TABLE, 'src') + ->join(ColumnModel::TABLE.' as dst', 'id', 'dst_column_id', self::TABLE, 'dst') ->findAll(); } @@ -106,12 +106,12 @@ class Transition extends Base return $this->db->table(self::TABLE) ->columns( - Task::TABLE.'.id', - Task::TABLE.'.title', + TaskModel::TABLE.'.id', + TaskModel::TABLE.'.title', 'src.title as src_column', 'dst.title as dst_column', - User::TABLE.'.name', - User::TABLE.'.username', + UserModel::TABLE.'.name', + UserModel::TABLE.'.username', self::TABLE.'.user_id', self::TABLE.'.date', self::TABLE.'.time_spent' @@ -121,10 +121,10 @@ class Transition extends Base ->eq(self::TABLE.'.project_id', $project_id) ->desc('date') ->desc(self::TABLE.'.id') - ->join(Task::TABLE, 'id', 'task_id') - ->join(User::TABLE, 'id', 'user_id') - ->join(Column::TABLE.' as src', 'id', 'src_column_id', self::TABLE, 'src') - ->join(Column::TABLE.' as dst', 'id', 'dst_column_id', self::TABLE, 'dst') + ->join(TaskModel::TABLE, 'id', 'task_id') + ->join(UserModel::TABLE, 'id', 'user_id') + ->join(ColumnModel::TABLE.' as src', 'id', 'src_column_id', self::TABLE, 'src') + ->join(ColumnModel::TABLE.' as dst', 'id', 'dst_column_id', self::TABLE, 'dst') ->findAll(); } } diff --git a/app/Model/UserLocking.php b/app/Model/UserLockingModel.php index ccaf402c..1d4d994c 100644 --- a/app/Model/UserLocking.php +++ b/app/Model/UserLockingModel.php @@ -7,10 +7,10 @@ use Kanboard\Core\Base; /** * User Locking Model * - * @package model + * @package Kanboard\Model * @author Frederic Guillot */ -class UserLocking extends Base +class UserLockingModel extends Base { /** * Get the number of failed login for the user @@ -21,7 +21,7 @@ class UserLocking extends Base */ public function getFailedLogin($username) { - return (int) $this->db->table(User::TABLE) + return (int) $this->db->table(UserModel::TABLE) ->eq('username', $username) ->findOneColumn('nb_failed_login'); } @@ -35,7 +35,7 @@ class UserLocking extends Base */ public function resetFailedLogin($username) { - return $this->db->table(User::TABLE) + return $this->db->table(UserModel::TABLE) ->eq('username', $username) ->update(array( 'nb_failed_login' => 0, @@ -52,7 +52,7 @@ class UserLocking extends Base */ public function incrementFailedLogin($username) { - return $this->db->table(User::TABLE) + return $this->db->table(UserModel::TABLE) ->eq('username', $username) ->increment('nb_failed_login', 1); } @@ -66,7 +66,7 @@ class UserLocking extends Base */ public function isLocked($username) { - return $this->db->table(User::TABLE) + return $this->db->table(UserModel::TABLE) ->eq('username', $username) ->neq('lock_expiration_date', 0) ->gte('lock_expiration_date', time()) @@ -83,7 +83,7 @@ class UserLocking extends Base */ public function lock($username, $duration = 15) { - return $this->db->table(User::TABLE) + return $this->db->table(UserModel::TABLE) ->eq('username', $username) ->update(array( 'lock_expiration_date' => time() + $duration * 60 diff --git a/app/Model/UserMention.php b/app/Model/UserMentionModel.php index 42b81840..cdb9949e 100644 --- a/app/Model/UserMention.php +++ b/app/Model/UserMentionModel.php @@ -8,10 +8,10 @@ use Kanboard\Event\GenericEvent; /** * User Mention * - * @package model + * @package Kanboard\Model * @author Frederic Guillot */ -class UserMention extends Base +class UserMentionModel extends Base { /** * Get list of mentioned users @@ -25,7 +25,7 @@ class UserMention extends Base $users = array(); if (preg_match_all('/@([^\s]+)/', $content, $matches)) { - $users = $this->db->table(User::TABLE) + $users = $this->db->table(UserModel::TABLE) ->columns('id', 'username', 'name', 'email', 'language') ->eq('notifications_enabled', 1) ->neq('id', $this->userSession->getId()) @@ -47,13 +47,13 @@ class UserMention extends Base public function fireEvents($content, $eventName, GenericEvent $event) { if (empty($event['project_id'])) { - $event['project_id'] = $this->taskFinder->getProjectId($event['task_id']); + $event['project_id'] = $this->taskFinderModel->getProjectId($event['task_id']); } $users = $this->getMentionedUsers($content); foreach ($users as $user) { - if ($this->projectPermission->isMember($event['project_id'], $user['id'])) { + if ($this->projectPermissionModel->isMember($event['project_id'], $user['id'])) { $event['mention'] = $user; $this->dispatcher->dispatch($eventName, $event); } diff --git a/app/Model/UserMetadata.php b/app/Model/UserMetadataModel.php index 491c1575..e931d3ba 100644 --- a/app/Model/UserMetadata.php +++ b/app/Model/UserMetadataModel.php @@ -2,15 +2,13 @@ namespace Kanboard\Model; -use Kanboard\Core\Base; - /** * User Metadata * - * @package model + * @package Kanboard\Model * @author Frederic Guillot */ -class UserMetadata extends Metadata +class UserMetadataModel extends MetadataModel { /** * Get the table diff --git a/app/Model/User.php b/app/Model/UserModel.php index cbfca0ac..f7a051c5 100644 --- a/app/Model/User.php +++ b/app/Model/UserModel.php @@ -10,10 +10,10 @@ use Kanboard\Core\Security\Role; /** * User model * - * @package model + * @package Kanboard\Model * @author Frederic Guillot */ -class User extends Base +class UserModel extends Base { /** * SQL table name @@ -86,7 +86,7 @@ class User extends Base { return $this->userSession->isAdmin() || // Avoid SQL query if connected $this->db - ->table(User::TABLE) + ->table(UserModel::TABLE) ->eq('id', $user_id) ->eq('role', Role::APP_ADMIN) ->exists(); @@ -212,7 +212,7 @@ class User extends Base $listing = $this->prepareList($users); if ($prepend) { - return array(User::EVERYBODY_ID => t('Everybody')) + $listing; + return array(UserModel::EVERYBODY_ID => t('Everybody')) + $listing; } return $listing; @@ -321,38 +321,38 @@ class User extends Base */ public function remove($user_id) { - $this->avatarFile->remove($user_id); + $this->avatarFileModel->remove($user_id); return $this->db->transaction(function (Database $db) use ($user_id) { // All assigned tasks are now unassigned (no foreign key) - if (! $db->table(Task::TABLE)->eq('owner_id', $user_id)->update(array('owner_id' => 0))) { + if (! $db->table(TaskModel::TABLE)->eq('owner_id', $user_id)->update(array('owner_id' => 0))) { return false; } // All assigned subtasks are now unassigned (no foreign key) - if (! $db->table(Subtask::TABLE)->eq('user_id', $user_id)->update(array('user_id' => 0))) { + if (! $db->table(SubtaskModel::TABLE)->eq('user_id', $user_id)->update(array('user_id' => 0))) { return false; } // All comments are not assigned anymore (no foreign key) - if (! $db->table(Comment::TABLE)->eq('user_id', $user_id)->update(array('user_id' => 0))) { + if (! $db->table(CommentModel::TABLE)->eq('user_id', $user_id)->update(array('user_id' => 0))) { return false; } // All private projects are removed - $project_ids = $db->table(Project::TABLE) + $project_ids = $db->table(ProjectModel::TABLE) ->eq('is_private', 1) - ->eq(ProjectUserRole::TABLE.'.user_id', $user_id) - ->join(ProjectUserRole::TABLE, 'project_id', 'id') - ->findAllByColumn(Project::TABLE.'.id'); + ->eq(ProjectUserRoleModel::TABLE.'.user_id', $user_id) + ->join(ProjectUserRoleModel::TABLE, 'project_id', 'id') + ->findAllByColumn(ProjectModel::TABLE.'.id'); if (! empty($project_ids)) { - $db->table(Project::TABLE)->in('id', $project_ids)->remove(); + $db->table(ProjectModel::TABLE)->in('id', $project_ids)->remove(); } // Finally remove the user - if (! $db->table(User::TABLE)->eq('id', $user_id)->remove()) { + if (! $db->table(UserModel::TABLE)->eq('id', $user_id)->remove()) { return false; } }); diff --git a/app/Model/UserNotificationFilter.php b/app/Model/UserNotificationFilterModel.php index d885da04..112ba290 100644 --- a/app/Model/UserNotificationFilter.php +++ b/app/Model/UserNotificationFilterModel.php @@ -7,10 +7,10 @@ use Kanboard\Core\Base; /** * User Notification Filter * - * @package model + * @package Kanboard\Model * @author Frederic Guillot */ -class UserNotificationFilter extends Base +class UserNotificationFilterModel extends Base { /** * SQL table name @@ -54,7 +54,7 @@ class UserNotificationFilter extends Base */ public function getSelectedFilter($user_id) { - return $this->db->table(User::TABLE)->eq('id', $user_id)->findOneColumn('notifications_filter'); + return $this->db->table(UserModel::TABLE)->eq('id', $user_id)->findOneColumn('notifications_filter'); } /** @@ -67,7 +67,7 @@ class UserNotificationFilter extends Base */ public function saveFilter($user_id, $filter) { - return $this->db->table(User::TABLE)->eq('id', $user_id)->update(array( + return $this->db->table(UserModel::TABLE)->eq('id', $user_id)->update(array( 'notifications_filter' => $filter, )); } diff --git a/app/Model/UserNotification.php b/app/Model/UserNotificationModel.php index ef90bb63..d77526f6 100644 --- a/app/Model/UserNotification.php +++ b/app/Model/UserNotificationModel.php @@ -8,10 +8,10 @@ use Kanboard\Core\Translator; /** * User Notification * - * @package model + * @package Kanboard\Model * @author Frederic Guillot */ -class UserNotification extends Base +class UserNotificationModel extends Base { /** * Send notifications to people @@ -25,7 +25,7 @@ class UserNotification extends Base $users = $this->getUsersWithNotificationEnabled($event_data['task']['project_id'], $this->userSession->getId()); foreach ($users as $user) { - if ($this->userNotificationFilter->shouldReceiveNotification($user, $event_data)) { + if ($this->userNotificationFilterModel->shouldReceiveNotification($user, $event_data)) { $this->sendUserNotification($user, $event_name, $event_data); } } @@ -47,15 +47,15 @@ class UserNotification extends Base if (! empty($user['language'])) { Translator::load($user['language']); } else { - Translator::load($this->config->get('application_language', 'en_US')); + Translator::load($this->configModel->get('application_language', 'en_US')); } - foreach ($this->userNotificationType->getSelectedTypes($user['id']) as $type) { - $this->userNotificationType->getType($type)->notifyUser($user, $event_name, $event_data); + foreach ($this->userNotificationTypeModel->getSelectedTypes($user['id']) as $type) { + $this->userNotificationTypeModel->getType($type)->notifyUser($user, $event_name, $event_data); } // Restore locales - $this->language->loadCurrentLanguage(); + $this->languageModel->loadCurrentLanguage(); } /** @@ -68,7 +68,7 @@ class UserNotification extends Base */ public function getUsersWithNotificationEnabled($project_id, $exclude_user_id = 0) { - if ($this->projectPermission->isEverybodyAllowed($project_id)) { + if ($this->projectPermissionModel->isEverybodyAllowed($project_id)) { return $this->getEverybodyWithNotificationEnabled($exclude_user_id); } @@ -94,7 +94,7 @@ class UserNotification extends Base */ public function enableNotification($user_id) { - return $this->db->table(User::TABLE)->eq('id', $user_id)->update(array('notifications_enabled' => 1)); + return $this->db->table(UserModel::TABLE)->eq('id', $user_id)->update(array('notifications_enabled' => 1)); } /** @@ -106,7 +106,7 @@ class UserNotification extends Base */ public function disableNotification($user_id) { - return $this->db->table(User::TABLE)->eq('id', $user_id)->update(array('notifications_enabled' => 0)); + return $this->db->table(UserModel::TABLE)->eq('id', $user_id)->update(array('notifications_enabled' => 0)); } /** @@ -126,12 +126,12 @@ class UserNotification extends Base $this->disableNotification($user_id); } - $filter = empty($values['notifications_filter']) ? UserNotificationFilter::FILTER_BOTH : $values['notifications_filter']; + $filter = empty($values['notifications_filter']) ? UserNotificationFilterModel::FILTER_BOTH : $values['notifications_filter']; $project_ids = empty($values['notification_projects']) ? array() : array_keys($values['notification_projects']); - $this->userNotificationFilter->saveFilter($user_id, $filter); - $this->userNotificationFilter->saveSelectedProjects($user_id, $project_ids); - $this->userNotificationType->saveSelectedTypes($user_id, $types); + $this->userNotificationFilterModel->saveFilter($user_id, $filter); + $this->userNotificationFilterModel->saveSelectedProjects($user_id, $project_ids); + $this->userNotificationTypeModel->saveSelectedTypes($user_id, $types); } /** @@ -143,9 +143,9 @@ class UserNotification extends Base */ public function readSettings($user_id) { - $values = $this->db->table(User::TABLE)->eq('id', $user_id)->columns('notifications_enabled', 'notifications_filter')->findOne(); - $values['notification_types'] = $this->userNotificationType->getSelectedTypes($user_id); - $values['notification_projects'] = $this->userNotificationFilter->getSelectedProjects($user_id); + $values = $this->db->table(UserModel::TABLE)->eq('id', $user_id)->columns('notifications_enabled', 'notifications_filter')->findOne(); + $values['notification_types'] = $this->userNotificationTypeModel->getSelectedTypes($user_id); + $values['notification_projects'] = $this->userNotificationFilterModel->getSelectedProjects($user_id); return $values; } @@ -160,27 +160,27 @@ class UserNotification extends Base private function getProjectUserMembersWithNotificationEnabled($project_id, $exclude_user_id) { return $this->db - ->table(ProjectUserRole::TABLE) - ->columns(User::TABLE.'.id', User::TABLE.'.username', User::TABLE.'.name', User::TABLE.'.email', User::TABLE.'.language', User::TABLE.'.notifications_filter') - ->join(User::TABLE, 'id', 'user_id') - ->eq(ProjectUserRole::TABLE.'.project_id', $project_id) - ->eq(User::TABLE.'.notifications_enabled', '1') - ->eq(User::TABLE.'.is_active', 1) - ->neq(User::TABLE.'.id', $exclude_user_id) + ->table(ProjectUserRoleModel::TABLE) + ->columns(UserModel::TABLE.'.id', UserModel::TABLE.'.username', UserModel::TABLE.'.name', UserModel::TABLE.'.email', UserModel::TABLE.'.language', UserModel::TABLE.'.notifications_filter') + ->join(UserModel::TABLE, 'id', 'user_id') + ->eq(ProjectUserRoleModel::TABLE.'.project_id', $project_id) + ->eq(UserModel::TABLE.'.notifications_enabled', '1') + ->eq(UserModel::TABLE.'.is_active', 1) + ->neq(UserModel::TABLE.'.id', $exclude_user_id) ->findAll(); } private function getProjectGroupMembersWithNotificationEnabled($project_id, $exclude_user_id) { return $this->db - ->table(ProjectGroupRole::TABLE) - ->columns(User::TABLE.'.id', User::TABLE.'.username', User::TABLE.'.name', User::TABLE.'.email', User::TABLE.'.language', User::TABLE.'.notifications_filter') - ->join(GroupMember::TABLE, 'group_id', 'group_id', ProjectGroupRole::TABLE) - ->join(User::TABLE, 'id', 'user_id', GroupMember::TABLE) - ->eq(ProjectGroupRole::TABLE.'.project_id', $project_id) - ->eq(User::TABLE.'.notifications_enabled', '1') - ->neq(User::TABLE.'.id', $exclude_user_id) - ->eq(User::TABLE.'.is_active', 1) + ->table(ProjectGroupRoleModel::TABLE) + ->columns(UserModel::TABLE.'.id', UserModel::TABLE.'.username', UserModel::TABLE.'.name', UserModel::TABLE.'.email', UserModel::TABLE.'.language', UserModel::TABLE.'.notifications_filter') + ->join(GroupMemberModel::TABLE, 'group_id', 'group_id', ProjectGroupRoleModel::TABLE) + ->join(UserModel::TABLE, 'id', 'user_id', GroupMemberModel::TABLE) + ->eq(ProjectGroupRoleModel::TABLE.'.project_id', $project_id) + ->eq(UserModel::TABLE.'.notifications_enabled', '1') + ->neq(UserModel::TABLE.'.id', $exclude_user_id) + ->eq(UserModel::TABLE.'.is_active', 1) ->findAll(); } @@ -194,11 +194,11 @@ class UserNotification extends Base private function getEverybodyWithNotificationEnabled($exclude_user_id) { return $this->db - ->table(User::TABLE) - ->columns(User::TABLE.'.id', User::TABLE.'.username', User::TABLE.'.name', User::TABLE.'.email', User::TABLE.'.language', User::TABLE.'.notifications_filter') + ->table(UserModel::TABLE) + ->columns(UserModel::TABLE.'.id', UserModel::TABLE.'.username', UserModel::TABLE.'.name', UserModel::TABLE.'.email', UserModel::TABLE.'.language', UserModel::TABLE.'.notifications_filter') ->eq('notifications_enabled', '1') - ->neq(User::TABLE.'.id', $exclude_user_id) - ->eq(User::TABLE.'.is_active', 1) + ->neq(UserModel::TABLE.'.id', $exclude_user_id) + ->eq(UserModel::TABLE.'.is_active', 1) ->findAll(); } } diff --git a/app/Model/UserNotificationType.php b/app/Model/UserNotificationTypeModel.php index d84cc690..0f377220 100644 --- a/app/Model/UserNotificationType.php +++ b/app/Model/UserNotificationTypeModel.php @@ -2,15 +2,13 @@ namespace Kanboard\Model; -use Kanboard\Core\Base; - /** * User Notification Type * - * @package model + * @package Kanboard\Model * @author Frederic Guillot */ -class UserNotificationType extends NotificationType +class UserNotificationTypeModel extends NotificationTypeModel { /** * SQL table name diff --git a/app/Model/UserUnreadNotification.php b/app/Model/UserUnreadNotificationModel.php index f3fcd601..6c930eef 100644 --- a/app/Model/UserUnreadNotification.php +++ b/app/Model/UserUnreadNotificationModel.php @@ -7,10 +7,10 @@ use Kanboard\Core\Base; /** * User Unread Notification * - * @package model + * @package Kanboard\Model * @author Frederic Guillot */ -class UserUnreadNotification extends Base +class UserUnreadNotificationModel extends Base { /** * SQL table name @@ -112,6 +112,6 @@ class UserUnreadNotification extends Base private function unserialize(&$event) { $event['event_data'] = json_decode($event['event_data'], true); - $event['title'] = $this->notification->getTitleWithoutAuthor($event['event_name'], $event['event_data']); + $event['title'] = $this->notificationModel->getTitleWithoutAuthor($event['event_name'], $event['event_data']); } } diff --git a/app/Notification/ActivityStreamNotification.php b/app/Notification/ActivityStreamNotification.php index 8ac265d3..9f23c88a 100644 --- a/app/Notification/ActivityStreamNotification.php +++ b/app/Notification/ActivityStreamNotification.php @@ -36,7 +36,7 @@ class ActivityStreamNotification extends Base implements NotificationInterface public function notifyProject(array $project, $event_name, array $event_data) { if ($this->userSession->isLogged()) { - $this->projectActivity->createEvent( + $this->projectActivityModel->createEvent( $project['id'], $event_data['task']['id'], $this->userSession->getId(), diff --git a/app/Notification/MailNotification.php b/app/Notification/MailNotification.php index 0ba06715..2d27179c 100644 --- a/app/Notification/MailNotification.php +++ b/app/Notification/MailNotification.php @@ -4,10 +4,10 @@ namespace Kanboard\Notification; use Kanboard\Core\Base; use Kanboard\Core\Notification\NotificationInterface; -use Kanboard\Model\Task; -use Kanboard\Model\TaskFile; -use Kanboard\Model\Comment; -use Kanboard\Model\Subtask; +use Kanboard\Model\TaskModel; +use Kanboard\Model\TaskFileModel; +use Kanboard\Model\CommentModel; +use Kanboard\Model\SubtaskModel; /** * Email Notification @@ -68,7 +68,7 @@ class MailNotification extends Base implements NotificationInterface { return $this->template->render( 'notification/'.str_replace('.', '_', $event_name), - $event_data + array('application_url' => $this->config->get('application_url')) + $event_data + array('application_url' => $this->configModel->get('application_url')) ); } @@ -83,50 +83,50 @@ class MailNotification extends Base implements NotificationInterface public function getMailSubject($event_name, array $event_data) { switch ($event_name) { - case TaskFile::EVENT_CREATE: + case TaskFileModel::EVENT_CREATE: $subject = $this->getStandardMailSubject(e('New attachment'), $event_data); break; - case Comment::EVENT_CREATE: + case CommentModel::EVENT_CREATE: $subject = $this->getStandardMailSubject(e('New comment'), $event_data); break; - case Comment::EVENT_UPDATE: + case CommentModel::EVENT_UPDATE: $subject = $this->getStandardMailSubject(e('Comment updated'), $event_data); break; - case Subtask::EVENT_CREATE: + case SubtaskModel::EVENT_CREATE: $subject = $this->getStandardMailSubject(e('New subtask'), $event_data); break; - case Subtask::EVENT_UPDATE: + case SubtaskModel::EVENT_UPDATE: $subject = $this->getStandardMailSubject(e('Subtask updated'), $event_data); break; - case Task::EVENT_CREATE: + case TaskModel::EVENT_CREATE: $subject = $this->getStandardMailSubject(e('New task'), $event_data); break; - case Task::EVENT_UPDATE: + case TaskModel::EVENT_UPDATE: $subject = $this->getStandardMailSubject(e('Task updated'), $event_data); break; - case Task::EVENT_CLOSE: + case TaskModel::EVENT_CLOSE: $subject = $this->getStandardMailSubject(e('Task closed'), $event_data); break; - case Task::EVENT_OPEN: + case TaskModel::EVENT_OPEN: $subject = $this->getStandardMailSubject(e('Task opened'), $event_data); break; - case Task::EVENT_MOVE_COLUMN: + case TaskModel::EVENT_MOVE_COLUMN: $subject = $this->getStandardMailSubject(e('Column change'), $event_data); break; - case Task::EVENT_MOVE_POSITION: + case TaskModel::EVENT_MOVE_POSITION: $subject = $this->getStandardMailSubject(e('Position change'), $event_data); break; - case Task::EVENT_MOVE_SWIMLANE: + case TaskModel::EVENT_MOVE_SWIMLANE: $subject = $this->getStandardMailSubject(e('Swimlane change'), $event_data); break; - case Task::EVENT_ASSIGNEE_CHANGE: + case TaskModel::EVENT_ASSIGNEE_CHANGE: $subject = $this->getStandardMailSubject(e('Assignee change'), $event_data); break; - case Task::EVENT_USER_MENTION: - case Comment::EVENT_USER_MENTION: + case TaskModel::EVENT_USER_MENTION: + case CommentModel::EVENT_USER_MENTION: $subject = $this->getStandardMailSubject(e('Mentioned'), $event_data); break; - case Task::EVENT_OVERDUE: + case TaskModel::EVENT_OVERDUE: $subject = e('[%s] Overdue tasks', $event_data['project_name']); break; default: diff --git a/app/Notification/WebNotification.php b/app/Notification/WebNotification.php index 99c0c903..d8818828 100644 --- a/app/Notification/WebNotification.php +++ b/app/Notification/WebNotification.php @@ -30,7 +30,7 @@ class WebNotification extends Base implements NotificationInterface */ public function notifyUser(array $user, $event_name, array $event_data) { - $this->userUnreadNotification->create($user['id'], $event_name, $event_data); + $this->userUnreadNotificationModel->create($user['id'], $event_name, $event_data); } /** diff --git a/app/Notification/WebhookNotification.php b/app/Notification/WebhookNotification.php index 25d59251..16045535 100644 --- a/app/Notification/WebhookNotification.php +++ b/app/Notification/WebhookNotification.php @@ -35,8 +35,8 @@ class WebhookNotification extends Base implements NotificationInterface */ public function notifyProject(array $project, $event_name, array $event_data) { - $url = $this->config->get('webhook_url'); - $token = $this->config->get('webhook_token'); + $url = $this->configModel->get('webhook_url'); + $token = $this->configModel->get('webhook_token'); if (! empty($url)) { if (strpos($url, '?') !== false) { diff --git a/app/ServiceProvider/ClassProvider.php b/app/ServiceProvider/ClassProvider.php index aa0f1111..3e6efb02 100644 --- a/app/ServiceProvider/ClassProvider.php +++ b/app/ServiceProvider/ClassProvider.php @@ -27,60 +27,60 @@ class ClassProvider implements ServiceProviderInterface 'AverageTimeSpentColumnAnalytic', ), 'Model' => array( - 'Action', - 'ActionParameter', - 'AvatarFile', - 'Board', - 'Category', - 'Color', - 'Column', - 'Comment', - 'Config', - 'Currency', - 'CustomFilter', - 'Group', - 'GroupMember', - 'Language', - 'LastLogin', - 'Link', - 'Notification', - 'PasswordReset', - 'Project', - 'ProjectFile', - 'ProjectActivity', - 'ProjectDuplication', - 'ProjectDailyColumnStats', - 'ProjectDailyStats', - 'ProjectPermission', - 'ProjectNotification', - 'ProjectMetadata', - 'ProjectGroupRole', - 'ProjectUserRole', - 'RememberMeSession', - 'Subtask', - 'SubtaskTimeTracking', - 'Swimlane', - 'Task', - 'TaskAnalytic', - 'TaskCreation', - 'TaskDuplication', - 'TaskExternalLink', - 'TaskFinder', - 'TaskFile', - 'TaskLink', - 'TaskModification', - 'TaskPosition', - 'TaskStatus', - 'TaskMetadata', - 'Timezone', - 'Transition', - 'User', - 'UserLocking', - 'UserMention', - 'UserNotification', - 'UserNotificationFilter', - 'UserUnreadNotification', - 'UserMetadata', + 'ActionModel', + 'ActionParameterModel', + 'AvatarFileModel', + 'BoardModel', + 'CategoryModel', + 'ColorModel', + 'ColumnModel', + 'CommentModel', + 'ConfigModel', + 'CurrencyModel', + 'CustomFilterModel', + 'GroupModel', + 'GroupMemberModel', + 'LanguageModel', + 'LastLoginModel', + 'LinkModel', + 'NotificationModel', + 'PasswordResetModel', + 'ProjectModel', + 'ProjectFileModel', + 'ProjectActivityModel', + 'ProjectDuplicationModel', + 'ProjectDailyColumnStatsModel', + 'ProjectDailyStatsModel', + 'ProjectPermissionModel', + 'ProjectNotificationModel', + 'ProjectMetadataModel', + 'ProjectGroupRoleModel', + 'ProjectUserRoleModel', + 'RememberMeSessionModel', + 'SubtaskModel', + 'SubtaskTimeTrackingModel', + 'SwimlaneModel', + 'TaskModel', + 'TaskAnalyticModel', + 'TaskCreationModel', + 'TaskDuplicationModel', + 'TaskExternalLinkModel', + 'TaskFinderModel', + 'TaskFileModel', + 'TaskLinkModel', + 'TaskModificationModel', + 'TaskPositionModel', + 'TaskStatusModel', + 'TaskMetadataModel', + 'TimezoneModel', + 'TransitionModel', + 'UserModel', + 'UserLockingModel', + 'UserMentionModel', + 'UserNotificationModel', + 'UserNotificationFilterModel', + 'UserUnreadNotificationModel', + 'UserMetadataModel', ), 'Validator' => array( 'ActionValidator', diff --git a/app/ServiceProvider/FilterProvider.php b/app/ServiceProvider/FilterProvider.php index b79c5185..cdef9ed8 100644 --- a/app/ServiceProvider/FilterProvider.php +++ b/app/ServiceProvider/FilterProvider.php @@ -27,10 +27,10 @@ use Kanboard\Filter\TaskStatusFilter; use Kanboard\Filter\TaskSubtaskAssigneeFilter; use Kanboard\Filter\TaskSwimlaneFilter; use Kanboard\Filter\TaskTitleFilter; -use Kanboard\Model\Project; -use Kanboard\Model\ProjectGroupRole; -use Kanboard\Model\ProjectUserRole; -use Kanboard\Model\User; +use Kanboard\Model\ProjectModel; +use Kanboard\Model\ProjectGroupRoleModel; +use Kanboard\Model\ProjectUserRoleModel; +use Kanboard\Model\UserModel; use Pimple\Container; use Pimple\ServiceProviderInterface; @@ -61,7 +61,7 @@ class FilterProvider implements ServiceProviderInterface { $container['userQuery'] = $container->factory(function ($c) { $builder = new QueryBuilder(); - $builder->withQuery($c['db']->table(User::TABLE)); + $builder->withQuery($c['db']->table(UserModel::TABLE)); return $builder; }); @@ -72,26 +72,26 @@ class FilterProvider implements ServiceProviderInterface { $container['projectGroupRoleQuery'] = $container->factory(function ($c) { $builder = new QueryBuilder(); - $builder->withQuery($c['db']->table(ProjectGroupRole::TABLE)); + $builder->withQuery($c['db']->table(ProjectGroupRoleModel::TABLE)); return $builder; }); $container['projectUserRoleQuery'] = $container->factory(function ($c) { $builder = new QueryBuilder(); - $builder->withQuery($c['db']->table(ProjectUserRole::TABLE)); + $builder->withQuery($c['db']->table(ProjectUserRoleModel::TABLE)); return $builder; }); $container['projectQuery'] = $container->factory(function ($c) { $builder = new QueryBuilder(); - $builder->withQuery($c['db']->table(Project::TABLE)); + $builder->withQuery($c['db']->table(ProjectModel::TABLE)); return $builder; }); $container['projectActivityLexer'] = $container->factory(function ($c) { $builder = new LexerBuilder(); $builder - ->withQuery($c['projectActivity']->getQuery()) + ->withQuery($c['projectActivityModel']->getQuery()) ->withFilter(new ProjectActivityTaskTitleFilter(), true) ->withFilter(new ProjectActivityTaskStatusFilter()) ->withFilter(new ProjectActivityProjectNameFilter()) @@ -108,7 +108,7 @@ class FilterProvider implements ServiceProviderInterface $container['projectActivityQuery'] = $container->factory(function ($c) { $builder = new QueryBuilder(); - $builder->withQuery($c['projectActivity']->getQuery()); + $builder->withQuery($c['projectActivityModel']->getQuery()); return $builder; }); @@ -120,7 +120,7 @@ class FilterProvider implements ServiceProviderInterface { $container['taskQuery'] = $container->factory(function ($c) { $builder = new QueryBuilder(); - $builder->withQuery($c['taskFinder']->getExtendedQuery()); + $builder->withQuery($c['taskFinderModel']->getExtendedQuery()); return $builder; }); @@ -128,13 +128,13 @@ class FilterProvider implements ServiceProviderInterface $builder = new LexerBuilder(); $builder - ->withQuery($c['taskFinder']->getExtendedQuery()) + ->withQuery($c['taskFinderModel']->getExtendedQuery()) ->withFilter(TaskAssigneeFilter::getInstance() ->setCurrentUserId($c['userSession']->getId()) ) ->withFilter(new TaskCategoryFilter()) ->withFilter(TaskColorFilter::getInstance() - ->setColorModel($c['color']) + ->setColorModel($c['colorModel']) ) ->withFilter(new TaskColumnFilter()) ->withFilter(new TaskCommentFilter()) diff --git a/app/ServiceProvider/NotificationProvider.php b/app/ServiceProvider/NotificationProvider.php index 2cb01576..a0571209 100644 --- a/app/ServiceProvider/NotificationProvider.php +++ b/app/ServiceProvider/NotificationProvider.php @@ -4,8 +4,8 @@ namespace Kanboard\ServiceProvider; use Pimple\Container; use Pimple\ServiceProviderInterface; -use Kanboard\Model\UserNotificationType; -use Kanboard\Model\ProjectNotificationType; +use Kanboard\Model\UserNotificationTypeModel; +use Kanboard\Model\ProjectNotificationTypeModel; use Kanboard\Notification\MailNotification as MailNotification; use Kanboard\Notification\WebNotification as WebNotification; @@ -26,15 +26,15 @@ class NotificationProvider implements ServiceProviderInterface */ public function register(Container $container) { - $container['userNotificationType'] = function ($container) { - $type = new UserNotificationType($container); + $container['userNotificationTypeModel'] = function ($container) { + $type = new UserNotificationTypeModel($container); $type->setType(MailNotification::TYPE, t('Email'), '\Kanboard\Notification\MailNotification'); $type->setType(WebNotification::TYPE, t('Web'), '\Kanboard\Notification\WebNotification'); return $type; }; - $container['projectNotificationType'] = function ($container) { - $type = new ProjectNotificationType($container); + $container['projectNotificationTypeModel'] = function ($container) { + $type = new ProjectNotificationTypeModel($container); $type->setType('webhook', 'Webhook', '\Kanboard\Notification\WebhookNotification', true); $type->setType('activity_stream', 'ActivityStream', '\Kanboard\Notification\ActivityStreamNotification', true); return $type; diff --git a/app/Subscriber/AuthSubscriber.php b/app/Subscriber/AuthSubscriber.php index dfb95a00..0097c407 100644 --- a/app/Subscriber/AuthSubscriber.php +++ b/app/Subscriber/AuthSubscriber.php @@ -45,9 +45,9 @@ class AuthSubscriber extends BaseSubscriber implements EventSubscriberInterface $userAgent = $this->request->getUserAgent(); $ipAddress = $this->request->getIpAddress(); - $this->userLocking->resetFailedLogin($this->userSession->getUsername()); + $this->userLockingModel->resetFailedLogin($this->userSession->getUsername()); - $this->lastLogin->create( + $this->lastLoginModel->create( $event->getAuthType(), $this->userSession->getId(), $ipAddress, @@ -59,7 +59,7 @@ class AuthSubscriber extends BaseSubscriber implements EventSubscriberInterface } if (isset($this->sessionStorage->hasRememberMe) && $this->sessionStorage->hasRememberMe) { - $session = $this->rememberMeSession->create($this->userSession->getId(), $ipAddress, $userAgent); + $session = $this->rememberMeSessionModel->create($this->userSession->getId(), $ipAddress, $userAgent); $this->rememberMeCookie->write($session['token'], $session['sequence'], $session['expiration']); } } @@ -75,10 +75,10 @@ class AuthSubscriber extends BaseSubscriber implements EventSubscriberInterface $credentials = $this->rememberMeCookie->read(); if ($credentials !== false) { - $session = $this->rememberMeSession->find($credentials['token'], $credentials['sequence']); + $session = $this->rememberMeSessionModel->find($credentials['token'], $credentials['sequence']); if (! empty($session)) { - $this->rememberMeSession->remove($session['id']); + $this->rememberMeSessionModel->remove($session['id']); } $this->rememberMeCookie->remove(); @@ -97,10 +97,10 @@ class AuthSubscriber extends BaseSubscriber implements EventSubscriberInterface $username = $event->getUsername(); if (! empty($username)) { - $this->userLocking->incrementFailedLogin($username); + $this->userLockingModel->incrementFailedLogin($username); - if ($this->userLocking->getFailedLogin($username) > BRUTEFORCE_LOCKDOWN) { - $this->userLocking->lock($username, BRUTEFORCE_LOCKDOWN_DURATION); + if ($this->userLockingModel->getFailedLogin($username) > BRUTEFORCE_LOCKDOWN) { + $this->userLockingModel->lock($username, BRUTEFORCE_LOCKDOWN_DURATION); } } } diff --git a/app/Subscriber/BootstrapSubscriber.php b/app/Subscriber/BootstrapSubscriber.php index e60840f1..7d12e9ae 100644 --- a/app/Subscriber/BootstrapSubscriber.php +++ b/app/Subscriber/BootstrapSubscriber.php @@ -16,12 +16,12 @@ class BootstrapSubscriber extends BaseSubscriber implements EventSubscriberInter public function execute() { $this->logger->debug('Subscriber executed: '.__METHOD__); - $this->language->loadCurrentLanguage(); - $this->timezone->setCurrentTimezone(); + $this->languageModel->loadCurrentLanguage(); + $this->timezoneModel->setCurrentTimezone(); $this->actionManager->attachEvents(); if ($this->userSession->isLogged()) { - $this->sessionStorage->hasSubtaskInProgress = $this->subtask->hasSubtaskInProgress($this->userSession->getId()); + $this->sessionStorage->hasSubtaskInProgress = $this->subtaskModel->hasSubtaskInProgress($this->userSession->getId()); } } diff --git a/app/Subscriber/LdapUserPhotoSubscriber.php b/app/Subscriber/LdapUserPhotoSubscriber.php index 3cf46077..93672cd1 100644 --- a/app/Subscriber/LdapUserPhotoSubscriber.php +++ b/app/Subscriber/LdapUserPhotoSubscriber.php @@ -42,7 +42,7 @@ class LdapUserPhotoSubscriber extends BaseSubscriber implements EventSubscriberI if (empty($profile['avatar_path']) && ! empty($photo)) { $this->logger->info('Saving user photo from LDAP profile'); - $this->avatarFile->uploadImageContent($profile['id'], $photo); + $this->avatarFileModel->uploadImageContent($profile['id'], $photo); } } } diff --git a/app/Subscriber/NotificationSubscriber.php b/app/Subscriber/NotificationSubscriber.php index 2a1fe6c7..db11e585 100644 --- a/app/Subscriber/NotificationSubscriber.php +++ b/app/Subscriber/NotificationSubscriber.php @@ -4,10 +4,10 @@ namespace Kanboard\Subscriber; use Kanboard\Event\GenericEvent; use Kanboard\Job\NotificationJob; -use Kanboard\Model\Task; -use Kanboard\Model\Comment; -use Kanboard\Model\Subtask; -use Kanboard\Model\TaskFile; +use Kanboard\Model\TaskModel; +use Kanboard\Model\CommentModel; +use Kanboard\Model\SubtaskModel; +use Kanboard\Model\TaskFileModel; use Symfony\Component\EventDispatcher\EventSubscriberInterface; class NotificationSubscriber extends BaseSubscriber implements EventSubscriberInterface @@ -15,21 +15,21 @@ class NotificationSubscriber extends BaseSubscriber implements EventSubscriberIn public static function getSubscribedEvents() { return array( - Task::EVENT_USER_MENTION => 'handleEvent', - Task::EVENT_CREATE => 'handleEvent', - Task::EVENT_UPDATE => 'handleEvent', - Task::EVENT_CLOSE => 'handleEvent', - Task::EVENT_OPEN => 'handleEvent', - Task::EVENT_MOVE_COLUMN => 'handleEvent', - Task::EVENT_MOVE_POSITION => 'handleEvent', - Task::EVENT_MOVE_SWIMLANE => 'handleEvent', - Task::EVENT_ASSIGNEE_CHANGE => 'handleEvent', - Subtask::EVENT_CREATE => 'handleEvent', - Subtask::EVENT_UPDATE => 'handleEvent', - Comment::EVENT_CREATE => 'handleEvent', - Comment::EVENT_UPDATE => 'handleEvent', - Comment::EVENT_USER_MENTION => 'handleEvent', - TaskFile::EVENT_CREATE => 'handleEvent', + TaskModel::EVENT_USER_MENTION => 'handleEvent', + TaskModel::EVENT_CREATE => 'handleEvent', + TaskModel::EVENT_UPDATE => 'handleEvent', + TaskModel::EVENT_CLOSE => 'handleEvent', + TaskModel::EVENT_OPEN => 'handleEvent', + TaskModel::EVENT_MOVE_COLUMN => 'handleEvent', + TaskModel::EVENT_MOVE_POSITION => 'handleEvent', + TaskModel::EVENT_MOVE_SWIMLANE => 'handleEvent', + TaskModel::EVENT_ASSIGNEE_CHANGE => 'handleEvent', + SubtaskModel::EVENT_CREATE => 'handleEvent', + SubtaskModel::EVENT_UPDATE => 'handleEvent', + CommentModel::EVENT_CREATE => 'handleEvent', + CommentModel::EVENT_UPDATE => 'handleEvent', + CommentModel::EVENT_USER_MENTION => 'handleEvent', + TaskFileModel::EVENT_CREATE => 'handleEvent', ); } diff --git a/app/Subscriber/ProjectDailySummarySubscriber.php b/app/Subscriber/ProjectDailySummarySubscriber.php index 982240c1..6971a121 100644 --- a/app/Subscriber/ProjectDailySummarySubscriber.php +++ b/app/Subscriber/ProjectDailySummarySubscriber.php @@ -4,7 +4,7 @@ namespace Kanboard\Subscriber; use Kanboard\Event\TaskEvent; use Kanboard\Job\ProjectMetricJob; -use Kanboard\Model\Task; +use Kanboard\Model\TaskModel; use Symfony\Component\EventDispatcher\EventSubscriberInterface; class ProjectDailySummarySubscriber extends BaseSubscriber implements EventSubscriberInterface @@ -12,11 +12,11 @@ class ProjectDailySummarySubscriber extends BaseSubscriber implements EventSubsc public static function getSubscribedEvents() { return array( - Task::EVENT_CREATE_UPDATE => 'execute', - Task::EVENT_CLOSE => 'execute', - Task::EVENT_OPEN => 'execute', - Task::EVENT_MOVE_COLUMN => 'execute', - Task::EVENT_MOVE_SWIMLANE => 'execute', + TaskModel::EVENT_CREATE_UPDATE => 'execute', + TaskModel::EVENT_CLOSE => 'execute', + TaskModel::EVENT_OPEN => 'execute', + TaskModel::EVENT_MOVE_COLUMN => 'execute', + TaskModel::EVENT_MOVE_SWIMLANE => 'execute', ); } diff --git a/app/Subscriber/ProjectModificationDateSubscriber.php b/app/Subscriber/ProjectModificationDateSubscriber.php index 62804a84..fee04eaa 100644 --- a/app/Subscriber/ProjectModificationDateSubscriber.php +++ b/app/Subscriber/ProjectModificationDateSubscriber.php @@ -3,7 +3,7 @@ namespace Kanboard\Subscriber; use Kanboard\Event\GenericEvent; -use Kanboard\Model\Task; +use Kanboard\Model\TaskModel; use Symfony\Component\EventDispatcher\EventSubscriberInterface; class ProjectModificationDateSubscriber extends BaseSubscriber implements EventSubscriberInterface @@ -11,14 +11,14 @@ class ProjectModificationDateSubscriber extends BaseSubscriber implements EventS public static function getSubscribedEvents() { return array( - Task::EVENT_CREATE_UPDATE => 'execute', - Task::EVENT_CLOSE => 'execute', - Task::EVENT_OPEN => 'execute', - Task::EVENT_MOVE_SWIMLANE => 'execute', - Task::EVENT_MOVE_COLUMN => 'execute', - Task::EVENT_MOVE_POSITION => 'execute', - Task::EVENT_MOVE_PROJECT => 'execute', - Task::EVENT_ASSIGNEE_CHANGE => 'execute', + TaskModel::EVENT_CREATE_UPDATE => 'execute', + TaskModel::EVENT_CLOSE => 'execute', + TaskModel::EVENT_OPEN => 'execute', + TaskModel::EVENT_MOVE_SWIMLANE => 'execute', + TaskModel::EVENT_MOVE_COLUMN => 'execute', + TaskModel::EVENT_MOVE_POSITION => 'execute', + TaskModel::EVENT_MOVE_PROJECT => 'execute', + TaskModel::EVENT_ASSIGNEE_CHANGE => 'execute', ); } @@ -26,7 +26,7 @@ class ProjectModificationDateSubscriber extends BaseSubscriber implements EventS { if (isset($event['project_id']) && !$this->isExecuted()) { $this->logger->debug('Subscriber executed: '.__METHOD__); - $this->project->updateModificationDate($event['project_id']); + $this->projectModel->updateModificationDate($event['project_id']); } } } diff --git a/app/Subscriber/RecurringTaskSubscriber.php b/app/Subscriber/RecurringTaskSubscriber.php index 09a5665a..75b7ff76 100644 --- a/app/Subscriber/RecurringTaskSubscriber.php +++ b/app/Subscriber/RecurringTaskSubscriber.php @@ -3,7 +3,7 @@ namespace Kanboard\Subscriber; use Kanboard\Event\TaskEvent; -use Kanboard\Model\Task; +use Kanboard\Model\TaskModel; use Symfony\Component\EventDispatcher\EventSubscriberInterface; class RecurringTaskSubscriber extends BaseSubscriber implements EventSubscriberInterface @@ -11,8 +11,8 @@ class RecurringTaskSubscriber extends BaseSubscriber implements EventSubscriberI public static function getSubscribedEvents() { return array( - Task::EVENT_MOVE_COLUMN => 'onMove', - Task::EVENT_CLOSE => 'onClose', + TaskModel::EVENT_MOVE_COLUMN => 'onMove', + TaskModel::EVENT_CLOSE => 'onClose', ); } @@ -20,11 +20,11 @@ class RecurringTaskSubscriber extends BaseSubscriber implements EventSubscriberI { $this->logger->debug('Subscriber executed: '.__METHOD__); - if ($event['recurrence_status'] == Task::RECURRING_STATUS_PENDING) { - if ($event['recurrence_trigger'] == Task::RECURRING_TRIGGER_FIRST_COLUMN && $this->column->getFirstColumnId($event['project_id']) == $event['src_column_id']) { - $this->taskDuplication->duplicateRecurringTask($event['task_id']); - } elseif ($event['recurrence_trigger'] == Task::RECURRING_TRIGGER_LAST_COLUMN && $this->column->getLastColumnId($event['project_id']) == $event['dst_column_id']) { - $this->taskDuplication->duplicateRecurringTask($event['task_id']); + if ($event['recurrence_status'] == TaskModel::RECURRING_STATUS_PENDING) { + if ($event['recurrence_trigger'] == TaskModel::RECURRING_TRIGGER_FIRST_COLUMN && $this->columnModel->getFirstColumnId($event['project_id']) == $event['src_column_id']) { + $this->taskDuplicationModel->duplicateRecurringTask($event['task_id']); + } elseif ($event['recurrence_trigger'] == TaskModel::RECURRING_TRIGGER_LAST_COLUMN && $this->columnModel->getLastColumnId($event['project_id']) == $event['dst_column_id']) { + $this->taskDuplicationModel->duplicateRecurringTask($event['task_id']); } } } @@ -33,8 +33,8 @@ class RecurringTaskSubscriber extends BaseSubscriber implements EventSubscriberI { $this->logger->debug('Subscriber executed: '.__METHOD__); - if ($event['recurrence_status'] == Task::RECURRING_STATUS_PENDING && $event['recurrence_trigger'] == Task::RECURRING_TRIGGER_CLOSE) { - $this->taskDuplication->duplicateRecurringTask($event['task_id']); + if ($event['recurrence_status'] == TaskModel::RECURRING_STATUS_PENDING && $event['recurrence_trigger'] == TaskModel::RECURRING_TRIGGER_CLOSE) { + $this->taskDuplicationModel->duplicateRecurringTask($event['task_id']); } } } diff --git a/app/Subscriber/SubtaskTimeTrackingSubscriber.php b/app/Subscriber/SubtaskTimeTrackingSubscriber.php index c0852bc8..7e39c126 100644 --- a/app/Subscriber/SubtaskTimeTrackingSubscriber.php +++ b/app/Subscriber/SubtaskTimeTrackingSubscriber.php @@ -3,7 +3,7 @@ namespace Kanboard\Subscriber; use Symfony\Component\EventDispatcher\EventSubscriberInterface; -use Kanboard\Model\Subtask; +use Kanboard\Model\SubtaskModel; use Kanboard\Event\SubtaskEvent; class SubtaskTimeTrackingSubscriber extends BaseSubscriber implements EventSubscriberInterface @@ -11,9 +11,9 @@ class SubtaskTimeTrackingSubscriber extends BaseSubscriber implements EventSubsc public static function getSubscribedEvents() { return array( - Subtask::EVENT_CREATE => 'updateTaskTime', - Subtask::EVENT_DELETE => 'updateTaskTime', - Subtask::EVENT_UPDATE => array( + SubtaskModel::EVENT_CREATE => 'updateTaskTime', + SubtaskModel::EVENT_DELETE => 'updateTaskTime', + SubtaskModel::EVENT_UPDATE => array( array('logStartEnd', 10), array('updateTaskTime', 0), ) @@ -24,24 +24,24 @@ class SubtaskTimeTrackingSubscriber extends BaseSubscriber implements EventSubsc { if (isset($event['task_id'])) { $this->logger->debug('Subscriber executed: '.__METHOD__); - $this->subtaskTimeTracking->updateTaskTimeTracking($event['task_id']); + $this->subtaskTimeTrackingModel->updateTaskTimeTracking($event['task_id']); } } public function logStartEnd(SubtaskEvent $event) { - if (isset($event['status']) && $this->config->get('subtask_time_tracking') == 1) { + if (isset($event['status']) && $this->configModel->get('subtask_time_tracking') == 1) { $this->logger->debug('Subscriber executed: '.__METHOD__); - $subtask = $this->subtask->getById($event['id']); + $subtask = $this->subtaskModel->getById($event['id']); if (empty($subtask['user_id'])) { return false; } - if ($subtask['status'] == Subtask::STATUS_INPROGRESS) { - return $this->subtaskTimeTracking->logStartTime($subtask['id'], $subtask['user_id']); + if ($subtask['status'] == SubtaskModel::STATUS_INPROGRESS) { + return $this->subtaskTimeTrackingModel->logStartTime($subtask['id'], $subtask['user_id']); } else { - return $this->subtaskTimeTracking->logEndTime($subtask['id'], $subtask['user_id']); + return $this->subtaskTimeTrackingModel->logEndTime($subtask['id'], $subtask['user_id']); } } } diff --git a/app/Subscriber/TransitionSubscriber.php b/app/Subscriber/TransitionSubscriber.php index bd537484..26d08f88 100644 --- a/app/Subscriber/TransitionSubscriber.php +++ b/app/Subscriber/TransitionSubscriber.php @@ -3,7 +3,7 @@ namespace Kanboard\Subscriber; use Kanboard\Event\TaskEvent; -use Kanboard\Model\Task; +use Kanboard\Model\TaskModel; use Symfony\Component\EventDispatcher\EventSubscriberInterface; class TransitionSubscriber extends BaseSubscriber implements EventSubscriberInterface @@ -11,7 +11,7 @@ class TransitionSubscriber extends BaseSubscriber implements EventSubscriberInte public static function getSubscribedEvents() { return array( - Task::EVENT_MOVE_COLUMN => 'execute', + TaskModel::EVENT_MOVE_COLUMN => 'execute', ); } @@ -22,7 +22,7 @@ class TransitionSubscriber extends BaseSubscriber implements EventSubscriberInte $user_id = $this->userSession->getId(); if (! empty($user_id)) { - $this->transition->save($user_id, $event->getAll()); + $this->transitionModel->save($user_id, $event->getAll()); } } } diff --git a/app/Template/analytic/compare_hours.php b/app/Template/analytic/compare_hours.php index 03a2981a..70d8d02b 100644 --- a/app/Template/analytic/compare_hours.php +++ b/app/Template/analytic/compare_hours.php @@ -40,7 +40,7 @@ <?= $this->url->link($this->text->e($task['title']), 'TaskViewController', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, '', t('View this task')) ?> </td> <td> - <?php if ($task['is_active'] == \Kanboard\Model\Task::STATUS_OPEN): ?> + <?php if ($task['is_active'] == \Kanboard\Model\TaskModel::STATUS_OPEN): ?> <?= t('Open') ?> <?php else: ?> <?= t('Closed') ?> diff --git a/app/Template/board/task_footer.php b/app/Template/board/task_footer.php index 8cf3e709..11df8962 100644 --- a/app/Template/board/task_footer.php +++ b/app/Template/board/task_footer.php @@ -33,11 +33,11 @@ </span> <?php endif ?> - <?php if ($task['recurrence_status'] == \Kanboard\Model\Task::RECURRING_STATUS_PENDING): ?> + <?php if ($task['recurrence_status'] == \Kanboard\Model\TaskModel::RECURRING_STATUS_PENDING): ?> <span title="<?= t('Recurrence') ?>" class="tooltip" data-href="<?= $this->url->href('BoardTooltipController', 'recurrence', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?>"><i class="fa fa-refresh fa-rotate-90"></i></span> <?php endif ?> - <?php if ($task['recurrence_status'] == \Kanboard\Model\Task::RECURRING_STATUS_PROCESSED): ?> + <?php if ($task['recurrence_status'] == \Kanboard\Model\TaskModel::RECURRING_STATUS_PROCESSED): ?> <span title="<?= t('Recurrence') ?>" class="tooltip" data-href="<?= $this->url->href('BoardTooltipController', 'recurrence', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?>"><i class="fa fa-refresh fa-rotate-90 fa-inverse"></i></span> <?php endif ?> diff --git a/app/Template/dashboard/projects.php b/app/Template/dashboard/projects.php index 4aa40621..5bf92980 100644 --- a/app/Template/dashboard/projects.php +++ b/app/Template/dashboard/projects.php @@ -8,7 +8,7 @@ <tr> <th class="column-5"><?= $paginator->order('Id', 'id') ?></th> <th class="column-3"><?= $paginator->order('<i class="fa fa-lock fa-fw" title="'.t('Private project').'"></i>', 'is_private') ?></th> - <th class="column-25"><?= $paginator->order(t('Project'), \Kanboard\Model\Project::TABLE.'.name') ?></th> + <th class="column-25"><?= $paginator->order(t('Project'), \Kanboard\Model\ProjectModel::TABLE.'.name') ?></th> <th><?= t('Columns') ?></th> </tr> <?php foreach ($paginator->getCollection() as $project): ?> diff --git a/app/Template/project_creation/create.php b/app/Template/project_creation/create.php index fb892012..01d06bab 100644 --- a/app/Template/project_creation/create.php +++ b/app/Template/project_creation/create.php @@ -22,10 +22,10 @@ <?= $this->form->checkbox('projectPermission', t('Permissions'), 1, true) ?> <?php endif ?> - <?= $this->form->checkbox('category', t('Categories'), 1, true) ?> - <?= $this->form->checkbox('action', t('Actions'), 1, true) ?> - <?= $this->form->checkbox('swimlane', t('Swimlanes'), 1, true) ?> - <?= $this->form->checkbox('task', t('Tasks'), 1, false) ?> + <?= $this->form->checkbox('categoryModel', t('Categories'), 1, true) ?> + <?= $this->form->checkbox('actionModel', t('Actions'), 1, true) ?> + <?= $this->form->checkbox('swimlaneModel', t('Swimlanes'), 1, true) ?> + <?= $this->form->checkbox('taskModel', t('Tasks'), 1, false) ?> </div> <div class="form-actions"> diff --git a/app/Template/project_view/duplicate.php b/app/Template/project_view/duplicate.php index 41ae39df..d2cd127a 100644 --- a/app/Template/project_view/duplicate.php +++ b/app/Template/project_view/duplicate.php @@ -14,11 +14,11 @@ <?= $this->form->checkbox('projectPermission', t('Permissions'), 1, true) ?> <?php endif ?> - <?= $this->form->checkbox('category', t('Categories'), 1, true) ?> - <?= $this->form->checkbox('action', t('Actions'), 1, true) ?> - <?= $this->form->checkbox('swimlane', t('Swimlanes'), 1, false) ?> - <?= $this->form->checkbox('task', t('Tasks'), 1, false) ?> - <?= $this->form->checkbox('projectMetadata', t('Metadata'), 1, false) ?> + <?= $this->form->checkbox('categoryModel', t('Categories'), 1, true) ?> + <?= $this->form->checkbox('actionModel', t('Actions'), 1, true) ?> + <?= $this->form->checkbox('swimlaneModel', t('Swimlanes'), 1, false) ?> + <?= $this->form->checkbox('taskModel', t('Tasks'), 1, false) ?> + <?= $this->form->checkbox('projectMetadataModel', t('Metadata'), 1, false) ?> <div class="form-actions"> <button type="submit" class="btn btn-red"><?= t('Duplicate') ?></button> diff --git a/app/Template/search/results.php b/app/Template/search/results.php index 97667c75..8376b9e8 100644 --- a/app/Template/search/results.php +++ b/app/Template/search/results.php @@ -41,7 +41,7 @@ <?= $this->dt->date($task['date_due']) ?> </td> <td> - <?php if ($task['is_active'] == \Kanboard\Model\Task::STATUS_OPEN): ?> + <?php if ($task['is_active'] == \Kanboard\Model\TaskModel::STATUS_OPEN): ?> <?= t('Open') ?> <?php else: ?> <?= t('Closed') ?> diff --git a/app/Template/task/time_tracking_details.php b/app/Template/task/time_tracking_details.php index d86273c5..1a179522 100644 --- a/app/Template/task/time_tracking_details.php +++ b/app/Template/task/time_tracking_details.php @@ -14,7 +14,7 @@ <th><?= $subtask_paginator->order(t('Subtask'), 'subtask_title') ?></th> <th class="column-20"><?= $subtask_paginator->order(t('Start'), 'start') ?></th> <th class="column-20"><?= $subtask_paginator->order(t('End'), 'end') ?></th> - <th class="column-10"><?= $subtask_paginator->order(t('Time spent'), \Kanboard\Model\SubtaskTimeTracking::TABLE.'.time_spent') ?></th> + <th class="column-10"><?= $subtask_paginator->order(t('Time spent'), \Kanboard\Model\SubtaskTimeTrackingModel::TABLE.'.time_spent') ?></th> </tr> <?php foreach ($subtask_paginator->getCollection() as $record): ?> <tr> diff --git a/app/Template/task_list/show.php b/app/Template/task_list/show.php index 9ffcb2e8..bb95b6a3 100644 --- a/app/Template/task_list/show.php +++ b/app/Template/task_list/show.php @@ -47,7 +47,7 @@ <?= $this->dt->date($task['date_due']) ?> </td> <td> - <?php if ($task['is_active'] == \Kanboard\Model\Task::STATUS_OPEN): ?> + <?php if ($task['is_active'] == \Kanboard\Model\TaskModel::STATUS_OPEN): ?> <?= t('Open') ?> <?php else: ?> <?= t('Closed') ?> diff --git a/app/Template/task_recurrence/edit.php b/app/Template/task_recurrence/edit.php index 550db2f8..09d14826 100644 --- a/app/Template/task_recurrence/edit.php +++ b/app/Template/task_recurrence/edit.php @@ -2,7 +2,7 @@ <h2><?= t('Edit recurrence') ?></h2> </div> -<?php if ($task['recurrence_status'] != \Kanboard\Model\Task::RECURRING_STATUS_NONE): ?> +<?php if ($task['recurrence_status'] != \Kanboard\Model\TaskModel::RECURRING_STATUS_NONE): ?> <div class="listing"> <?= $this->render('task_recurrence/info', array( 'task' => $task, @@ -13,7 +13,7 @@ </div> <?php endif ?> -<?php if ($task['recurrence_status'] != \Kanboard\Model\Task::RECURRING_STATUS_PROCESSED): ?> +<?php if ($task['recurrence_status'] != \Kanboard\Model\TaskModel::RECURRING_STATUS_PROCESSED): ?> <form class="popover-form" method="post" action="<?= $this->url->href('TaskRecurrenceController', 'update', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?>" autocomplete="off"> diff --git a/app/Template/task_recurrence/info.php b/app/Template/task_recurrence/info.php index 97794604..04d58c7f 100644 --- a/app/Template/task_recurrence/info.php +++ b/app/Template/task_recurrence/info.php @@ -1,7 +1,7 @@ <ul> - <?php if ($task['recurrence_status'] == \Kanboard\Model\Task::RECURRING_STATUS_PENDING): ?> + <?php if ($task['recurrence_status'] == \Kanboard\Model\TaskModel::RECURRING_STATUS_PENDING): ?> <li><?= t('Recurrent task is scheduled to be generated') ?></li> - <?php elseif ($task['recurrence_status'] == \Kanboard\Model\Task::RECURRING_STATUS_PROCESSED): ?> + <?php elseif ($task['recurrence_status'] == \Kanboard\Model\TaskModel::RECURRING_STATUS_PROCESSED): ?> <li><?= t('Recurrent task has been generated:') ?> <ul> <li> diff --git a/app/User/Avatar/GravatarProvider.php b/app/User/Avatar/GravatarProvider.php index 87ca51b1..e066d766 100644 --- a/app/User/Avatar/GravatarProvider.php +++ b/app/User/Avatar/GravatarProvider.php @@ -37,6 +37,6 @@ class GravatarProvider extends Base implements AvatarProviderInterface */ public function isActive(array $user) { - return !empty($user['email']) && $this->config->get('integration_gravatar') == 1; + return !empty($user['email']) && $this->configModel->get('integration_gravatar') == 1; } } diff --git a/app/User/LdapUserProvider.php b/app/User/LdapUserProvider.php index 74cf4cd5..274d7665 100644 --- a/app/User/LdapUserProvider.php +++ b/app/User/LdapUserProvider.php @@ -3,7 +3,7 @@ namespace Kanboard\User; use Kanboard\Core\User\UserProviderInterface; -use Kanboard\Model\Language; +use Kanboard\Model\LanguageModel; /** * LDAP User Provider @@ -211,7 +211,7 @@ class LdapUserProvider implements UserProviderInterface $attributes = array('is_ldap_user' => 1); if (! empty($this->language)) { - $attributes['language'] = Language::findCode($this->language); + $attributes['language'] = LanguageModel::findCode($this->language); } return $attributes; diff --git a/app/Validator/AuthValidator.php b/app/Validator/AuthValidator.php index cd6e04d5..14d66ee4 100644 --- a/app/Validator/AuthValidator.php +++ b/app/Validator/AuthValidator.php @@ -59,7 +59,7 @@ class AuthValidator extends Base $result = true; $errors = array(); - if ($this->userLocking->isLocked($values['username'])) { + if ($this->userLockingModel->isLocked($values['username'])) { $result = false; $errors['login'] = t('Your account is locked for %d minutes', BRUTEFORCE_LOCKDOWN_DURATION); $this->logger->error('Account locked: '.$values['username']); @@ -100,7 +100,7 @@ class AuthValidator extends Base $result = true; $errors = array(); - if ($this->userLocking->hasCaptcha($values['username'])) { + if ($this->userLockingModel->hasCaptcha($values['username'])) { if (! isset($this->sessionStorage->captcha)) { $result = false; } else { diff --git a/app/Validator/GroupValidator.php b/app/Validator/GroupValidator.php index 2226abd3..2946ca23 100644 --- a/app/Validator/GroupValidator.php +++ b/app/Validator/GroupValidator.php @@ -4,7 +4,7 @@ namespace Kanboard\Validator; use SimpleValidator\Validator; use SimpleValidator\Validators; -use Kanboard\Model\Group; +use Kanboard\Model\GroupModel; /** * Group Validator @@ -63,7 +63,7 @@ class GroupValidator extends Base return array( new Validators\Required('name', t('The name is required')), new Validators\MaxLength('name', t('The maximum length is %d characters', 100), 100), - new Validators\Unique('name', t('The name must be unique'), $this->db->getConnection(), Group::TABLE, 'id'), + new Validators\Unique('name', t('The name must be unique'), $this->db->getConnection(), GroupModel::TABLE, 'id'), new Validators\MaxLength('external_id', t('The maximum length is %d characters', 255), 255), new Validators\Integer('id', t('This value must be an integer')), ); diff --git a/app/Validator/LinkValidator.php b/app/Validator/LinkValidator.php index 10a826da..2a9967a2 100644 --- a/app/Validator/LinkValidator.php +++ b/app/Validator/LinkValidator.php @@ -4,7 +4,7 @@ namespace Kanboard\Validator; use SimpleValidator\Validator; use SimpleValidator\Validators; -use Kanboard\Model\Link; +use Kanboard\Model\LinkModel; /** * Link Validator @@ -25,7 +25,7 @@ class LinkValidator extends Base { $v = new Validator($values, array( new Validators\Required('label', t('Field required')), - new Validators\Unique('label', t('This label must be unique'), $this->db->getConnection(), Link::TABLE), + new Validators\Unique('label', t('This label must be unique'), $this->db->getConnection(), LinkModel::TABLE), new Validators\NotEquals('label', 'opposite_label', t('The labels must be different')), )); @@ -48,7 +48,7 @@ class LinkValidator extends Base new Validators\Required('id', t('Field required')), new Validators\Required('opposite_id', t('Field required')), new Validators\Required('label', t('Field required')), - new Validators\Unique('label', t('This label must be unique'), $this->db->getConnection(), Link::TABLE), + new Validators\Unique('label', t('This label must be unique'), $this->db->getConnection(), LinkModel::TABLE), )); return array( diff --git a/app/Validator/ProjectValidator.php b/app/Validator/ProjectValidator.php index 1c6c90f8..b1406a2f 100644 --- a/app/Validator/ProjectValidator.php +++ b/app/Validator/ProjectValidator.php @@ -4,7 +4,7 @@ namespace Kanboard\Validator; use SimpleValidator\Validator; use SimpleValidator\Validators; -use Kanboard\Model\Project; +use Kanboard\Model\ProjectModel; /** * Project Validator @@ -34,7 +34,7 @@ class ProjectValidator extends Base new Validators\MaxLength('start_date', t('The maximum length is %d characters', 10), 10), new Validators\MaxLength('end_date', t('The maximum length is %d characters', 10), 10), new Validators\AlphaNumeric('identifier', t('This value must be alphanumeric')) , - new Validators\Unique('identifier', t('The identifier must be unique'), $this->db->getConnection(), Project::TABLE), + new Validators\Unique('identifier', t('The identifier must be unique'), $this->db->getConnection(), ProjectModel::TABLE), ); } diff --git a/app/Validator/TaskLinkValidator.php b/app/Validator/TaskLinkValidator.php index c88c2b16..1c167e4c 100644 --- a/app/Validator/TaskLinkValidator.php +++ b/app/Validator/TaskLinkValidator.php @@ -4,7 +4,7 @@ namespace Kanboard\Validator; use SimpleValidator\Validator; use SimpleValidator\Validators; -use Kanboard\Model\Task; +use Kanboard\Model\TaskModel; /** * Task Link Validator @@ -27,7 +27,7 @@ class TaskLinkValidator extends Base new Validators\Required('opposite_task_id', t('Field required')), new Validators\Required('link_id', t('Field required')), new Validators\NotEquals('opposite_task_id', 'task_id', t('A task cannot be linked to itself')), - new Validators\Exists('opposite_task_id', t('This linked task id doesn\'t exists'), $this->db->getConnection(), Task::TABLE, 'id') + new Validators\Exists('opposite_task_id', t('This linked task id doesn\'t exists'), $this->db->getConnection(), TaskModel::TABLE, 'id') ); } diff --git a/app/Validator/UserValidator.php b/app/Validator/UserValidator.php index e5953f30..1a24f23e 100644 --- a/app/Validator/UserValidator.php +++ b/app/Validator/UserValidator.php @@ -4,7 +4,7 @@ namespace Kanboard\Validator; use SimpleValidator\Validator; use SimpleValidator\Validators; -use Kanboard\Model\User; +use Kanboard\Model\UserModel; /** * User Validator @@ -25,7 +25,7 @@ class UserValidator extends Base return array( new Validators\MaxLength('role', t('The maximum length is %d characters', 25), 25), new Validators\MaxLength('username', t('The maximum length is %d characters', 50), 50), - new Validators\Unique('username', t('The username must be unique'), $this->db->getConnection(), User::TABLE, 'id'), + new Validators\Unique('username', t('The username must be unique'), $this->db->getConnection(), UserModel::TABLE, 'id'), new Validators\Email('email', t('Email address invalid')), new Validators\Integer('is_ldap_user', t('This value must be an integer')), ); diff --git a/tests/integration/ApiTest.php b/tests/integration/ApiTest.php index 5fed0368..f552bea9 100644 --- a/tests/integration/ApiTest.php +++ b/tests/integration/ApiTest.php @@ -51,9 +51,9 @@ class Api extends PHPUnit_Framework_TestCase if ($projects) { foreach ($projects as $project) { - $this->assertEquals('http://127.0.0.1:8000/?controller=board&action=show&project_id='.$project['id'], $project['url']['board']); - $this->assertEquals('http://127.0.0.1:8000/?controller=calendar&action=show&project_id='.$project['id'], $project['url']['calendar']); - $this->assertEquals('http://127.0.0.1:8000/?controller=listing&action=show&project_id='.$project['id'], $project['url']['list']); + $this->assertEquals('http://127.0.0.1:8000/?controller=BoardViewController&action=show&project_id='.$project['id'], $project['url']['board']); + $this->assertEquals('http://127.0.0.1:8000/?controller=CalendarController&action=show&project_id='.$project['id'], $project['url']['calendar']); + $this->assertEquals('http://127.0.0.1:8000/?controller=TaskListController&action=show&project_id='.$project['id'], $project['url']['list']); $this->assertTrue($this->client->removeProject($project['id'])); } } @@ -71,9 +71,9 @@ class Api extends PHPUnit_Framework_TestCase $project = $this->client->getProjectById(1); $this->assertNotEmpty($project); $this->assertEquals(1, $project['id']); - $this->assertEquals('http://127.0.0.1:8000/?controller=board&action=show&project_id='.$project['id'], $project['url']['board']); - $this->assertEquals('http://127.0.0.1:8000/?controller=calendar&action=show&project_id='.$project['id'], $project['url']['calendar']); - $this->assertEquals('http://127.0.0.1:8000/?controller=listing&action=show&project_id='.$project['id'], $project['url']['list']); + $this->assertEquals('http://127.0.0.1:8000/?controller=BoardViewController&action=show&project_id='.$project['id'], $project['url']['board']); + $this->assertEquals('http://127.0.0.1:8000/?controller=CalendarController&action=show&project_id='.$project['id'], $project['url']['calendar']); + $this->assertEquals('http://127.0.0.1:8000/?controller=TaskListController&action=show&project_id='.$project['id'], $project['url']['list']); } public function testGetProjectByName() @@ -81,9 +81,9 @@ class Api extends PHPUnit_Framework_TestCase $project = $this->client->getProjectByName('API test'); $this->assertNotEmpty($project); $this->assertEquals(1, $project['id']); - $this->assertEquals('http://127.0.0.1:8000/?controller=board&action=show&project_id='.$project['id'], $project['url']['board']); - $this->assertEquals('http://127.0.0.1:8000/?controller=calendar&action=show&project_id='.$project['id'], $project['url']['calendar']); - $this->assertEquals('http://127.0.0.1:8000/?controller=listing&action=show&project_id='.$project['id'], $project['url']['list']); + $this->assertEquals('http://127.0.0.1:8000/?controller=BoardViewController&action=show&project_id='.$project['id'], $project['url']['board']); + $this->assertEquals('http://127.0.0.1:8000/?controller=CalendarController&action=show&project_id='.$project['id'], $project['url']['calendar']); + $this->assertEquals('http://127.0.0.1:8000/?controller=TaskListController&action=show&project_id='.$project['id'], $project['url']['list']); $project = $this->client->getProjectByName(array('name' => 'API test')); $this->assertNotEmpty($project); @@ -100,9 +100,9 @@ class Api extends PHPUnit_Framework_TestCase $this->assertNotEmpty($projects); foreach ($projects as $project) { - $this->assertEquals('http://127.0.0.1:8000/?controller=board&action=show&project_id='.$project['id'], $project['url']['board']); - $this->assertEquals('http://127.0.0.1:8000/?controller=calendar&action=show&project_id='.$project['id'], $project['url']['calendar']); - $this->assertEquals('http://127.0.0.1:8000/?controller=listing&action=show&project_id='.$project['id'], $project['url']['list']); + $this->assertEquals('http://127.0.0.1:8000/?controller=BoardViewController&action=show&project_id='.$project['id'], $project['url']['board']); + $this->assertEquals('http://127.0.0.1:8000/?controller=CalendarController&action=show&project_id='.$project['id'], $project['url']['calendar']); + $this->assertEquals('http://127.0.0.1:8000/?controller=TaskListController&action=show&project_id='.$project['id'], $project['url']['list']); } } @@ -235,7 +235,7 @@ class Api extends PHPUnit_Framework_TestCase $this->assertNotFalse($task); $this->assertTrue(is_array($task)); $this->assertEquals('Task #1', $task['title']); - $this->assertEquals('http://127.0.0.1:8000/?controller=task&action=show&task_id='.$task['id'].'&project_id='.$task['project_id'], $task['url']); + $this->assertEquals('http://127.0.0.1:8000/?controller=TaskViewController&action=show&task_id='.$task['id'].'&project_id='.$task['project_id'], $task['url']); } public function testGetAllTasks() @@ -245,7 +245,7 @@ class Api extends PHPUnit_Framework_TestCase $this->assertNotFalse($tasks); $this->assertTrue(is_array($tasks)); $this->assertEquals('Task #1', $tasks[0]['title']); - $this->assertEquals('http://127.0.0.1:8000/?controller=task&action=show&task_id='.$tasks[0]['id'].'&project_id='.$tasks[0]['project_id'], $tasks[0]['url']); + $this->assertEquals('http://127.0.0.1:8000/?controller=TaskViewController&action=show&task_id='.$tasks[0]['id'].'&project_id='.$tasks[0]['project_id'], $tasks[0]['url']); $tasks = $this->client->getAllTasks(2, 0); @@ -896,7 +896,7 @@ class Api extends PHPUnit_Framework_TestCase $this->assertNotEmpty($task); $this->assertEquals('Task with external ticket number', $task['title']); $this->assertEquals('TICKET-1234', $task['reference']); - $this->assertEquals('http://127.0.0.1:8000/?controller=task&action=show&task_id='.$task['id'].'&project_id='.$task['project_id'], $task['url']); + $this->assertEquals('http://127.0.0.1:8000/?controller=TaskViewController&action=show&task_id='.$task['id'].'&project_id='.$task['project_id'], $task['url']); } public function testCreateOverdueTask() diff --git a/tests/units/Action/CommentCreationMoveTaskColumnTest.php b/tests/units/Action/CommentCreationMoveTaskColumnTest.php index 9615865d..5eaf515e 100644 --- a/tests/units/Action/CommentCreationMoveTaskColumnTest.php +++ b/tests/units/Action/CommentCreationMoveTaskColumnTest.php @@ -3,10 +3,10 @@ require_once __DIR__.'/../Base.php'; use Kanboard\Event\GenericEvent; -use Kanboard\Model\Task; -use Kanboard\Model\TaskCreation; -use Kanboard\Model\Comment; -use Kanboard\Model\Project; +use Kanboard\Model\TaskModel; +use Kanboard\Model\TaskCreationModel; +use Kanboard\Model\CommentModel; +use Kanboard\Model\ProjectModel; use Kanboard\Action\CommentCreationMoveTaskColumn; class CommentCreationMoveTaskColumnTest extends Base @@ -15,9 +15,9 @@ class CommentCreationMoveTaskColumnTest extends Base { $this->container['sessionStorage']->user = array('id' => 1); - $projectModel = new Project($this->container); - $commentModel = new Comment($this->container); - $taskCreationModel = new TaskCreation($this->container); + $projectModel = new ProjectModel($this->container); + $commentModel = new CommentModel($this->container); + $taskCreationModel = new TaskCreationModel($this->container); $this->assertEquals(1, $projectModel->create(array('name' => 'test1'))); $this->assertEquals(1, $taskCreationModel->create(array('project_id' => 1, 'title' => 'test'))); @@ -28,7 +28,7 @@ class CommentCreationMoveTaskColumnTest extends Base $action->setProjectId(1); $action->setParam('column_id', 2); - $this->assertTrue($action->execute($event, Task::EVENT_MOVE_COLUMN)); + $this->assertTrue($action->execute($event, TaskModel::EVENT_MOVE_COLUMN)); $comment = $commentModel->getById(1); $this->assertNotEmpty($comment); @@ -39,8 +39,8 @@ class CommentCreationMoveTaskColumnTest extends Base public function testWithUserNotLogged() { - $projectModel = new Project($this->container); - $taskCreationModel = new TaskCreation($this->container); + $projectModel = new ProjectModel($this->container); + $taskCreationModel = new TaskCreationModel($this->container); $this->assertEquals(1, $projectModel->create(array('name' => 'test1'))); $this->assertEquals(1, $taskCreationModel->create(array('project_id' => 1, 'title' => 'test'))); @@ -51,6 +51,6 @@ class CommentCreationMoveTaskColumnTest extends Base $action->setProjectId(1); $action->setParam('column_id', 2); - $this->assertFalse($action->execute($event, Task::EVENT_MOVE_COLUMN)); + $this->assertFalse($action->execute($event, TaskModel::EVENT_MOVE_COLUMN)); } } diff --git a/tests/units/Action/CommentCreationTest.php b/tests/units/Action/CommentCreationTest.php index a2e52dc6..4a2fc386 100644 --- a/tests/units/Action/CommentCreationTest.php +++ b/tests/units/Action/CommentCreationTest.php @@ -3,11 +3,11 @@ require_once __DIR__.'/../Base.php'; use Kanboard\Event\GenericEvent; -use Kanboard\Model\TaskCreation; -use Kanboard\Model\Comment; -use Kanboard\Model\Project; -use Kanboard\Model\ProjectUserRole; -use Kanboard\Model\User; +use Kanboard\Model\TaskCreationModel; +use Kanboard\Model\CommentModel; +use Kanboard\Model\ProjectModel; +use Kanboard\Model\ProjectUserRoleModel; +use Kanboard\Model\UserModel; use Kanboard\Action\CommentCreation; use Kanboard\Core\Security\Role; @@ -15,11 +15,11 @@ class CommentCreationTest extends Base { public function testSuccess() { - $userModel = new User($this->container); - $projectModel = new Project($this->container); - $projectUserRoleModel = new ProjectUserRole($this->container); - $commentModel = new Comment($this->container); - $taskCreationModel = new TaskCreation($this->container); + $userModel = new UserModel($this->container); + $projectModel = new ProjectModel($this->container); + $projectUserRoleModel = new ProjectUserRoleModel($this->container); + $commentModel = new CommentModel($this->container); + $taskCreationModel = new TaskCreationModel($this->container); $this->assertEquals(1, $projectModel->create(array('name' => 'test1'))); $this->assertEquals(1, $taskCreationModel->create(array('project_id' => 1, 'title' => 'test'))); @@ -44,10 +44,10 @@ class CommentCreationTest extends Base public function testWithUserNotAssignable() { - $userModel = new User($this->container); - $projectModel = new Project($this->container); - $commentModel = new Comment($this->container); - $taskCreationModel = new TaskCreation($this->container); + $userModel = new UserModel($this->container); + $projectModel = new ProjectModel($this->container); + $commentModel = new CommentModel($this->container); + $taskCreationModel = new TaskCreationModel($this->container); $this->assertEquals(1, $projectModel->create(array('name' => 'test1'))); $this->assertEquals(1, $taskCreationModel->create(array('project_id' => 1, 'title' => 'test'))); @@ -71,9 +71,9 @@ class CommentCreationTest extends Base public function testWithNoComment() { - $userModel = new User($this->container); - $projectModel = new Project($this->container); - $taskCreationModel = new TaskCreation($this->container); + $userModel = new UserModel($this->container); + $projectModel = new ProjectModel($this->container); + $taskCreationModel = new TaskCreationModel($this->container); $this->assertEquals(1, $projectModel->create(array('name' => 'test1'))); $this->assertEquals(1, $taskCreationModel->create(array('project_id' => 1, 'title' => 'test'))); diff --git a/tests/units/Action/TaskAssignCategoryColorTest.php b/tests/units/Action/TaskAssignCategoryColorTest.php index b386d9bf..09c08264 100644 --- a/tests/units/Action/TaskAssignCategoryColorTest.php +++ b/tests/units/Action/TaskAssignCategoryColorTest.php @@ -3,21 +3,21 @@ require_once __DIR__.'/../Base.php'; use Kanboard\Event\GenericEvent; -use Kanboard\Model\Category; -use Kanboard\Model\TaskCreation; -use Kanboard\Model\TaskFinder; -use Kanboard\Model\Project; -use Kanboard\Model\Task; +use Kanboard\Model\CategoryModel; +use Kanboard\Model\TaskCreationModel; +use Kanboard\Model\TaskFinderModel; +use Kanboard\Model\ProjectModel; +use Kanboard\Model\TaskModel; use Kanboard\Action\TaskAssignCategoryColor; class TaskAssignCategoryColorTest extends Base { public function testChangeCategory() { - $categoryModel = new Category($this->container); - $projectModel = new Project($this->container); - $taskCreationModel = new TaskCreation($this->container); - $taskFinderModel = new TaskFinder($this->container); + $categoryModel = new CategoryModel($this->container); + $projectModel = new ProjectModel($this->container); + $taskCreationModel = new TaskCreationModel($this->container); + $taskFinderModel = new TaskFinderModel($this->container); $this->assertEquals(1, $projectModel->create(array('name' => 'test1'))); $this->assertEquals(1, $taskCreationModel->create(array('project_id' => 1, 'title' => 'test'))); @@ -30,7 +30,7 @@ class TaskAssignCategoryColorTest extends Base $action->setParam('color_id', 'red'); $action->setParam('category_id', 1); - $this->assertTrue($action->execute($event, Task::EVENT_CREATE_UPDATE)); + $this->assertTrue($action->execute($event, TaskModel::EVENT_CREATE_UPDATE)); $task = $taskFinderModel->getById(1); $this->assertNotEmpty($task); @@ -39,9 +39,9 @@ class TaskAssignCategoryColorTest extends Base public function testWithWrongColor() { - $categoryModel = new Category($this->container); - $projectModel = new Project($this->container); - $taskCreationModel = new TaskCreation($this->container); + $categoryModel = new CategoryModel($this->container); + $projectModel = new ProjectModel($this->container); + $taskCreationModel = new TaskCreationModel($this->container); $this->assertEquals(1, $projectModel->create(array('name' => 'test1'))); $this->assertEquals(1, $taskCreationModel->create(array('project_id' => 1, 'title' => 'test'))); @@ -54,6 +54,6 @@ class TaskAssignCategoryColorTest extends Base $action->setParam('color_id', 'red'); $action->setParam('category_id', 1); - $this->assertFalse($action->execute($event, Task::EVENT_CREATE_UPDATE)); + $this->assertFalse($action->execute($event, TaskModel::EVENT_CREATE_UPDATE)); } } diff --git a/tests/units/Action/TaskAssignCategoryLabelTest.php b/tests/units/Action/TaskAssignCategoryLabelTest.php index ba988a72..1ddb1f7a 100644 --- a/tests/units/Action/TaskAssignCategoryLabelTest.php +++ b/tests/units/Action/TaskAssignCategoryLabelTest.php @@ -3,20 +3,20 @@ require_once __DIR__.'/../Base.php'; use Kanboard\Event\GenericEvent; -use Kanboard\Model\Category; -use Kanboard\Model\TaskCreation; -use Kanboard\Model\TaskFinder; -use Kanboard\Model\Project; +use Kanboard\Model\CategoryModel; +use Kanboard\Model\TaskCreationModel; +use Kanboard\Model\TaskFinderModel; +use Kanboard\Model\ProjectModel; use Kanboard\Action\TaskAssignCategoryLabel; class TaskAssignCategoryLabelTest extends Base { public function testChangeCategory() { - $categoryModel = new Category($this->container); - $projectModel = new Project($this->container); - $taskCreationModel = new TaskCreation($this->container); - $taskFinderModel = new TaskFinder($this->container); + $categoryModel = new CategoryModel($this->container); + $projectModel = new ProjectModel($this->container); + $taskCreationModel = new TaskCreationModel($this->container); + $taskFinderModel = new TaskFinderModel($this->container); $this->assertEquals(1, $projectModel->create(array('name' => 'test1'))); $this->assertEquals(1, $taskCreationModel->create(array('project_id' => 1, 'title' => 'test'))); @@ -39,9 +39,9 @@ class TaskAssignCategoryLabelTest extends Base public function testWithWrongLabel() { - $categoryModel = new Category($this->container); - $projectModel = new Project($this->container); - $taskCreationModel = new TaskCreation($this->container); + $categoryModel = new CategoryModel($this->container); + $projectModel = new ProjectModel($this->container); + $taskCreationModel = new TaskCreationModel($this->container); $this->assertEquals(1, $projectModel->create(array('name' => 'test1'))); $this->assertEquals(1, $taskCreationModel->create(array('project_id' => 1, 'title' => 'test'))); @@ -60,9 +60,9 @@ class TaskAssignCategoryLabelTest extends Base public function testWithExistingCategory() { - $categoryModel = new Category($this->container); - $projectModel = new Project($this->container); - $taskCreationModel = new TaskCreation($this->container); + $categoryModel = new CategoryModel($this->container); + $projectModel = new ProjectModel($this->container); + $taskCreationModel = new TaskCreationModel($this->container); $this->assertEquals(1, $projectModel->create(array('name' => 'test1'))); $this->assertEquals(1, $categoryModel->create(array('name' => 'c1', 'project_id' => 1))); diff --git a/tests/units/Action/TaskAssignCategoryLinkTest.php b/tests/units/Action/TaskAssignCategoryLinkTest.php index ba0e7152..712c3c02 100644 --- a/tests/units/Action/TaskAssignCategoryLinkTest.php +++ b/tests/units/Action/TaskAssignCategoryLinkTest.php @@ -2,11 +2,11 @@ require_once __DIR__.'/../Base.php'; -use Kanboard\Model\TaskCreation; -use Kanboard\Model\TaskFinder; -use Kanboard\Model\Project; -use Kanboard\Model\TaskLink; -use Kanboard\Model\Category; +use Kanboard\Model\TaskCreationModel; +use Kanboard\Model\TaskFinderModel; +use Kanboard\Model\ProjectModel; +use Kanboard\Model\TaskLinkModel; +use Kanboard\Model\CategoryModel; use Kanboard\Event\TaskLinkEvent; use Kanboard\Action\TaskAssignCategoryLink; @@ -14,10 +14,10 @@ class TaskAssignCategoryLinkTest extends Base { public function testAssignCategory() { - $tc = new TaskCreation($this->container); - $tf = new TaskFinder($this->container); - $p = new Project($this->container); - $c = new Category($this->container); + $tc = new TaskCreationModel($this->container); + $tf = new TaskFinderModel($this->container); + $p = new ProjectModel($this->container); + $c = new CategoryModel($this->container); $action = new TaskAssignCategoryLink($this->container); $action->setProjectId(1); @@ -35,7 +35,7 @@ class TaskAssignCategoryLinkTest extends Base 'link_id' => 2, )); - $this->assertTrue($action->execute($event, TaskLink::EVENT_CREATE_UPDATE)); + $this->assertTrue($action->execute($event, TaskLinkModel::EVENT_CREATE_UPDATE)); $task = $tf->getById(1); $this->assertEquals(1, $task['category_id']); @@ -43,10 +43,10 @@ class TaskAssignCategoryLinkTest extends Base public function testWhenLinkDontMatch() { - $tc = new TaskCreation($this->container); - $tf = new TaskFinder($this->container); - $p = new Project($this->container); - $c = new Category($this->container); + $tc = new TaskCreationModel($this->container); + $tf = new TaskFinderModel($this->container); + $p = new ProjectModel($this->container); + $c = new CategoryModel($this->container); $action = new TaskAssignCategoryLink($this->container); $action->setProjectId(1); @@ -64,14 +64,14 @@ class TaskAssignCategoryLinkTest extends Base 'link_id' => 2, )); - $this->assertFalse($action->execute($event, TaskLink::EVENT_CREATE_UPDATE)); + $this->assertFalse($action->execute($event, TaskLinkModel::EVENT_CREATE_UPDATE)); } public function testThatExistingCategoryWillNotChange() { - $tc = new TaskCreation($this->container); - $p = new Project($this->container); - $c = new Category($this->container); + $tc = new TaskCreationModel($this->container); + $p = new ProjectModel($this->container); + $c = new CategoryModel($this->container); $action = new TaskAssignCategoryLink($this->container); $action->setProjectId(1); @@ -90,6 +90,6 @@ class TaskAssignCategoryLinkTest extends Base 'link_id' => 2, )); - $this->assertFalse($action->execute($event, TaskLink::EVENT_CREATE_UPDATE)); + $this->assertFalse($action->execute($event, TaskLinkModel::EVENT_CREATE_UPDATE)); } } diff --git a/tests/units/Action/TaskAssignColorCategoryTest.php b/tests/units/Action/TaskAssignColorCategoryTest.php index 86c855d1..6502035f 100644 --- a/tests/units/Action/TaskAssignColorCategoryTest.php +++ b/tests/units/Action/TaskAssignColorCategoryTest.php @@ -3,21 +3,21 @@ require_once __DIR__.'/../Base.php'; use Kanboard\Event\GenericEvent; -use Kanboard\Model\Category; -use Kanboard\Model\TaskCreation; -use Kanboard\Model\TaskFinder; -use Kanboard\Model\Project; -use Kanboard\Model\Task; +use Kanboard\Model\CategoryModel; +use Kanboard\Model\TaskCreationModel; +use Kanboard\Model\TaskFinderModel; +use Kanboard\Model\ProjectModel; +use Kanboard\Model\TaskModel; use Kanboard\Action\TaskAssignColorCategory; class TaskAssignColorCategoryTest extends Base { public function testChangeColor() { - $categoryModel = new Category($this->container); - $projectModel = new Project($this->container); - $taskCreationModel = new TaskCreation($this->container); - $taskFinderModel = new TaskFinder($this->container); + $categoryModel = new CategoryModel($this->container); + $projectModel = new ProjectModel($this->container); + $taskCreationModel = new TaskCreationModel($this->container); + $taskFinderModel = new TaskFinderModel($this->container); $this->assertEquals(1, $projectModel->create(array('name' => 'test1'))); $this->assertEquals(1, $taskCreationModel->create(array('project_id' => 1, 'title' => 'test'))); @@ -30,7 +30,7 @@ class TaskAssignColorCategoryTest extends Base $action->setParam('color_id', 'red'); $action->setParam('category_id', 1); - $this->assertTrue($action->execute($event, Task::EVENT_CREATE_UPDATE)); + $this->assertTrue($action->execute($event, TaskModel::EVENT_CREATE_UPDATE)); $task = $taskFinderModel->getById(1); $this->assertNotEmpty($task); @@ -39,8 +39,8 @@ class TaskAssignColorCategoryTest extends Base public function testWithWrongCategory() { - $projectModel = new Project($this->container); - $taskCreationModel = new TaskCreation($this->container); + $projectModel = new ProjectModel($this->container); + $taskCreationModel = new TaskCreationModel($this->container); $this->assertEquals(1, $projectModel->create(array('name' => 'test1'))); $this->assertEquals(1, $taskCreationModel->create(array('project_id' => 1, 'title' => 'test'))); @@ -52,6 +52,6 @@ class TaskAssignColorCategoryTest extends Base $action->setParam('color_id', 'red'); $action->setParam('category_id', 1); - $this->assertFalse($action->execute($event, Task::EVENT_CREATE_UPDATE)); + $this->assertFalse($action->execute($event, TaskModel::EVENT_CREATE_UPDATE)); } } diff --git a/tests/units/Action/TaskAssignColorColumnTest.php b/tests/units/Action/TaskAssignColorColumnTest.php index 130422b5..d4ba8e01 100644 --- a/tests/units/Action/TaskAssignColorColumnTest.php +++ b/tests/units/Action/TaskAssignColorColumnTest.php @@ -3,19 +3,19 @@ require_once __DIR__.'/../Base.php'; use Kanboard\Event\GenericEvent; -use Kanboard\Model\TaskCreation; -use Kanboard\Model\TaskFinder; -use Kanboard\Model\Project; -use Kanboard\Model\Task; +use Kanboard\Model\TaskCreationModel; +use Kanboard\Model\TaskFinderModel; +use Kanboard\Model\ProjectModel; +use Kanboard\Model\TaskModel; use Kanboard\Action\TaskAssignColorColumn; class TaskAssignColorColumnTest extends Base { public function testChangeColumn() { - $projectModel = new Project($this->container); - $taskCreationModel = new TaskCreation($this->container); - $taskFinderModel = new TaskFinder($this->container); + $projectModel = new ProjectModel($this->container); + $taskCreationModel = new TaskCreationModel($this->container); + $taskFinderModel = new TaskFinderModel($this->container); $this->assertEquals(1, $projectModel->create(array('name' => 'test1'))); $this->assertEquals(1, $taskCreationModel->create(array('project_id' => 1, 'title' => 'test'))); @@ -27,7 +27,7 @@ class TaskAssignColorColumnTest extends Base $action->setParam('color_id', 'red'); $action->setParam('column_id', 2); - $this->assertTrue($action->execute($event, Task::EVENT_MOVE_COLUMN)); + $this->assertTrue($action->execute($event, TaskModel::EVENT_MOVE_COLUMN)); $task = $taskFinderModel->getById(1); $this->assertNotEmpty($task); @@ -36,8 +36,8 @@ class TaskAssignColorColumnTest extends Base public function testWithWrongCategory() { - $projectModel = new Project($this->container); - $taskCreationModel = new TaskCreation($this->container); + $projectModel = new ProjectModel($this->container); + $taskCreationModel = new TaskCreationModel($this->container); $this->assertEquals(1, $projectModel->create(array('name' => 'test1'))); $this->assertEquals(1, $taskCreationModel->create(array('project_id' => 1, 'title' => 'test'))); @@ -49,6 +49,6 @@ class TaskAssignColorColumnTest extends Base $action->setParam('color_id', 'red'); $action->setParam('column_id', 2); - $this->assertFalse($action->execute($event, Task::EVENT_MOVE_COLUMN)); + $this->assertFalse($action->execute($event, TaskModel::EVENT_MOVE_COLUMN)); } } diff --git a/tests/units/Action/TaskAssignColorLinkTest.php b/tests/units/Action/TaskAssignColorLinkTest.php index 6df029d3..07d0969b 100644 --- a/tests/units/Action/TaskAssignColorLinkTest.php +++ b/tests/units/Action/TaskAssignColorLinkTest.php @@ -3,19 +3,19 @@ require_once __DIR__.'/../Base.php'; use Kanboard\Event\GenericEvent; -use Kanboard\Model\TaskCreation; -use Kanboard\Model\TaskFinder; -use Kanboard\Model\Project; -use Kanboard\Model\TaskLink; +use Kanboard\Model\TaskCreationModel; +use Kanboard\Model\TaskFinderModel; +use Kanboard\Model\ProjectModel; +use Kanboard\Model\TaskLinkModel; use Kanboard\Action\TaskAssignColorLink; class TaskAssignColorLinkTest extends Base { public function testChangeColor() { - $projectModel = new Project($this->container); - $taskCreationModel = new TaskCreation($this->container); - $taskFinderModel = new TaskFinder($this->container); + $projectModel = new ProjectModel($this->container); + $taskCreationModel = new TaskCreationModel($this->container); + $taskFinderModel = new TaskFinderModel($this->container); $this->assertEquals(1, $projectModel->create(array('name' => 'test1'))); $this->assertEquals(1, $taskCreationModel->create(array('project_id' => 1, 'title' => 'test'))); @@ -27,7 +27,7 @@ class TaskAssignColorLinkTest extends Base $action->setParam('color_id', 'red'); $action->setParam('link_id', 1); - $this->assertTrue($action->execute($event, TaskLink::EVENT_CREATE_UPDATE)); + $this->assertTrue($action->execute($event, TaskLinkModel::EVENT_CREATE_UPDATE)); $task = $taskFinderModel->getById(1); $this->assertNotEmpty($task); @@ -36,8 +36,8 @@ class TaskAssignColorLinkTest extends Base public function testWithWrongLink() { - $projectModel = new Project($this->container); - $taskCreationModel = new TaskCreation($this->container); + $projectModel = new ProjectModel($this->container); + $taskCreationModel = new TaskCreationModel($this->container); $this->assertEquals(1, $projectModel->create(array('name' => 'test1'))); $this->assertEquals(1, $taskCreationModel->create(array('project_id' => 1, 'title' => 'test'))); @@ -49,6 +49,6 @@ class TaskAssignColorLinkTest extends Base $action->setParam('color_id', 'red'); $action->setParam('link_id', 1); - $this->assertFalse($action->execute($event, TaskLink::EVENT_CREATE_UPDATE)); + $this->assertFalse($action->execute($event, TaskLinkModel::EVENT_CREATE_UPDATE)); } } diff --git a/tests/units/Action/TaskAssignColorPriorityTest.php b/tests/units/Action/TaskAssignColorPriorityTest.php index be6d8727..2fce8e66 100644 --- a/tests/units/Action/TaskAssignColorPriorityTest.php +++ b/tests/units/Action/TaskAssignColorPriorityTest.php @@ -3,21 +3,21 @@ require_once __DIR__.'/../Base.php'; use Kanboard\Event\GenericEvent; -use Kanboard\Model\Category; -use Kanboard\Model\TaskCreation; -use Kanboard\Model\TaskFinder; -use Kanboard\Model\Project; -use Kanboard\Model\Task; +use Kanboard\Model\CategoryModel; +use Kanboard\Model\TaskCreationModel; +use Kanboard\Model\TaskFinderModel; +use Kanboard\Model\ProjectModel; +use Kanboard\Model\TaskModel; use Kanboard\Action\TaskAssignColorPriority; class TaskAssignColorPriorityTest extends Base { public function testChangeColor() { - $categoryModel = new Category($this->container); - $projectModel = new Project($this->container); - $taskCreationModel = new TaskCreation($this->container); - $taskFinderModel = new TaskFinder($this->container); + $categoryModel = new CategoryModel($this->container); + $projectModel = new ProjectModel($this->container); + $taskCreationModel = new TaskCreationModel($this->container); + $taskFinderModel = new TaskFinderModel($this->container); $this->assertEquals(1, $projectModel->create(array('name' => 'test1'))); $this->assertEquals(1, $taskCreationModel->create(array('project_id' => 1, 'title' => 'test'))); @@ -30,7 +30,7 @@ class TaskAssignColorPriorityTest extends Base $action->setParam('color_id', 'red'); $action->setParam('priority', 1); - $this->assertTrue($action->execute($event, Task::EVENT_CREATE_UPDATE)); + $this->assertTrue($action->execute($event, TaskModel::EVENT_CREATE_UPDATE)); $task = $taskFinderModel->getById(1); $this->assertNotEmpty($task); @@ -39,8 +39,8 @@ class TaskAssignColorPriorityTest extends Base public function testWithWrongPriority() { - $projectModel = new Project($this->container); - $taskCreationModel = new TaskCreation($this->container); + $projectModel = new ProjectModel($this->container); + $taskCreationModel = new TaskCreationModel($this->container); $this->assertEquals(1, $projectModel->create(array('name' => 'test1'))); $this->assertEquals(1, $taskCreationModel->create(array('project_id' => 1, 'title' => 'test'))); @@ -52,6 +52,6 @@ class TaskAssignColorPriorityTest extends Base $action->setParam('color_id', 'red'); $action->setParam('priority', 1); - $this->assertFalse($action->execute($event, Task::EVENT_CREATE_UPDATE)); + $this->assertFalse($action->execute($event, TaskModel::EVENT_CREATE_UPDATE)); } } diff --git a/tests/units/Action/TaskAssignColorUserTest.php b/tests/units/Action/TaskAssignColorUserTest.php index 76e2282c..370f9070 100644 --- a/tests/units/Action/TaskAssignColorUserTest.php +++ b/tests/units/Action/TaskAssignColorUserTest.php @@ -3,19 +3,19 @@ require_once __DIR__.'/../Base.php'; use Kanboard\Event\GenericEvent; -use Kanboard\Model\TaskCreation; -use Kanboard\Model\TaskFinder; -use Kanboard\Model\Project; -use Kanboard\Model\Task; +use Kanboard\Model\TaskCreationModel; +use Kanboard\Model\TaskFinderModel; +use Kanboard\Model\ProjectModel; +use Kanboard\Model\TaskModel; use Kanboard\Action\TaskAssignColorUser; class TaskAssignColorUserTest extends Base { public function testChangeColor() { - $projectModel = new Project($this->container); - $taskCreationModel = new TaskCreation($this->container); - $taskFinderModel = new TaskFinder($this->container); + $projectModel = new ProjectModel($this->container); + $taskCreationModel = new TaskCreationModel($this->container); + $taskFinderModel = new TaskFinderModel($this->container); $this->assertEquals(1, $projectModel->create(array('name' => 'test1'))); $this->assertEquals(1, $taskCreationModel->create(array('project_id' => 1, 'title' => 'test'))); @@ -27,7 +27,7 @@ class TaskAssignColorUserTest extends Base $action->setParam('color_id', 'red'); $action->setParam('user_id', 1); - $this->assertTrue($action->execute($event, Task::EVENT_ASSIGNEE_CHANGE)); + $this->assertTrue($action->execute($event, TaskModel::EVENT_ASSIGNEE_CHANGE)); $task = $taskFinderModel->getById(1); $this->assertNotEmpty($task); @@ -36,8 +36,8 @@ class TaskAssignColorUserTest extends Base public function testWithWrongUser() { - $projectModel = new Project($this->container); - $taskCreationModel = new TaskCreation($this->container); + $projectModel = new ProjectModel($this->container); + $taskCreationModel = new TaskCreationModel($this->container); $this->assertEquals(1, $projectModel->create(array('name' => 'test1'))); $this->assertEquals(1, $taskCreationModel->create(array('project_id' => 1, 'title' => 'test'))); @@ -49,6 +49,6 @@ class TaskAssignColorUserTest extends Base $action->setParam('color_id', 'red'); $action->setParam('user_id', 1); - $this->assertFalse($action->execute($event, Task::EVENT_ASSIGNEE_CHANGE)); + $this->assertFalse($action->execute($event, TaskModel::EVENT_ASSIGNEE_CHANGE)); } } diff --git a/tests/units/Action/TaskAssignCurrentUserColumnTest.php b/tests/units/Action/TaskAssignCurrentUserColumnTest.php index a741076b..6fdbda63 100644 --- a/tests/units/Action/TaskAssignCurrentUserColumnTest.php +++ b/tests/units/Action/TaskAssignCurrentUserColumnTest.php @@ -3,10 +3,10 @@ require_once __DIR__.'/../Base.php'; use Kanboard\Event\GenericEvent; -use Kanboard\Model\TaskCreation; -use Kanboard\Model\TaskFinder; -use Kanboard\Model\Project; -use Kanboard\Model\Task; +use Kanboard\Model\TaskCreationModel; +use Kanboard\Model\TaskFinderModel; +use Kanboard\Model\ProjectModel; +use Kanboard\Model\TaskModel; use Kanboard\Action\TaskAssignCurrentUserColumn; class TaskAssignCurrentUserColumnTest extends Base @@ -15,9 +15,9 @@ class TaskAssignCurrentUserColumnTest extends Base { $this->container['sessionStorage']->user = array('id' => 1); - $projectModel = new Project($this->container); - $taskCreationModel = new TaskCreation($this->container); - $taskFinderModel = new TaskFinder($this->container); + $projectModel = new ProjectModel($this->container); + $taskCreationModel = new TaskCreationModel($this->container); + $taskFinderModel = new TaskFinderModel($this->container); $this->assertEquals(1, $projectModel->create(array('name' => 'test1'))); $this->assertEquals(1, $taskCreationModel->create(array('project_id' => 1, 'title' => 'test'))); @@ -28,7 +28,7 @@ class TaskAssignCurrentUserColumnTest extends Base $action->setProjectId(1); $action->setParam('column_id', 2); - $this->assertTrue($action->execute($event, Task::EVENT_MOVE_COLUMN)); + $this->assertTrue($action->execute($event, TaskModel::EVENT_MOVE_COLUMN)); $task = $taskFinderModel->getById(1); $this->assertNotEmpty($task); @@ -39,8 +39,8 @@ class TaskAssignCurrentUserColumnTest extends Base { $this->container['sessionStorage']->user = array('id' => 1); - $projectModel = new Project($this->container); - $taskCreationModel = new TaskCreation($this->container); + $projectModel = new ProjectModel($this->container); + $taskCreationModel = new TaskCreationModel($this->container); $this->assertEquals(1, $projectModel->create(array('name' => 'test1'))); $this->assertEquals(1, $taskCreationModel->create(array('project_id' => 1, 'title' => 'test'))); @@ -51,13 +51,13 @@ class TaskAssignCurrentUserColumnTest extends Base $action->setProjectId(1); $action->setParam('column_id', 2); - $this->assertFalse($action->execute($event, Task::EVENT_MOVE_COLUMN)); + $this->assertFalse($action->execute($event, TaskModel::EVENT_MOVE_COLUMN)); } public function testWithNoUserSession() { - $projectModel = new Project($this->container); - $taskCreationModel = new TaskCreation($this->container); + $projectModel = new ProjectModel($this->container); + $taskCreationModel = new TaskCreationModel($this->container); $this->assertEquals(1, $projectModel->create(array('name' => 'test1'))); $this->assertEquals(1, $taskCreationModel->create(array('project_id' => 1, 'title' => 'test'))); @@ -68,6 +68,6 @@ class TaskAssignCurrentUserColumnTest extends Base $action->setProjectId(1); $action->setParam('column_id', 2); - $this->assertFalse($action->execute($event, Task::EVENT_MOVE_COLUMN)); + $this->assertFalse($action->execute($event, TaskModel::EVENT_MOVE_COLUMN)); } } diff --git a/tests/units/Action/TaskAssignCurrentUserTest.php b/tests/units/Action/TaskAssignCurrentUserTest.php index 2f4b235f..5569a191 100644 --- a/tests/units/Action/TaskAssignCurrentUserTest.php +++ b/tests/units/Action/TaskAssignCurrentUserTest.php @@ -3,10 +3,10 @@ require_once __DIR__.'/../Base.php'; use Kanboard\Event\GenericEvent; -use Kanboard\Model\TaskCreation; -use Kanboard\Model\TaskFinder; -use Kanboard\Model\Project; -use Kanboard\Model\Task; +use Kanboard\Model\TaskCreationModel; +use Kanboard\Model\TaskFinderModel; +use Kanboard\Model\ProjectModel; +use Kanboard\Model\TaskModel; use Kanboard\Action\TaskAssignCurrentUser; class TaskAssignCurrentUserTest extends Base @@ -15,9 +15,9 @@ class TaskAssignCurrentUserTest extends Base { $this->container['sessionStorage']->user = array('id' => 1); - $projectModel = new Project($this->container); - $taskCreationModel = new TaskCreation($this->container); - $taskFinderModel = new TaskFinder($this->container); + $projectModel = new ProjectModel($this->container); + $taskCreationModel = new TaskCreationModel($this->container); + $taskFinderModel = new TaskFinderModel($this->container); $this->assertEquals(1, $projectModel->create(array('name' => 'test1'))); $this->assertEquals(1, $taskCreationModel->create(array('project_id' => 1, 'title' => 'test'))); @@ -27,7 +27,7 @@ class TaskAssignCurrentUserTest extends Base $action = new TaskAssignCurrentUser($this->container); $action->setProjectId(1); - $this->assertTrue($action->execute($event, Task::EVENT_CREATE)); + $this->assertTrue($action->execute($event, TaskModel::EVENT_CREATE)); $task = $taskFinderModel->getById(1); $this->assertNotEmpty($task); @@ -36,8 +36,8 @@ class TaskAssignCurrentUserTest extends Base public function testWithNoUserSession() { - $projectModel = new Project($this->container); - $taskCreationModel = new TaskCreation($this->container); + $projectModel = new ProjectModel($this->container); + $taskCreationModel = new TaskCreationModel($this->container); $this->assertEquals(1, $projectModel->create(array('name' => 'test1'))); $this->assertEquals(1, $taskCreationModel->create(array('project_id' => 1, 'title' => 'test'))); @@ -47,6 +47,6 @@ class TaskAssignCurrentUserTest extends Base $action = new TaskAssignCurrentUser($this->container); $action->setProjectId(1); - $this->assertFalse($action->execute($event, Task::EVENT_CREATE)); + $this->assertFalse($action->execute($event, TaskModel::EVENT_CREATE)); } } diff --git a/tests/units/Action/TaskAssignSpecificUserTest.php b/tests/units/Action/TaskAssignSpecificUserTest.php index 7741e983..78ec314f 100644 --- a/tests/units/Action/TaskAssignSpecificUserTest.php +++ b/tests/units/Action/TaskAssignSpecificUserTest.php @@ -3,19 +3,19 @@ require_once __DIR__.'/../Base.php'; use Kanboard\Event\GenericEvent; -use Kanboard\Model\TaskCreation; -use Kanboard\Model\TaskFinder; -use Kanboard\Model\Project; -use Kanboard\Model\Task; +use Kanboard\Model\TaskCreationModel; +use Kanboard\Model\TaskFinderModel; +use Kanboard\Model\ProjectModel; +use Kanboard\Model\TaskModel; use Kanboard\Action\TaskAssignSpecificUser; class TaskAssignSpecificUserTest extends Base { public function testChangeUser() { - $projectModel = new Project($this->container); - $taskCreationModel = new TaskCreation($this->container); - $taskFinderModel = new TaskFinder($this->container); + $projectModel = new ProjectModel($this->container); + $taskCreationModel = new TaskCreationModel($this->container); + $taskFinderModel = new TaskFinderModel($this->container); $this->assertEquals(1, $projectModel->create(array('name' => 'test1'))); $this->assertEquals(1, $taskCreationModel->create(array('project_id' => 1, 'title' => 'test', 'owner_id' => 0))); @@ -27,7 +27,7 @@ class TaskAssignSpecificUserTest extends Base $action->setParam('column_id', 2); $action->setParam('user_id', 1); - $this->assertTrue($action->execute($event, Task::EVENT_MOVE_COLUMN)); + $this->assertTrue($action->execute($event, TaskModel::EVENT_MOVE_COLUMN)); $task = $taskFinderModel->getById(1); $this->assertNotEmpty($task); @@ -36,8 +36,8 @@ class TaskAssignSpecificUserTest extends Base public function testWithWrongColumn() { - $projectModel = new Project($this->container); - $taskCreationModel = new TaskCreation($this->container); + $projectModel = new ProjectModel($this->container); + $taskCreationModel = new TaskCreationModel($this->container); $this->assertEquals(1, $projectModel->create(array('name' => 'test1'))); $this->assertEquals(1, $taskCreationModel->create(array('project_id' => 1, 'title' => 'test'))); @@ -49,6 +49,6 @@ class TaskAssignSpecificUserTest extends Base $action->setParam('column_id', 2); $action->setParam('user_id', 1); - $this->assertFalse($action->execute($event, Task::EVENT_MOVE_COLUMN)); + $this->assertFalse($action->execute($event, TaskModel::EVENT_MOVE_COLUMN)); } } diff --git a/tests/units/Action/TaskAssignUserTest.php b/tests/units/Action/TaskAssignUserTest.php index d723ed2b..060128eb 100644 --- a/tests/units/Action/TaskAssignUserTest.php +++ b/tests/units/Action/TaskAssignUserTest.php @@ -3,11 +3,11 @@ require_once __DIR__.'/../Base.php'; use Kanboard\Event\GenericEvent; -use Kanboard\Model\TaskCreation; -use Kanboard\Model\TaskFinder; -use Kanboard\Model\Project; -use Kanboard\Model\ProjectUserRole; -use Kanboard\Model\User; +use Kanboard\Model\TaskCreationModel; +use Kanboard\Model\TaskFinderModel; +use Kanboard\Model\ProjectModel; +use Kanboard\Model\ProjectUserRoleModel; +use Kanboard\Model\UserModel; use Kanboard\Action\TaskAssignUser; use Kanboard\Core\Security\Role; @@ -15,11 +15,11 @@ class TaskAssignUserTest extends Base { public function testChangeUser() { - $userModel = new User($this->container); - $projectModel = new Project($this->container); - $projectUserRoleModel = new ProjectUserRole($this->container); - $taskCreationModel = new TaskCreation($this->container); - $taskFinderModel = new TaskFinder($this->container); + $userModel = new UserModel($this->container); + $projectModel = new ProjectModel($this->container); + $projectUserRoleModel = new ProjectUserRoleModel($this->container); + $taskCreationModel = new TaskCreationModel($this->container); + $taskFinderModel = new TaskFinderModel($this->container); $this->assertEquals(1, $projectModel->create(array('name' => 'test1'))); $this->assertEquals(1, $taskCreationModel->create(array('project_id' => 1, 'title' => 'test', 'owner_id' => 0))); @@ -41,8 +41,8 @@ class TaskAssignUserTest extends Base public function testWithNotAssignableUser() { - $projectModel = new Project($this->container); - $taskCreationModel = new TaskCreation($this->container); + $projectModel = new ProjectModel($this->container); + $taskCreationModel = new TaskCreationModel($this->container); $this->assertEquals(1, $projectModel->create(array('name' => 'test1'))); $this->assertEquals(1, $taskCreationModel->create(array('project_id' => 1, 'title' => 'test'))); diff --git a/tests/units/Action/TaskCloseColumnTest.php b/tests/units/Action/TaskCloseColumnTest.php index 654aeec1..f9a938f0 100644 --- a/tests/units/Action/TaskCloseColumnTest.php +++ b/tests/units/Action/TaskCloseColumnTest.php @@ -3,19 +3,19 @@ require_once __DIR__.'/../Base.php'; use Kanboard\Event\GenericEvent; -use Kanboard\Model\TaskCreation; -use Kanboard\Model\TaskFinder; -use Kanboard\Model\Project; -use Kanboard\Model\Task; +use Kanboard\Model\TaskCreationModel; +use Kanboard\Model\TaskFinderModel; +use Kanboard\Model\ProjectModel; +use Kanboard\Model\TaskModel; use Kanboard\Action\TaskCloseColumn; class TaskCloseColumnTest extends Base { public function testClose() { - $projectModel = new Project($this->container); - $taskCreationModel = new TaskCreation($this->container); - $taskFinderModel = new TaskFinder($this->container); + $projectModel = new ProjectModel($this->container); + $taskCreationModel = new TaskCreationModel($this->container); + $taskFinderModel = new TaskFinderModel($this->container); $this->assertEquals(1, $projectModel->create(array('name' => 'test1'))); $this->assertEquals(1, $taskCreationModel->create(array('project_id' => 1, 'title' => 'test'))); @@ -26,7 +26,7 @@ class TaskCloseColumnTest extends Base $action->setProjectId(1); $action->setParam('column_id', 2); - $this->assertTrue($action->execute($event, Task::EVENT_MOVE_COLUMN)); + $this->assertTrue($action->execute($event, TaskModel::EVENT_MOVE_COLUMN)); $task = $taskFinderModel->getById(1); $this->assertNotEmpty($task); @@ -35,8 +35,8 @@ class TaskCloseColumnTest extends Base public function testWithWrongColumn() { - $projectModel = new Project($this->container); - $taskCreationModel = new TaskCreation($this->container); + $projectModel = new ProjectModel($this->container); + $taskCreationModel = new TaskCreationModel($this->container); $this->assertEquals(1, $projectModel->create(array('name' => 'test1'))); $this->assertEquals(1, $taskCreationModel->create(array('project_id' => 1, 'title' => 'test'))); @@ -47,6 +47,6 @@ class TaskCloseColumnTest extends Base $action->setProjectId(1); $action->setParam('column_id', 2); - $this->assertFalse($action->execute($event, Task::EVENT_MOVE_COLUMN)); + $this->assertFalse($action->execute($event, TaskModel::EVENT_MOVE_COLUMN)); } } diff --git a/tests/units/Action/TaskCloseNoActivityTest.php b/tests/units/Action/TaskCloseNoActivityTest.php index b6e04c47..707d8585 100644 --- a/tests/units/Action/TaskCloseNoActivityTest.php +++ b/tests/units/Action/TaskCloseNoActivityTest.php @@ -3,25 +3,25 @@ require_once __DIR__.'/../Base.php'; use Kanboard\Event\TaskListEvent; -use Kanboard\Model\TaskCreation; -use Kanboard\Model\TaskFinder; -use Kanboard\Model\Project; -use Kanboard\Model\Task; +use Kanboard\Model\TaskCreationModel; +use Kanboard\Model\TaskFinderModel; +use Kanboard\Model\ProjectModel; +use Kanboard\Model\TaskModel; use Kanboard\Action\TaskCloseNoActivity; class TaskCloseNoActivityTest extends Base { public function testClose() { - $projectModel = new Project($this->container); - $taskCreationModel = new TaskCreation($this->container); - $taskFinderModel = new TaskFinder($this->container); + $projectModel = new ProjectModel($this->container); + $taskCreationModel = new TaskCreationModel($this->container); + $taskFinderModel = new TaskFinderModel($this->container); $this->assertEquals(1, $projectModel->create(array('name' => 'test1'))); $this->assertEquals(1, $taskCreationModel->create(array('project_id' => 1, 'title' => 'test'))); $this->assertEquals(2, $taskCreationModel->create(array('project_id' => 1, 'title' => 'test'))); - $this->container['db']->table(Task::TABLE)->eq('id', 1)->update(array('date_modification' => strtotime('-10days'))); + $this->container['db']->table(TaskModel::TABLE)->eq('id', 1)->update(array('date_modification' => strtotime('-10days'))); $tasks = $taskFinderModel->getAll(1); $event = new TaskListEvent(array('tasks' => $tasks, 'project_id' => 1)); @@ -30,7 +30,7 @@ class TaskCloseNoActivityTest extends Base $action->setProjectId(1); $action->setParam('duration', 2); - $this->assertTrue($action->execute($event, Task::EVENT_DAILY_CRONJOB)); + $this->assertTrue($action->execute($event, TaskModel::EVENT_DAILY_CRONJOB)); $task = $taskFinderModel->getById(1); $this->assertNotEmpty($task); diff --git a/tests/units/Action/TaskCloseTest.php b/tests/units/Action/TaskCloseTest.php index 536d79ca..3df10cb8 100644 --- a/tests/units/Action/TaskCloseTest.php +++ b/tests/units/Action/TaskCloseTest.php @@ -3,18 +3,18 @@ require_once __DIR__.'/../Base.php'; use Kanboard\Event\GenericEvent; -use Kanboard\Model\TaskCreation; -use Kanboard\Model\TaskFinder; -use Kanboard\Model\Project; +use Kanboard\Model\TaskCreationModel; +use Kanboard\Model\TaskFinderModel; +use Kanboard\Model\ProjectModel; use Kanboard\Action\TaskClose; class TaskCloseTest extends Base { public function testClose() { - $projectModel = new Project($this->container); - $taskCreationModel = new TaskCreation($this->container); - $taskFinderModel = new TaskFinder($this->container); + $projectModel = new ProjectModel($this->container); + $taskCreationModel = new TaskCreationModel($this->container); + $taskFinderModel = new TaskFinderModel($this->container); $this->assertEquals(1, $projectModel->create(array('name' => 'test1'))); $this->assertEquals(1, $taskCreationModel->create(array('project_id' => 1, 'title' => 'test'))); @@ -34,8 +34,8 @@ class TaskCloseTest extends Base public function testWithNoTaskId() { - $projectModel = new Project($this->container); - $taskCreationModel = new TaskCreation($this->container); + $projectModel = new ProjectModel($this->container); + $taskCreationModel = new TaskCreationModel($this->container); $this->assertEquals(1, $projectModel->create(array('name' => 'test1'))); $this->assertEquals(1, $taskCreationModel->create(array('project_id' => 1, 'title' => 'test'))); diff --git a/tests/units/Action/TaskCreationTest.php b/tests/units/Action/TaskCreationTest.php index 57a3ee46..fb3d334f 100644 --- a/tests/units/Action/TaskCreationTest.php +++ b/tests/units/Action/TaskCreationTest.php @@ -3,16 +3,16 @@ require_once __DIR__.'/../Base.php'; use Kanboard\Event\GenericEvent; -use Kanboard\Model\TaskFinder; -use Kanboard\Model\Project; +use Kanboard\Model\TaskFinderModel; +use Kanboard\Model\ProjectModel; use Kanboard\Action\TaskCreation as TaskCreationAction; class TaskCreationActionTest extends Base { public function testSuccess() { - $projectModel = new Project($this->container); - $taskFinderModel = new TaskFinder($this->container); + $projectModel = new ProjectModel($this->container); + $taskFinderModel = new TaskFinderModel($this->container); $this->assertEquals(1, $projectModel->create(array('name' => 'test1'))); @@ -33,7 +33,7 @@ class TaskCreationActionTest extends Base public function testWithNoTitle() { - $projectModel = new Project($this->container); + $projectModel = new ProjectModel($this->container); $this->assertEquals(1, $projectModel->create(array('name' => 'test1'))); diff --git a/tests/units/Action/TaskDuplicateAnotherProjectTest.php b/tests/units/Action/TaskDuplicateAnotherProjectTest.php index d5f99ec9..98ff187f 100644 --- a/tests/units/Action/TaskDuplicateAnotherProjectTest.php +++ b/tests/units/Action/TaskDuplicateAnotherProjectTest.php @@ -3,19 +3,19 @@ require_once __DIR__.'/../Base.php'; use Kanboard\Event\GenericEvent; -use Kanboard\Model\Task; -use Kanboard\Model\TaskFinder; -use Kanboard\Model\TaskCreation; -use Kanboard\Model\Project; +use Kanboard\Model\TaskModel; +use Kanboard\Model\TaskFinderModel; +use Kanboard\Model\TaskCreationModel; +use Kanboard\Model\ProjectModel; use Kanboard\Action\TaskDuplicateAnotherProject; class TaskDuplicateAnotherProjectTest extends Base { public function testSuccess() { - $projectModel = new Project($this->container); - $taskCreationModel = new TaskCreation($this->container); - $taskFinderModel = new TaskFinder($this->container); + $projectModel = new ProjectModel($this->container); + $taskCreationModel = new TaskCreationModel($this->container); + $taskFinderModel = new TaskFinderModel($this->container); $this->assertEquals(1, $projectModel->create(array('name' => 'test1'))); $this->assertEquals(2, $projectModel->create(array('name' => 'test2'))); @@ -28,7 +28,7 @@ class TaskDuplicateAnotherProjectTest extends Base $action->setParam('project_id', 2); $action->setParam('column_id', 2); - $this->assertTrue($action->execute($event, Task::EVENT_CLOSE)); + $this->assertTrue($action->execute($event, TaskModel::EVENT_CLOSE)); $task = $taskFinderModel->getById(2); $this->assertNotEmpty($task); @@ -38,7 +38,7 @@ class TaskDuplicateAnotherProjectTest extends Base public function testWithWrongColumn() { - $projectModel = new Project($this->container); + $projectModel = new ProjectModel($this->container); $this->assertEquals(1, $projectModel->create(array('name' => 'test1'))); $this->assertEquals(2, $projectModel->create(array('name' => 'test2'))); @@ -50,6 +50,6 @@ class TaskDuplicateAnotherProjectTest extends Base $action->setParam('project_id', 2); $action->setParam('column_id', 2); - $this->assertFalse($action->execute($event, Task::EVENT_CLOSE)); + $this->assertFalse($action->execute($event, TaskModel::EVENT_CLOSE)); } } diff --git a/tests/units/Action/TaskEmailNoActivityTest.php b/tests/units/Action/TaskEmailNoActivityTest.php index af4baed5..c4d489d8 100644 --- a/tests/units/Action/TaskEmailNoActivityTest.php +++ b/tests/units/Action/TaskEmailNoActivityTest.php @@ -3,28 +3,28 @@ require_once __DIR__.'/../Base.php'; use Kanboard\Event\TaskListEvent; -use Kanboard\Model\TaskCreation; -use Kanboard\Model\TaskFinder; -use Kanboard\Model\Project; -use Kanboard\Model\Task; -use Kanboard\Model\User; +use Kanboard\Model\TaskCreationModel; +use Kanboard\Model\TaskFinderModel; +use Kanboard\Model\ProjectModel; +use Kanboard\Model\TaskModel; +use Kanboard\Model\UserModel; use Kanboard\Action\TaskEmailNoActivity; class TaskEmailNoActivityTest extends Base { public function testSendEmail() { - $userModel = new User($this->container); - $projectModel = new Project($this->container); - $taskCreationModel = new TaskCreation($this->container); - $taskFinderModel = new TaskFinder($this->container); + $userModel = new UserModel($this->container); + $projectModel = new ProjectModel($this->container); + $taskCreationModel = new TaskCreationModel($this->container); + $taskFinderModel = new TaskFinderModel($this->container); $this->assertEquals(2, $userModel->create(array('username' => 'test', 'email' => 'chuck@norris', 'name' => 'Chuck Norris'))); $this->assertEquals(1, $projectModel->create(array('name' => 'test1'))); $this->assertEquals(1, $taskCreationModel->create(array('project_id' => 1, 'title' => 'test'))); $this->assertEquals(2, $taskCreationModel->create(array('project_id' => 1, 'title' => 'test'))); - $this->container['db']->table(Task::TABLE)->eq('id', 1)->update(array('date_modification' => strtotime('-10days'))); + $this->container['db']->table(TaskModel::TABLE)->eq('id', 1)->update(array('date_modification' => strtotime('-10days'))); $tasks = $taskFinderModel->getAll(1); $event = new TaskListEvent(array('tasks' => $tasks, 'project_id' => 1)); @@ -40,22 +40,22 @@ class TaskEmailNoActivityTest extends Base ->method('send') ->with('chuck@norris', 'Chuck Norris', 'Old tasks', $this->anything()); - $this->assertTrue($action->execute($event, Task::EVENT_DAILY_CRONJOB)); + $this->assertTrue($action->execute($event, TaskModel::EVENT_DAILY_CRONJOB)); } public function testUserWithNoEmail() { - $userModel = new User($this->container); - $projectModel = new Project($this->container); - $taskCreationModel = new TaskCreation($this->container); - $taskFinderModel = new TaskFinder($this->container); + $userModel = new UserModel($this->container); + $projectModel = new ProjectModel($this->container); + $taskCreationModel = new TaskCreationModel($this->container); + $taskFinderModel = new TaskFinderModel($this->container); $this->assertEquals(2, $userModel->create(array('username' => 'test', 'name' => 'Chuck Norris'))); $this->assertEquals(1, $projectModel->create(array('name' => 'test1'))); $this->assertEquals(1, $taskCreationModel->create(array('project_id' => 1, 'title' => 'test'))); $this->assertEquals(2, $taskCreationModel->create(array('project_id' => 1, 'title' => 'test'))); - $this->container['db']->table(Task::TABLE)->eq('id', 1)->update(array('date_modification' => strtotime('-10days'))); + $this->container['db']->table(TaskModel::TABLE)->eq('id', 1)->update(array('date_modification' => strtotime('-10days'))); $tasks = $taskFinderModel->getAll(1); $event = new TaskListEvent(array('tasks' => $tasks, 'project_id' => 1)); @@ -70,15 +70,15 @@ class TaskEmailNoActivityTest extends Base ->expects($this->never()) ->method('send'); - $this->assertFalse($action->execute($event, Task::EVENT_DAILY_CRONJOB)); + $this->assertFalse($action->execute($event, TaskModel::EVENT_DAILY_CRONJOB)); } public function testTooRecent() { - $userModel = new User($this->container); - $projectModel = new Project($this->container); - $taskCreationModel = new TaskCreation($this->container); - $taskFinderModel = new TaskFinder($this->container); + $userModel = new UserModel($this->container); + $projectModel = new ProjectModel($this->container); + $taskCreationModel = new TaskCreationModel($this->container); + $taskFinderModel = new TaskFinderModel($this->container); $this->assertEquals(2, $userModel->create(array('username' => 'test', 'email' => 'chuck@norris', 'name' => 'Chuck Norris'))); $this->assertEquals(1, $projectModel->create(array('name' => 'test1'))); @@ -98,6 +98,6 @@ class TaskEmailNoActivityTest extends Base ->expects($this->never()) ->method('send'); - $this->assertFalse($action->execute($event, Task::EVENT_DAILY_CRONJOB)); + $this->assertFalse($action->execute($event, TaskModel::EVENT_DAILY_CRONJOB)); } } diff --git a/tests/units/Action/TaskEmailTest.php b/tests/units/Action/TaskEmailTest.php index 93b7b559..df71aaf8 100644 --- a/tests/units/Action/TaskEmailTest.php +++ b/tests/units/Action/TaskEmailTest.php @@ -3,19 +3,19 @@ require_once __DIR__.'/../Base.php'; use Kanboard\Event\GenericEvent; -use Kanboard\Model\Task; -use Kanboard\Model\TaskCreation; -use Kanboard\Model\Project; -use Kanboard\Model\User; +use Kanboard\Model\TaskModel; +use Kanboard\Model\TaskCreationModel; +use Kanboard\Model\ProjectModel; +use Kanboard\Model\UserModel; use Kanboard\Action\TaskEmail; class TaskEmailTest extends Base { public function testSuccess() { - $userModel = new User($this->container); - $projectModel = new Project($this->container); - $taskCreationModel = new TaskCreation($this->container); + $userModel = new UserModel($this->container); + $projectModel = new ProjectModel($this->container); + $taskCreationModel = new TaskCreationModel($this->container); $this->assertEquals(1, $projectModel->create(array('name' => 'test1'))); $this->assertEquals(1, $taskCreationModel->create(array('project_id' => 1, 'title' => 'test'))); @@ -38,12 +38,12 @@ class TaskEmailTest extends Base $this->stringContains('test') ); - $this->assertTrue($action->execute($event, Task::EVENT_CLOSE)); + $this->assertTrue($action->execute($event, TaskModel::EVENT_CLOSE)); } public function testWithWrongColumn() { - $projectModel = new Project($this->container); + $projectModel = new ProjectModel($this->container); $this->assertEquals(1, $projectModel->create(array('name' => 'test1'))); @@ -55,6 +55,6 @@ class TaskEmailTest extends Base $action->setParam('user_id', 1); $action->setParam('subject', 'My email subject'); - $this->assertFalse($action->execute($event, Task::EVENT_CLOSE)); + $this->assertFalse($action->execute($event, TaskModel::EVENT_CLOSE)); } } diff --git a/tests/units/Action/TaskMoveAnotherProjectTest.php b/tests/units/Action/TaskMoveAnotherProjectTest.php index ec48f0a4..d36df47b 100644 --- a/tests/units/Action/TaskMoveAnotherProjectTest.php +++ b/tests/units/Action/TaskMoveAnotherProjectTest.php @@ -3,19 +3,19 @@ require_once __DIR__.'/../Base.php'; use Kanboard\Event\GenericEvent; -use Kanboard\Model\Task; -use Kanboard\Model\TaskFinder; -use Kanboard\Model\TaskCreation; -use Kanboard\Model\Project; +use Kanboard\Model\TaskModel; +use Kanboard\Model\TaskFinderModel; +use Kanboard\Model\TaskCreationModel; +use Kanboard\Model\ProjectModel; use Kanboard\Action\TaskMoveAnotherProject; class TaskMoveAnotherProjectTest extends Base { public function testSuccess() { - $projectModel = new Project($this->container); - $taskCreationModel = new TaskCreation($this->container); - $taskFinderModel = new TaskFinder($this->container); + $projectModel = new ProjectModel($this->container); + $taskCreationModel = new TaskCreationModel($this->container); + $taskFinderModel = new TaskFinderModel($this->container); $this->assertEquals(1, $projectModel->create(array('name' => 'test1'))); $this->assertEquals(2, $projectModel->create(array('name' => 'test2'))); @@ -28,7 +28,7 @@ class TaskMoveAnotherProjectTest extends Base $action->setParam('project_id', 2); $action->setParam('column_id', 2); - $this->assertTrue($action->execute($event, Task::EVENT_CLOSE)); + $this->assertTrue($action->execute($event, TaskModel::EVENT_CLOSE)); $task = $taskFinderModel->getById(1); $this->assertNotEmpty($task); @@ -39,7 +39,7 @@ class TaskMoveAnotherProjectTest extends Base public function testWithWrongColumn() { - $projectModel = new Project($this->container); + $projectModel = new ProjectModel($this->container); $this->assertEquals(1, $projectModel->create(array('name' => 'test1'))); $this->assertEquals(2, $projectModel->create(array('name' => 'test2'))); @@ -51,6 +51,6 @@ class TaskMoveAnotherProjectTest extends Base $action->setParam('project_id', 2); $action->setParam('column_id', 2); - $this->assertFalse($action->execute($event, Task::EVENT_CLOSE)); + $this->assertFalse($action->execute($event, TaskModel::EVENT_CLOSE)); } } diff --git a/tests/units/Action/TaskMoveColumnAssignedTest.php b/tests/units/Action/TaskMoveColumnAssignedTest.php index 3b325505..f8982969 100644 --- a/tests/units/Action/TaskMoveColumnAssignedTest.php +++ b/tests/units/Action/TaskMoveColumnAssignedTest.php @@ -3,19 +3,19 @@ require_once __DIR__.'/../Base.php'; use Kanboard\Event\GenericEvent; -use Kanboard\Model\Task; -use Kanboard\Model\TaskFinder; -use Kanboard\Model\TaskCreation; -use Kanboard\Model\Project; +use Kanboard\Model\TaskModel; +use Kanboard\Model\TaskFinderModel; +use Kanboard\Model\TaskCreationModel; +use Kanboard\Model\ProjectModel; use Kanboard\Action\TaskMoveColumnAssigned; class TaskMoveColumnAssignedTest extends Base { public function testSuccess() { - $projectModel = new Project($this->container); - $taskCreationModel = new TaskCreation($this->container); - $taskFinderModel = new TaskFinder($this->container); + $projectModel = new ProjectModel($this->container); + $taskCreationModel = new TaskCreationModel($this->container); + $taskFinderModel = new TaskFinderModel($this->container); $this->assertEquals(1, $projectModel->create(array('name' => 'test1'))); $this->assertEquals(2, $projectModel->create(array('name' => 'test2'))); @@ -28,7 +28,7 @@ class TaskMoveColumnAssignedTest extends Base $action->setParam('src_column_id', 1); $action->setParam('dest_column_id', 2); - $this->assertTrue($action->execute($event, Task::EVENT_ASSIGNEE_CHANGE)); + $this->assertTrue($action->execute($event, TaskModel::EVENT_ASSIGNEE_CHANGE)); $task = $taskFinderModel->getById(1); $this->assertNotEmpty($task); @@ -38,7 +38,7 @@ class TaskMoveColumnAssignedTest extends Base public function testWithWrongColumn() { - $projectModel = new Project($this->container); + $projectModel = new ProjectModel($this->container); $this->assertEquals(1, $projectModel->create(array('name' => 'test1'))); $this->assertEquals(2, $projectModel->create(array('name' => 'test2'))); @@ -50,6 +50,6 @@ class TaskMoveColumnAssignedTest extends Base $action->setParam('src_column_id', 1); $action->setParam('dest_column_id', 2); - $this->assertFalse($action->execute($event, Task::EVENT_ASSIGNEE_CHANGE)); + $this->assertFalse($action->execute($event, TaskModel::EVENT_ASSIGNEE_CHANGE)); } } diff --git a/tests/units/Action/TaskMoveColumnCategoryChangeTest.php b/tests/units/Action/TaskMoveColumnCategoryChangeTest.php index 8783c679..c42383f8 100644 --- a/tests/units/Action/TaskMoveColumnCategoryChangeTest.php +++ b/tests/units/Action/TaskMoveColumnCategoryChangeTest.php @@ -3,21 +3,21 @@ require_once __DIR__.'/../Base.php'; use Kanboard\Event\GenericEvent; -use Kanboard\Model\Category; -use Kanboard\Model\Task; -use Kanboard\Model\TaskFinder; -use Kanboard\Model\TaskCreation; -use Kanboard\Model\Project; +use Kanboard\Model\CategoryModel; +use Kanboard\Model\TaskModel; +use Kanboard\Model\TaskFinderModel; +use Kanboard\Model\TaskCreationModel; +use Kanboard\Model\ProjectModel; use Kanboard\Action\TaskMoveColumnCategoryChange; class TaskMoveColumnCategoryChangeTest extends Base { public function testSuccess() { - $projectModel = new Project($this->container); - $taskCreationModel = new TaskCreation($this->container); - $taskFinderModel = new TaskFinder($this->container); - $categoryModel = new Category($this->container); + $projectModel = new ProjectModel($this->container); + $taskCreationModel = new TaskCreationModel($this->container); + $taskFinderModel = new TaskFinderModel($this->container); + $categoryModel = new CategoryModel($this->container); $this->assertEquals(1, $projectModel->create(array('name' => 'test1'))); $this->assertEquals(2, $projectModel->create(array('name' => 'test2'))); @@ -31,7 +31,7 @@ class TaskMoveColumnCategoryChangeTest extends Base $action->setParam('category_id', 1); $action->setParam('dest_column_id', 2); - $this->assertTrue($action->execute($event, Task::EVENT_UPDATE)); + $this->assertTrue($action->execute($event, TaskModel::EVENT_UPDATE)); $task = $taskFinderModel->getById(1); $this->assertNotEmpty($task); @@ -41,9 +41,9 @@ class TaskMoveColumnCategoryChangeTest extends Base public function testWithWrongColumn() { - $projectModel = new Project($this->container); - $taskCreationModel = new TaskCreation($this->container); - $categoryModel = new Category($this->container); + $projectModel = new ProjectModel($this->container); + $taskCreationModel = new TaskCreationModel($this->container); + $categoryModel = new CategoryModel($this->container); $this->assertEquals(1, $projectModel->create(array('name' => 'test1'))); $this->assertEquals(2, $projectModel->create(array('name' => 'test2'))); @@ -57,14 +57,14 @@ class TaskMoveColumnCategoryChangeTest extends Base $action->setParam('category_id', 1); $action->setParam('dest_column_id', 2); - $this->assertFalse($action->execute($event, Task::EVENT_UPDATE)); + $this->assertFalse($action->execute($event, TaskModel::EVENT_UPDATE)); } public function testWithWrongCategory() { - $projectModel = new Project($this->container); - $taskCreationModel = new TaskCreation($this->container); - $categoryModel = new Category($this->container); + $projectModel = new ProjectModel($this->container); + $taskCreationModel = new TaskCreationModel($this->container); + $categoryModel = new CategoryModel($this->container); $this->assertEquals(1, $projectModel->create(array('name' => 'test1'))); $this->assertEquals(2, $projectModel->create(array('name' => 'test2'))); @@ -79,6 +79,6 @@ class TaskMoveColumnCategoryChangeTest extends Base $action->setParam('category_id', 1); $action->setParam('dest_column_id', 2); - $this->assertFalse($action->execute($event, Task::EVENT_UPDATE)); + $this->assertFalse($action->execute($event, TaskModel::EVENT_UPDATE)); } } diff --git a/tests/units/Action/TaskMoveColumnUnAssignedTest.php b/tests/units/Action/TaskMoveColumnUnAssignedTest.php index cf2333cc..befae36b 100644 --- a/tests/units/Action/TaskMoveColumnUnAssignedTest.php +++ b/tests/units/Action/TaskMoveColumnUnAssignedTest.php @@ -3,19 +3,19 @@ require_once __DIR__.'/../Base.php'; use Kanboard\Event\GenericEvent; -use Kanboard\Model\Task; -use Kanboard\Model\TaskFinder; -use Kanboard\Model\TaskCreation; -use Kanboard\Model\Project; +use Kanboard\Model\TaskModel; +use Kanboard\Model\TaskFinderModel; +use Kanboard\Model\TaskCreationModel; +use Kanboard\Model\ProjectModel; use Kanboard\Action\TaskMoveColumnUnAssigned; class TaskMoveColumnUnAssignedTest extends Base { public function testSuccess() { - $projectModel = new Project($this->container); - $taskCreationModel = new TaskCreation($this->container); - $taskFinderModel = new TaskFinder($this->container); + $projectModel = new ProjectModel($this->container); + $taskCreationModel = new TaskCreationModel($this->container); + $taskFinderModel = new TaskFinderModel($this->container); $this->assertEquals(1, $projectModel->create(array('name' => 'test1'))); $this->assertEquals(2, $projectModel->create(array('name' => 'test2'))); @@ -28,7 +28,7 @@ class TaskMoveColumnUnAssignedTest extends Base $action->setParam('src_column_id', 1); $action->setParam('dest_column_id', 2); - $this->assertTrue($action->execute($event, Task::EVENT_ASSIGNEE_CHANGE)); + $this->assertTrue($action->execute($event, TaskModel::EVENT_ASSIGNEE_CHANGE)); $task = $taskFinderModel->getById(1); $this->assertNotEmpty($task); @@ -38,7 +38,7 @@ class TaskMoveColumnUnAssignedTest extends Base public function testWithWrongColumn() { - $projectModel = new Project($this->container); + $projectModel = new ProjectModel($this->container); $this->assertEquals(1, $projectModel->create(array('name' => 'test1'))); $this->assertEquals(2, $projectModel->create(array('name' => 'test2'))); @@ -50,12 +50,12 @@ class TaskMoveColumnUnAssignedTest extends Base $action->setParam('src_column_id', 1); $action->setParam('dest_column_id', 2); - $this->assertFalse($action->execute($event, Task::EVENT_ASSIGNEE_CHANGE)); + $this->assertFalse($action->execute($event, TaskModel::EVENT_ASSIGNEE_CHANGE)); } public function testWithWrongUser() { - $projectModel = new Project($this->container); + $projectModel = new ProjectModel($this->container); $this->assertEquals(1, $projectModel->create(array('name' => 'test1'))); $this->assertEquals(2, $projectModel->create(array('name' => 'test2'))); @@ -67,6 +67,6 @@ class TaskMoveColumnUnAssignedTest extends Base $action->setParam('src_column_id', 1); $action->setParam('dest_column_id', 2); - $this->assertFalse($action->execute($event, Task::EVENT_ASSIGNEE_CHANGE)); + $this->assertFalse($action->execute($event, TaskModel::EVENT_ASSIGNEE_CHANGE)); } } diff --git a/tests/units/Action/TaskOpenTest.php b/tests/units/Action/TaskOpenTest.php index 01290a64..1018e2ea 100644 --- a/tests/units/Action/TaskOpenTest.php +++ b/tests/units/Action/TaskOpenTest.php @@ -3,18 +3,18 @@ require_once __DIR__.'/../Base.php'; use Kanboard\Event\GenericEvent; -use Kanboard\Model\TaskCreation; -use Kanboard\Model\TaskFinder; -use Kanboard\Model\Project; +use Kanboard\Model\TaskCreationModel; +use Kanboard\Model\TaskFinderModel; +use Kanboard\Model\ProjectModel; use Kanboard\Action\TaskOpen; class TaskOpenTest extends Base { public function testClose() { - $projectModel = new Project($this->container); - $taskCreationModel = new TaskCreation($this->container); - $taskFinderModel = new TaskFinder($this->container); + $projectModel = new ProjectModel($this->container); + $taskCreationModel = new TaskCreationModel($this->container); + $taskFinderModel = new TaskFinderModel($this->container); $this->assertEquals(1, $projectModel->create(array('name' => 'test1'))); $this->assertEquals(1, $taskCreationModel->create(array('project_id' => 1, 'title' => 'test', 'is_active' => 0))); @@ -34,8 +34,8 @@ class TaskOpenTest extends Base public function testWithNoTaskId() { - $projectModel = new Project($this->container); - $taskCreationModel = new TaskCreation($this->container); + $projectModel = new ProjectModel($this->container); + $taskCreationModel = new TaskCreationModel($this->container); $this->assertEquals(1, $projectModel->create(array('name' => 'test1'))); $this->assertEquals(1, $taskCreationModel->create(array('project_id' => 1, 'title' => 'test'))); diff --git a/tests/units/Action/TaskUpdateStartDateTest.php b/tests/units/Action/TaskUpdateStartDateTest.php index adf5bd9d..ddd9eafd 100644 --- a/tests/units/Action/TaskUpdateStartDateTest.php +++ b/tests/units/Action/TaskUpdateStartDateTest.php @@ -3,19 +3,19 @@ require_once __DIR__.'/../Base.php'; use Kanboard\Event\GenericEvent; -use Kanboard\Model\TaskCreation; -use Kanboard\Model\TaskFinder; -use Kanboard\Model\Project; -use Kanboard\Model\Task; +use Kanboard\Model\TaskCreationModel; +use Kanboard\Model\TaskFinderModel; +use Kanboard\Model\ProjectModel; +use Kanboard\Model\TaskModel; use Kanboard\Action\TaskUpdateStartDate; class TaskUpdateStartDateTest extends Base { public function testClose() { - $projectModel = new Project($this->container); - $taskCreationModel = new TaskCreation($this->container); - $taskFinderModel = new TaskFinder($this->container); + $projectModel = new ProjectModel($this->container); + $taskCreationModel = new TaskCreationModel($this->container); + $taskFinderModel = new TaskFinderModel($this->container); $this->assertEquals(1, $projectModel->create(array('name' => 'test1'))); $this->assertEquals(1, $taskCreationModel->create(array('project_id' => 1, 'title' => 'test'))); @@ -26,7 +26,7 @@ class TaskUpdateStartDateTest extends Base $action->setProjectId(1); $action->setParam('column_id', 2); - $this->assertTrue($action->execute($event, Task::EVENT_MOVE_COLUMN)); + $this->assertTrue($action->execute($event, TaskModel::EVENT_MOVE_COLUMN)); $task = $taskFinderModel->getById(1); $this->assertNotEmpty($task); @@ -35,8 +35,8 @@ class TaskUpdateStartDateTest extends Base public function testWithWrongColumn() { - $projectModel = new Project($this->container); - $taskCreationModel = new TaskCreation($this->container); + $projectModel = new ProjectModel($this->container); + $taskCreationModel = new TaskCreationModel($this->container); $this->assertEquals(1, $projectModel->create(array('name' => 'test1'))); $this->assertEquals(1, $taskCreationModel->create(array('project_id' => 1, 'title' => 'test'))); @@ -47,6 +47,6 @@ class TaskUpdateStartDateTest extends Base $action->setProjectId(1); $action->setParam('column_id', 2); - $this->assertFalse($action->execute($event, Task::EVENT_MOVE_COLUMN)); + $this->assertFalse($action->execute($event, TaskModel::EVENT_MOVE_COLUMN)); } } diff --git a/tests/units/Analytic/AverageLeadCycleTimeAnalyticTest.php b/tests/units/Analytic/AverageLeadCycleTimeAnalyticTest.php index b87e9573..831ec960 100644 --- a/tests/units/Analytic/AverageLeadCycleTimeAnalyticTest.php +++ b/tests/units/Analytic/AverageLeadCycleTimeAnalyticTest.php @@ -2,17 +2,17 @@ require_once __DIR__.'/../Base.php'; -use Kanboard\Model\TaskCreation; -use Kanboard\Model\Project; -use Kanboard\Model\Task; +use Kanboard\Model\TaskCreationModel; +use Kanboard\Model\ProjectModel; +use Kanboard\Model\TaskModel; use Kanboard\Analytic\AverageLeadCycleTimeAnalytic; class AverageLeadCycleTimeAnalyticTest extends Base { public function testBuild() { - $taskCreationModel = new TaskCreation($this->container); - $projectModel = new Project($this->container); + $taskCreationModel = new TaskCreationModel($this->container); + $projectModel = new ProjectModel($this->container); $averageLeadCycleTimeAnalytic = new AverageLeadCycleTimeAnalytic($this->container); $now = time(); @@ -26,19 +26,19 @@ class AverageLeadCycleTimeAnalyticTest extends Base $this->assertEquals(5, $taskCreationModel->create(array('project_id' => 1, 'title' => 'test'))); // LT=3600 CT=1800 - $this->container['db']->table(Task::TABLE)->eq('id', 1)->update(array('date_completed' => $now + 3600, 'date_started' => $now + 1800)); + $this->container['db']->table(TaskModel::TABLE)->eq('id', 1)->update(array('date_completed' => $now + 3600, 'date_started' => $now + 1800)); // LT=1800 CT=900 - $this->container['db']->table(Task::TABLE)->eq('id', 2)->update(array('date_completed' => $now + 1800, 'date_started' => $now + 900)); + $this->container['db']->table(TaskModel::TABLE)->eq('id', 2)->update(array('date_completed' => $now + 1800, 'date_started' => $now + 900)); // LT=3600 CT=0 - $this->container['db']->table(Task::TABLE)->eq('id', 3)->update(array('date_completed' => $now + 3600)); + $this->container['db']->table(TaskModel::TABLE)->eq('id', 3)->update(array('date_completed' => $now + 3600)); // LT=2*3600 CT=0 - $this->container['db']->table(Task::TABLE)->eq('id', 4)->update(array('date_completed' => $now + 2 * 3600)); + $this->container['db']->table(TaskModel::TABLE)->eq('id', 4)->update(array('date_completed' => $now + 2 * 3600)); // CT=0 - $this->container['db']->table(Task::TABLE)->eq('id', 5)->update(array('date_started' => $now + 900)); + $this->container['db']->table(TaskModel::TABLE)->eq('id', 5)->update(array('date_started' => $now + 900)); $stats = $averageLeadCycleTimeAnalytic->build(1); @@ -51,7 +51,7 @@ class AverageLeadCycleTimeAnalyticTest extends Base public function testBuildWithNoTasks() { - $projectModel = new Project($this->container); + $projectModel = new ProjectModel($this->container); $averageLeadCycleTimeAnalytic = new AverageLeadCycleTimeAnalytic($this->container); $this->assertEquals(1, $projectModel->create(array('name' => 'test1'))); diff --git a/tests/units/Analytic/AverageTimeSpentColumnAnalyticTest.php b/tests/units/Analytic/AverageTimeSpentColumnAnalyticTest.php index 4e01bfa9..1da425fb 100644 --- a/tests/units/Analytic/AverageTimeSpentColumnAnalyticTest.php +++ b/tests/units/Analytic/AverageTimeSpentColumnAnalyticTest.php @@ -2,19 +2,19 @@ require_once __DIR__.'/../Base.php'; -use Kanboard\Model\TaskCreation; -use Kanboard\Model\Project; -use Kanboard\Model\Transition; -use Kanboard\Model\Task; -use Kanboard\Model\TaskFinder; +use Kanboard\Model\TaskCreationModel; +use Kanboard\Model\ProjectModel; +use Kanboard\Model\TransitionModel; +use Kanboard\Model\TaskModel; +use Kanboard\Model\TaskFinderModel; use Kanboard\Analytic\AverageTimeSpentColumnAnalytic; class AverageTimeSpentColumnAnalyticTest extends Base { public function testAverageWithNoTransitions() { - $taskCreationModel = new TaskCreation($this->container); - $projectModel = new Project($this->container); + $taskCreationModel = new TaskCreationModel($this->container); + $projectModel = new ProjectModel($this->container); $averageLeadCycleTimeAnalytic = new AverageTimeSpentColumnAnalytic($this->container); $this->assertEquals(1, $projectModel->create(array('name' => 'test1'))); @@ -24,8 +24,8 @@ class AverageTimeSpentColumnAnalyticTest extends Base $now = time(); - $this->container['db']->table(Task::TABLE)->eq('id', 1)->update(array('date_completed' => $now + 3600)); - $this->container['db']->table(Task::TABLE)->eq('id', 2)->update(array('date_completed' => $now + 1800)); + $this->container['db']->table(TaskModel::TABLE)->eq('id', 1)->update(array('date_completed' => $now + 3600)); + $this->container['db']->table(TaskModel::TABLE)->eq('id', 2)->update(array('date_completed' => $now + 1800)); $stats = $averageLeadCycleTimeAnalytic->build(1); @@ -52,10 +52,10 @@ class AverageTimeSpentColumnAnalyticTest extends Base public function testAverageWithTransitions() { - $transitionModel = new Transition($this->container); - $taskFinderModel = new TaskFinder($this->container); - $taskCreationModel = new TaskCreation($this->container); - $projectModel = new Project($this->container); + $transitionModel = new TransitionModel($this->container); + $taskFinderModel = new TaskFinderModel($this->container); + $taskCreationModel = new TaskCreationModel($this->container); + $projectModel = new ProjectModel($this->container); $averageLeadCycleTimeAnalytic = new AverageTimeSpentColumnAnalytic($this->container); $this->assertEquals(1, $projectModel->create(array('name' => 'test1'))); @@ -64,8 +64,8 @@ class AverageTimeSpentColumnAnalyticTest extends Base $this->assertEquals(2, $taskCreationModel->create(array('project_id' => 1, 'title' => 'test'))); $now = time(); - $this->container['db']->table(Task::TABLE)->eq('id', 1)->update(array('date_completed' => $now + 3600)); - $this->container['db']->table(Task::TABLE)->eq('id', 2)->update(array('date_completed' => $now + 1800)); + $this->container['db']->table(TaskModel::TABLE)->eq('id', 1)->update(array('date_completed' => $now + 3600)); + $this->container['db']->table(TaskModel::TABLE)->eq('id', 2)->update(array('date_completed' => $now + 1800)); foreach (array(1, 2) as $task_id) { $task = $taskFinderModel->getById($task_id); diff --git a/tests/units/Analytic/EstimatedTimeComparisonAnalyticTest.php b/tests/units/Analytic/EstimatedTimeComparisonAnalyticTest.php index 2ca631b1..29bf88a3 100644 --- a/tests/units/Analytic/EstimatedTimeComparisonAnalyticTest.php +++ b/tests/units/Analytic/EstimatedTimeComparisonAnalyticTest.php @@ -2,16 +2,16 @@ require_once __DIR__.'/../Base.php'; -use Kanboard\Model\TaskCreation; -use Kanboard\Model\Project; +use Kanboard\Model\TaskCreationModel; +use Kanboard\Model\ProjectModel; use Kanboard\Analytic\EstimatedTimeComparisonAnalytic; class EstimatedTimeComparisonAnalyticTest extends Base { public function testBuild() { - $taskCreationModel = new TaskCreation($this->container); - $projectModel = new Project($this->container); + $taskCreationModel = new TaskCreationModel($this->container); + $projectModel = new ProjectModel($this->container); $estimatedTimeComparisonAnalytic = new EstimatedTimeComparisonAnalytic($this->container); $this->assertEquals(1, $projectModel->create(array('name' => 'test1'))); @@ -41,8 +41,8 @@ class EstimatedTimeComparisonAnalyticTest extends Base public function testBuildWithNoClosedTask() { - $taskCreationModel = new TaskCreation($this->container); - $projectModel = new Project($this->container); + $taskCreationModel = new TaskCreationModel($this->container); + $projectModel = new ProjectModel($this->container); $estimatedTimeComparisonAnalytic = new EstimatedTimeComparisonAnalytic($this->container); $this->assertEquals(1, $projectModel->create(array('name' => 'test1'))); @@ -70,8 +70,8 @@ class EstimatedTimeComparisonAnalyticTest extends Base public function testBuildWithOnlyClosedTask() { - $taskCreationModel = new TaskCreation($this->container); - $projectModel = new Project($this->container); + $taskCreationModel = new TaskCreationModel($this->container); + $projectModel = new ProjectModel($this->container); $estimatedTimeComparisonAnalytic = new EstimatedTimeComparisonAnalytic($this->container); $this->assertEquals(1, $projectModel->create(array('name' => 'test1'))); diff --git a/tests/units/Analytic/TaskDistributionAnalyticTest.php b/tests/units/Analytic/TaskDistributionAnalyticTest.php index 531101ef..0d600b8b 100644 --- a/tests/units/Analytic/TaskDistributionAnalyticTest.php +++ b/tests/units/Analytic/TaskDistributionAnalyticTest.php @@ -2,15 +2,15 @@ require_once __DIR__.'/../Base.php'; -use Kanboard\Model\TaskCreation; -use Kanboard\Model\Project; +use Kanboard\Model\TaskCreationModel; +use Kanboard\Model\ProjectModel; use Kanboard\Analytic\TaskDistributionAnalytic; class TaskDistributionAnalyticTest extends Base { public function testBuild() { - $projectModel = new Project($this->container); + $projectModel = new ProjectModel($this->container); $taskDistributionModel = new TaskDistributionAnalytic($this->container); $this->assertEquals(1, $projectModel->create(array('name' => 'test1'))); @@ -49,7 +49,7 @@ class TaskDistributionAnalyticTest extends Base private function createTasks($column_id, $nb_active, $nb_inactive) { - $taskCreationModel = new TaskCreation($this->container); + $taskCreationModel = new TaskCreationModel($this->container); for ($i = 0; $i < $nb_active; $i++) { $this->assertNotFalse($taskCreationModel->create(array('project_id' => 1, 'title' => 'test', 'column_id' => $column_id, 'is_active' => 1))); diff --git a/tests/units/Analytic/UserDistributionAnalyticTest.php b/tests/units/Analytic/UserDistributionAnalyticTest.php index bdc136e1..f4514899 100644 --- a/tests/units/Analytic/UserDistributionAnalyticTest.php +++ b/tests/units/Analytic/UserDistributionAnalyticTest.php @@ -2,10 +2,10 @@ require_once __DIR__.'/../Base.php'; -use Kanboard\Model\TaskCreation; -use Kanboard\Model\Project; -use Kanboard\Model\ProjectUserRole; -use Kanboard\Model\User; +use Kanboard\Model\TaskCreationModel; +use Kanboard\Model\ProjectModel; +use Kanboard\Model\ProjectUserRoleModel; +use Kanboard\Model\UserModel; use Kanboard\Analytic\UserDistributionAnalytic; use Kanboard\Core\Security\Role; @@ -13,9 +13,9 @@ class UserDistributionAnalyticTest extends Base { public function testBuild() { - $projectModel = new Project($this->container); - $projectUserRoleModel = new ProjectUserRole($this->container); - $userModel = new User($this->container); + $projectModel = new ProjectModel($this->container); + $projectUserRoleModel = new ProjectUserRoleModel($this->container); + $userModel = new UserModel($this->container); $userDistributionModel = new UserDistributionAnalytic($this->container); $this->assertEquals(1, $projectModel->create(array('name' => 'test1'))); @@ -70,7 +70,7 @@ class UserDistributionAnalyticTest extends Base private function createTasks($user_id, $nb_active, $nb_inactive) { - $taskCreationModel = new TaskCreation($this->container); + $taskCreationModel = new TaskCreationModel($this->container); for ($i = 0; $i < $nb_active; $i++) { $this->assertNotFalse($taskCreationModel->create(array('project_id' => 1, 'title' => 'test', 'owner_id' => $user_id, 'is_active' => 1))); diff --git a/tests/units/Auth/DatabaseAuthTest.php b/tests/units/Auth/DatabaseAuthTest.php index ac099a7e..97c75bd2 100644 --- a/tests/units/Auth/DatabaseAuthTest.php +++ b/tests/units/Auth/DatabaseAuthTest.php @@ -3,7 +3,7 @@ require_once __DIR__.'/../Base.php'; use Kanboard\Auth\DatabaseAuth; -use Kanboard\Model\User; +use Kanboard\Model\UserModel; class DatabaseAuthTest extends Base { @@ -41,7 +41,7 @@ class DatabaseAuthTest extends Base public function testIsvalidSession() { - $userModel = new User($this->container); + $userModel = new UserModel($this->container); $provider = new DatabaseAuth($this->container); $this->assertFalse($provider->isValidSession()); diff --git a/tests/units/Base.php b/tests/units/Base.php index 16c34573..c7e066d1 100644 --- a/tests/units/Base.php +++ b/tests/units/Base.php @@ -63,8 +63,8 @@ abstract class Base extends PHPUnit_Framework_TestCase ->setMethods(array('send')) ->getMock(); - $this->container['userNotificationType'] = $this - ->getMockBuilder('\Kanboard\Model\UserNotificationType') + $this->container['userNotificationTypeModel'] = $this + ->getMockBuilder('\Kanboard\Model\UserNotificationTypeModel') ->setConstructorArgs(array($this->container)) ->setMethods(array('getType', 'getSelectedTypes')) ->getMock(); diff --git a/tests/units/Core/Action/ActionManagerTest.php b/tests/units/Core/Action/ActionManagerTest.php index aae5bd2d..e7c2071f 100644 --- a/tests/units/Core/Action/ActionManagerTest.php +++ b/tests/units/Core/Action/ActionManagerTest.php @@ -7,10 +7,10 @@ use Kanboard\Action\TaskAssignColorColumn; use Kanboard\Action\TaskClose; use Kanboard\Action\TaskCloseColumn; use Kanboard\Action\TaskUpdateStartDate; -use Kanboard\Model\Action; -use Kanboard\Model\Task; -use Kanboard\Model\Project; -use Kanboard\Model\ProjectUserRole; +use Kanboard\Model\ActionModel; +use Kanboard\Model\TaskModel; +use Kanboard\Model\ProjectModel; +use Kanboard\Model\ProjectUserRoleModel; use Kanboard\Core\Security\Role; class ActionManagerTest extends Base @@ -79,16 +79,16 @@ class ActionManagerTest extends Base $events = $actionManager->getCompatibleEvents('\\'.get_class($actionTaskAssignColorColumn)); $this->assertCount(2, $events); - $this->assertArrayHasKey(Task::EVENT_CREATE, $events); - $this->assertArrayHasKey(Task::EVENT_MOVE_COLUMN, $events); - $this->assertNotEmpty($events[Task::EVENT_CREATE]); - $this->assertNotEmpty($events[Task::EVENT_MOVE_COLUMN]); + $this->assertArrayHasKey(TaskModel::EVENT_CREATE, $events); + $this->assertArrayHasKey(TaskModel::EVENT_MOVE_COLUMN, $events); + $this->assertNotEmpty($events[TaskModel::EVENT_CREATE]); + $this->assertNotEmpty($events[TaskModel::EVENT_MOVE_COLUMN]); } public function testAttachEventsWithoutUserSession() { - $projectModel = new Project($this->container); - $actionModel = new Action($this->container); + $projectModel = new ProjectModel($this->container); + $actionModel = new ActionModel($this->container); $actionTaskAssignColorColumn = new TaskAssignColorColumn($this->container); $actionManager = new ActionManager($this->container); $actionManager->register($actionTaskAssignColorColumn); @@ -101,13 +101,13 @@ class ActionManagerTest extends Base $this->assertEquals(1, $projectModel->create(array('name' =>'test'))); $this->assertEquals(1, $actionModel->create(array( 'project_id' => 1, - 'event_name' => Task::EVENT_CREATE, + 'event_name' => TaskModel::EVENT_CREATE, 'action_name' => key($actions), 'params' => array('column_id' => 1, 'color_id' => 'red'), ))); $actionManager->attachEvents(); - $listeners = $this->container['dispatcher']->getListeners(Task::EVENT_CREATE); + $listeners = $this->container['dispatcher']->getListeners(TaskModel::EVENT_CREATE); $this->assertCount(1, $listeners); $this->assertInstanceOf(get_class($actionTaskAssignColorColumn), $listeners[0][0]); @@ -118,9 +118,9 @@ class ActionManagerTest extends Base { $this->container['sessionStorage']->user = array('id' => 1); - $projectModel = new Project($this->container); - $projectUserRoleModel = new ProjectUserRole($this->container); - $actionModel = new Action($this->container); + $projectModel = new ProjectModel($this->container); + $projectUserRoleModel = new ProjectUserRoleModel($this->container); + $actionModel = new ActionModel($this->container); $actionTaskAssignColorColumn = new TaskAssignColorColumn($this->container); $actionManager = new ActionManager($this->container); $actionManager->register($actionTaskAssignColorColumn); @@ -134,21 +134,21 @@ class ActionManagerTest extends Base $this->assertEquals(1, $actionModel->create(array( 'project_id' => 1, - 'event_name' => Task::EVENT_CREATE, + 'event_name' => TaskModel::EVENT_CREATE, 'action_name' => key($actions), 'params' => array('column_id' => 1, 'color_id' => 'red'), ))); $this->assertEquals(2, $actionModel->create(array( 'project_id' => 2, - 'event_name' => Task::EVENT_MOVE_COLUMN, + 'event_name' => TaskModel::EVENT_MOVE_COLUMN, 'action_name' => key($actions), 'params' => array('column_id' => 1, 'color_id' => 'red'), ))); $actionManager->attachEvents(); - $listeners = $this->container['dispatcher']->getListeners(Task::EVENT_MOVE_COLUMN); + $listeners = $this->container['dispatcher']->getListeners(TaskModel::EVENT_MOVE_COLUMN); $this->assertCount(1, $listeners); $this->assertInstanceOf(get_class($actionTaskAssignColorColumn), $listeners[0][0]); @@ -157,9 +157,9 @@ class ActionManagerTest extends Base public function testThatEachListenerAreDifferentInstance() { - $projectModel = new Project($this->container); - $projectUserRoleModel = new ProjectUserRole($this->container); - $actionModel = new Action($this->container); + $projectModel = new ProjectModel($this->container); + $projectUserRoleModel = new ProjectUserRoleModel($this->container); + $actionModel = new ActionModel($this->container); $actionTaskAssignColorColumn = new TaskAssignColorColumn($this->container); $actionManager = new ActionManager($this->container); $actionManager->register($actionTaskAssignColorColumn); @@ -169,21 +169,21 @@ class ActionManagerTest extends Base $this->assertEquals(1, $actionModel->create(array( 'project_id' => 1, - 'event_name' => Task::EVENT_MOVE_COLUMN, + 'event_name' => TaskModel::EVENT_MOVE_COLUMN, 'action_name' => key($actions), 'params' => array('column_id' => 2, 'color_id' => 'green'), ))); $this->assertEquals(2, $actionModel->create(array( 'project_id' => 1, - 'event_name' => Task::EVENT_MOVE_COLUMN, + 'event_name' => TaskModel::EVENT_MOVE_COLUMN, 'action_name' => key($actions), 'params' => array('column_id' => 1, 'color_id' => 'red'), ))); $actionManager->attachEvents(); - $listeners = $this->container['dispatcher']->getListeners(Task::EVENT_MOVE_COLUMN); + $listeners = $this->container['dispatcher']->getListeners(TaskModel::EVENT_MOVE_COLUMN); $this->assertCount(2, $listeners); $this->assertFalse($listeners[0][0] === $listeners[1][0]); diff --git a/tests/units/Core/Filter/LexerBuilderTest.php b/tests/units/Core/Filter/LexerBuilderTest.php index ac5315bb..23726f32 100644 --- a/tests/units/Core/Filter/LexerBuilderTest.php +++ b/tests/units/Core/Filter/LexerBuilderTest.php @@ -5,17 +5,17 @@ require_once __DIR__.'/../../Base.php'; use Kanboard\Core\Filter\LexerBuilder; use Kanboard\Filter\TaskAssigneeFilter; use Kanboard\Filter\TaskTitleFilter; -use Kanboard\Model\Project; -use Kanboard\Model\TaskCreation; -use Kanboard\Model\TaskFinder; +use Kanboard\Model\ProjectModel; +use Kanboard\Model\TaskCreationModel; +use Kanboard\Model\TaskFinderModel; class LexerBuilderTest extends Base { public function testBuilderThatReturnResult() { - $project = new Project($this->container); - $taskCreation = new TaskCreation($this->container); - $taskFinder = new TaskFinder($this->container); + $project = new ProjectModel($this->container); + $taskCreation = new TaskCreationModel($this->container); + $taskFinder = new TaskFinderModel($this->container); $query = $taskFinder->getExtendedQuery(); $this->assertEquals(1, $project->create(array('name' => 'Project'))); @@ -33,9 +33,9 @@ class LexerBuilderTest extends Base public function testBuilderThatReturnNothing() { - $project = new Project($this->container); - $taskCreation = new TaskCreation($this->container); - $taskFinder = new TaskFinder($this->container); + $project = new ProjectModel($this->container); + $taskCreation = new TaskCreationModel($this->container); + $taskFinder = new TaskFinderModel($this->container); $query = $taskFinder->getExtendedQuery(); $this->assertEquals(1, $project->create(array('name' => 'Project'))); @@ -52,9 +52,9 @@ class LexerBuilderTest extends Base public function testBuilderWithEmptyInput() { - $project = new Project($this->container); - $taskCreation = new TaskCreation($this->container); - $taskFinder = new TaskFinder($this->container); + $project = new ProjectModel($this->container); + $taskCreation = new TaskCreationModel($this->container); + $taskFinder = new TaskFinderModel($this->container); $query = $taskFinder->getExtendedQuery(); $this->assertEquals(1, $project->create(array('name' => 'Project'))); @@ -71,9 +71,9 @@ class LexerBuilderTest extends Base public function testBuilderWithMultipleMatches() { - $project = new Project($this->container); - $taskCreation = new TaskCreation($this->container); - $taskFinder = new TaskFinder($this->container); + $project = new ProjectModel($this->container); + $taskCreation = new TaskCreationModel($this->container); + $taskFinder = new TaskFinderModel($this->container); $query = $taskFinder->getExtendedQuery(); $this->assertEquals(1, $project->create(array('name' => 'Project'))); @@ -91,7 +91,7 @@ class LexerBuilderTest extends Base public function testClone() { - $taskFinder = new TaskFinder($this->container); + $taskFinder = new TaskFinderModel($this->container); $query = $taskFinder->getExtendedQuery(); $builder = new LexerBuilder(); diff --git a/tests/units/Core/Filter/OrCriteriaTest.php b/tests/units/Core/Filter/OrCriteriaTest.php index 787d3461..a46726c3 100644 --- a/tests/units/Core/Filter/OrCriteriaTest.php +++ b/tests/units/Core/Filter/OrCriteriaTest.php @@ -3,10 +3,10 @@ use Kanboard\Core\Filter\OrCriteria; use Kanboard\Filter\TaskAssigneeFilter; use Kanboard\Filter\TaskTitleFilter; -use Kanboard\Model\Project; -use Kanboard\Model\TaskCreation; -use Kanboard\Model\TaskFinder; -use Kanboard\Model\User; +use Kanboard\Model\ProjectModel; +use Kanboard\Model\TaskCreationModel; +use Kanboard\Model\TaskFinderModel; +use Kanboard\Model\UserModel; require_once __DIR__.'/../../Base.php'; @@ -14,10 +14,10 @@ class OrCriteriaTest extends Base { public function testWithSameFilter() { - $taskFinder = new TaskFinder($this->container); - $taskCreation = new TaskCreation($this->container); - $projectModel = new Project($this->container); - $userModel = new User($this->container); + $taskFinder = new TaskFinderModel($this->container); + $taskCreation = new TaskCreationModel($this->container); + $projectModel = new ProjectModel($this->container); + $userModel = new UserModel($this->container); $query = $taskFinder->getExtendedQuery(); $this->assertEquals(2, $userModel->create(array('username' => 'foobar', 'name' => 'Foo Bar'))); @@ -36,10 +36,10 @@ class OrCriteriaTest extends Base public function testWithDifferentFilter() { - $taskFinder = new TaskFinder($this->container); - $taskCreation = new TaskCreation($this->container); - $projectModel = new Project($this->container); - $userModel = new User($this->container); + $taskFinder = new TaskFinderModel($this->container); + $taskCreation = new TaskCreationModel($this->container); + $projectModel = new ProjectModel($this->container); + $userModel = new UserModel($this->container); $query = $taskFinder->getExtendedQuery(); $this->assertEquals(2, $userModel->create(array('username' => 'foobar', 'name' => 'Foo Bar'))); diff --git a/tests/units/Core/Group/GroupManagerTest.php b/tests/units/Core/Group/GroupManagerTest.php index faf5501f..e89ad15b 100644 --- a/tests/units/Core/Group/GroupManagerTest.php +++ b/tests/units/Core/Group/GroupManagerTest.php @@ -2,7 +2,7 @@ require_once __DIR__.'/../../Base.php'; -use Kanboard\Model\Group; +use Kanboard\Model\GroupModel; use Kanboard\Core\Group\GroupManager; use Kanboard\Group\DatabaseBackendGroupProvider; @@ -10,7 +10,7 @@ class GroupManagerTest extends Base { public function testFind() { - $groupModel = new Group($this->container); + $groupModel = new GroupModel($this->container); $groupManager = new GroupManager; $this->assertEquals(1, $groupModel->create('Group 1')); diff --git a/tests/units/Core/User/GroupSyncTest.php b/tests/units/Core/User/GroupSyncTest.php index decb2fdc..d3df71bb 100644 --- a/tests/units/Core/User/GroupSyncTest.php +++ b/tests/units/Core/User/GroupSyncTest.php @@ -3,15 +3,15 @@ require_once __DIR__.'/../../Base.php'; use Kanboard\Core\User\GroupSync; -use Kanboard\Model\Group; -use Kanboard\Model\GroupMember; +use Kanboard\Model\GroupModel; +use Kanboard\Model\GroupMemberModel; class GroupSyncTest extends Base { public function testAddGroups() { - $group = new Group($this->container); - $groupMember = new GroupMember($this->container); + $group = new GroupModel($this->container); + $groupMember = new GroupMemberModel($this->container); $groupSync = new GroupSync($this->container); $this->assertEquals(1, $group->create('My Group 1', 'externalId1')); @@ -30,8 +30,8 @@ class GroupSyncTest extends Base public function testRemoveGroups() { - $group = new Group($this->container); - $groupMember = new GroupMember($this->container); + $group = new GroupModel($this->container); + $groupMember = new GroupMemberModel($this->container); $groupSync = new GroupSync($this->container); $this->assertEquals(1, $group->create('My Group 1', 'externalId1')); @@ -50,8 +50,8 @@ class GroupSyncTest extends Base public function testBoth() { - $group = new Group($this->container); - $groupMember = new GroupMember($this->container); + $group = new GroupModel($this->container); + $groupMember = new GroupMemberModel($this->container); $groupSync = new GroupSync($this->container); $this->assertEquals(1, $group->create('My Group 1', 'externalId1')); @@ -74,8 +74,8 @@ class GroupSyncTest extends Base public function testThatInternalGroupsAreNotTouched() { - $group = new Group($this->container); - $groupMember = new GroupMember($this->container); + $group = new GroupModel($this->container); + $groupMember = new GroupMemberModel($this->container); $groupSync = new GroupSync($this->container); $this->assertEquals(1, $group->create('My Group 1')); diff --git a/tests/units/Export/TaskExportTest.php b/tests/units/Export/TaskExportTest.php index f0637c25..c142cde9 100644 --- a/tests/units/Export/TaskExportTest.php +++ b/tests/units/Export/TaskExportTest.php @@ -2,21 +2,21 @@ require_once __DIR__ . '/../Base.php'; -use Kanboard\Model\TaskCreation; +use Kanboard\Model\TaskCreationModel; use Kanboard\Export\TaskExport; -use Kanboard\Model\Project; -use Kanboard\Model\Category; -use Kanboard\Model\Swimlane; +use Kanboard\Model\ProjectModel; +use Kanboard\Model\CategoryModel; +use Kanboard\Model\SwimlaneModel; class TaskExportTest extends Base { public function testExport() { - $tc = new TaskCreation($this->container); - $p = new Project($this->container); - $c = new Category($this->container); + $tc = new TaskCreationModel($this->container); + $p = new ProjectModel($this->container); + $c = new CategoryModel($this->container); $e = new TaskExport($this->container); - $s = new Swimlane($this->container); + $s = new SwimlaneModel($this->container); $this->assertEquals(1, $p->create(array('name' => 'Export Project'))); diff --git a/tests/units/Export/TransitionExportTest.php b/tests/units/Export/TransitionExportTest.php index 7ff3082e..ee195ad1 100644 --- a/tests/units/Export/TransitionExportTest.php +++ b/tests/units/Export/TransitionExportTest.php @@ -2,18 +2,18 @@ require_once __DIR__ . '/../Base.php'; -use Kanboard\Model\TaskCreation; -use Kanboard\Model\Transition; +use Kanboard\Model\TaskCreationModel; +use Kanboard\Model\TransitionModel; use Kanboard\Export\TransitionExport; -use Kanboard\Model\Project; +use Kanboard\Model\ProjectModel; class TransitionExportTest extends Base { public function testExport() { - $projectModel = new Project($this->container); - $taskCreationModel = new TaskCreation($this->container); - $transitionModel = new Transition($this->container); + $projectModel = new ProjectModel($this->container); + $taskCreationModel = new TaskCreationModel($this->container); + $transitionModel = new TransitionModel($this->container); $transitionExportModel = new TransitionExport($this->container); $this->assertEquals(1, $projectModel->create(array('name' => 'test'))); diff --git a/tests/units/Filter/ProjectActivityCreationDateFilterTest.php b/tests/units/Filter/ProjectActivityCreationDateFilterTest.php index 1dce4451..716d58bd 100644 --- a/tests/units/Filter/ProjectActivityCreationDateFilterTest.php +++ b/tests/units/Filter/ProjectActivityCreationDateFilterTest.php @@ -1,11 +1,11 @@ <?php use Kanboard\Filter\ProjectActivityCreationDateFilter; -use Kanboard\Model\Project; -use Kanboard\Model\ProjectActivity; -use Kanboard\Model\TaskCreation; -use Kanboard\Model\TaskFinder; -use Kanboard\Model\Task; +use Kanboard\Model\ProjectModel; +use Kanboard\Model\ProjectActivityModel; +use Kanboard\Model\TaskCreationModel; +use Kanboard\Model\TaskFinderModel; +use Kanboard\Model\TaskModel; require_once __DIR__.'/../Base.php'; @@ -13,14 +13,14 @@ class ProjectActivityCreationDateFilterTest extends Base { public function testWithToday() { - $taskFinder = new TaskFinder($this->container); - $taskCreation = new TaskCreation($this->container); - $projectModel = new Project($this->container); - $projectActivityModel = new ProjectActivity($this->container); + $taskFinder = new TaskFinderModel($this->container); + $taskCreation = new TaskCreationModel($this->container); + $projectModel = new ProjectModel($this->container); + $projectActivityModel = new ProjectActivityModel($this->container); $this->assertEquals(1, $projectModel->create(array('name' => 'P1'))); $this->assertEquals(1, $taskCreation->create(array('title' => 'Test', 'project_id' => 1))); - $this->assertNotFalse($projectActivityModel->createEvent(1, 1, 1, Task::EVENT_CREATE, array('task' => $taskFinder->getById(1)))); + $this->assertNotFalse($projectActivityModel->createEvent(1, 1, 1, TaskModel::EVENT_CREATE, array('task' => $taskFinder->getById(1)))); $query = $projectActivityModel->getQuery(); $filter = new ProjectActivityCreationDateFilter('today'); @@ -33,14 +33,14 @@ class ProjectActivityCreationDateFilterTest extends Base public function testWithYesterday() { - $taskFinder = new TaskFinder($this->container); - $taskCreation = new TaskCreation($this->container); - $projectModel = new Project($this->container); - $projectActivityModel = new ProjectActivity($this->container); + $taskFinder = new TaskFinderModel($this->container); + $taskCreation = new TaskCreationModel($this->container); + $projectModel = new ProjectModel($this->container); + $projectActivityModel = new ProjectActivityModel($this->container); $this->assertEquals(1, $projectModel->create(array('name' => 'P1'))); $this->assertEquals(1, $taskCreation->create(array('title' => 'Test', 'project_id' => 1))); - $this->assertNotFalse($projectActivityModel->createEvent(1, 1, 1, Task::EVENT_CREATE, array('task' => $taskFinder->getById(1)))); + $this->assertNotFalse($projectActivityModel->createEvent(1, 1, 1, TaskModel::EVENT_CREATE, array('task' => $taskFinder->getById(1)))); $query = $projectActivityModel->getQuery(); $filter = new ProjectActivityCreationDateFilter('yesterday'); @@ -53,14 +53,14 @@ class ProjectActivityCreationDateFilterTest extends Base public function testWithStrtotimeString() { - $taskFinder = new TaskFinder($this->container); - $taskCreation = new TaskCreation($this->container); - $projectModel = new Project($this->container); - $projectActivityModel = new ProjectActivity($this->container); + $taskFinder = new TaskFinderModel($this->container); + $taskCreation = new TaskCreationModel($this->container); + $projectModel = new ProjectModel($this->container); + $projectActivityModel = new ProjectActivityModel($this->container); $this->assertEquals(1, $projectModel->create(array('name' => 'P1'))); $this->assertEquals(1, $taskCreation->create(array('title' => 'Test', 'project_id' => 1))); - $this->assertNotFalse($projectActivityModel->createEvent(1, 1, 1, Task::EVENT_CREATE, array('task' => $taskFinder->getById(1)))); + $this->assertNotFalse($projectActivityModel->createEvent(1, 1, 1, TaskModel::EVENT_CREATE, array('task' => $taskFinder->getById(1)))); $query = $projectActivityModel->getQuery(); $filter = new ProjectActivityCreationDateFilter('<=last week'); @@ -73,14 +73,14 @@ class ProjectActivityCreationDateFilterTest extends Base public function testWithIsoDate() { - $taskFinder = new TaskFinder($this->container); - $taskCreation = new TaskCreation($this->container); - $projectModel = new Project($this->container); - $projectActivityModel = new ProjectActivity($this->container); + $taskFinder = new TaskFinderModel($this->container); + $taskCreation = new TaskCreationModel($this->container); + $projectModel = new ProjectModel($this->container); + $projectActivityModel = new ProjectActivityModel($this->container); $this->assertEquals(1, $projectModel->create(array('name' => 'P1'))); $this->assertEquals(1, $taskCreation->create(array('title' => 'Test', 'project_id' => 1))); - $this->assertNotFalse($projectActivityModel->createEvent(1, 1, 1, Task::EVENT_CREATE, array('task' => $taskFinder->getById(1)))); + $this->assertNotFalse($projectActivityModel->createEvent(1, 1, 1, TaskModel::EVENT_CREATE, array('task' => $taskFinder->getById(1)))); $query = $projectActivityModel->getQuery(); $filter = new ProjectActivityCreationDateFilter(date('Y-m-d')); @@ -93,14 +93,14 @@ class ProjectActivityCreationDateFilterTest extends Base public function testWithOperatorAndIsoDate() { - $taskFinder = new TaskFinder($this->container); - $taskCreation = new TaskCreation($this->container); - $projectModel = new Project($this->container); - $projectActivityModel = new ProjectActivity($this->container); + $taskFinder = new TaskFinderModel($this->container); + $taskCreation = new TaskCreationModel($this->container); + $projectModel = new ProjectModel($this->container); + $projectActivityModel = new ProjectActivityModel($this->container); $this->assertEquals(1, $projectModel->create(array('name' => 'P1'))); $this->assertEquals(1, $taskCreation->create(array('title' => 'Test', 'project_id' => 1))); - $this->assertNotFalse($projectActivityModel->createEvent(1, 1, 1, Task::EVENT_CREATE, array('task' => $taskFinder->getById(1)))); + $this->assertNotFalse($projectActivityModel->createEvent(1, 1, 1, TaskModel::EVENT_CREATE, array('task' => $taskFinder->getById(1)))); $query = $projectActivityModel->getQuery(); $filter = new ProjectActivityCreationDateFilter('>='.date('Y-m-d')); diff --git a/tests/units/Filter/ProjectActivityCreatorFilterTest.php b/tests/units/Filter/ProjectActivityCreatorFilterTest.php index 99c70322..65281d06 100644 --- a/tests/units/Filter/ProjectActivityCreatorFilterTest.php +++ b/tests/units/Filter/ProjectActivityCreatorFilterTest.php @@ -1,11 +1,11 @@ <?php use Kanboard\Filter\ProjectActivityCreatorFilter; -use Kanboard\Model\Project; -use Kanboard\Model\ProjectActivity; -use Kanboard\Model\TaskCreation; -use Kanboard\Model\TaskFinder; -use Kanboard\Model\Task; +use Kanboard\Model\ProjectModel; +use Kanboard\Model\ProjectActivityModel; +use Kanboard\Model\TaskCreationModel; +use Kanboard\Model\TaskFinderModel; +use Kanboard\Model\TaskModel; require_once __DIR__.'/../Base.php'; @@ -13,14 +13,14 @@ class ProjectActivityCreatorFilterTest extends Base { public function testWithUsername() { - $taskFinder = new TaskFinder($this->container); - $taskCreation = new TaskCreation($this->container); - $projectModel = new Project($this->container); - $projectActivityModel = new ProjectActivity($this->container); + $taskFinder = new TaskFinderModel($this->container); + $taskCreation = new TaskCreationModel($this->container); + $projectModel = new ProjectModel($this->container); + $projectActivityModel = new ProjectActivityModel($this->container); $this->assertEquals(1, $projectModel->create(array('name' => 'P1'))); $this->assertEquals(1, $taskCreation->create(array('title' => 'Test', 'project_id' => 1))); - $this->assertNotFalse($projectActivityModel->createEvent(1, 1, 1, Task::EVENT_CREATE, array('task' => $taskFinder->getById(1)))); + $this->assertNotFalse($projectActivityModel->createEvent(1, 1, 1, TaskModel::EVENT_CREATE, array('task' => $taskFinder->getById(1)))); $query = $projectActivityModel->getQuery(); $filter = new ProjectActivityCreatorFilter('admin'); @@ -32,14 +32,14 @@ class ProjectActivityCreatorFilterTest extends Base public function testWithAnotherUsername() { - $taskFinder = new TaskFinder($this->container); - $taskCreation = new TaskCreation($this->container); - $projectModel = new Project($this->container); - $projectActivityModel = new ProjectActivity($this->container); + $taskFinder = new TaskFinderModel($this->container); + $taskCreation = new TaskCreationModel($this->container); + $projectModel = new ProjectModel($this->container); + $projectActivityModel = new ProjectActivityModel($this->container); $this->assertEquals(1, $projectModel->create(array('name' => 'P1'))); $this->assertEquals(1, $taskCreation->create(array('title' => 'Test', 'project_id' => 1))); - $this->assertNotFalse($projectActivityModel->createEvent(1, 1, 1, Task::EVENT_CREATE, array('task' => $taskFinder->getById(1)))); + $this->assertNotFalse($projectActivityModel->createEvent(1, 1, 1, TaskModel::EVENT_CREATE, array('task' => $taskFinder->getById(1)))); $query = $projectActivityModel->getQuery(); $filter = new ProjectActivityCreatorFilter('John Doe'); @@ -51,14 +51,14 @@ class ProjectActivityCreatorFilterTest extends Base public function testWithCurrentUser() { - $taskFinder = new TaskFinder($this->container); - $taskCreation = new TaskCreation($this->container); - $projectModel = new Project($this->container); - $projectActivityModel = new ProjectActivity($this->container); + $taskFinder = new TaskFinderModel($this->container); + $taskCreation = new TaskCreationModel($this->container); + $projectModel = new ProjectModel($this->container); + $projectActivityModel = new ProjectActivityModel($this->container); $this->assertEquals(1, $projectModel->create(array('name' => 'P1'))); $this->assertEquals(1, $taskCreation->create(array('title' => 'Test', 'project_id' => 1))); - $this->assertNotFalse($projectActivityModel->createEvent(1, 1, 1, Task::EVENT_CREATE, array('task' => $taskFinder->getById(1)))); + $this->assertNotFalse($projectActivityModel->createEvent(1, 1, 1, TaskModel::EVENT_CREATE, array('task' => $taskFinder->getById(1)))); $query = $projectActivityModel->getQuery(); $filter = new ProjectActivityCreatorFilter('me'); @@ -71,14 +71,14 @@ class ProjectActivityCreatorFilterTest extends Base public function testWithAnotherCurrentUser() { - $taskFinder = new TaskFinder($this->container); - $taskCreation = new TaskCreation($this->container); - $projectModel = new Project($this->container); - $projectActivityModel = new ProjectActivity($this->container); + $taskFinder = new TaskFinderModel($this->container); + $taskCreation = new TaskCreationModel($this->container); + $projectModel = new ProjectModel($this->container); + $projectActivityModel = new ProjectActivityModel($this->container); $this->assertEquals(1, $projectModel->create(array('name' => 'P1'))); $this->assertEquals(1, $taskCreation->create(array('title' => 'Test', 'project_id' => 1))); - $this->assertNotFalse($projectActivityModel->createEvent(1, 1, 1, Task::EVENT_CREATE, array('task' => $taskFinder->getById(1)))); + $this->assertNotFalse($projectActivityModel->createEvent(1, 1, 1, TaskModel::EVENT_CREATE, array('task' => $taskFinder->getById(1)))); $query = $projectActivityModel->getQuery(); $filter = new ProjectActivityCreatorFilter('me'); diff --git a/tests/units/Filter/ProjectActivityProjectIdFilterTest.php b/tests/units/Filter/ProjectActivityProjectIdFilterTest.php index 193852e1..75e6fa70 100644 --- a/tests/units/Filter/ProjectActivityProjectIdFilterTest.php +++ b/tests/units/Filter/ProjectActivityProjectIdFilterTest.php @@ -1,11 +1,11 @@ <?php use Kanboard\Filter\ProjectActivityProjectIdFilter; -use Kanboard\Model\Project; -use Kanboard\Model\ProjectActivity; -use Kanboard\Model\TaskCreation; -use Kanboard\Model\TaskFinder; -use Kanboard\Model\Task; +use Kanboard\Model\ProjectModel; +use Kanboard\Model\ProjectActivityModel; +use Kanboard\Model\TaskCreationModel; +use Kanboard\Model\TaskFinderModel; +use Kanboard\Model\TaskModel; require_once __DIR__.'/../Base.php'; @@ -13,10 +13,10 @@ class ProjectActivityProjectIdFilterTest extends Base { public function testFilterByProjectId() { - $taskFinder = new TaskFinder($this->container); - $taskCreation = new TaskCreation($this->container); - $projectModel = new Project($this->container); - $projectActivityModel = new ProjectActivity($this->container); + $taskFinder = new TaskFinderModel($this->container); + $taskCreation = new TaskCreationModel($this->container); + $projectModel = new ProjectModel($this->container); + $projectActivityModel = new ProjectActivityModel($this->container); $query = $projectActivityModel->getQuery(); $this->assertEquals(1, $projectModel->create(array('name' => 'P1'))); @@ -25,8 +25,8 @@ class ProjectActivityProjectIdFilterTest extends Base $this->assertEquals(1, $taskCreation->create(array('title' => 'Test', 'project_id' => 1))); $this->assertEquals(2, $taskCreation->create(array('title' => 'Test', 'project_id' => 2))); - $this->assertNotFalse($projectActivityModel->createEvent(1, 1, 1, Task::EVENT_CREATE, array('task' => $taskFinder->getById(1)))); - $this->assertNotFalse($projectActivityModel->createEvent(2, 2, 1, Task::EVENT_CREATE, array('task' => $taskFinder->getById(2)))); + $this->assertNotFalse($projectActivityModel->createEvent(1, 1, 1, TaskModel::EVENT_CREATE, array('task' => $taskFinder->getById(1)))); + $this->assertNotFalse($projectActivityModel->createEvent(2, 2, 1, TaskModel::EVENT_CREATE, array('task' => $taskFinder->getById(2)))); $filter = new ProjectActivityProjectIdFilter(1); $filter->withQuery($query)->apply(); diff --git a/tests/units/Filter/ProjectActivityProjectIdsFilterTest.php b/tests/units/Filter/ProjectActivityProjectIdsFilterTest.php index e99d2e2f..b5c4683d 100644 --- a/tests/units/Filter/ProjectActivityProjectIdsFilterTest.php +++ b/tests/units/Filter/ProjectActivityProjectIdsFilterTest.php @@ -1,11 +1,11 @@ <?php use Kanboard\Filter\ProjectActivityProjectIdsFilter; -use Kanboard\Model\Project; -use Kanboard\Model\ProjectActivity; -use Kanboard\Model\TaskCreation; -use Kanboard\Model\TaskFinder; -use Kanboard\Model\Task; +use Kanboard\Model\ProjectModel; +use Kanboard\Model\ProjectActivityModel; +use Kanboard\Model\TaskCreationModel; +use Kanboard\Model\TaskFinderModel; +use Kanboard\Model\TaskModel; require_once __DIR__.'/../Base.php'; @@ -13,10 +13,10 @@ class ProjectActivityProjectIdsFilterTest extends Base { public function testFilterByProjectIds() { - $taskFinder = new TaskFinder($this->container); - $taskCreation = new TaskCreation($this->container); - $projectModel = new Project($this->container); - $projectActivityModel = new ProjectActivity($this->container); + $taskFinder = new TaskFinderModel($this->container); + $taskCreation = new TaskCreationModel($this->container); + $projectModel = new ProjectModel($this->container); + $projectActivityModel = new ProjectActivityModel($this->container); $query = $projectActivityModel->getQuery(); $this->assertEquals(1, $projectModel->create(array('name' => 'P1'))); @@ -27,9 +27,9 @@ class ProjectActivityProjectIdsFilterTest extends Base $this->assertEquals(2, $taskCreation->create(array('title' => 'Test', 'project_id' => 2))); $this->assertEquals(3, $taskCreation->create(array('title' => 'Test', 'project_id' => 3))); - $this->assertNotFalse($projectActivityModel->createEvent(1, 1, 1, Task::EVENT_CREATE, array('task' => $taskFinder->getById(1)))); - $this->assertNotFalse($projectActivityModel->createEvent(2, 2, 1, Task::EVENT_CREATE, array('task' => $taskFinder->getById(2)))); - $this->assertNotFalse($projectActivityModel->createEvent(3, 3, 1, Task::EVENT_CREATE, array('task' => $taskFinder->getById(3)))); + $this->assertNotFalse($projectActivityModel->createEvent(1, 1, 1, TaskModel::EVENT_CREATE, array('task' => $taskFinder->getById(1)))); + $this->assertNotFalse($projectActivityModel->createEvent(2, 2, 1, TaskModel::EVENT_CREATE, array('task' => $taskFinder->getById(2)))); + $this->assertNotFalse($projectActivityModel->createEvent(3, 3, 1, TaskModel::EVENT_CREATE, array('task' => $taskFinder->getById(3)))); $filter = new ProjectActivityProjectIdsFilter(array(1, 2)); $filter->withQuery($query)->apply(); @@ -38,10 +38,10 @@ class ProjectActivityProjectIdsFilterTest extends Base public function testWithEmptyArgument() { - $taskFinder = new TaskFinder($this->container); - $taskCreation = new TaskCreation($this->container); - $projectModel = new Project($this->container); - $projectActivityModel = new ProjectActivity($this->container); + $taskFinder = new TaskFinderModel($this->container); + $taskCreation = new TaskCreationModel($this->container); + $projectModel = new ProjectModel($this->container); + $projectActivityModel = new ProjectActivityModel($this->container); $query = $projectActivityModel->getQuery(); $this->assertEquals(1, $projectModel->create(array('name' => 'P1'))); @@ -52,9 +52,9 @@ class ProjectActivityProjectIdsFilterTest extends Base $this->assertEquals(2, $taskCreation->create(array('title' => 'Test', 'project_id' => 2))); $this->assertEquals(3, $taskCreation->create(array('title' => 'Test', 'project_id' => 3))); - $this->assertNotFalse($projectActivityModel->createEvent(1, 1, 1, Task::EVENT_CREATE, $taskFinder->getById(1))); - $this->assertNotFalse($projectActivityModel->createEvent(2, 2, 1, Task::EVENT_CREATE, $taskFinder->getById(2))); - $this->assertNotFalse($projectActivityModel->createEvent(3, 3, 1, Task::EVENT_CREATE, $taskFinder->getById(3))); + $this->assertNotFalse($projectActivityModel->createEvent(1, 1, 1, TaskModel::EVENT_CREATE, $taskFinder->getById(1))); + $this->assertNotFalse($projectActivityModel->createEvent(2, 2, 1, TaskModel::EVENT_CREATE, $taskFinder->getById(2))); + $this->assertNotFalse($projectActivityModel->createEvent(3, 3, 1, TaskModel::EVENT_CREATE, $taskFinder->getById(3))); $filter = new ProjectActivityProjectIdsFilter(array()); $filter->withQuery($query)->apply(); diff --git a/tests/units/Filter/ProjectActivityProjectNameFilterTest.php b/tests/units/Filter/ProjectActivityProjectNameFilterTest.php index de9d7d59..3ec01bc0 100644 --- a/tests/units/Filter/ProjectActivityProjectNameFilterTest.php +++ b/tests/units/Filter/ProjectActivityProjectNameFilterTest.php @@ -1,11 +1,11 @@ <?php use Kanboard\Filter\ProjectActivityProjectNameFilter; -use Kanboard\Model\Project; -use Kanboard\Model\ProjectActivity; -use Kanboard\Model\TaskCreation; -use Kanboard\Model\TaskFinder; -use Kanboard\Model\Task; +use Kanboard\Model\ProjectModel; +use Kanboard\Model\ProjectActivityModel; +use Kanboard\Model\TaskCreationModel; +use Kanboard\Model\TaskFinderModel; +use Kanboard\Model\TaskModel; require_once __DIR__.'/../Base.php'; @@ -13,10 +13,10 @@ class ProjectActivityProjectNameFilterTest extends Base { public function testFilterByProjectName() { - $taskFinder = new TaskFinder($this->container); - $taskCreation = new TaskCreation($this->container); - $projectModel = new Project($this->container); - $projectActivityModel = new ProjectActivity($this->container); + $taskFinder = new TaskFinderModel($this->container); + $taskCreation = new TaskCreationModel($this->container); + $projectModel = new ProjectModel($this->container); + $projectActivityModel = new ProjectActivityModel($this->container); $query = $projectActivityModel->getQuery(); $this->assertEquals(1, $projectModel->create(array('name' => 'P1'))); @@ -25,8 +25,8 @@ class ProjectActivityProjectNameFilterTest extends Base $this->assertEquals(1, $taskCreation->create(array('title' => 'Test', 'project_id' => 1))); $this->assertEquals(2, $taskCreation->create(array('title' => 'Test', 'project_id' => 2))); - $this->assertNotFalse($projectActivityModel->createEvent(1, 1, 1, Task::EVENT_CREATE, array('task' => $taskFinder->getById(1)))); - $this->assertNotFalse($projectActivityModel->createEvent(2, 2, 1, Task::EVENT_CREATE, array('task' => $taskFinder->getById(2)))); + $this->assertNotFalse($projectActivityModel->createEvent(1, 1, 1, TaskModel::EVENT_CREATE, array('task' => $taskFinder->getById(1)))); + $this->assertNotFalse($projectActivityModel->createEvent(2, 2, 1, TaskModel::EVENT_CREATE, array('task' => $taskFinder->getById(2)))); $filter = new ProjectActivityProjectNameFilter('P1'); $filter->withQuery($query)->apply(); diff --git a/tests/units/Filter/ProjectActivityTaskIdFilterTest.php b/tests/units/Filter/ProjectActivityTaskIdFilterTest.php index 646cab1b..940d1c6f 100644 --- a/tests/units/Filter/ProjectActivityTaskIdFilterTest.php +++ b/tests/units/Filter/ProjectActivityTaskIdFilterTest.php @@ -1,11 +1,11 @@ <?php use Kanboard\Filter\ProjectActivityTaskIdFilter; -use Kanboard\Model\Project; -use Kanboard\Model\ProjectActivity; -use Kanboard\Model\TaskCreation; -use Kanboard\Model\TaskFinder; -use Kanboard\Model\Task; +use Kanboard\Model\ProjectModel; +use Kanboard\Model\ProjectActivityModel; +use Kanboard\Model\TaskCreationModel; +use Kanboard\Model\TaskFinderModel; +use Kanboard\Model\TaskModel; require_once __DIR__.'/../Base.php'; @@ -13,10 +13,10 @@ class ProjectActivityTaskIdFilterTest extends Base { public function testFilterByTaskId() { - $taskFinder = new TaskFinder($this->container); - $taskCreation = new TaskCreation($this->container); - $projectModel = new Project($this->container); - $projectActivityModel = new ProjectActivity($this->container); + $taskFinder = new TaskFinderModel($this->container); + $taskCreation = new TaskCreationModel($this->container); + $projectModel = new ProjectModel($this->container); + $projectActivityModel = new ProjectActivityModel($this->container); $query = $projectActivityModel->getQuery(); $this->assertEquals(1, $projectModel->create(array('name' => 'P1'))); @@ -24,8 +24,8 @@ class ProjectActivityTaskIdFilterTest extends Base $this->assertEquals(1, $taskCreation->create(array('title' => 'Test', 'project_id' => 1))); $this->assertEquals(2, $taskCreation->create(array('title' => 'Test', 'project_id' => 1))); - $this->assertNotFalse($projectActivityModel->createEvent(1, 1, 1, Task::EVENT_CREATE, array('task' => $taskFinder->getById(1)))); - $this->assertNotFalse($projectActivityModel->createEvent(1, 2, 1, Task::EVENT_CREATE, array('task' => $taskFinder->getById(2)))); + $this->assertNotFalse($projectActivityModel->createEvent(1, 1, 1, TaskModel::EVENT_CREATE, array('task' => $taskFinder->getById(1)))); + $this->assertNotFalse($projectActivityModel->createEvent(1, 2, 1, TaskModel::EVENT_CREATE, array('task' => $taskFinder->getById(2)))); $filter = new ProjectActivityTaskIdFilter(1); $filter->withQuery($query)->apply(); diff --git a/tests/units/Filter/ProjectActivityTaskStatusFilterTest.php b/tests/units/Filter/ProjectActivityTaskStatusFilterTest.php index b8df6338..673a4990 100644 --- a/tests/units/Filter/ProjectActivityTaskStatusFilterTest.php +++ b/tests/units/Filter/ProjectActivityTaskStatusFilterTest.php @@ -1,12 +1,12 @@ <?php use Kanboard\Filter\ProjectActivityTaskStatusFilter; -use Kanboard\Model\Project; -use Kanboard\Model\ProjectActivity; -use Kanboard\Model\TaskCreation; -use Kanboard\Model\TaskFinder; -use Kanboard\Model\Task; -use Kanboard\Model\TaskStatus; +use Kanboard\Model\ProjectModel; +use Kanboard\Model\ProjectActivityModel; +use Kanboard\Model\TaskCreationModel; +use Kanboard\Model\TaskFinderModel; +use Kanboard\Model\TaskModel; +use Kanboard\Model\TaskStatusModel; require_once __DIR__.'/../Base.php'; @@ -14,19 +14,19 @@ class ProjectActivityTaskStatusFilterTest extends Base { public function testFilterByTaskStatus() { - $taskFinder = new TaskFinder($this->container); - $taskCreation = new TaskCreation($this->container); - $taskStatus = new TaskStatus($this->container); - $projectModel = new Project($this->container); - $projectActivityModel = new ProjectActivity($this->container); + $taskFinder = new TaskFinderModel($this->container); + $taskCreation = new TaskCreationModel($this->container); + $taskStatus = new TaskStatusModel($this->container); + $projectModel = new ProjectModel($this->container); + $projectActivityModel = new ProjectActivityModel($this->container); $this->assertEquals(1, $projectModel->create(array('name' => 'P1'))); $this->assertEquals(1, $taskCreation->create(array('title' => 'Test', 'project_id' => 1))); $this->assertEquals(2, $taskCreation->create(array('title' => 'Test', 'project_id' => 1))); - $this->assertNotFalse($projectActivityModel->createEvent(1, 1, 1, Task::EVENT_CREATE, array('task' => $taskFinder->getById(1)))); - $this->assertNotFalse($projectActivityModel->createEvent(1, 2, 1, Task::EVENT_CREATE, array('task' => $taskFinder->getById(2)))); + $this->assertNotFalse($projectActivityModel->createEvent(1, 1, 1, TaskModel::EVENT_CREATE, array('task' => $taskFinder->getById(1)))); + $this->assertNotFalse($projectActivityModel->createEvent(1, 2, 1, TaskModel::EVENT_CREATE, array('task' => $taskFinder->getById(2)))); $this->assertTrue($taskStatus->close(1)); diff --git a/tests/units/Filter/ProjectActivityTaskTitleFilterTest.php b/tests/units/Filter/ProjectActivityTaskTitleFilterTest.php index 925a1ab2..f6217dba 100644 --- a/tests/units/Filter/ProjectActivityTaskTitleFilterTest.php +++ b/tests/units/Filter/ProjectActivityTaskTitleFilterTest.php @@ -1,11 +1,11 @@ <?php use Kanboard\Filter\ProjectActivityTaskTitleFilter; -use Kanboard\Model\Project; -use Kanboard\Model\ProjectActivity; -use Kanboard\Model\TaskCreation; -use Kanboard\Model\TaskFinder; -use Kanboard\Model\Task; +use Kanboard\Model\ProjectModel; +use Kanboard\Model\ProjectActivityModel; +use Kanboard\Model\TaskCreationModel; +use Kanboard\Model\TaskFinderModel; +use Kanboard\Model\TaskModel; require_once __DIR__.'/../Base.php'; @@ -13,10 +13,10 @@ class ProjectActivityTaskTitleFilterTest extends Base { public function testWithFullTitle() { - $taskFinder = new TaskFinder($this->container); - $taskCreation = new TaskCreation($this->container); - $projectModel = new Project($this->container); - $projectActivityModel = new ProjectActivity($this->container); + $taskFinder = new TaskFinderModel($this->container); + $taskCreation = new TaskCreationModel($this->container); + $projectModel = new ProjectModel($this->container); + $projectActivityModel = new ProjectActivityModel($this->container); $query = $projectActivityModel->getQuery(); $this->assertEquals(1, $projectModel->create(array('name' => 'P1'))); @@ -24,8 +24,8 @@ class ProjectActivityTaskTitleFilterTest extends Base $this->assertEquals(1, $taskCreation->create(array('title' => 'Test1', 'project_id' => 1))); $this->assertEquals(2, $taskCreation->create(array('title' => 'Test2', 'project_id' => 1))); - $this->assertNotFalse($projectActivityModel->createEvent(1, 1, 1, Task::EVENT_CREATE, array('task' => $taskFinder->getById(1)))); - $this->assertNotFalse($projectActivityModel->createEvent(1, 2, 1, Task::EVENT_CREATE, array('task' => $taskFinder->getById(2)))); + $this->assertNotFalse($projectActivityModel->createEvent(1, 1, 1, TaskModel::EVENT_CREATE, array('task' => $taskFinder->getById(1)))); + $this->assertNotFalse($projectActivityModel->createEvent(1, 2, 1, TaskModel::EVENT_CREATE, array('task' => $taskFinder->getById(2)))); $filter = new ProjectActivityTaskTitleFilter('test2'); $filter->withQuery($query)->apply(); @@ -34,10 +34,10 @@ class ProjectActivityTaskTitleFilterTest extends Base public function testWithPartialTitle() { - $taskFinder = new TaskFinder($this->container); - $taskCreation = new TaskCreation($this->container); - $projectModel = new Project($this->container); - $projectActivityModel = new ProjectActivity($this->container); + $taskFinder = new TaskFinderModel($this->container); + $taskCreation = new TaskCreationModel($this->container); + $projectModel = new ProjectModel($this->container); + $projectActivityModel = new ProjectActivityModel($this->container); $query = $projectActivityModel->getQuery(); $this->assertEquals(1, $projectModel->create(array('name' => 'P1'))); @@ -45,8 +45,8 @@ class ProjectActivityTaskTitleFilterTest extends Base $this->assertEquals(1, $taskCreation->create(array('title' => 'Test1', 'project_id' => 1))); $this->assertEquals(2, $taskCreation->create(array('title' => 'Test2', 'project_id' => 1))); - $this->assertNotFalse($projectActivityModel->createEvent(1, 1, 1, Task::EVENT_CREATE, array('task' => $taskFinder->getById(1)))); - $this->assertNotFalse($projectActivityModel->createEvent(1, 2, 1, Task::EVENT_CREATE, array('task' => $taskFinder->getById(2)))); + $this->assertNotFalse($projectActivityModel->createEvent(1, 1, 1, TaskModel::EVENT_CREATE, array('task' => $taskFinder->getById(1)))); + $this->assertNotFalse($projectActivityModel->createEvent(1, 2, 1, TaskModel::EVENT_CREATE, array('task' => $taskFinder->getById(2)))); $filter = new ProjectActivityTaskTitleFilter('test'); $filter->withQuery($query)->apply(); @@ -55,10 +55,10 @@ class ProjectActivityTaskTitleFilterTest extends Base public function testWithId() { - $taskFinder = new TaskFinder($this->container); - $taskCreation = new TaskCreation($this->container); - $projectModel = new Project($this->container); - $projectActivityModel = new ProjectActivity($this->container); + $taskFinder = new TaskFinderModel($this->container); + $taskCreation = new TaskCreationModel($this->container); + $projectModel = new ProjectModel($this->container); + $projectActivityModel = new ProjectActivityModel($this->container); $query = $projectActivityModel->getQuery(); $this->assertEquals(1, $projectModel->create(array('name' => 'P1'))); @@ -66,8 +66,8 @@ class ProjectActivityTaskTitleFilterTest extends Base $this->assertEquals(1, $taskCreation->create(array('title' => 'Test1', 'project_id' => 1))); $this->assertEquals(2, $taskCreation->create(array('title' => 'Test2', 'project_id' => 1))); - $this->assertNotFalse($projectActivityModel->createEvent(1, 1, 1, Task::EVENT_CREATE, array('task' => $taskFinder->getById(1)))); - $this->assertNotFalse($projectActivityModel->createEvent(1, 2, 1, Task::EVENT_CREATE, array('task' => $taskFinder->getById(2)))); + $this->assertNotFalse($projectActivityModel->createEvent(1, 1, 1, TaskModel::EVENT_CREATE, array('task' => $taskFinder->getById(1)))); + $this->assertNotFalse($projectActivityModel->createEvent(1, 2, 1, TaskModel::EVENT_CREATE, array('task' => $taskFinder->getById(2)))); $filter = new ProjectActivityTaskTitleFilter('#2'); $filter->withQuery($query)->apply(); diff --git a/tests/units/Filter/TaskAssigneeFilterTest.php b/tests/units/Filter/TaskAssigneeFilterTest.php index 356342c5..dec3824e 100644 --- a/tests/units/Filter/TaskAssigneeFilterTest.php +++ b/tests/units/Filter/TaskAssigneeFilterTest.php @@ -1,10 +1,10 @@ <?php use Kanboard\Filter\TaskAssigneeFilter; -use Kanboard\Model\Project; -use Kanboard\Model\TaskCreation; -use Kanboard\Model\TaskFinder; -use Kanboard\Model\User; +use Kanboard\Model\ProjectModel; +use Kanboard\Model\TaskCreationModel; +use Kanboard\Model\TaskFinderModel; +use Kanboard\Model\UserModel; require_once __DIR__.'/../Base.php'; @@ -12,9 +12,9 @@ class TaskAssigneeFilterTest extends Base { public function testWithIntegerAssigneeId() { - $taskFinder = new TaskFinder($this->container); - $taskCreation = new TaskCreation($this->container); - $projectModel = new Project($this->container); + $taskFinder = new TaskFinderModel($this->container); + $taskCreation = new TaskCreationModel($this->container); + $projectModel = new ProjectModel($this->container); $query = $taskFinder->getExtendedQuery(); $this->assertEquals(1, $projectModel->create(array('name' => 'Test'))); @@ -37,9 +37,9 @@ class TaskAssigneeFilterTest extends Base public function testWithStringAssigneeId() { - $taskFinder = new TaskFinder($this->container); - $taskCreation = new TaskCreation($this->container); - $projectModel = new Project($this->container); + $taskFinder = new TaskFinderModel($this->container); + $taskCreation = new TaskCreationModel($this->container); + $projectModel = new ProjectModel($this->container); $query = $taskFinder->getExtendedQuery(); $this->assertEquals(1, $projectModel->create(array('name' => 'Test'))); @@ -62,9 +62,9 @@ class TaskAssigneeFilterTest extends Base public function testWithUsername() { - $taskFinder = new TaskFinder($this->container); - $taskCreation = new TaskCreation($this->container); - $projectModel = new Project($this->container); + $taskFinder = new TaskFinderModel($this->container); + $taskCreation = new TaskCreationModel($this->container); + $projectModel = new ProjectModel($this->container); $query = $taskFinder->getExtendedQuery(); $this->assertEquals(1, $projectModel->create(array('name' => 'Test'))); @@ -87,10 +87,10 @@ class TaskAssigneeFilterTest extends Base public function testWithName() { - $taskFinder = new TaskFinder($this->container); - $taskCreation = new TaskCreation($this->container); - $projectModel = new Project($this->container); - $userModel = new User($this->container); + $taskFinder = new TaskFinderModel($this->container); + $taskCreation = new TaskCreationModel($this->container); + $projectModel = new ProjectModel($this->container); + $userModel = new UserModel($this->container); $query = $taskFinder->getExtendedQuery(); $this->assertEquals(2, $userModel->create(array('username' => 'foobar', 'name' => 'Foo Bar'))); @@ -114,9 +114,9 @@ class TaskAssigneeFilterTest extends Base public function testWithNobody() { - $taskFinder = new TaskFinder($this->container); - $taskCreation = new TaskCreation($this->container); - $projectModel = new Project($this->container); + $taskFinder = new TaskFinderModel($this->container); + $taskCreation = new TaskCreationModel($this->container); + $projectModel = new ProjectModel($this->container); $query = $taskFinder->getExtendedQuery(); $this->assertEquals(1, $projectModel->create(array('name' => 'Test'))); @@ -132,9 +132,9 @@ class TaskAssigneeFilterTest extends Base public function testWithCurrentUser() { - $taskFinder = new TaskFinder($this->container); - $taskCreation = new TaskCreation($this->container); - $projectModel = new Project($this->container); + $taskFinder = new TaskFinderModel($this->container); + $taskCreation = new TaskCreationModel($this->container); + $projectModel = new ProjectModel($this->container); $query = $taskFinder->getExtendedQuery(); $this->assertEquals(1, $projectModel->create(array('name' => 'Test'))); diff --git a/tests/units/Filter/TaskCommentFilterTest.php b/tests/units/Filter/TaskCommentFilterTest.php index 8d1b7f44..95ffb32f 100644 --- a/tests/units/Filter/TaskCommentFilterTest.php +++ b/tests/units/Filter/TaskCommentFilterTest.php @@ -1,10 +1,10 @@ <?php use Kanboard\Filter\TaskCommentFilter; -use Kanboard\Model\Comment; -use Kanboard\Model\Project; -use Kanboard\Model\TaskCreation; -use Kanboard\Model\TaskFinder; +use Kanboard\Model\CommentModel; +use Kanboard\Model\ProjectModel; +use Kanboard\Model\TaskCreationModel; +use Kanboard\Model\TaskFinderModel; require_once __DIR__.'/../Base.php'; @@ -12,10 +12,10 @@ class TaskCommentFilterTest extends Base { public function testMatch() { - $taskFinder = new TaskFinder($this->container); - $taskCreation = new TaskCreation($this->container); - $commentModel = new Comment($this->container); - $projectModel = new Project($this->container); + $taskFinder = new TaskFinderModel($this->container); + $taskCreation = new TaskCreationModel($this->container); + $commentModel = new CommentModel($this->container); + $projectModel = new ProjectModel($this->container); $query = $taskFinder->getExtendedQuery(); $this->assertEquals(1, $projectModel->create(array('name' => 'Test'))); @@ -32,10 +32,10 @@ class TaskCommentFilterTest extends Base public function testNoMatch() { - $taskFinder = new TaskFinder($this->container); - $taskCreation = new TaskCreation($this->container); - $commentModel = new Comment($this->container); - $projectModel = new Project($this->container); + $taskFinder = new TaskFinderModel($this->container); + $taskCreation = new TaskCreationModel($this->container); + $commentModel = new CommentModel($this->container); + $projectModel = new ProjectModel($this->container); $query = $taskFinder->getExtendedQuery(); $this->assertEquals(1, $projectModel->create(array('name' => 'Test'))); diff --git a/tests/units/Filter/TaskCreatorFilterTest.php b/tests/units/Filter/TaskCreatorFilterTest.php index 1c344de7..b5abe6cf 100644 --- a/tests/units/Filter/TaskCreatorFilterTest.php +++ b/tests/units/Filter/TaskCreatorFilterTest.php @@ -1,10 +1,10 @@ <?php use Kanboard\Filter\TaskCreatorFilter; -use Kanboard\Model\Project; -use Kanboard\Model\TaskCreation; -use Kanboard\Model\TaskFinder; -use Kanboard\Model\User; +use Kanboard\Model\ProjectModel; +use Kanboard\Model\TaskCreationModel; +use Kanboard\Model\TaskFinderModel; +use Kanboard\Model\UserModel; require_once __DIR__.'/../Base.php'; @@ -12,9 +12,9 @@ class TaskCreatorFilterTest extends Base { public function testWithIntegerAssigneeId() { - $taskFinder = new TaskFinder($this->container); - $taskCreation = new TaskCreation($this->container); - $projectModel = new Project($this->container); + $taskFinder = new TaskFinderModel($this->container); + $taskCreation = new TaskCreationModel($this->container); + $projectModel = new ProjectModel($this->container); $query = $taskFinder->getExtendedQuery(); $this->assertEquals(1, $projectModel->create(array('name' => 'Test'))); @@ -37,9 +37,9 @@ class TaskCreatorFilterTest extends Base public function testWithStringAssigneeId() { - $taskFinder = new TaskFinder($this->container); - $taskCreation = new TaskCreation($this->container); - $projectModel = new Project($this->container); + $taskFinder = new TaskFinderModel($this->container); + $taskCreation = new TaskCreationModel($this->container); + $projectModel = new ProjectModel($this->container); $query = $taskFinder->getExtendedQuery(); $this->assertEquals(1, $projectModel->create(array('name' => 'Test'))); @@ -62,9 +62,9 @@ class TaskCreatorFilterTest extends Base public function testWithUsername() { - $taskFinder = new TaskFinder($this->container); - $taskCreation = new TaskCreation($this->container); - $projectModel = new Project($this->container); + $taskFinder = new TaskFinderModel($this->container); + $taskCreation = new TaskCreationModel($this->container); + $projectModel = new ProjectModel($this->container); $query = $taskFinder->getExtendedQuery(); $this->assertEquals(1, $projectModel->create(array('name' => 'Test'))); @@ -87,10 +87,10 @@ class TaskCreatorFilterTest extends Base public function testWithName() { - $taskFinder = new TaskFinder($this->container); - $taskCreation = new TaskCreation($this->container); - $projectModel = new Project($this->container); - $userModel = new User($this->container); + $taskFinder = new TaskFinderModel($this->container); + $taskCreation = new TaskCreationModel($this->container); + $projectModel = new ProjectModel($this->container); + $userModel = new UserModel($this->container); $query = $taskFinder->getExtendedQuery(); $this->assertEquals(2, $userModel->create(array('username' => 'foobar', 'name' => 'Foo Bar'))); @@ -114,9 +114,9 @@ class TaskCreatorFilterTest extends Base public function testWithNobody() { - $taskFinder = new TaskFinder($this->container); - $taskCreation = new TaskCreation($this->container); - $projectModel = new Project($this->container); + $taskFinder = new TaskFinderModel($this->container); + $taskCreation = new TaskCreationModel($this->container); + $projectModel = new ProjectModel($this->container); $query = $taskFinder->getExtendedQuery(); $this->assertEquals(1, $projectModel->create(array('name' => 'Test'))); @@ -132,9 +132,9 @@ class TaskCreatorFilterTest extends Base public function testWithCurrentUser() { - $taskFinder = new TaskFinder($this->container); - $taskCreation = new TaskCreation($this->container); - $projectModel = new Project($this->container); + $taskFinder = new TaskFinderModel($this->container); + $taskCreation = new TaskCreationModel($this->container); + $projectModel = new ProjectModel($this->container); $query = $taskFinder->getExtendedQuery(); $this->assertEquals(1, $projectModel->create(array('name' => 'Test'))); diff --git a/tests/units/Helper/AssetHelperTest.php b/tests/units/Helper/AssetHelperTest.php index 6ef5accd..da780c4b 100644 --- a/tests/units/Helper/AssetHelperTest.php +++ b/tests/units/Helper/AssetHelperTest.php @@ -3,14 +3,14 @@ require_once __DIR__.'/../Base.php'; use Kanboard\Helper\AssetHelper; -use Kanboard\Model\Config; +use Kanboard\Model\ConfigModel; class AssetHelperTest extends Base { public function testCustomCss() { $h = new AssetHelper($this->container); - $c = new Config($this->container); + $c = new ConfigModel($this->container); $this->assertEmpty($h->customCss()); diff --git a/tests/units/Helper/ProjectActivityHelperTest.php b/tests/units/Helper/ProjectActivityHelperTest.php index 88b2d352..1ad95699 100644 --- a/tests/units/Helper/ProjectActivityHelperTest.php +++ b/tests/units/Helper/ProjectActivityHelperTest.php @@ -1,11 +1,11 @@ <?php use Kanboard\Helper\ProjectActivityHelper; -use Kanboard\Model\Project; -use Kanboard\Model\ProjectActivity; -use Kanboard\Model\Task; -use Kanboard\Model\TaskCreation; -use Kanboard\Model\TaskFinder; +use Kanboard\Model\ProjectModel; +use Kanboard\Model\ProjectActivityModel; +use Kanboard\Model\TaskModel; +use Kanboard\Model\TaskCreationModel; +use Kanboard\Model\TaskFinderModel; require_once __DIR__.'/../Base.php'; @@ -13,10 +13,10 @@ class ProjectActivityHelperTest extends Base { public function testGetProjectEvents() { - $taskFinder = new TaskFinder($this->container); - $taskCreation = new TaskCreation($this->container); - $projectModel = new Project($this->container); - $projectActivityModel = new ProjectActivity($this->container); + $taskFinder = new TaskFinderModel($this->container); + $taskCreation = new TaskCreationModel($this->container); + $projectModel = new ProjectModel($this->container); + $projectActivityModel = new ProjectActivityModel($this->container); $this->assertEquals(1, $projectModel->create(array('name' => 'P1'))); @@ -24,9 +24,9 @@ class ProjectActivityHelperTest extends Base $this->assertEquals(2, $taskCreation->create(array('title' => 'Test', 'project_id' => 1))); $this->assertEquals(3, $taskCreation->create(array('title' => 'Test', 'project_id' => 1))); - $this->assertNotFalse($projectActivityModel->createEvent(1, 1, 1, Task::EVENT_CREATE, array('task' => $taskFinder->getById(1)))); - $this->assertNotFalse($projectActivityModel->createEvent(1, 2, 1, Task::EVENT_CREATE, array('task' => $taskFinder->getById(2)))); - $this->assertNotFalse($projectActivityModel->createEvent(1, 3, 1, Task::EVENT_CREATE, array('task' => $taskFinder->getById(3)))); + $this->assertNotFalse($projectActivityModel->createEvent(1, 1, 1, TaskModel::EVENT_CREATE, array('task' => $taskFinder->getById(1)))); + $this->assertNotFalse($projectActivityModel->createEvent(1, 2, 1, TaskModel::EVENT_CREATE, array('task' => $taskFinder->getById(2)))); + $this->assertNotFalse($projectActivityModel->createEvent(1, 3, 1, TaskModel::EVENT_CREATE, array('task' => $taskFinder->getById(3)))); $helper = new ProjectActivityHelper($this->container); $events = $helper->getProjectEvents(1); @@ -41,10 +41,10 @@ class ProjectActivityHelperTest extends Base public function testGetProjectsEvents() { - $taskFinder = new TaskFinder($this->container); - $taskCreation = new TaskCreation($this->container); - $projectModel = new Project($this->container); - $projectActivityModel = new ProjectActivity($this->container); + $taskFinder = new TaskFinderModel($this->container); + $taskCreation = new TaskCreationModel($this->container); + $projectModel = new ProjectModel($this->container); + $projectActivityModel = new ProjectActivityModel($this->container); $this->assertEquals(1, $projectModel->create(array('name' => 'P1'))); $this->assertEquals(2, $projectModel->create(array('name' => 'P2'))); @@ -54,9 +54,9 @@ class ProjectActivityHelperTest extends Base $this->assertEquals(2, $taskCreation->create(array('title' => 'Test', 'project_id' => 2))); $this->assertEquals(3, $taskCreation->create(array('title' => 'Test', 'project_id' => 3))); - $this->assertNotFalse($projectActivityModel->createEvent(1, 1, 1, Task::EVENT_CREATE, array('task' => $taskFinder->getById(1)))); - $this->assertNotFalse($projectActivityModel->createEvent(2, 2, 1, Task::EVENT_CREATE, array('task' => $taskFinder->getById(2)))); - $this->assertNotFalse($projectActivityModel->createEvent(3, 3, 1, Task::EVENT_CREATE, array('task' => $taskFinder->getById(3)))); + $this->assertNotFalse($projectActivityModel->createEvent(1, 1, 1, TaskModel::EVENT_CREATE, array('task' => $taskFinder->getById(1)))); + $this->assertNotFalse($projectActivityModel->createEvent(2, 2, 1, TaskModel::EVENT_CREATE, array('task' => $taskFinder->getById(2)))); + $this->assertNotFalse($projectActivityModel->createEvent(3, 3, 1, TaskModel::EVENT_CREATE, array('task' => $taskFinder->getById(3)))); $helper = new ProjectActivityHelper($this->container); $events = $helper->getProjectsEvents(array(1, 2)); @@ -71,18 +71,18 @@ class ProjectActivityHelperTest extends Base public function testGetTaskEvents() { - $taskFinder = new TaskFinder($this->container); - $taskCreation = new TaskCreation($this->container); - $projectModel = new Project($this->container); - $projectActivityModel = new ProjectActivity($this->container); + $taskFinder = new TaskFinderModel($this->container); + $taskCreation = new TaskCreationModel($this->container); + $projectModel = new ProjectModel($this->container); + $projectActivityModel = new ProjectActivityModel($this->container); $this->assertEquals(1, $projectModel->create(array('name' => 'P1'))); $this->assertEquals(1, $taskCreation->create(array('title' => 'Test', 'project_id' => 1))); $this->assertEquals(2, $taskCreation->create(array('title' => 'Test', 'project_id' => 1))); - $this->assertNotFalse($projectActivityModel->createEvent(1, 1, 1, Task::EVENT_CREATE, array('task' => $taskFinder->getById(1)))); - $this->assertNotFalse($projectActivityModel->createEvent(1, 2, 1, Task::EVENT_CREATE, array('task' => $taskFinder->getById(2)))); + $this->assertNotFalse($projectActivityModel->createEvent(1, 1, 1, TaskModel::EVENT_CREATE, array('task' => $taskFinder->getById(1)))); + $this->assertNotFalse($projectActivityModel->createEvent(1, 2, 1, TaskModel::EVENT_CREATE, array('task' => $taskFinder->getById(2)))); $helper = new ProjectActivityHelper($this->container); $events = $helper->getTaskEvents(1); diff --git a/tests/units/Helper/TextHelperTest.php b/tests/units/Helper/TextHelperTest.php index 8f596541..c9447abb 100644 --- a/tests/units/Helper/TextHelperTest.php +++ b/tests/units/Helper/TextHelperTest.php @@ -3,16 +3,16 @@ require_once __DIR__.'/../Base.php'; use Kanboard\Helper\TextHelper; -use Kanboard\Model\Project; -use Kanboard\Model\TaskCreation; +use Kanboard\Model\ProjectModel; +use Kanboard\Model\TaskCreationModel; class TextHelperTest extends Base { public function testMarkdownTaskLink() { $helper = new TextHelper($this->container); - $projectModel = new Project($this->container); - $taskCreationModel = new TaskCreation($this->container); + $projectModel = new ProjectModel($this->container); + $taskCreationModel = new TaskCreationModel($this->container); $this->assertEquals(1, $projectModel->create(array('name' => 'Project #1'))); $this->assertTrue($projectModel->enablePublicAccess(1)); diff --git a/tests/units/Helper/UrlHelperTest.php b/tests/units/Helper/UrlHelperTest.php index 34ab7604..b1f0a032 100644 --- a/tests/units/Helper/UrlHelperTest.php +++ b/tests/units/Helper/UrlHelperTest.php @@ -3,7 +3,7 @@ require_once __DIR__.'/../Base.php'; use Kanboard\Helper\UrlHelper; -use Kanboard\Model\Config; +use Kanboard\Model\ConfigModel; use Kanboard\Core\Http\Request; class UrlHelperTest extends Base @@ -115,7 +115,7 @@ class UrlHelperTest extends Base $h = new UrlHelper($this->container); $this->assertEquals('http://kb:1234/', $h->base()); - $c = new Config($this->container); + $c = new ConfigModel($this->container); $c->save(array('application_url' => 'https://mykanboard/')); $this->container['memoryCache']->flush(); diff --git a/tests/units/Helper/UserHelperTest.php b/tests/units/Helper/UserHelperTest.php index be563b47..c149e663 100644 --- a/tests/units/Helper/UserHelperTest.php +++ b/tests/units/Helper/UserHelperTest.php @@ -4,13 +4,12 @@ require_once __DIR__.'/../Base.php'; use Kanboard\Core\User\UserSession; use Kanboard\Helper\UserHelper; -use Kanboard\Model\Project; -use Kanboard\Model\ProjectUserRole; -use Kanboard\Model\TaskCreation; -use Kanboard\Model\TaskFinder; -use Kanboard\Model\User as UserModel; +use Kanboard\Model\ProjectModel; +use Kanboard\Model\ProjectUserRoleModel; +use Kanboard\Model\TaskCreationModel; +use Kanboard\Model\TaskFinderModel; use Kanboard\Core\Security\Role; -use Kanboard\Model\User; +use Kanboard\Model\UserModel; class UserHelperTest extends Base { @@ -76,7 +75,7 @@ class UserHelperTest extends Base public function testHasProjectAccessForAdmins() { $helper = new UserHelper($this->container); - $project = new Project($this->container); + $project = new ProjectModel($this->container); $this->container['sessionStorage']->user = array( 'id' => 2, @@ -92,7 +91,7 @@ class UserHelperTest extends Base public function testHasProjectAccessForManagers() { $helper = new UserHelper($this->container); - $project = new Project($this->container); + $project = new ProjectModel($this->container); $this->container['sessionStorage']->user = array( 'id' => 2, @@ -108,7 +107,7 @@ class UserHelperTest extends Base public function testHasProjectAccessForUsers() { $helper = new UserHelper($this->container); - $project = new Project($this->container); + $project = new ProjectModel($this->container); $this->container['sessionStorage']->user = array( 'id' => 2, @@ -125,8 +124,8 @@ class UserHelperTest extends Base { $helper = new UserHelper($this->container); $user = new UserModel($this->container); - $project = new Project($this->container); - $projectUserRole = new ProjectUserRole($this->container); + $project = new ProjectModel($this->container); + $projectUserRole = new ProjectUserRoleModel($this->container); $this->container['sessionStorage']->user = array( 'id' => 2, @@ -153,8 +152,8 @@ class UserHelperTest extends Base { $helper = new UserHelper($this->container); $user = new UserModel($this->container); - $project = new Project($this->container); - $projectUserRole = new ProjectUserRole($this->container); + $project = new ProjectModel($this->container); + $projectUserRole = new ProjectUserRoleModel($this->container); $this->container['sessionStorage']->user = array( 'id' => 2, @@ -181,8 +180,8 @@ class UserHelperTest extends Base { $helper = new UserHelper($this->container); $user = new UserModel($this->container); - $project = new Project($this->container); - $projectUserRole = new ProjectUserRole($this->container); + $project = new ProjectModel($this->container); + $projectUserRole = new ProjectUserRoleModel($this->container); $this->container['sessionStorage']->user = array( 'id' => 2, @@ -209,8 +208,8 @@ class UserHelperTest extends Base { $helper = new UserHelper($this->container); $user = new UserModel($this->container); - $project = new Project($this->container); - $projectUserRole = new ProjectUserRole($this->container); + $project = new ProjectModel($this->container); + $projectUserRole = new ProjectUserRoleModel($this->container); $this->container['sessionStorage']->user = array( 'id' => 2, @@ -235,11 +234,11 @@ class UserHelperTest extends Base public function testCanRemoveTask() { - $taskCreationModel = new TaskCreation($this->container); - $taskFinderModel = new TaskFinder($this->container); + $taskCreationModel = new TaskCreationModel($this->container); + $taskFinderModel = new TaskFinderModel($this->container); $helper = new UserHelper($this->container); - $projectModel = new Project($this->container); - $userModel = new User($this->container); + $projectModel = new ProjectModel($this->container); + $userModel = new UserModel($this->container); $userSessionModel = new UserSession($this->container); $this->assertNotFalse($userModel->create(array('username' => 'toto', 'password' => '123456'))); @@ -278,7 +277,7 @@ class UserHelperTest extends Base $this->assertTrue($helper->canRemoveTask($task)); // User #2 can remove his own TaskViewController - $user = $userModel->getbyId(2); + $user = $userModel->getById(2); $this->assertNotEmpty($user); $userSessionModel->initialize($user); diff --git a/tests/units/Model/ActionTest.php b/tests/units/Model/ActionTest.php index ed687846..5db18983 100644 --- a/tests/units/Model/ActionTest.php +++ b/tests/units/Model/ActionTest.php @@ -2,27 +2,27 @@ require_once __DIR__.'/../Base.php'; -use Kanboard\Model\Action; -use Kanboard\Model\Project; -use Kanboard\Model\Task; -use Kanboard\Model\User; -use Kanboard\Model\Column; -use Kanboard\Model\Category; -use Kanboard\Model\ProjectUserRole; +use Kanboard\Model\ActionModel; +use Kanboard\Model\ProjectModel; +use Kanboard\Model\TaskModel; +use Kanboard\Model\UserModel; +use Kanboard\Model\ColumnModel; +use Kanboard\Model\CategoryModel; +use Kanboard\Model\ProjectUserRoleModel; use Kanboard\Core\Security\Role; class ActionTest extends Base { public function testCreate() { - $projectModel = new Project($this->container); - $actionModel = new Action($this->container); + $projectModel = new ProjectModel($this->container); + $actionModel = new ActionModel($this->container); $this->assertEquals(1, $projectModel->create(array('name' => 'test'))); $this->assertEquals(1, $actionModel->create(array( 'project_id' => 1, - 'event_name' => Task::EVENT_CREATE, + 'event_name' => TaskModel::EVENT_CREATE, 'action_name' => '\Kanboard\Action\TaskAssignColorColumn', 'params' => array('column_id' => 1, 'color_id' => 'red'), ))); @@ -30,14 +30,14 @@ class ActionTest extends Base public function testRemove() { - $projectModel = new Project($this->container); - $actionModel = new Action($this->container); + $projectModel = new ProjectModel($this->container); + $actionModel = new ActionModel($this->container); $this->assertEquals(1, $projectModel->create(array('name' => 'test'))); $this->assertEquals(1, $actionModel->create(array( 'project_id' => 1, - 'event_name' => Task::EVENT_CREATE, + 'event_name' => TaskModel::EVENT_CREATE, 'action_name' => '\Kanboard\Action\TaskAssignColorColumn', 'params' => array('column_id' => 1, 'color_id' => 'red'), ))); @@ -49,14 +49,14 @@ class ActionTest extends Base public function testGetById() { - $projectModel = new Project($this->container); - $actionModel = new Action($this->container); + $projectModel = new ProjectModel($this->container); + $actionModel = new ActionModel($this->container); $this->assertEquals(1, $projectModel->create(array('name' => 'test'))); $this->assertEquals(1, $actionModel->create(array( 'project_id' => 1, - 'event_name' => Task::EVENT_CREATE, + 'event_name' => TaskModel::EVENT_CREATE, 'action_name' => '\Kanboard\Action\TaskAssignColorColumn', 'params' => array('column_id' => 1, 'color_id' => 'red'), ))); @@ -65,28 +65,28 @@ class ActionTest extends Base $this->assertNotEmpty($action); $this->assertEquals(1, $action['project_id']); $this->assertEquals('\Kanboard\Action\TaskAssignColorColumn', $action['action_name']); - $this->assertEquals(Task::EVENT_CREATE, $action['event_name']); + $this->assertEquals(TaskModel::EVENT_CREATE, $action['event_name']); $this->assertEquals(array('column_id' => 1, 'color_id' => 'red'), $action['params']); } public function testGetAll() { - $projectModel = new Project($this->container); - $actionModel = new Action($this->container); + $projectModel = new ProjectModel($this->container); + $actionModel = new ActionModel($this->container); $this->assertEquals(1, $projectModel->create(array('name' => 'test1'))); $this->assertEquals(2, $projectModel->create(array('name' => 'test2'))); $this->assertEquals(1, $actionModel->create(array( 'project_id' => 1, - 'event_name' => Task::EVENT_CREATE, + 'event_name' => TaskModel::EVENT_CREATE, 'action_name' => '\Kanboard\Action\TaskAssignColorColumn', 'params' => array('column_id' => 1, 'color_id' => 'red'), ))); $this->assertEquals(2, $actionModel->create(array( 'project_id' => 2, - 'event_name' => Task::EVENT_MOVE_COLUMN, + 'event_name' => TaskModel::EVENT_MOVE_COLUMN, 'action_name' => '\Kanboard\Action\TaskAssignColorColumn', 'params' => array('column_id' => 6, 'color_id' => 'blue'), ))); @@ -96,33 +96,33 @@ class ActionTest extends Base $this->assertEquals(1, $actions[0]['project_id']); $this->assertEquals('\Kanboard\Action\TaskAssignColorColumn', $actions[0]['action_name']); - $this->assertEquals(Task::EVENT_CREATE, $actions[0]['event_name']); + $this->assertEquals(TaskModel::EVENT_CREATE, $actions[0]['event_name']); $this->assertEquals(array('column_id' => 1, 'color_id' => 'red'), $actions[0]['params']); $this->assertEquals(2, $actions[1]['project_id']); $this->assertEquals('\Kanboard\Action\TaskAssignColorColumn', $actions[1]['action_name']); - $this->assertEquals(Task::EVENT_MOVE_COLUMN, $actions[1]['event_name']); + $this->assertEquals(TaskModel::EVENT_MOVE_COLUMN, $actions[1]['event_name']); $this->assertEquals(array('column_id' => 6, 'color_id' => 'blue'), $actions[1]['params']); } public function testGetAllByProject() { - $projectModel = new Project($this->container); - $actionModel = new Action($this->container); + $projectModel = new ProjectModel($this->container); + $actionModel = new ActionModel($this->container); $this->assertEquals(1, $projectModel->create(array('name' => 'test1'))); $this->assertEquals(2, $projectModel->create(array('name' => 'test2'))); $this->assertEquals(1, $actionModel->create(array( 'project_id' => 1, - 'event_name' => Task::EVENT_CREATE, + 'event_name' => TaskModel::EVENT_CREATE, 'action_name' => '\Kanboard\Action\TaskAssignColorColumn', 'params' => array('column_id' => 1, 'color_id' => 'red'), ))); $this->assertEquals(2, $actionModel->create(array( 'project_id' => 2, - 'event_name' => Task::EVENT_MOVE_COLUMN, + 'event_name' => TaskModel::EVENT_MOVE_COLUMN, 'action_name' => '\Kanboard\Action\TaskAssignColorColumn', 'params' => array('column_id' => 6, 'color_id' => 'blue'), ))); @@ -132,7 +132,7 @@ class ActionTest extends Base $this->assertEquals(1, $actions[0]['project_id']); $this->assertEquals('\Kanboard\Action\TaskAssignColorColumn', $actions[0]['action_name']); - $this->assertEquals(Task::EVENT_CREATE, $actions[0]['event_name']); + $this->assertEquals(TaskModel::EVENT_CREATE, $actions[0]['event_name']); $this->assertEquals(array('column_id' => 1, 'color_id' => 'red'), $actions[0]['params']); @@ -141,16 +141,16 @@ class ActionTest extends Base $this->assertEquals(2, $actions[0]['project_id']); $this->assertEquals('\Kanboard\Action\TaskAssignColorColumn', $actions[0]['action_name']); - $this->assertEquals(Task::EVENT_MOVE_COLUMN, $actions[0]['event_name']); + $this->assertEquals(TaskModel::EVENT_MOVE_COLUMN, $actions[0]['event_name']); $this->assertEquals(array('column_id' => 6, 'color_id' => 'blue'), $actions[0]['params']); } public function testGetAllByUser() { - $projectModel = new Project($this->container); - $projectUserRoleModel = new ProjectUserRole($this->container); - $userModel = new User($this->container); - $actionModel = new Action($this->container); + $projectModel = new ProjectModel($this->container); + $projectUserRoleModel = new ProjectUserRoleModel($this->container); + $userModel = new UserModel($this->container); + $actionModel = new ActionModel($this->container); $this->assertEquals(1, $projectModel->create(array('name' => 'test1'))); $this->assertEquals(2, $projectModel->create(array('name' => 'test2'))); @@ -165,21 +165,21 @@ class ActionTest extends Base $this->assertEquals(1, $actionModel->create(array( 'project_id' => 1, - 'event_name' => Task::EVENT_CREATE, + 'event_name' => TaskModel::EVENT_CREATE, 'action_name' => '\Kanboard\Action\TaskAssignColorColumn', 'params' => array('column_id' => 1, 'color_id' => 'red'), ))); $this->assertEquals(2, $actionModel->create(array( 'project_id' => 2, - 'event_name' => Task::EVENT_MOVE_COLUMN, + 'event_name' => TaskModel::EVENT_MOVE_COLUMN, 'action_name' => '\Kanboard\Action\TaskAssignColorColumn', 'params' => array('column_id' => 6, 'color_id' => 'blue'), ))); $this->assertEquals(3, $actionModel->create(array( 'project_id' => 3, - 'event_name' => Task::EVENT_MOVE_COLUMN, + 'event_name' => TaskModel::EVENT_MOVE_COLUMN, 'action_name' => '\Kanboard\Action\TaskAssignColorColumn', 'params' => array('column_id' => 10, 'color_id' => 'green'), ))); @@ -192,7 +192,7 @@ class ActionTest extends Base $this->assertEquals(1, $actions[0]['project_id']); $this->assertEquals('\Kanboard\Action\TaskAssignColorColumn', $actions[0]['action_name']); - $this->assertEquals(Task::EVENT_CREATE, $actions[0]['event_name']); + $this->assertEquals(TaskModel::EVENT_CREATE, $actions[0]['event_name']); $this->assertEquals(array('column_id' => 1, 'color_id' => 'red'), $actions[0]['params']); $actions = $actionModel->getAllByUser(3); @@ -200,21 +200,21 @@ class ActionTest extends Base $this->assertEquals(2, $actions[0]['project_id']); $this->assertEquals('\Kanboard\Action\TaskAssignColorColumn', $actions[0]['action_name']); - $this->assertEquals(Task::EVENT_MOVE_COLUMN, $actions[0]['event_name']); + $this->assertEquals(TaskModel::EVENT_MOVE_COLUMN, $actions[0]['event_name']); $this->assertEquals(array('column_id' => 6, 'color_id' => 'blue'), $actions[0]['params']); } public function testDuplicateWithColumnAndColorParameter() { - $projectModel = new Project($this->container); - $actionModel = new Action($this->container); + $projectModel = new ProjectModel($this->container); + $actionModel = new ActionModel($this->container); $this->assertEquals(1, $projectModel->create(array('name' => 'test1'))); $this->assertEquals(2, $projectModel->create(array('name' => 'test2'))); $this->assertEquals(1, $actionModel->create(array( 'project_id' => 1, - 'event_name' => Task::EVENT_CREATE, + 'event_name' => TaskModel::EVENT_CREATE, 'action_name' => '\Kanboard\Action\TaskAssignColorColumn', 'params' => array('column_id' => 1, 'color_id' => 'red'), ))); @@ -226,21 +226,21 @@ class ActionTest extends Base $this->assertEquals(2, $actions[0]['project_id']); $this->assertEquals('\Kanboard\Action\TaskAssignColorColumn', $actions[0]['action_name']); - $this->assertEquals(Task::EVENT_CREATE, $actions[0]['event_name']); + $this->assertEquals(TaskModel::EVENT_CREATE, $actions[0]['event_name']); $this->assertEquals(array('column_id' => 5, 'color_id' => 'red'), $actions[0]['params']); } public function testDuplicateWithColumnsParameter() { - $projectModel = new Project($this->container); - $actionModel = new Action($this->container); + $projectModel = new ProjectModel($this->container); + $actionModel = new ActionModel($this->container); $this->assertEquals(1, $projectModel->create(array('name' => 'test1'))); $this->assertEquals(2, $projectModel->create(array('name' => 'test2'))); $this->assertEquals(1, $actionModel->create(array( 'project_id' => 1, - 'event_name' => Task::EVENT_CREATE, + 'event_name' => TaskModel::EVENT_CREATE, 'action_name' => '\Kanboard\Action\TaskAssignColorColumn', 'params' => array('src_column_id' => 1, 'dst_column_id' => 2, 'dest_column_id' => 3), ))); @@ -252,15 +252,15 @@ class ActionTest extends Base $this->assertEquals(2, $actions[0]['project_id']); $this->assertEquals('\Kanboard\Action\TaskAssignColorColumn', $actions[0]['action_name']); - $this->assertEquals(Task::EVENT_CREATE, $actions[0]['event_name']); + $this->assertEquals(TaskModel::EVENT_CREATE, $actions[0]['event_name']); $this->assertEquals(array('src_column_id' => 5, 'dst_column_id' => 6, 'dest_column_id' => 7), $actions[0]['params']); } public function testDuplicateWithColumnParameterNotfound() { - $projectModel = new Project($this->container); - $actionModel = new Action($this->container); - $columnModel = new Column($this->container); + $projectModel = new ProjectModel($this->container); + $actionModel = new ActionModel($this->container); + $columnModel = new ColumnModel($this->container); $this->assertEquals(1, $projectModel->create(array('name' => 'test1'))); $this->assertEquals(2, $projectModel->create(array('name' => 'test2'))); @@ -269,14 +269,14 @@ class ActionTest extends Base $this->assertEquals(1, $actionModel->create(array( 'project_id' => 1, - 'event_name' => Task::EVENT_CREATE, + 'event_name' => TaskModel::EVENT_CREATE, 'action_name' => '\Kanboard\Action\TaskAssignColorColumn', 'params' => array('column_id' => 1, 'color_id' => 'red'), ))); $this->assertEquals(2, $actionModel->create(array( 'project_id' => 1, - 'event_name' => Task::EVENT_MOVE_COLUMN, + 'event_name' => TaskModel::EVENT_MOVE_COLUMN, 'action_name' => '\Kanboard\Action\TaskAssignColorColumn', 'params' => array('column_id' => 2, 'color_id' => 'green'), ))); @@ -288,14 +288,14 @@ class ActionTest extends Base $this->assertEquals(2, $actions[0]['project_id']); $this->assertEquals('\Kanboard\Action\TaskAssignColorColumn', $actions[0]['action_name']); - $this->assertEquals(Task::EVENT_CREATE, $actions[0]['event_name']); + $this->assertEquals(TaskModel::EVENT_CREATE, $actions[0]['event_name']); $this->assertEquals(array('column_id' => 5, 'color_id' => 'red'), $actions[0]['params']); } public function testDuplicateWithProjectParameter() { - $projectModel = new Project($this->container); - $actionModel = new Action($this->container); + $projectModel = new ProjectModel($this->container); + $actionModel = new ActionModel($this->container); $this->assertEquals(1, $projectModel->create(array('name' => 'test1'))); $this->assertEquals(2, $projectModel->create(array('name' => 'test2'))); @@ -303,7 +303,7 @@ class ActionTest extends Base $this->assertEquals(1, $actionModel->create(array( 'project_id' => 1, - 'event_name' => Task::EVENT_CLOSE, + 'event_name' => TaskModel::EVENT_CLOSE, 'action_name' => '\Kanboard\Action\TaskDuplicateAnotherProject', 'params' => array('column_id' => 1, 'project_id' => 3), ))); @@ -315,21 +315,21 @@ class ActionTest extends Base $this->assertEquals(2, $actions[0]['project_id']); $this->assertEquals('\Kanboard\Action\TaskDuplicateAnotherProject', $actions[0]['action_name']); - $this->assertEquals(Task::EVENT_CLOSE, $actions[0]['event_name']); + $this->assertEquals(TaskModel::EVENT_CLOSE, $actions[0]['event_name']); $this->assertEquals(array('column_id' => 5, 'project_id' => 3), $actions[0]['params']); } public function testDuplicateWithProjectParameterIdenticalToDestination() { - $projectModel = new Project($this->container); - $actionModel = new Action($this->container); + $projectModel = new ProjectModel($this->container); + $actionModel = new ActionModel($this->container); $this->assertEquals(1, $projectModel->create(array('name' => 'test1'))); $this->assertEquals(2, $projectModel->create(array('name' => 'test2'))); $this->assertEquals(1, $actionModel->create(array( 'project_id' => 1, - 'event_name' => Task::EVENT_CLOSE, + 'event_name' => TaskModel::EVENT_CLOSE, 'action_name' => '\Kanboard\Action\TaskDuplicateAnotherProject', 'params' => array('column_id' => 1, 'project_id' => 2), ))); @@ -342,10 +342,10 @@ class ActionTest extends Base public function testDuplicateWithUserParameter() { - $projectUserRoleModel = new ProjectUserRole($this->container); - $userModel = new User($this->container); - $projectModel = new Project($this->container); - $actionModel = new Action($this->container); + $projectUserRoleModel = new ProjectUserRoleModel($this->container); + $userModel = new UserModel($this->container); + $projectModel = new ProjectModel($this->container); + $actionModel = new ActionModel($this->container); $this->assertEquals(1, $projectModel->create(array('name' => 'test1'))); $this->assertEquals(2, $projectModel->create(array('name' => 'test2'))); @@ -357,7 +357,7 @@ class ActionTest extends Base $this->assertEquals(1, $actionModel->create(array( 'project_id' => 1, - 'event_name' => Task::EVENT_MOVE_COLUMN, + 'event_name' => TaskModel::EVENT_MOVE_COLUMN, 'action_name' => '\Kanboard\Action\TaskAssignSpecificUser', 'params' => array('column_id' => 1, 'user_id' => 2), ))); @@ -369,16 +369,16 @@ class ActionTest extends Base $this->assertEquals(2, $actions[0]['project_id']); $this->assertEquals('\Kanboard\Action\TaskAssignSpecificUser', $actions[0]['action_name']); - $this->assertEquals(Task::EVENT_MOVE_COLUMN, $actions[0]['event_name']); + $this->assertEquals(TaskModel::EVENT_MOVE_COLUMN, $actions[0]['event_name']); $this->assertEquals(array('column_id' => 5, 'user_id' => 2), $actions[0]['params']); } public function testDuplicateWithUserParameterButNotAssignable() { - $projectUserRoleModel = new ProjectUserRole($this->container); - $userModel = new User($this->container); - $projectModel = new Project($this->container); - $actionModel = new Action($this->container); + $projectUserRoleModel = new ProjectUserRoleModel($this->container); + $userModel = new UserModel($this->container); + $projectModel = new ProjectModel($this->container); + $actionModel = new ActionModel($this->container); $this->assertEquals(1, $projectModel->create(array('name' => 'test1'))); $this->assertEquals(2, $projectModel->create(array('name' => 'test2'))); @@ -390,7 +390,7 @@ class ActionTest extends Base $this->assertEquals(1, $actionModel->create(array( 'project_id' => 1, - 'event_name' => Task::EVENT_MOVE_COLUMN, + 'event_name' => TaskModel::EVENT_MOVE_COLUMN, 'action_name' => '\Kanboard\Action\TaskAssignSpecificUser', 'params' => array('column_id' => 1, 'user_id' => 2), ))); @@ -403,10 +403,10 @@ class ActionTest extends Base public function testDuplicateWithUserParameterButNotAvailable() { - $projectUserRoleModel = new ProjectUserRole($this->container); - $userModel = new User($this->container); - $projectModel = new Project($this->container); - $actionModel = new Action($this->container); + $projectUserRoleModel = new ProjectUserRoleModel($this->container); + $userModel = new UserModel($this->container); + $projectModel = new ProjectModel($this->container); + $actionModel = new ActionModel($this->container); $this->assertEquals(1, $projectModel->create(array('name' => 'test1'))); $this->assertEquals(2, $projectModel->create(array('name' => 'test2'))); @@ -417,7 +417,7 @@ class ActionTest extends Base $this->assertEquals(1, $actionModel->create(array( 'project_id' => 1, - 'event_name' => Task::EVENT_MOVE_COLUMN, + 'event_name' => TaskModel::EVENT_MOVE_COLUMN, 'action_name' => '\Kanboard\Action\TaskAssignSpecificUser', 'params' => array('column_id' => 1, 'owner_id' => 2), ))); @@ -430,9 +430,9 @@ class ActionTest extends Base public function testDuplicateWithCategoryParameter() { - $projectModel = new Project($this->container); - $actionModel = new Action($this->container); - $categoryModel = new Category($this->container); + $projectModel = new ProjectModel($this->container); + $actionModel = new ActionModel($this->container); + $categoryModel = new CategoryModel($this->container); $this->assertEquals(1, $projectModel->create(array('name' => 'test1'))); $this->assertEquals(2, $projectModel->create(array('name' => 'test2'))); @@ -442,7 +442,7 @@ class ActionTest extends Base $this->assertEquals(1, $actionModel->create(array( 'project_id' => 1, - 'event_name' => Task::EVENT_CREATE_UPDATE, + 'event_name' => TaskModel::EVENT_CREATE_UPDATE, 'action_name' => '\Kanboard\Action\TaskAssignColorCategory', 'params' => array('column_id' => 1, 'category_id' => 1), ))); @@ -454,15 +454,15 @@ class ActionTest extends Base $this->assertEquals(2, $actions[0]['project_id']); $this->assertEquals('\Kanboard\Action\TaskAssignColorCategory', $actions[0]['action_name']); - $this->assertEquals(Task::EVENT_CREATE_UPDATE, $actions[0]['event_name']); + $this->assertEquals(TaskModel::EVENT_CREATE_UPDATE, $actions[0]['event_name']); $this->assertEquals(array('column_id' => 5, 'category_id' => 2), $actions[0]['params']); } public function testDuplicateWithCategoryParameterButDifferentName() { - $projectModel = new Project($this->container); - $actionModel = new Action($this->container); - $categoryModel = new Category($this->container); + $projectModel = new ProjectModel($this->container); + $actionModel = new ActionModel($this->container); + $categoryModel = new CategoryModel($this->container); $this->assertEquals(1, $projectModel->create(array('name' => 'test1'))); $this->assertEquals(2, $projectModel->create(array('name' => 'test2'))); @@ -472,7 +472,7 @@ class ActionTest extends Base $this->assertEquals(1, $actionModel->create(array( 'project_id' => 1, - 'event_name' => Task::EVENT_CREATE_UPDATE, + 'event_name' => TaskModel::EVENT_CREATE_UPDATE, 'action_name' => '\Kanboard\Action\TaskAssignColorCategory', 'params' => array('column_id' => 1, 'category_id' => 1), ))); @@ -485,9 +485,9 @@ class ActionTest extends Base public function testDuplicateWithCategoryParameterButNotFound() { - $projectModel = new Project($this->container); - $actionModel = new Action($this->container); - $categoryModel = new Category($this->container); + $projectModel = new ProjectModel($this->container); + $actionModel = new ActionModel($this->container); + $categoryModel = new CategoryModel($this->container); $this->assertEquals(1, $projectModel->create(array('name' => 'test1'))); $this->assertEquals(2, $projectModel->create(array('name' => 'test2'))); @@ -496,7 +496,7 @@ class ActionTest extends Base $this->assertEquals(1, $actionModel->create(array( 'project_id' => 1, - 'event_name' => Task::EVENT_CREATE_UPDATE, + 'event_name' => TaskModel::EVENT_CREATE_UPDATE, 'action_name' => '\Kanboard\Action\TaskAssignColorCategory', 'params' => array('column_id' => 1, 'category_id' => 1), ))); diff --git a/tests/units/Model/BoardTest.php b/tests/units/Model/BoardTest.php index 20665ac2..80587d89 100644 --- a/tests/units/Model/BoardTest.php +++ b/tests/units/Model/BoardTest.php @@ -2,21 +2,21 @@ require_once __DIR__.'/../Base.php'; -use Kanboard\Model\Project; -use Kanboard\Model\Board; -use Kanboard\Model\Column; -use Kanboard\Model\Config; -use Kanboard\Model\TaskCreation; -use Kanboard\Model\TaskFinder; -use Kanboard\Model\Swimlane; +use Kanboard\Model\ProjectModel; +use Kanboard\Model\BoardModel; +use Kanboard\Model\ColumnModel; +use Kanboard\Model\ConfigModel; +use Kanboard\Model\TaskCreationModel; +use Kanboard\Model\TaskFinderModel; +use Kanboard\Model\SwimlaneModel; class BoardTest extends Base { public function testCreation() { - $p = new Project($this->container); - $columnModel = new Column($this->container); - $c = new Config($this->container); + $p = new ProjectModel($this->container); + $columnModel = new ColumnModel($this->container); + $c = new ConfigModel($this->container); // Default columns @@ -48,8 +48,8 @@ class BoardTest extends Base public function testGetBoard() { - $p = new Project($this->container); - $b = new Board($this->container); + $p = new ProjectModel($this->container); + $b = new BoardModel($this->container); $this->assertEquals(1, $p->create(array('name' => 'UnitTest1'))); @@ -69,11 +69,11 @@ class BoardTest extends Base public function testGetBoardWithSwimlane() { - $b = new Board($this->container); - $tc = new TaskCreation($this->container); - $tf = new TaskFinder($this->container); - $p = new Project($this->container); - $s = new Swimlane($this->container); + $b = new BoardModel($this->container); + $tc = new TaskCreationModel($this->container); + $tf = new TaskFinderModel($this->container); + $p = new ProjectModel($this->container); + $s = new SwimlaneModel($this->container); $this->assertEquals(1, $p->create(array('name' => 'Project #1'))); $this->assertEquals(1, $s->create(array('project_id' => 1, 'name' => 'test 1'))); diff --git a/tests/units/Model/CategoryTest.php b/tests/units/Model/CategoryTest.php index 600007d0..1fdc51f6 100644 --- a/tests/units/Model/CategoryTest.php +++ b/tests/units/Model/CategoryTest.php @@ -2,20 +2,20 @@ require_once __DIR__.'/../Base.php'; -use Kanboard\Model\Config; -use Kanboard\Model\TaskCreation; -use Kanboard\Model\TaskFinder; -use Kanboard\Model\Project; -use Kanboard\Model\Category; +use Kanboard\Model\ConfigModel; +use Kanboard\Model\TaskCreationModel; +use Kanboard\Model\TaskFinderModel; +use Kanboard\Model\ProjectModel; +use Kanboard\Model\CategoryModel; class CategoryTest extends Base { public function testCreation() { - $taskCreationModel = new TaskCreation($this->container); - $taskFinderModel = new TaskFinder($this->container); - $projectModel = new Project($this->container); - $categoryModel = new Category($this->container); + $taskCreationModel = new TaskCreationModel($this->container); + $taskFinderModel = new TaskFinderModel($this->container); + $projectModel = new ProjectModel($this->container); + $categoryModel = new CategoryModel($this->container); $this->assertEquals(1, $projectModel->create(array('name' => 'Project #1'))); $this->assertEquals(1, $categoryModel->create(array('name' => 'Category #1', 'project_id' => 1))); @@ -33,8 +33,8 @@ class CategoryTest extends Base public function testExists() { - $projectModel = new Project($this->container); - $categoryModel = new Category($this->container); + $projectModel = new ProjectModel($this->container); + $categoryModel = new CategoryModel($this->container); $this->assertEquals(1, $projectModel->create(array('name' => 'Project #1'))); $this->assertEquals(1, $categoryModel->create(array('name' => 'Category #1', 'project_id' => 1))); @@ -44,8 +44,8 @@ class CategoryTest extends Base public function testGetById() { - $projectModel = new Project($this->container); - $categoryModel = new Category($this->container); + $projectModel = new ProjectModel($this->container); + $categoryModel = new CategoryModel($this->container); $this->assertEquals(1, $projectModel->create(array('name' => 'Project #1'))); $this->assertEquals(1, $categoryModel->create(array('name' => 'Category #1', 'project_id' => 1, 'description' => 'test'))); @@ -59,8 +59,8 @@ class CategoryTest extends Base public function testGetNameById() { - $projectModel = new Project($this->container); - $categoryModel = new Category($this->container); + $projectModel = new ProjectModel($this->container); + $categoryModel = new CategoryModel($this->container); $this->assertEquals(1, $projectModel->create(array('name' => 'Project #1'))); $this->assertEquals(1, $categoryModel->create(array('name' => 'Category #1', 'project_id' => 1, 'description' => 'test'))); @@ -71,8 +71,8 @@ class CategoryTest extends Base public function testGetIdByName() { - $projectModel = new Project($this->container); - $categoryModel = new Category($this->container); + $projectModel = new ProjectModel($this->container); + $categoryModel = new CategoryModel($this->container); $this->assertEquals(1, $projectModel->create(array('name' => 'Project #1'))); $this->assertEquals(1, $categoryModel->create(array('name' => 'Category #1', 'project_id' => 1, 'description' => 'test'))); @@ -83,8 +83,8 @@ class CategoryTest extends Base public function testGetList() { - $projectModel = new Project($this->container); - $categoryModel = new Category($this->container); + $projectModel = new ProjectModel($this->container); + $categoryModel = new CategoryModel($this->container); $this->assertEquals(1, $projectModel->create(array('name' => 'Project #1'))); $this->assertEquals(1, $categoryModel->create(array('name' => 'Category #1', 'project_id' => 1, 'description' => 'test'))); @@ -117,8 +117,8 @@ class CategoryTest extends Base public function testGetAll() { - $projectModel = new Project($this->container); - $categoryModel = new Category($this->container); + $projectModel = new ProjectModel($this->container); + $categoryModel = new CategoryModel($this->container); $this->assertEquals(1, $projectModel->create(array('name' => 'Project #1'))); $this->assertEquals(1, $categoryModel->create(array('name' => 'Category #1', 'project_id' => 1, 'description' => 'test'))); @@ -140,9 +140,9 @@ class CategoryTest extends Base public function testCreateDefaultCategories() { - $projectModel = new Project($this->container); - $categoryModel = new Category($this->container); - $configModel = new Config($this->container); + $projectModel = new ProjectModel($this->container); + $categoryModel = new CategoryModel($this->container); + $configModel = new ConfigModel($this->container); $this->assertTrue($configModel->save(array('project_categories' => 'C1, C2, C3'))); $this->assertEquals(1, $projectModel->create(array('name' => 'Project #1'))); @@ -157,8 +157,8 @@ class CategoryTest extends Base public function testUpdate() { - $projectModel = new Project($this->container); - $categoryModel = new Category($this->container); + $projectModel = new ProjectModel($this->container); + $categoryModel = new CategoryModel($this->container); $this->assertEquals(1, $projectModel->create(array('name' => 'Project #1'))); $this->assertEquals(1, $categoryModel->create(array('name' => 'Category #1', 'project_id' => 1))); @@ -172,10 +172,10 @@ class CategoryTest extends Base public function testRemove() { - $taskCreationModel = new TaskCreation($this->container); - $taskFinderModel = new TaskFinder($this->container); - $projectModel = new Project($this->container); - $categoryModel = new Category($this->container); + $taskCreationModel = new TaskCreationModel($this->container); + $taskFinderModel = new TaskFinderModel($this->container); + $projectModel = new ProjectModel($this->container); + $categoryModel = new CategoryModel($this->container); $this->assertEquals(1, $projectModel->create(array('name' => 'Project #1'))); $this->assertEquals(1, $categoryModel->create(array('name' => 'Category #1', 'project_id' => 1))); @@ -195,8 +195,8 @@ class CategoryTest extends Base public function testDuplicate() { - $projectModel = new Project($this->container); - $categoryModel = new Category($this->container); + $projectModel = new ProjectModel($this->container); + $categoryModel = new CategoryModel($this->container); $this->assertEquals(1, $projectModel->create(array('name' => 'Project #1'))); $this->assertEquals(2, $projectModel->create(array('name' => 'Project #2'))); diff --git a/tests/units/Model/ColorTest.php b/tests/units/Model/ColorTest.php index e96ecb6b..2a2c4b87 100644 --- a/tests/units/Model/ColorTest.php +++ b/tests/units/Model/ColorTest.php @@ -2,14 +2,14 @@ require_once __DIR__.'/../Base.php'; -use Kanboard\Model\Color; -use Kanboard\Model\Config; +use Kanboard\Model\ColorModel; +use Kanboard\Model\ConfigModel; class ColorTest extends Base { public function testFind() { - $colorModel = new Color($this->container); + $colorModel = new ColorModel($this->container); $this->assertEquals('yellow', $colorModel->find('yellow')); $this->assertEquals('yellow', $colorModel->find('Yellow')); $this->assertEquals('dark_grey', $colorModel->find('Dark Grey')); @@ -18,7 +18,7 @@ class ColorTest extends Base public function testGetColorProperties() { - $colorModel = new Color($this->container); + $colorModel = new ColorModel($this->container); $expected = array( 'name' => 'Light Green', 'background' => '#dcedc8', @@ -38,7 +38,7 @@ class ColorTest extends Base public function testGetList() { - $colorModel = new Color($this->container); + $colorModel = new ColorModel($this->container); $colors = $colorModel->getList(); $this->assertCount(16, $colors); @@ -52,8 +52,8 @@ class ColorTest extends Base public function testGetDefaultColor() { - $colorModel = new Color($this->container); - $configModel = new Config($this->container); + $colorModel = new ColorModel($this->container); + $configModel = new ConfigModel($this->container); $this->assertEquals('yellow', $colorModel->getDefaultColor()); @@ -64,7 +64,7 @@ class ColorTest extends Base public function testGetDefaultColors() { - $colorModel = new Color($this->container); + $colorModel = new ColorModel($this->container); $colors = $colorModel->getDefaultColors(); $this->assertCount(16, $colors); @@ -72,19 +72,19 @@ class ColorTest extends Base public function testGetBorderColor() { - $colorModel = new Color($this->container); + $colorModel = new ColorModel($this->container); $this->assertEquals('rgb(74, 227, 113)', $colorModel->getBorderColor('green')); } public function testGetBackgroundColor() { - $colorModel = new Color($this->container); + $colorModel = new ColorModel($this->container); $this->assertEquals('rgb(189, 244, 203)', $colorModel->getBackgroundColor('green')); } public function testGetCss() { - $colorModel = new Color($this->container); + $colorModel = new ColorModel($this->container); $css = $colorModel->getCss(); $this->assertStringStartsWith('div.color-yellow {', $css); diff --git a/tests/units/Model/ColumnTest.php b/tests/units/Model/ColumnTest.php index e40f89c6..7340a274 100644 --- a/tests/units/Model/ColumnTest.php +++ b/tests/units/Model/ColumnTest.php @@ -2,15 +2,15 @@ require_once __DIR__.'/../Base.php'; -use Kanboard\Model\Project; -use Kanboard\Model\Column; +use Kanboard\Model\ProjectModel; +use Kanboard\Model\ColumnModel; class ColumnTest extends Base { public function testGetColumn() { - $projectModel = new Project($this->container); - $columnModel = new Column($this->container); + $projectModel = new ProjectModel($this->container); + $columnModel = new ColumnModel($this->container); $this->assertEquals(1, $projectModel->create(array('name' => 'UnitTest'))); @@ -24,8 +24,8 @@ class ColumnTest extends Base public function testGetFirstColumnId() { - $projectModel = new Project($this->container); - $columnModel = new Column($this->container); + $projectModel = new ProjectModel($this->container); + $columnModel = new ColumnModel($this->container); $this->assertEquals(1, $projectModel->create(array('name' => 'UnitTest'))); $this->assertEquals(1, $columnModel->getFirstColumnId(1)); @@ -33,8 +33,8 @@ class ColumnTest extends Base public function testGetLastColumnId() { - $projectModel = new Project($this->container); - $columnModel = new Column($this->container); + $projectModel = new ProjectModel($this->container); + $columnModel = new ColumnModel($this->container); $this->assertEquals(1, $projectModel->create(array('name' => 'UnitTest'))); $this->assertEquals(4, $columnModel->getLastColumnId(1)); @@ -42,8 +42,8 @@ class ColumnTest extends Base public function testGetLastColumnPosition() { - $projectModel = new Project($this->container); - $columnModel = new Column($this->container); + $projectModel = new ProjectModel($this->container); + $columnModel = new ColumnModel($this->container); $this->assertEquals(1, $projectModel->create(array('name' => 'UnitTest'))); $this->assertEquals(4, $columnModel->getLastColumnPosition(1)); @@ -51,8 +51,8 @@ class ColumnTest extends Base public function testGetColumnIdByTitle() { - $projectModel = new Project($this->container); - $columnModel = new Column($this->container); + $projectModel = new ProjectModel($this->container); + $columnModel = new ColumnModel($this->container); $this->assertEquals(1, $projectModel->create(array('name' => 'UnitTest'))); $this->assertEquals(2, $columnModel->getColumnIdByTitle(1, 'Ready')); @@ -60,8 +60,8 @@ class ColumnTest extends Base public function testGetTitleByColumnId() { - $projectModel = new Project($this->container); - $columnModel = new Column($this->container); + $projectModel = new ProjectModel($this->container); + $columnModel = new ColumnModel($this->container); $this->assertEquals(1, $projectModel->create(array('name' => 'UnitTest'))); $this->assertEquals('Work in progress', $columnModel->getColumnTitleById(3)); @@ -69,8 +69,8 @@ class ColumnTest extends Base public function testGetAll() { - $projectModel = new Project($this->container); - $columnModel = new Column($this->container); + $projectModel = new ProjectModel($this->container); + $columnModel = new ColumnModel($this->container); $this->assertEquals(1, $projectModel->create(array('name' => 'UnitTest'))); @@ -96,8 +96,8 @@ class ColumnTest extends Base public function testGetList() { - $projectModel = new Project($this->container); - $columnModel = new Column($this->container); + $projectModel = new ProjectModel($this->container); + $columnModel = new ColumnModel($this->container); $this->assertEquals(1, $projectModel->create(array('name' => 'UnitTest'))); @@ -119,8 +119,8 @@ class ColumnTest extends Base public function testAddColumn() { - $projectModel = new Project($this->container); - $columnModel = new Column($this->container); + $projectModel = new ProjectModel($this->container); + $columnModel = new ColumnModel($this->container); $this->assertEquals(1, $projectModel->create(array('name' => 'UnitTest'))); $this->assertNotFalse($columnModel->create(1, 'another column')); @@ -142,8 +142,8 @@ class ColumnTest extends Base public function testUpdateColumn() { - $projectModel = new Project($this->container); - $columnModel = new Column($this->container); + $projectModel = new ProjectModel($this->container); + $columnModel = new ColumnModel($this->container); $this->assertEquals(1, $projectModel->create(array('name' => 'UnitTest'))); @@ -163,8 +163,8 @@ class ColumnTest extends Base public function testRemoveColumn() { - $projectModel = new Project($this->container); - $columnModel = new Column($this->container); + $projectModel = new ProjectModel($this->container); + $columnModel = new ColumnModel($this->container); $this->assertEquals(1, $projectModel->create(array('name' => 'UnitTest'))); $this->assertTrue($columnModel->remove(3)); @@ -177,8 +177,8 @@ class ColumnTest extends Base public function testChangePosition() { - $projectModel = new Project($this->container); - $columnModel = new Column($this->container); + $projectModel = new ProjectModel($this->container); + $columnModel = new ColumnModel($this->container); $this->assertEquals(1, $projectModel->create(array('name' => 'test1'))); diff --git a/tests/units/Model/CommentTest.php b/tests/units/Model/CommentTest.php index bb96e4f4..7250ae0b 100644 --- a/tests/units/Model/CommentTest.php +++ b/tests/units/Model/CommentTest.php @@ -2,17 +2,17 @@ require_once __DIR__.'/../Base.php'; -use Kanboard\Model\TaskCreation; -use Kanboard\Model\Project; -use Kanboard\Model\Comment; +use Kanboard\Model\TaskCreationModel; +use Kanboard\Model\ProjectModel; +use Kanboard\Model\CommentModel; class CommentTest extends Base { public function testCreate() { - $c = new Comment($this->container); - $tc = new TaskCreation($this->container); - $p = new Project($this->container); + $c = new CommentModel($this->container); + $tc = new TaskCreationModel($this->container); + $p = new ProjectModel($this->container); $this->assertEquals(1, $p->create(array('name' => 'test1'))); $this->assertEquals(1, $tc->create(array('title' => 'test', 'project_id' => 1, 'column_id' => 3, 'owner_id' => 1))); @@ -38,9 +38,9 @@ class CommentTest extends Base public function testGetAll() { - $c = new Comment($this->container); - $tc = new TaskCreation($this->container); - $p = new Project($this->container); + $c = new CommentModel($this->container); + $tc = new TaskCreationModel($this->container); + $p = new ProjectModel($this->container); $this->assertEquals(1, $p->create(array('name' => 'test1'))); $this->assertEquals(1, $tc->create(array('title' => 'test', 'project_id' => 1, 'column_id' => 3, 'owner_id' => 1))); @@ -61,9 +61,9 @@ class CommentTest extends Base public function testUpdate() { - $c = new Comment($this->container); - $tc = new TaskCreation($this->container); - $p = new Project($this->container); + $c = new CommentModel($this->container); + $tc = new TaskCreationModel($this->container); + $p = new ProjectModel($this->container); $this->assertEquals(1, $p->create(array('name' => 'test1'))); $this->assertEquals(1, $tc->create(array('title' => 'test', 'project_id' => 1, 'column_id' => 3, 'owner_id' => 1))); @@ -77,9 +77,9 @@ class CommentTest extends Base public function validateRemove() { - $c = new Comment($this->container); - $tc = new TaskCreation($this->container); - $p = new Project($this->container); + $c = new CommentModel($this->container); + $tc = new TaskCreationModel($this->container); + $p = new ProjectModel($this->container); $this->assertEquals(1, $p->create(array('name' => 'test1'))); $this->assertEquals(1, $tc->create(array('title' => 'test', 'project_id' => 1, 'column_id' => 3, 'owner_id' => 1))); diff --git a/tests/units/Model/ConfigTest.php b/tests/units/Model/ConfigTest.php index ad74ad50..3345ee3e 100644 --- a/tests/units/Model/ConfigTest.php +++ b/tests/units/Model/ConfigTest.php @@ -2,13 +2,13 @@ require_once __DIR__.'/../Base.php'; -use Kanboard\Model\Config; +use Kanboard\Model\ConfigModel; class ConfigTest extends Base { public function testRegenerateToken() { - $configModel = new Config($this->container); + $configModel = new ConfigModel($this->container); $token = $configModel->getOption('api_token'); $this->assertTrue($configModel->regenerateToken('api_token')); $this->assertNotEquals($token, $configModel->getOption('api_token')); @@ -16,7 +16,7 @@ class ConfigTest extends Base public function testCRUDOperations() { - $c = new Config($this->container); + $c = new ConfigModel($this->container); $this->assertTrue($c->save(array('key1' => 'value1'))); $this->assertTrue($c->save(array('key1' => 'value2'))); @@ -41,7 +41,7 @@ class ConfigTest extends Base public function testSaveApplicationUrl() { - $c = new Config($this->container); + $c = new ConfigModel($this->container); $this->assertTrue($c->save(array('application_url' => 'http://localhost/'))); $this->assertEquals('http://localhost/', $c->getOption('application_url')); @@ -55,7 +55,7 @@ class ConfigTest extends Base public function testDefaultValues() { - $c = new Config($this->container); + $c = new ConfigModel($this->container); $this->assertEquals(172800, $c->getOption('board_highlight_period')); $this->assertEquals(60, $c->getOption('board_public_refresh_interval')); @@ -92,7 +92,7 @@ class ConfigTest extends Base public function testGetOption() { - $c = new Config($this->container); + $c = new ConfigModel($this->container); $this->assertEquals('', $c->getOption('board_columns')); $this->assertEquals('test', $c->getOption('board_columns', 'test')); @@ -101,7 +101,7 @@ class ConfigTest extends Base public function testGetWithCaching() { - $c = new Config($this->container); + $c = new ConfigModel($this->container); $this->assertEquals('UTC', $c->get('application_timezone')); $this->assertTrue($c->save(array('application_timezone' => 'Europe/Paris'))); diff --git a/tests/units/Model/CurrencyTest.php b/tests/units/Model/CurrencyTest.php index 0bc71da6..162cdfc1 100644 --- a/tests/units/Model/CurrencyTest.php +++ b/tests/units/Model/CurrencyTest.php @@ -2,20 +2,20 @@ require_once __DIR__.'/../Base.php'; -use Kanboard\Model\Currency; +use Kanboard\Model\CurrencyModel; class CurrencyTest extends Base { public function testGetCurrencies() { - $currencyModel = new Currency($this->container); + $currencyModel = new CurrencyModel($this->container); $currencies = $currencyModel->getCurrencies(); $this->assertArrayHasKey('EUR', $currencies); } public function testGetAll() { - $currencyModel = new Currency($this->container); + $currencyModel = new CurrencyModel($this->container); $currencies = $currencyModel->getAll(); $this->assertCount(0, $currencies); @@ -28,21 +28,21 @@ class CurrencyTest extends Base public function testCreate() { - $currencyModel = new Currency($this->container); + $currencyModel = new CurrencyModel($this->container); $this->assertNotFalse($currencyModel->create('EUR', 1.2)); $this->assertNotFalse($currencyModel->create('EUR', 1.5)); } public function testUpdate() { - $currencyModel = new Currency($this->container); + $currencyModel = new CurrencyModel($this->container); $this->assertNotFalse($currencyModel->create('EUR', 1.1)); $this->assertNotFalse($currencyModel->update('EUR', 2.2)); } public function testGetPrice() { - $currencyModel = new Currency($this->container); + $currencyModel = new CurrencyModel($this->container); $this->assertEquals(123, $currencyModel->getPrice('USD', 123)); diff --git a/tests/units/Model/CustomFilterTest.php b/tests/units/Model/CustomFilterTest.php index a73bc401..463a1c91 100644 --- a/tests/units/Model/CustomFilterTest.php +++ b/tests/units/Model/CustomFilterTest.php @@ -2,16 +2,16 @@ require_once __DIR__.'/../Base.php'; -use Kanboard\Model\Project; -use Kanboard\Model\User; -use Kanboard\Model\CustomFilter; +use Kanboard\Model\ProjectModel; +use Kanboard\Model\UserModel; +use Kanboard\Model\CustomFilterModel; class CustomFilterTest extends Base { public function testCreation() { - $p = new Project($this->container); - $cf = new CustomFilter($this->container); + $p = new ProjectModel($this->container); + $cf = new CustomFilterModel($this->container); $this->assertEquals(1, $p->create(array('name' => 'UnitTest'))); $this->assertEquals(1, $cf->create(array('name' => 'My filter 1', 'filter' => 'status:open color:blue', 'project_id' => 1, 'user_id' => 1))); @@ -36,8 +36,8 @@ class CustomFilterTest extends Base public function testModification() { - $p = new Project($this->container); - $cf = new CustomFilter($this->container); + $p = new ProjectModel($this->container); + $cf = new CustomFilterModel($this->container); $this->assertEquals(1, $p->create(array('name' => 'UnitTest'))); $this->assertEquals(1, $cf->create(array('name' => 'My filter 1', 'filter' => 'status:open color:blue', 'project_id' => 1, 'user_id' => 1))); @@ -54,9 +54,9 @@ class CustomFilterTest extends Base public function testGetAll() { - $u = new User($this->container); - $p = new Project($this->container); - $cf = new CustomFilter($this->container); + $u = new UserModel($this->container); + $p = new ProjectModel($this->container); + $cf = new CustomFilterModel($this->container); $this->assertEquals(1, $p->create(array('name' => 'UnitTest 1'))); $this->assertEquals(2, $p->create(array('name' => 'UnitTest 2'))); @@ -128,8 +128,8 @@ class CustomFilterTest extends Base public function testRemove() { - $p = new Project($this->container); - $cf = new CustomFilter($this->container); + $p = new ProjectModel($this->container); + $cf = new CustomFilterModel($this->container); $this->assertEquals(1, $p->create(array('name' => 'UnitTest'))); $this->assertEquals(1, $cf->create(array('name' => 'My filter 1', 'filter' => 'status:open color:blue', 'project_id' => 1, 'user_id' => 1))); diff --git a/tests/units/Model/GroupMemberTest.php b/tests/units/Model/GroupMemberTest.php index 0ff9fdf6..edc9d98c 100644 --- a/tests/units/Model/GroupMemberTest.php +++ b/tests/units/Model/GroupMemberTest.php @@ -2,16 +2,16 @@ require_once __DIR__.'/../Base.php'; -use Kanboard\Model\Group; -use Kanboard\Model\User; -use Kanboard\Model\GroupMember; +use Kanboard\Model\GroupModel; +use Kanboard\Model\UserModel; +use Kanboard\Model\GroupMemberModel; class GroupMemberTest extends Base { public function testAddRemove() { - $groupModel = new Group($this->container); - $groupMemberModel = new GroupMember($this->container); + $groupModel = new GroupModel($this->container); + $groupMemberModel = new GroupMemberModel($this->container); $this->assertEquals(1, $groupModel->create('Test')); @@ -32,9 +32,9 @@ class GroupMemberTest extends Base public function testMembers() { - $userModel = new User($this->container); - $groupModel = new Group($this->container); - $groupMemberModel = new GroupMember($this->container); + $userModel = new UserModel($this->container); + $groupModel = new GroupModel($this->container); + $groupMemberModel = new GroupMemberModel($this->container); $this->assertEquals(1, $groupModel->create('Group A')); $this->assertEquals(2, $groupModel->create('Group B')); diff --git a/tests/units/Model/GroupTest.php b/tests/units/Model/GroupTest.php index 36b47dc5..85c2c5d9 100644 --- a/tests/units/Model/GroupTest.php +++ b/tests/units/Model/GroupTest.php @@ -2,20 +2,20 @@ require_once __DIR__.'/../Base.php'; -use Kanboard\Model\Group; +use Kanboard\Model\GroupModel; class GroupTest extends Base { public function testCreation() { - $groupModel = new Group($this->container); + $groupModel = new GroupModel($this->container); $this->assertEquals(1, $groupModel->create('Test')); $this->assertFalse($groupModel->create('Test')); } public function testGetById() { - $groupModel = new Group($this->container); + $groupModel = new GroupModel($this->container); $this->assertEquals(1, $groupModel->create('Test')); $group = $groupModel->getById(1); @@ -27,7 +27,7 @@ class GroupTest extends Base public function testGetAll() { - $groupModel = new Group($this->container); + $groupModel = new GroupModel($this->container); $this->assertEquals(1, $groupModel->create('B')); $this->assertEquals(2, $groupModel->create('A', 'uuid')); @@ -41,7 +41,7 @@ class GroupTest extends Base public function testUpdate() { - $groupModel = new Group($this->container); + $groupModel = new GroupModel($this->container); $this->assertEquals(1, $groupModel->create('Test')); $this->assertTrue($groupModel->update(array('id' => 1, 'name' => 'My group', 'external_id' => 'test'))); @@ -52,7 +52,7 @@ class GroupTest extends Base public function testRemove() { - $groupModel = new Group($this->container); + $groupModel = new GroupModel($this->container); $this->assertEquals(1, $groupModel->create('Test')); $this->assertTrue($groupModel->remove(1)); $this->assertEmpty($groupModel->getById(1)); diff --git a/tests/units/Model/LanguageTest.php b/tests/units/Model/LanguageTest.php index dff98a83..4330c3c8 100644 --- a/tests/units/Model/LanguageTest.php +++ b/tests/units/Model/LanguageTest.php @@ -1,6 +1,6 @@ <?php -use Kanboard\Model\Language; +use Kanboard\Model\LanguageModel; require_once __DIR__.'/../Base.php'; @@ -8,21 +8,21 @@ class LanguageTest extends Base { public function testGetCodes() { - $codes = Language::getCodes(); + $codes = LanguageModel::getCodes(); $this->assertContains('fr_FR', $codes); $this->assertContains('en_US', $codes); } public function testFindCode() { - $this->assertSame('', Language::findCode('xx-XX')); - $this->assertSame('fr_FR', Language::findCode('fr-FR')); - $this->assertSame('en_US', Language::findCode('en-US')); + $this->assertSame('', LanguageModel::findCode('xx-XX')); + $this->assertSame('fr_FR', LanguageModel::findCode('fr-FR')); + $this->assertSame('en_US', LanguageModel::findCode('en-US')); } public function testGetJsLanguage() { - $languageModel = new Language($this->container); + $languageModel = new LanguageModel($this->container); $this->assertEquals('en', $languageModel->getJsLanguageCode()); $this->container['sessionStorage']->user = array('language' => 'fr_FR'); @@ -34,7 +34,7 @@ class LanguageTest extends Base public function testGetCurrentLanguage() { - $languageModel = new Language($this->container); + $languageModel = new LanguageModel($this->container); $this->assertEquals('en_US', $languageModel->getCurrentLanguage()); $this->container['sessionStorage']->user = array('language' => 'fr_FR'); @@ -46,7 +46,7 @@ class LanguageTest extends Base public function testGetLanguages() { - $languageModel = new Language($this->container); + $languageModel = new LanguageModel($this->container); $this->assertNotEmpty($languageModel->getLanguages()); $this->assertArrayHasKey('fr_FR', $languageModel->getLanguages()); $this->assertContains('Français', $languageModel->getLanguages()); diff --git a/tests/units/Model/LastLoginTest.php b/tests/units/Model/LastLoginTest.php index fc5ea1e5..8c291e15 100644 --- a/tests/units/Model/LastLoginTest.php +++ b/tests/units/Model/LastLoginTest.php @@ -2,13 +2,13 @@ require_once __DIR__.'/../Base.php'; -use Kanboard\Model\LastLogin; +use Kanboard\Model\LastLoginModel; class LastLoginTest extends Base { public function testCreate() { - $lastLoginModel = new LastLogin($this->container); + $lastLoginModel = new LastLoginModel($this->container); $this->assertTrue($lastLoginModel->create('Test1', 1, '127.0.0.1', 'My browser')); $this->assertTrue($lastLoginModel->create('Test2', 1, '127.0.0.1', str_repeat('Too long', 50))); @@ -29,7 +29,7 @@ class LastLoginTest extends Base public function testCleanup() { - $lastLoginModel = new LastLogin($this->container); + $lastLoginModel = new LastLoginModel($this->container); for ($i = 0; $i < $lastLoginModel::NB_LOGINS + 5; $i++) { $this->assertTrue($lastLoginModel->create('Test' . $i, 1, '127.0.0.1', 'My browser')); diff --git a/tests/units/Model/LinkTest.php b/tests/units/Model/LinkTest.php index b102646d..600c09f3 100644 --- a/tests/units/Model/LinkTest.php +++ b/tests/units/Model/LinkTest.php @@ -2,13 +2,13 @@ require_once __DIR__.'/../Base.php'; -use Kanboard\Model\Link; +use Kanboard\Model\LinkModel; class LinkTest extends Base { public function testCreateLink() { - $l = new Link($this->container); + $l = new LinkModel($this->container); $this->assertNotFalse($l->create('Link A')); $this->assertFalse($l->create('Link A')); @@ -38,7 +38,7 @@ class LinkTest extends Base public function testGetOppositeLinkId() { - $l = new Link($this->container); + $l = new LinkModel($this->container); $this->assertNotFalse($l->create('Link A')); $this->assertNotFalse($l->create('Link B', 'Link C')); @@ -50,7 +50,7 @@ class LinkTest extends Base public function testUpdate() { - $l = new Link($this->container); + $l = new LinkModel($this->container); $this->assertTrue($l->update(array('id' => 2, 'label' => 'test', 'opposite_id' => 0))); @@ -62,7 +62,7 @@ class LinkTest extends Base public function testRemove() { - $l = new Link($this->container); + $l = new LinkModel($this->container); $link = $l->getById(3); $this->assertNotEmpty($link); @@ -82,7 +82,7 @@ class LinkTest extends Base public function testGetMergedList() { - $l = new Link($this->container); + $l = new LinkModel($this->container); $links = $l->getMergedList(); $this->assertNotEmpty($links); @@ -93,7 +93,7 @@ class LinkTest extends Base public function testGetList() { - $l = new Link($this->container); + $l = new LinkModel($this->container); $links = $l->getList(); $this->assertNotEmpty($links); diff --git a/tests/units/Model/NotificationTest.php b/tests/units/Model/NotificationTest.php index d5ec7735..96ee5f4e 100644 --- a/tests/units/Model/NotificationTest.php +++ b/tests/units/Model/NotificationTest.php @@ -2,27 +2,27 @@ require_once __DIR__.'/../Base.php'; -use Kanboard\Model\TaskFinder; -use Kanboard\Model\TaskCreation; -use Kanboard\Model\Subtask; -use Kanboard\Model\Comment; -use Kanboard\Model\TaskFile; -use Kanboard\Model\Task; -use Kanboard\Model\Project; -use Kanboard\Model\Notification; +use Kanboard\Model\TaskFinderModel; +use Kanboard\Model\TaskCreationModel; +use Kanboard\Model\SubtaskModel; +use Kanboard\Model\CommentModel; +use Kanboard\Model\TaskFileModel; +use Kanboard\Model\TaskModel; +use Kanboard\Model\ProjectModel; +use Kanboard\Model\NotificationModel; use Kanboard\Subscriber\NotificationSubscriber; class NotificationTest extends Base { public function testGetTitle() { - $wn = new Notification($this->container); - $p = new Project($this->container); - $tf = new TaskFinder($this->container); - $tc = new TaskCreation($this->container); - $s = new Subtask($this->container); - $c = new Comment($this->container); - $f = new TaskFile($this->container); + $wn = new NotificationModel($this->container); + $p = new ProjectModel($this->container); + $tf = new TaskFinderModel($this->container); + $tc = new TaskCreationModel($this->container); + $s = new SubtaskModel($this->container); + $c = new CommentModel($this->container); + $f = new TaskFileModel($this->container); $this->assertEquals(1, $p->create(array('name' => 'test'))); $this->assertEquals(1, $tc->create(array('title' => 'test', 'project_id' => 1))); @@ -62,7 +62,7 @@ class NotificationTest extends Base $this->assertNotEmpty($title); } - $this->assertNotEmpty($wn->getTitleWithoutAuthor(Task::EVENT_OVERDUE, array('tasks' => array(array('id' => 1))))); + $this->assertNotEmpty($wn->getTitleWithoutAuthor(TaskModel::EVENT_OVERDUE, array('tasks' => array(array('id' => 1))))); $this->assertNotEmpty($wn->getTitleWithoutAuthor('unkown', array())); } } diff --git a/tests/units/Model/PasswordResetTest.php b/tests/units/Model/PasswordResetTest.php index f88d24fb..01ca1d12 100644 --- a/tests/units/Model/PasswordResetTest.php +++ b/tests/units/Model/PasswordResetTest.php @@ -2,15 +2,15 @@ require_once __DIR__.'/../Base.php'; -use Kanboard\Model\User; -use Kanboard\Model\PasswordReset; +use Kanboard\Model\UserModel; +use Kanboard\Model\PasswordResetModel; class PasswordResetTest extends Base { public function testCreate() { - $userModel = new User($this->container); - $passwordResetModel = new PasswordReset($this->container); + $userModel = new UserModel($this->container); + $passwordResetModel = new PasswordResetModel($this->container); $this->assertEquals(2, $userModel->create(array('username' => 'user1'))); $this->assertEquals(3, $userModel->create(array('username' => 'user2', 'email' => 'user1@localhost'))); @@ -22,8 +22,8 @@ class PasswordResetTest extends Base public function testGetUserIdByToken() { - $userModel = new User($this->container); - $passwordResetModel = new PasswordReset($this->container); + $userModel = new UserModel($this->container); + $passwordResetModel = new PasswordResetModel($this->container); $this->assertEquals(2, $userModel->create(array('username' => 'user2', 'email' => 'user1@localhost'))); @@ -33,8 +33,8 @@ class PasswordResetTest extends Base public function testGetUserIdByTokenWhenExpired() { - $userModel = new User($this->container); - $passwordResetModel = new PasswordReset($this->container); + $userModel = new UserModel($this->container); + $passwordResetModel = new PasswordResetModel($this->container); $this->assertEquals(2, $userModel->create(array('username' => 'user2', 'email' => 'user1@localhost'))); @@ -44,8 +44,8 @@ class PasswordResetTest extends Base public function testDisableTokens() { - $userModel = new User($this->container); - $passwordResetModel = new PasswordReset($this->container); + $userModel = new UserModel($this->container); + $passwordResetModel = new PasswordResetModel($this->container); $this->assertEquals(2, $userModel->create(array('username' => 'user2', 'email' => 'user1@localhost'))); @@ -63,8 +63,8 @@ class PasswordResetTest extends Base public function testGetAll() { - $userModel = new User($this->container); - $passwordResetModel = new PasswordReset($this->container); + $userModel = new UserModel($this->container); + $passwordResetModel = new PasswordResetModel($this->container); $this->assertEquals(2, $userModel->create(array('username' => 'user2', 'email' => 'user1@localhost'))); $this->assertNotFalse($passwordResetModel->create('user2')); diff --git a/tests/units/Model/ProjectActivityTest.php b/tests/units/Model/ProjectActivityTest.php index 16036cd4..0b87b515 100644 --- a/tests/units/Model/ProjectActivityTest.php +++ b/tests/units/Model/ProjectActivityTest.php @@ -2,43 +2,43 @@ require_once __DIR__.'/../Base.php'; -use Kanboard\Model\Task; -use Kanboard\Model\TaskFinder; -use Kanboard\Model\TaskCreation; -use Kanboard\Model\ProjectActivity; -use Kanboard\Model\Project; +use Kanboard\Model\TaskModel; +use Kanboard\Model\TaskFinderModel; +use Kanboard\Model\TaskCreationModel; +use Kanboard\Model\ProjectActivityModel; +use Kanboard\Model\ProjectModel; class ProjectActivityTest extends Base { public function testCreation() { - $projectActivity = new ProjectActivity($this->container); - $taskCreation = new TaskCreation($this->container); - $taskFinder = new TaskFinder($this->container); - $projectModel = new Project($this->container); + $projectActivity = new ProjectActivityModel($this->container); + $taskCreation = new TaskCreationModel($this->container); + $taskFinder = new TaskFinderModel($this->container); + $projectModel = new ProjectModel($this->container); $this->assertEquals(1, $projectModel->create(array('name' => 'Project #1'))); $this->assertEquals(1, $taskCreation->create(array('title' => 'Task #1', 'project_id' => 1))); $this->assertEquals(2, $taskCreation->create(array('title' => 'Task #2', 'project_id' => 1))); - $this->assertTrue($projectActivity->createEvent(1, 1, 1, Task::EVENT_CLOSE, array('task' => $taskFinder->getById(1)))); - $this->assertTrue($projectActivity->createEvent(1, 2, 1, Task::EVENT_UPDATE, array('task' => $taskFinder->getById(2)))); - $this->assertFalse($projectActivity->createEvent(1, 1, 0, Task::EVENT_OPEN, array('task' => $taskFinder->getById(1)))); + $this->assertTrue($projectActivity->createEvent(1, 1, 1, TaskModel::EVENT_CLOSE, array('task' => $taskFinder->getById(1)))); + $this->assertTrue($projectActivity->createEvent(1, 2, 1, TaskModel::EVENT_UPDATE, array('task' => $taskFinder->getById(2)))); + $this->assertFalse($projectActivity->createEvent(1, 1, 0, TaskModel::EVENT_OPEN, array('task' => $taskFinder->getById(1)))); $events = $projectActivity->getQuery()->desc('id')->findAll(); $this->assertCount(2, $events); $this->assertEquals(time(), $events[0]['date_creation'], '', 1); - $this->assertEquals(Task::EVENT_UPDATE, $events[0]['event_name']); - $this->assertEquals(Task::EVENT_CLOSE, $events[1]['event_name']); + $this->assertEquals(TaskModel::EVENT_UPDATE, $events[0]['event_name']); + $this->assertEquals(TaskModel::EVENT_CLOSE, $events[1]['event_name']); } public function testCleanup() { - $projectActivity = new ProjectActivity($this->container); - $taskCreation = new TaskCreation($this->container); - $taskFinder = new TaskFinder($this->container); - $projectModel = new Project($this->container); + $projectActivity = new ProjectActivityModel($this->container); + $taskCreation = new TaskCreationModel($this->container); + $taskFinder = new TaskFinderModel($this->container); + $projectModel = new ProjectModel($this->container); $this->assertEquals(1, $projectModel->create(array('name' => 'Project #1'))); $this->assertEquals(1, $taskCreation->create(array('title' => 'Task #1', 'project_id' => 1))); @@ -48,7 +48,7 @@ class ProjectActivityTest extends Base $task = $taskFinder->getById(1); for ($i = 0; $i < $nb_events; $i++) { - $this->assertTrue($projectActivity->createEvent(1, 1, 1, Task::EVENT_CLOSE, array('task' => $task))); + $this->assertTrue($projectActivity->createEvent(1, 1, 1, TaskModel::EVENT_CLOSE, array('task' => $task))); } $this->assertEquals($nb_events, $this->container['db']->table('project_activities')->count()); diff --git a/tests/units/Model/ProjectDailyColumnStatsTest.php b/tests/units/Model/ProjectDailyColumnStatsTest.php index 4f92ad2b..5e500340 100644 --- a/tests/units/Model/ProjectDailyColumnStatsTest.php +++ b/tests/units/Model/ProjectDailyColumnStatsTest.php @@ -2,29 +2,29 @@ require_once __DIR__.'/../Base.php'; -use Kanboard\Model\Project; -use Kanboard\Model\ProjectDailyColumnStats; -use Kanboard\Model\Config; -use Kanboard\Model\Task; -use Kanboard\Model\TaskCreation; +use Kanboard\Model\ProjectModel; +use Kanboard\Model\ProjectDailyColumnStatsModel; +use Kanboard\Model\ConfigModel; +use Kanboard\Model\TaskModel; +use Kanboard\Model\TaskCreationModel; class ProjectDailyColumnStatsTest extends Base { public function testUpdateTotalsWithScoreAtNull() { - $projectModel = new Project($this->container); - $projectDailyColumnStats = new ProjectDailyColumnStats($this->container); - $taskCreationModel = new TaskCreation($this->container); + $projectModel = new ProjectModel($this->container); + $projectDailyColumnStats = new ProjectDailyColumnStatsModel($this->container); + $taskCreationModel = new TaskCreationModel($this->container); $this->assertEquals(1, $projectModel->create(array('name' => 'UnitTest'))); $this->assertEquals(1, $taskCreationModel->create(array('project_id' => 1, 'title' => 'test'))); $projectDailyColumnStats->updateTotals(1, '2016-01-16'); - $task = $this->container['db']->table(Task::TABLE)->findOne(); + $task = $this->container['db']->table(TaskModel::TABLE)->findOne(); $this->assertNull($task['score']); - $stats = $this->container['db']->table(ProjectDailyColumnStats::TABLE) + $stats = $this->container['db']->table(ProjectDailyColumnStatsModel::TABLE) ->asc('day') ->asc('column_id') ->columns('day', 'project_id', 'column_id', 'total', 'score') @@ -45,8 +45,8 @@ class ProjectDailyColumnStatsTest extends Base public function testUpdateTotals() { - $projectModel = new Project($this->container); - $projectDailyColumnStats = new ProjectDailyColumnStats($this->container); + $projectModel = new ProjectModel($this->container); + $projectDailyColumnStats = new ProjectDailyColumnStatsModel($this->container); $this->assertEquals(1, $projectModel->create(array('name' => 'UnitTest'))); $this->createTasks(1, 2, 1); @@ -68,7 +68,7 @@ class ProjectDailyColumnStatsTest extends Base $projectDailyColumnStats->updateTotals(1, '2016-01-17'); - $stats = $this->container['db']->table(ProjectDailyColumnStats::TABLE) + $stats = $this->container['db']->table(ProjectDailyColumnStatsModel::TABLE) ->asc('day') ->asc('column_id') ->columns('day', 'project_id', 'column_id', 'total', 'score') @@ -117,9 +117,9 @@ class ProjectDailyColumnStatsTest extends Base public function testUpdateTotalsWithOnlyOpenTasks() { - $configModel = new Config($this->container); - $projectModel = new Project($this->container); - $projectDailyColumnStats = new ProjectDailyColumnStats($this->container); + $configModel = new ConfigModel($this->container); + $projectModel = new ProjectModel($this->container); + $projectDailyColumnStats = new ProjectDailyColumnStatsModel($this->container); $this->assertEquals(1, $projectModel->create(array('name' => 'UnitTest'))); $this->assertTrue($configModel->save(array('cfd_include_closed_tasks' => 0))); @@ -144,7 +144,7 @@ class ProjectDailyColumnStatsTest extends Base $projectDailyColumnStats->updateTotals(1, '2016-01-17'); - $stats = $this->container['db']->table(ProjectDailyColumnStats::TABLE) + $stats = $this->container['db']->table(ProjectDailyColumnStatsModel::TABLE) ->asc('day') ->asc('column_id') ->columns('day', 'project_id', 'column_id', 'total', 'score') @@ -193,8 +193,8 @@ class ProjectDailyColumnStatsTest extends Base public function testCountDays() { - $projectModel = new Project($this->container); - $projectDailyColumnStats = new ProjectDailyColumnStats($this->container); + $projectModel = new ProjectModel($this->container); + $projectDailyColumnStats = new ProjectDailyColumnStatsModel($this->container); $this->assertEquals(1, $projectModel->create(array('name' => 'UnitTest'))); @@ -208,8 +208,8 @@ class ProjectDailyColumnStatsTest extends Base public function testGetAggregatedMetrics() { - $projectModel = new Project($this->container); - $projectDailyColumnStats = new ProjectDailyColumnStats($this->container); + $projectModel = new ProjectModel($this->container); + $projectDailyColumnStats = new ProjectDailyColumnStatsModel($this->container); $this->assertEquals(1, $projectModel->create(array('name' => 'UnitTest'))); $this->createTasks(1, 2, 1); @@ -258,7 +258,7 @@ class ProjectDailyColumnStatsTest extends Base private function createTasks($column_id, $score, $is_active) { - $taskCreationModel = new TaskCreation($this->container); + $taskCreationModel = new TaskCreationModel($this->container); $this->assertNotFalse($taskCreationModel->create(array('project_id' => 1, 'title' => 'test', 'column_id' => $column_id, 'score' => $score, 'is_active' => $is_active))); } } diff --git a/tests/units/Model/ProjectDailyStatsTest.php b/tests/units/Model/ProjectDailyStatsTest.php index c3b20cb9..851af985 100644 --- a/tests/units/Model/ProjectDailyStatsTest.php +++ b/tests/units/Model/ProjectDailyStatsTest.php @@ -2,19 +2,19 @@ require_once __DIR__.'/../Base.php'; -use Kanboard\Model\Project; -use Kanboard\Model\ProjectDailyStats; -use Kanboard\Model\TaskCreation; -use Kanboard\Model\TaskStatus; +use Kanboard\Model\ProjectModel; +use Kanboard\Model\ProjectDailyStatsModel; +use Kanboard\Model\TaskCreationModel; +use Kanboard\Model\TaskStatusModel; class ProjectDailyStatsTest extends Base { public function testUpdateTotals() { - $p = new Project($this->container); - $pds = new ProjectDailyStats($this->container); - $tc = new TaskCreation($this->container); - $ts = new TaskStatus($this->container); + $p = new ProjectModel($this->container); + $pds = new ProjectDailyStatsModel($this->container); + $tc = new TaskCreationModel($this->container); + $ts = new TaskStatusModel($this->container); $this->assertEquals(1, $p->create(array('name' => 'UnitTest'))); $this->assertEquals(2, $p->create(array('name' => 'UnitTest'))); diff --git a/tests/units/Model/ProjectDuplicationTest.php b/tests/units/Model/ProjectDuplicationTest.php index 4023a28f..312c7168 100644 --- a/tests/units/Model/ProjectDuplicationTest.php +++ b/tests/units/Model/ProjectDuplicationTest.php @@ -2,33 +2,33 @@ require_once __DIR__.'/../Base.php'; -use Kanboard\Model\Action; -use Kanboard\Model\Project; -use Kanboard\Model\Category; -use Kanboard\Model\ProjectUserRole; -use Kanboard\Model\ProjectGroupRole; -use Kanboard\Model\ProjectDuplication; -use Kanboard\Model\User; -use Kanboard\Model\Group; -use Kanboard\Model\GroupMember; -use Kanboard\Model\Swimlane; -use Kanboard\Model\Task; -use Kanboard\Model\TaskCreation; -use Kanboard\Model\TaskFinder; +use Kanboard\Model\ActionModel; +use Kanboard\Model\ProjectModel; +use Kanboard\Model\CategoryModel; +use Kanboard\Model\ProjectUserRoleModel; +use Kanboard\Model\ProjectGroupRoleModel; +use Kanboard\Model\ProjectDuplicationModel; +use Kanboard\Model\UserModel; +use Kanboard\Model\GroupModel; +use Kanboard\Model\GroupMemberModel; +use Kanboard\Model\SwimlaneModel; +use Kanboard\Model\TaskModel; +use Kanboard\Model\TaskCreationModel; +use Kanboard\Model\TaskFinderModel; use Kanboard\Core\Security\Role; class ProjectDuplicationTest extends Base { public function testGetSelections() { - $projectDuplicationModel = new ProjectDuplication($this->container); + $projectDuplicationModel = new ProjectDuplicationModel($this->container); $this->assertCount(6, $projectDuplicationModel->getOptionalSelection()); $this->assertCount(7, $projectDuplicationModel->getPossibleSelection()); } public function testGetClonedProjectName() { - $pd = new ProjectDuplication($this->container); + $pd = new ProjectDuplicationModel($this->container); $this->assertEquals('test (Clone)', $pd->getClonedProjectName('test')); @@ -41,8 +41,8 @@ class ProjectDuplicationTest extends Base public function testClonePublicProject() { - $p = new Project($this->container); - $pd = new ProjectDuplication($this->container); + $p = new ProjectModel($this->container); + $pd = new ProjectDuplicationModel($this->container); $this->assertEquals(1, $p->create(array('name' => 'Public'))); $this->assertEquals(2, $pd->duplicate(1)); @@ -59,9 +59,9 @@ class ProjectDuplicationTest extends Base public function testClonePrivateProject() { - $p = new Project($this->container); - $pd = new ProjectDuplication($this->container); - $pp = new ProjectUserRole($this->container); + $p = new ProjectModel($this->container); + $pd = new ProjectDuplicationModel($this->container); + $pp = new ProjectUserRoleModel($this->container); $this->assertEquals(1, $p->create(array('name' => 'Private', 'is_private' => 1), 1, true)); $this->assertEquals(2, $pd->duplicate(1)); @@ -80,8 +80,8 @@ class ProjectDuplicationTest extends Base public function testCloneSharedProject() { - $p = new Project($this->container); - $pd = new ProjectDuplication($this->container); + $p = new ProjectModel($this->container); + $pd = new ProjectDuplicationModel($this->container); $this->assertEquals(1, $p->create(array('name' => 'Shared'))); $this->assertTrue($p->update(array('id' => 1, 'is_public' => 1, 'token' => 'test'))); @@ -101,8 +101,8 @@ class ProjectDuplicationTest extends Base public function testCloneInactiveProject() { - $p = new Project($this->container); - $pd = new ProjectDuplication($this->container); + $p = new ProjectModel($this->container); + $pd = new ProjectDuplicationModel($this->container); $this->assertEquals(1, $p->create(array('name' => 'Inactive'))); $this->assertTrue($p->update(array('id' => 1, 'is_active' => 0))); @@ -120,16 +120,16 @@ class ProjectDuplicationTest extends Base public function testCloneProjectWithOwner() { - $p = new Project($this->container); - $pd = new ProjectDuplication($this->container); - $projectUserRoleModel = new ProjectUserRole($this->container); + $p = new ProjectModel($this->container); + $pd = new ProjectDuplicationModel($this->container); + $projectUserRoleModel = new ProjectUserRoleModel($this->container); $this->assertEquals(1, $p->create(array('name' => 'Owner'))); $project = $p->getById(1); $this->assertEquals(0, $project['owner_id']); - $this->assertEquals(2, $pd->duplicate(1, array('projectPermission'), 1)); + $this->assertEquals(2, $pd->duplicate(1, array('projectPermissionModel'), 1)); $project = $p->getById(2); $this->assertNotEmpty($project); @@ -141,15 +141,15 @@ class ProjectDuplicationTest extends Base public function testCloneProjectWithDifferentName() { - $p = new Project($this->container); - $pd = new ProjectDuplication($this->container); + $p = new ProjectModel($this->container); + $pd = new ProjectDuplicationModel($this->container); $this->assertEquals(1, $p->create(array('name' => 'Owner'))); $project = $p->getById(1); $this->assertEquals(0, $project['owner_id']); - $this->assertEquals(2, $pd->duplicate(1, array('projectPermission'), 1, 'Foobar')); + $this->assertEquals(2, $pd->duplicate(1, array('projectPermissionModel'), 1, 'Foobar')); $project = $p->getById(2); $this->assertNotEmpty($project); @@ -159,8 +159,8 @@ class ProjectDuplicationTest extends Base public function testCloneProjectAndForceItToBePrivate() { - $p = new Project($this->container); - $pd = new ProjectDuplication($this->container); + $p = new ProjectModel($this->container); + $pd = new ProjectDuplicationModel($this->container); $this->assertEquals(1, $p->create(array('name' => 'Owner'))); @@ -168,7 +168,7 @@ class ProjectDuplicationTest extends Base $this->assertEquals(0, $project['owner_id']); $this->assertEquals(0, $project['is_private']); - $this->assertEquals(2, $pd->duplicate(1, array('projectPermission'), 1, 'Foobar', true)); + $this->assertEquals(2, $pd->duplicate(1, array('projectPermissionModel'), 1, 'Foobar', true)); $project = $p->getById(2); $this->assertNotEmpty($project); @@ -179,9 +179,9 @@ class ProjectDuplicationTest extends Base public function testCloneProjectWithCategories() { - $p = new Project($this->container); - $c = new Category($this->container); - $pd = new ProjectDuplication($this->container); + $p = new ProjectModel($this->container); + $c = new CategoryModel($this->container); + $pd = new ProjectDuplicationModel($this->container); $this->assertEquals(1, $p->create(array('name' => 'P1'))); @@ -204,10 +204,10 @@ class ProjectDuplicationTest extends Base public function testCloneProjectWithUsers() { - $p = new Project($this->container); - $pp = new ProjectUserRole($this->container); - $u = new User($this->container); - $pd = new ProjectDuplication($this->container); + $p = new ProjectModel($this->container); + $pp = new ProjectUserRoleModel($this->container); + $u = new UserModel($this->container); + $pd = new ProjectDuplicationModel($this->container); $this->assertEquals(2, $u->create(array('username' => 'user1'))); $this->assertEquals(3, $u->create(array('username' => 'user2'))); @@ -229,10 +229,10 @@ class ProjectDuplicationTest extends Base public function testCloneProjectWithUsersAndOverrideOwner() { - $p = new Project($this->container); - $pp = new ProjectUserRole($this->container); - $u = new User($this->container); - $pd = new ProjectDuplication($this->container); + $p = new ProjectModel($this->container); + $pp = new ProjectUserRoleModel($this->container); + $u = new UserModel($this->container); + $pd = new ProjectDuplicationModel($this->container); $this->assertEquals(2, $u->create(array('username' => 'user1'))); $this->assertEquals(1, $p->create(array('name' => 'P1'), 2)); @@ -243,7 +243,7 @@ class ProjectDuplicationTest extends Base $this->assertTrue($pp->addUser(1, 2, Role::PROJECT_MANAGER)); $this->assertTrue($pp->addUser(1, 1, Role::PROJECT_MEMBER)); - $this->assertEquals(2, $pd->duplicate(1, array('projectPermission'), 1)); + $this->assertEquals(2, $pd->duplicate(1, array('projectPermissionModel'), 1)); $this->assertCount(2, $pp->getUsers(2)); $this->assertEquals(Role::PROJECT_MANAGER, $pp->getUserRole(2, 2)); @@ -255,10 +255,10 @@ class ProjectDuplicationTest extends Base public function testCloneTeamProjectToPrivatProject() { - $p = new Project($this->container); - $pp = new ProjectUserRole($this->container); - $u = new User($this->container); - $pd = new ProjectDuplication($this->container); + $p = new ProjectModel($this->container); + $pp = new ProjectUserRoleModel($this->container); + $u = new UserModel($this->container); + $pd = new ProjectDuplicationModel($this->container); $this->assertEquals(2, $u->create(array('username' => 'user1'))); $this->assertEquals(3, $u->create(array('username' => 'user2'))); @@ -271,7 +271,7 @@ class ProjectDuplicationTest extends Base $this->assertTrue($pp->addUser(1, 2, Role::PROJECT_MANAGER)); $this->assertTrue($pp->addUser(1, 1, Role::PROJECT_MEMBER)); - $this->assertEquals(2, $pd->duplicate(1, array('projectPermission'), 3, 'My private project', true)); + $this->assertEquals(2, $pd->duplicate(1, array('projectPermissionModel'), 3, 'My private project', true)); $this->assertCount(1, $pp->getUsers(2)); $this->assertEquals(Role::PROJECT_MANAGER, $pp->getUserRole(2, 3)); @@ -283,13 +283,13 @@ class ProjectDuplicationTest extends Base public function testCloneProjectWithGroups() { - $p = new Project($this->container); - $pd = new ProjectDuplication($this->container); - $userModel = new User($this->container); - $groupModel = new Group($this->container); - $groupMemberModel = new GroupMember($this->container); - $projectGroupRoleModel = new ProjectGroupRole($this->container); - $projectUserRoleModel = new ProjectUserRole($this->container); + $p = new ProjectModel($this->container); + $pd = new ProjectDuplicationModel($this->container); + $userModel = new UserModel($this->container); + $groupModel = new GroupModel($this->container); + $groupMemberModel = new GroupMemberModel($this->container); + $projectGroupRoleModel = new ProjectGroupRoleModel($this->container); + $projectUserRoleModel = new ProjectUserRoleModel($this->container); $this->assertEquals(1, $p->create(array('name' => 'P1'))); @@ -319,15 +319,15 @@ class ProjectDuplicationTest extends Base public function testCloneProjectWithActionTaskAssignCurrentUser() { - $p = new Project($this->container); - $a = new Action($this->container); - $pd = new ProjectDuplication($this->container); + $p = new ProjectModel($this->container); + $a = new ActionModel($this->container); + $pd = new ProjectDuplicationModel($this->container); $this->assertEquals(1, $p->create(array('name' => 'P1'))); $this->assertEquals(1, $a->create(array( 'project_id' => 1, - 'event_name' => Task::EVENT_MOVE_COLUMN, + 'event_name' => TaskModel::EVENT_MOVE_COLUMN, 'action_name' => 'TaskAssignCurrentUser', 'params' => array('column_id' => 2), ))); @@ -344,10 +344,10 @@ class ProjectDuplicationTest extends Base public function testCloneProjectWithActionTaskAssignColorCategory() { - $p = new Project($this->container); - $a = new Action($this->container); - $c = new Category($this->container); - $pd = new ProjectDuplication($this->container); + $p = new ProjectModel($this->container); + $a = new ActionModel($this->container); + $c = new CategoryModel($this->container); + $pd = new ProjectDuplicationModel($this->container); $this->assertEquals(1, $p->create(array('name' => 'P1'))); @@ -357,7 +357,7 @@ class ProjectDuplicationTest extends Base $this->assertEquals(1, $a->create(array( 'project_id' => 1, - 'event_name' => Task::EVENT_CREATE_UPDATE, + 'event_name' => TaskModel::EVENT_CREATE_UPDATE, 'action_name' => 'TaskAssignColorCategory', 'params' => array('color_id' => 'blue', 'category_id' => 2), ))); @@ -375,11 +375,11 @@ class ProjectDuplicationTest extends Base public function testCloneProjectWithSwimlanes() { - $p = new Project($this->container); - $pd = new ProjectDuplication($this->container); - $s = new Swimlane($this->container); - $tc = new TaskCreation($this->container); - $tf = new TaskFinder($this->container); + $p = new ProjectModel($this->container); + $pd = new ProjectDuplicationModel($this->container); + $s = new SwimlaneModel($this->container); + $tc = new TaskCreationModel($this->container); + $tf = new TaskFinderModel($this->container); $this->assertEquals(1, $p->create(array('name' => 'P1', 'default_swimlane' => 'New Default'))); @@ -394,7 +394,7 @@ class ProjectDuplicationTest extends Base $this->assertEquals(3, $tc->create(array('title' => 'T2', 'project_id' => 1, 'swimlane_id' => 2))); $this->assertEquals(4, $tc->create(array('title' => 'T3', 'project_id' => 1, 'swimlane_id' => 3))); - $this->assertEquals(2, $pd->duplicate(1, array('category', 'swimlane'))); + $this->assertEquals(2, $pd->duplicate(1, array('categoryModel', 'swimlaneModel'))); $swimlanes = $s->getAll(2); $this->assertCount(3, $swimlanes); @@ -414,10 +414,10 @@ class ProjectDuplicationTest extends Base public function testCloneProjectWithTasks() { - $p = new Project($this->container); - $pd = new ProjectDuplication($this->container); - $tc = new TaskCreation($this->container); - $tf = new TaskFinder($this->container); + $p = new ProjectModel($this->container); + $pd = new ProjectDuplicationModel($this->container); + $tc = new TaskCreationModel($this->container); + $tf = new TaskFinderModel($this->container); $this->assertEquals(1, $p->create(array('name' => 'P1'))); @@ -426,7 +426,7 @@ class ProjectDuplicationTest extends Base $this->assertEquals(2, $tc->create(array('title' => 'T2', 'project_id' => 1, 'column_id' => 2))); $this->assertEquals(3, $tc->create(array('title' => 'T3', 'project_id' => 1, 'column_id' => 3))); - $this->assertEquals(2, $pd->duplicate(1, array('category', 'action', 'task'))); + $this->assertEquals(2, $pd->duplicate(1, array('categoryModel', 'actionModel', 'taskModel'))); // Check if Tasks have been duplicated $tasks = $tf->getAll(2); @@ -438,11 +438,11 @@ class ProjectDuplicationTest extends Base public function testCloneProjectWithSwimlanesAndTasks() { - $p = new Project($this->container); - $pd = new ProjectDuplication($this->container); - $s = new Swimlane($this->container); - $tc = new TaskCreation($this->container); - $tf = new TaskFinder($this->container); + $p = new ProjectModel($this->container); + $pd = new ProjectDuplicationModel($this->container); + $s = new SwimlaneModel($this->container); + $tc = new TaskCreationModel($this->container); + $tf = new TaskFinderModel($this->container); $this->assertEquals(1, $p->create(array('name' => 'P1', 'default_swimlane' => 'New Default'))); @@ -456,7 +456,7 @@ class ProjectDuplicationTest extends Base $this->assertEquals(2, $tc->create(array('title' => 'T2', 'project_id' => 1, 'column_id' => 2, 'owner_id' => 1))); $this->assertEquals(3, $tc->create(array('title' => 'T3', 'project_id' => 1, 'column_id' => 3, 'owner_id' => 1))); - $this->assertEquals(2, $pd->duplicate(1, array('projectPermission', 'swimlane', 'task'))); + $this->assertEquals(2, $pd->duplicate(1, array('projectPermissionModel', 'swimlaneModel', 'taskModel'))); // Check if Swimlanes have been duplicated $swimlanes = $s->getAll(2); diff --git a/tests/units/Model/ProjectFileTest.php b/tests/units/Model/ProjectFileTest.php index 0d7a9377..116dd3d2 100644 --- a/tests/units/Model/ProjectFileTest.php +++ b/tests/units/Model/ProjectFileTest.php @@ -2,15 +2,15 @@ require_once __DIR__.'/../Base.php'; -use Kanboard\Model\ProjectFile; -use Kanboard\Model\Project; +use Kanboard\Model\ProjectFileModel; +use Kanboard\Model\ProjectModel; class ProjectFileTest extends Base { public function testCreation() { - $projectModel = new Project($this->container); - $fileModel = new ProjectFile($this->container); + $projectModel = new ProjectModel($this->container); + $fileModel = new ProjectFileModel($this->container); $this->assertEquals(1, $projectModel->create(array('name' => 'test'))); $this->assertEquals(1, $fileModel->create(1, 'test', '/tmp/foo', 10)); @@ -34,8 +34,8 @@ class ProjectFileTest extends Base public function testCreationWithFileNameTooLong() { - $projectModel = new Project($this->container); - $fileModel = new ProjectFile($this->container); + $projectModel = new ProjectModel($this->container); + $fileModel = new ProjectFileModel($this->container); $this->assertEquals(1, $projectModel->create(array('name' => 'test'))); @@ -54,8 +54,8 @@ class ProjectFileTest extends Base { $this->container['sessionStorage']->user = array('id' => 1); - $projectModel = new Project($this->container); - $fileModel = new ProjectFile($this->container); + $projectModel = new ProjectModel($this->container); + $fileModel = new ProjectFileModel($this->container); $this->assertEquals(1, $projectModel->create(array('name' => 'test'))); $this->assertEquals(1, $fileModel->create(1, 'test', '/tmp/foo', 10)); @@ -67,8 +67,8 @@ class ProjectFileTest extends Base public function testGetAll() { - $projectModel = new Project($this->container); - $fileModel = new ProjectFile($this->container); + $projectModel = new ProjectModel($this->container); + $fileModel = new ProjectFileModel($this->container); $this->assertEquals(1, $projectModel->create(array('name' => 'test'))); @@ -100,13 +100,13 @@ class ProjectFileTest extends Base public function testGetThumbnailPath() { - $fileModel = new ProjectFile($this->container); + $fileModel = new ProjectFileModel($this->container); $this->assertEquals('thumbnails'.DIRECTORY_SEPARATOR.'test', $fileModel->getThumbnailPath('test')); } public function testGeneratePath() { - $fileModel = new ProjectFile($this->container); + $fileModel = new ProjectFileModel($this->container); $this->assertStringStartsWith('projects'.DIRECTORY_SEPARATOR.'34'.DIRECTORY_SEPARATOR, $fileModel->generatePath(34, 'test.png')); $this->assertNotEquals($fileModel->generatePath(34, 'test1.png'), $fileModel->generatePath(34, 'test2.png')); @@ -115,12 +115,12 @@ class ProjectFileTest extends Base public function testUploadFiles() { $fileModel = $this - ->getMockBuilder('\Kanboard\Model\ProjectFile') + ->getMockBuilder('\Kanboard\Model\ProjectFileModel') ->setConstructorArgs(array($this->container)) ->setMethods(array('generateThumbnailFromFile')) ->getMock(); - $projectModel = new Project($this->container); + $projectModel = new ProjectModel($this->container); $this->assertEquals(1, $projectModel->create(array('name' => 'test'))); @@ -181,7 +181,7 @@ class ProjectFileTest extends Base public function testUploadFilesWithEmptyFiles() { - $fileModel = new ProjectFile($this->container); + $fileModel = new ProjectFileModel($this->container); $this->assertFalse($fileModel->uploadFiles(1, array())); } @@ -206,7 +206,7 @@ class ProjectFileTest extends Base ), ); - $fileModel = new ProjectFile($this->container); + $fileModel = new ProjectFileModel($this->container); $this->assertFalse($fileModel->uploadFiles(1, $files)); } @@ -237,19 +237,19 @@ class ProjectFileTest extends Base ->with($this->equalTo('/tmp/phpYzdqkD'), $this->anything()) ->will($this->throwException(new \Kanboard\Core\ObjectStorage\ObjectStorageException('test'))); - $fileModel = new ProjectFile($this->container); + $fileModel = new ProjectFileModel($this->container); $this->assertFalse($fileModel->uploadFiles(1, $files)); } public function testUploadFileContent() { $fileModel = $this - ->getMockBuilder('\Kanboard\Model\ProjectFile') + ->getMockBuilder('\Kanboard\Model\ProjectFileModel') ->setConstructorArgs(array($this->container)) ->setMethods(array('generateThumbnailFromFile')) ->getMock(); - $projectModel = new Project($this->container); + $projectModel = new ProjectModel($this->container); $data = 'test'; $this->assertEquals(1, $projectModel->create(array('name' => 'test'))); @@ -276,12 +276,12 @@ class ProjectFileTest extends Base public function testUploadImageContent() { $fileModel = $this - ->getMockBuilder('\Kanboard\Model\ProjectFile') + ->getMockBuilder('\Kanboard\Model\ProjectFileModel') ->setConstructorArgs(array($this->container)) ->setMethods(array('generateThumbnailFromData')) ->getMock(); - $projectModel = new Project($this->container); + $projectModel = new ProjectModel($this->container); $data = 'test'; $this->assertEquals(1, $projectModel->create(array('name' => 'test'))); diff --git a/tests/units/Model/ProjectGroupRoleTest.php b/tests/units/Model/ProjectGroupRoleTest.php index e38e812a..e703d4a9 100644 --- a/tests/units/Model/ProjectGroupRoleTest.php +++ b/tests/units/Model/ProjectGroupRoleTest.php @@ -2,21 +2,21 @@ require_once __DIR__.'/../Base.php'; -use Kanboard\Model\Project; -use Kanboard\Model\User; -use Kanboard\Model\Group; -use Kanboard\Model\GroupMember; -use Kanboard\Model\ProjectGroupRole; +use Kanboard\Model\ProjectModel; +use Kanboard\Model\UserModel; +use Kanboard\Model\GroupModel; +use Kanboard\Model\GroupMemberModel; +use Kanboard\Model\ProjectGroupRoleModel; use Kanboard\Core\Security\Role; class ProjectGroupRoleTest extends Base { public function testGetUserRole() { - $projectModel = new Project($this->container); - $groupModel = new Group($this->container); - $groupRoleModel = new ProjectGroupRole($this->container); - $groupMemberModel = new GroupMember($this->container); + $projectModel = new ProjectModel($this->container); + $groupModel = new GroupModel($this->container); + $groupRoleModel = new ProjectGroupRoleModel($this->container); + $groupMemberModel = new GroupMemberModel($this->container); $this->assertEquals(1, $projectModel->create(array('name' => 'Test'))); $this->assertEquals(1, $groupModel->create('Group A')); @@ -30,9 +30,9 @@ class ProjectGroupRoleTest extends Base public function testAddGroup() { - $projectModel = new Project($this->container); - $groupModel = new Group($this->container); - $groupRoleModel = new ProjectGroupRole($this->container); + $projectModel = new ProjectModel($this->container); + $groupModel = new GroupModel($this->container); + $groupRoleModel = new ProjectGroupRoleModel($this->container); $this->assertEquals(1, $projectModel->create(array('name' => 'Test'))); $this->assertEquals(1, $groupModel->create('Test')); @@ -49,9 +49,9 @@ class ProjectGroupRoleTest extends Base public function testRemoveGroup() { - $projectModel = new Project($this->container); - $groupModel = new Group($this->container); - $groupRoleModel = new ProjectGroupRole($this->container); + $projectModel = new ProjectModel($this->container); + $groupModel = new GroupModel($this->container); + $groupRoleModel = new ProjectGroupRoleModel($this->container); $this->assertEquals(1, $projectModel->create(array('name' => 'Test'))); $this->assertEquals(1, $groupModel->create('Test')); @@ -65,9 +65,9 @@ class ProjectGroupRoleTest extends Base public function testChangeRole() { - $projectModel = new Project($this->container); - $groupModel = new Group($this->container); - $groupRoleModel = new ProjectGroupRole($this->container); + $projectModel = new ProjectModel($this->container); + $groupModel = new GroupModel($this->container); + $groupRoleModel = new ProjectGroupRoleModel($this->container); $this->assertEquals(1, $projectModel->create(array('name' => 'Test'))); $this->assertEquals(1, $groupModel->create('Test')); @@ -84,9 +84,9 @@ class ProjectGroupRoleTest extends Base public function testGetGroups() { - $projectModel = new Project($this->container); - $groupModel = new Group($this->container); - $groupRoleModel = new ProjectGroupRole($this->container); + $projectModel = new ProjectModel($this->container); + $groupModel = new GroupModel($this->container); + $groupRoleModel = new ProjectGroupRoleModel($this->container); $this->assertEquals(1, $projectModel->create(array('name' => 'Test'))); $this->assertEquals(1, $groupModel->create('Group C')); @@ -115,11 +115,11 @@ class ProjectGroupRoleTest extends Base public function testGetUsers() { - $userModel = new User($this->container); - $projectModel = new Project($this->container); - $groupModel = new Group($this->container); - $groupMemberModel = new GroupMember($this->container); - $groupRoleModel = new ProjectGroupRole($this->container); + $userModel = new UserModel($this->container); + $projectModel = new ProjectModel($this->container); + $groupModel = new GroupModel($this->container); + $groupMemberModel = new GroupMemberModel($this->container); + $groupRoleModel = new ProjectGroupRoleModel($this->container); $this->assertEquals(1, $projectModel->create(array('name' => 'Project 1'))); $this->assertEquals(2, $projectModel->create(array('name' => 'Project 2'))); @@ -164,11 +164,11 @@ class ProjectGroupRoleTest extends Base public function testGetAssignableUsers() { - $userModel = new User($this->container); - $projectModel = new Project($this->container); - $groupModel = new Group($this->container); - $groupMemberModel = new GroupMember($this->container); - $groupRoleModel = new ProjectGroupRole($this->container); + $userModel = new UserModel($this->container); + $projectModel = new ProjectModel($this->container); + $groupModel = new GroupModel($this->container); + $groupMemberModel = new GroupMemberModel($this->container); + $groupRoleModel = new ProjectGroupRoleModel($this->container); $this->assertEquals(1, $projectModel->create(array('name' => 'Project 1'))); $this->assertEquals(2, $projectModel->create(array('name' => 'Project 2'))); @@ -206,11 +206,11 @@ class ProjectGroupRoleTest extends Base public function testGetAssignableUsersWithDisabledUsers() { - $userModel = new User($this->container); - $projectModel = new Project($this->container); - $groupModel = new Group($this->container); - $groupMemberModel = new GroupMember($this->container); - $groupRoleModel = new ProjectGroupRole($this->container); + $userModel = new UserModel($this->container); + $projectModel = new ProjectModel($this->container); + $groupModel = new GroupModel($this->container); + $groupMemberModel = new GroupMemberModel($this->container); + $groupRoleModel = new ProjectGroupRoleModel($this->container); $this->assertEquals(1, $projectModel->create(array('name' => 'Project 1'))); $this->assertEquals(2, $projectModel->create(array('name' => 'Project 2'))); @@ -244,11 +244,11 @@ class ProjectGroupRoleTest extends Base public function testGetProjectsByUser() { - $userModel = new User($this->container); - $projectModel = new Project($this->container); - $groupModel = new Group($this->container); - $groupMemberModel = new GroupMember($this->container); - $groupRoleModel = new ProjectGroupRole($this->container); + $userModel = new UserModel($this->container); + $projectModel = new ProjectModel($this->container); + $groupModel = new GroupModel($this->container); + $groupMemberModel = new GroupMemberModel($this->container); + $groupRoleModel = new ProjectGroupRoleModel($this->container); $this->assertEquals(1, $projectModel->create(array('name' => 'Project 1'))); $this->assertEquals(2, $projectModel->create(array('name' => 'Project 2'))); @@ -290,11 +290,11 @@ class ProjectGroupRoleTest extends Base public function testGetActiveProjectsByUser() { - $userModel = new User($this->container); - $projectModel = new Project($this->container); - $groupModel = new Group($this->container); - $groupMemberModel = new GroupMember($this->container); - $groupRoleModel = new ProjectGroupRole($this->container); + $userModel = new UserModel($this->container); + $projectModel = new ProjectModel($this->container); + $groupModel = new GroupModel($this->container); + $groupMemberModel = new GroupMemberModel($this->container); + $groupRoleModel = new ProjectGroupRoleModel($this->container); $this->assertEquals(1, $projectModel->create(array('name' => 'Project 1', 'is_active' => 0))); $this->assertEquals(2, $projectModel->create(array('name' => 'Project 2'))); @@ -317,27 +317,27 @@ class ProjectGroupRoleTest extends Base $this->assertTrue($groupRoleModel->addGroup(2, 2, Role::PROJECT_MEMBER)); $this->assertTrue($groupRoleModel->addGroup(1, 3, Role::PROJECT_MANAGER)); - $projects = $groupRoleModel->getProjectsByUser(2, array(Project::ACTIVE)); + $projects = $groupRoleModel->getProjectsByUser(2, array(ProjectModel::ACTIVE)); $this->assertCount(0, $projects); - $projects = $groupRoleModel->getProjectsByUser(3, array(Project::ACTIVE)); + $projects = $groupRoleModel->getProjectsByUser(3, array(ProjectModel::ACTIVE)); $this->assertCount(0, $projects); - $projects = $groupRoleModel->getProjectsByUser(4, array(Project::ACTIVE)); + $projects = $groupRoleModel->getProjectsByUser(4, array(ProjectModel::ACTIVE)); $this->assertCount(0, $projects); - $projects = $groupRoleModel->getProjectsByUser(5, array(Project::ACTIVE)); + $projects = $groupRoleModel->getProjectsByUser(5, array(ProjectModel::ACTIVE)); $this->assertCount(1, $projects); $this->assertEquals('Project 2', $projects[2]); } public function testGetInactiveProjectsByUser() { - $userModel = new User($this->container); - $projectModel = new Project($this->container); - $groupModel = new Group($this->container); - $groupMemberModel = new GroupMember($this->container); - $groupRoleModel = new ProjectGroupRole($this->container); + $userModel = new UserModel($this->container); + $projectModel = new ProjectModel($this->container); + $groupModel = new GroupModel($this->container); + $groupMemberModel = new GroupMemberModel($this->container); + $groupRoleModel = new ProjectGroupRoleModel($this->container); $this->assertEquals(1, $projectModel->create(array('name' => 'Project 1', 'is_active' => 0))); $this->assertEquals(2, $projectModel->create(array('name' => 'Project 2'))); @@ -360,29 +360,29 @@ class ProjectGroupRoleTest extends Base $this->assertTrue($groupRoleModel->addGroup(2, 2, Role::PROJECT_MEMBER)); $this->assertTrue($groupRoleModel->addGroup(1, 3, Role::PROJECT_MANAGER)); - $projects = $groupRoleModel->getProjectsByUser(2, array(Project::INACTIVE)); + $projects = $groupRoleModel->getProjectsByUser(2, array(ProjectModel::INACTIVE)); $this->assertCount(1, $projects); $this->assertEquals('Project 1', $projects[1]); - $projects = $groupRoleModel->getProjectsByUser(3, array(Project::INACTIVE)); + $projects = $groupRoleModel->getProjectsByUser(3, array(ProjectModel::INACTIVE)); $this->assertCount(1, $projects); $this->assertEquals('Project 1', $projects[1]); - $projects = $groupRoleModel->getProjectsByUser(4, array(Project::INACTIVE)); + $projects = $groupRoleModel->getProjectsByUser(4, array(ProjectModel::INACTIVE)); $this->assertCount(1, $projects); $this->assertEquals('Project 1', $projects[1]); - $projects = $groupRoleModel->getProjectsByUser(5, array(Project::INACTIVE)); + $projects = $groupRoleModel->getProjectsByUser(5, array(ProjectModel::INACTIVE)); $this->assertCount(0, $projects); } public function testUserInMultipleGroupsShouldReturnHighestRole() { - $userModel = new User($this->container); - $projectModel = new Project($this->container); - $groupModel = new Group($this->container); - $groupRoleModel = new ProjectGroupRole($this->container); - $groupMemberModel = new GroupMember($this->container); + $userModel = new UserModel($this->container); + $projectModel = new ProjectModel($this->container); + $groupModel = new GroupModel($this->container); + $groupRoleModel = new ProjectGroupRoleModel($this->container); + $groupMemberModel = new GroupMemberModel($this->container); $this->assertEquals(1, $projectModel->create(array('name' => 'Test'))); $this->assertEquals(2, $userModel->create(array('username' => 'My user'))); diff --git a/tests/units/Model/ProjectMetadataTest.php b/tests/units/Model/ProjectMetadataTest.php index 16f49033..2f6d111a 100644 --- a/tests/units/Model/ProjectMetadataTest.php +++ b/tests/units/Model/ProjectMetadataTest.php @@ -2,15 +2,15 @@ require_once __DIR__.'/../Base.php'; -use Kanboard\Model\Project; -use Kanboard\Model\ProjectMetadata; +use Kanboard\Model\ProjectModel; +use Kanboard\Model\ProjectMetadataModel; class ProjectMetadataTest extends Base { public function testOperations() { - $projectModel = new Project($this->container); - $projectMetadataModel = new ProjectMetadata($this->container); + $projectModel = new ProjectModel($this->container); + $projectMetadataModel = new ProjectMetadataModel($this->container); $this->assertEquals(1, $projectModel->create(array('name' => 'project #1'))); $this->assertEquals(2, $projectModel->create(array('name' => 'project #2'))); @@ -39,8 +39,8 @@ class ProjectMetadataTest extends Base public function testAutomaticRemove() { - $projectModel = new Project($this->container); - $projectMetadataModel = new ProjectMetadata($this->container); + $projectModel = new ProjectModel($this->container); + $projectMetadataModel = new ProjectMetadataModel($this->container); $this->assertEquals(1, $projectModel->create(array('name' => 'project #1'))); $this->assertTrue($projectMetadataModel->save(1, array('key1' => 'value1'))); @@ -52,8 +52,8 @@ class ProjectMetadataTest extends Base public function testDuplicate() { - $projectModel = new Project($this->container); - $projectMetadataModel = new ProjectMetadata($this->container); + $projectModel = new ProjectModel($this->container); + $projectMetadataModel = new ProjectMetadataModel($this->container); $this->assertEquals(1, $projectModel->create(array('name' => 'project #1'))); $this->assertEquals(2, $projectModel->create(array('name' => 'project #2'))); diff --git a/tests/units/Model/ProjectNotificationTypeTest.php b/tests/units/Model/ProjectNotificationTypeTest.php index 71e2b964..7f735828 100644 --- a/tests/units/Model/ProjectNotificationTypeTest.php +++ b/tests/units/Model/ProjectNotificationTypeTest.php @@ -2,14 +2,14 @@ require_once __DIR__.'/../Base.php'; -use Kanboard\Model\Project; -use Kanboard\Model\ProjectNotificationType; +use Kanboard\Model\ProjectModel; +use Kanboard\Model\ProjectNotificationTypeModel; class ProjectNotificationTypeTest extends Base { public function testGetTypes() { - $nt = new ProjectNotificationType($this->container); + $nt = new ProjectNotificationTypeModel($this->container); $this->assertEmpty($nt->getTypes()); $nt->setType('foo', 'Foo', 'Something1'); @@ -22,8 +22,8 @@ class ProjectNotificationTypeTest extends Base public function testGetSelectedTypes() { - $nt = new ProjectNotificationType($this->container); - $p = new Project($this->container); + $nt = new ProjectNotificationTypeModel($this->container); + $p = new ProjectModel($this->container); $this->assertEquals(1, $p->create(array('name' => 'UnitTest'))); diff --git a/tests/units/Model/ProjectPermissionTest.php b/tests/units/Model/ProjectPermissionTest.php index f88796b4..c9e0a481 100644 --- a/tests/units/Model/ProjectPermissionTest.php +++ b/tests/units/Model/ProjectPermissionTest.php @@ -2,26 +2,26 @@ require_once __DIR__.'/../Base.php'; -use Kanboard\Model\ProjectPermission; -use Kanboard\Model\Project; -use Kanboard\Model\User; -use Kanboard\Model\Group; -use Kanboard\Model\GroupMember; -use Kanboard\Model\ProjectGroupRole; -use Kanboard\Model\ProjectUserRole; +use Kanboard\Model\ProjectPermissionModel; +use Kanboard\Model\ProjectModel; +use Kanboard\Model\UserModel; +use Kanboard\Model\GroupModel; +use Kanboard\Model\GroupMemberModel; +use Kanboard\Model\ProjectGroupRoleModel; +use Kanboard\Model\ProjectUserRoleModel; use Kanboard\Core\Security\Role; class ProjectPermissionTest extends Base { public function testFindByUsernames() { - $userModel = new User($this->container); - $projectModel = new Project($this->container); - $groupModel = new Group($this->container); - $groupMemberModel = new GroupMember($this->container); - $groupRoleModel = new ProjectGroupRole($this->container); - $userRoleModel = new ProjectUserRole($this->container); - $projectPermissionModel = new ProjectPermission($this->container); + $userModel = new UserModel($this->container); + $projectModel = new ProjectModel($this->container); + $groupModel = new GroupModel($this->container); + $groupMemberModel = new GroupMemberModel($this->container); + $groupRoleModel = new ProjectGroupRoleModel($this->container); + $userRoleModel = new ProjectUserRoleModel($this->container); + $projectPermissionModel = new ProjectPermissionModel($this->container); $this->assertEquals(1, $projectModel->create(array('name' => 'Project 1'))); @@ -42,10 +42,10 @@ class ProjectPermissionTest extends Base public function testGetQueryByRole() { - $userModel = new User($this->container); - $projectModel = new Project($this->container); - $userRoleModel = new ProjectUserRole($this->container); - $projectPermission = new ProjectPermission($this->container); + $userModel = new UserModel($this->container); + $projectModel = new ProjectModel($this->container); + $userRoleModel = new ProjectUserRoleModel($this->container); + $projectPermission = new ProjectPermissionModel($this->container); $this->assertEquals(1, $projectModel->create(array('name' => 'Project 1'))); $this->assertEquals(2, $projectModel->create(array('name' => 'Project 2'))); @@ -105,8 +105,8 @@ class ProjectPermissionTest extends Base public function testEverybodyAllowed() { - $projectModel = new Project($this->container); - $projectPermission = new ProjectPermission($this->container); + $projectModel = new ProjectModel($this->container); + $projectPermission = new ProjectPermissionModel($this->container); $this->assertEquals(1, $projectModel->create(array('name' => 'Project 1'))); $this->assertEquals(2, $projectModel->create(array('name' => 'Project 2', 'is_everybody_allowed' => 1))); @@ -117,13 +117,13 @@ class ProjectPermissionTest extends Base public function testIsUserAllowed() { - $userModel = new User($this->container); - $projectModel = new Project($this->container); - $groupModel = new Group($this->container); - $groupRoleModel = new ProjectGroupRole($this->container); - $groupMemberModel = new GroupMember($this->container); - $userRoleModel = new ProjectUserRole($this->container); - $projectPermission = new ProjectPermission($this->container); + $userModel = new UserModel($this->container); + $projectModel = new ProjectModel($this->container); + $groupModel = new GroupModel($this->container); + $groupRoleModel = new ProjectGroupRoleModel($this->container); + $groupMemberModel = new GroupMemberModel($this->container); + $userRoleModel = new ProjectUserRoleModel($this->container); + $projectPermission = new ProjectPermissionModel($this->container); $this->assertEquals(2, $userModel->create(array('username' => 'user 1'))); $this->assertEquals(3, $userModel->create(array('username' => 'user 2'))); @@ -154,13 +154,13 @@ class ProjectPermissionTest extends Base public function testIsAssignable() { - $userModel = new User($this->container); - $projectModel = new Project($this->container); - $groupModel = new Group($this->container); - $groupRoleModel = new ProjectGroupRole($this->container); - $groupMemberModel = new GroupMember($this->container); - $userRoleModel = new ProjectUserRole($this->container); - $projectPermission = new ProjectPermission($this->container); + $userModel = new UserModel($this->container); + $projectModel = new ProjectModel($this->container); + $groupModel = new GroupModel($this->container); + $groupRoleModel = new ProjectGroupRoleModel($this->container); + $groupMemberModel = new GroupMemberModel($this->container); + $userRoleModel = new ProjectUserRoleModel($this->container); + $projectPermission = new ProjectPermissionModel($this->container); $this->assertEquals(2, $userModel->create(array('username' => 'user 1'))); $this->assertEquals(3, $userModel->create(array('username' => 'user 2'))); @@ -191,10 +191,10 @@ class ProjectPermissionTest extends Base public function testIsAssignableWhenUserIsDisabled() { - $userModel = new User($this->container); - $projectModel = new Project($this->container); - $userRoleModel = new ProjectUserRole($this->container); - $projectPermission = new ProjectPermission($this->container); + $userModel = new UserModel($this->container); + $projectModel = new ProjectModel($this->container); + $userRoleModel = new ProjectUserRoleModel($this->container); + $projectPermission = new ProjectPermissionModel($this->container); $this->assertEquals(2, $userModel->create(array('username' => 'user 1'))); $this->assertEquals(3, $userModel->create(array('username' => 'user 2', 'is_active' => 0))); @@ -210,13 +210,13 @@ class ProjectPermissionTest extends Base public function testIsMember() { - $userModel = new User($this->container); - $projectModel = new Project($this->container); - $groupModel = new Group($this->container); - $groupRoleModel = new ProjectGroupRole($this->container); - $groupMemberModel = new GroupMember($this->container); - $userRoleModel = new ProjectUserRole($this->container); - $projectPermission = new ProjectPermission($this->container); + $userModel = new UserModel($this->container); + $projectModel = new ProjectModel($this->container); + $groupModel = new GroupModel($this->container); + $groupRoleModel = new ProjectGroupRoleModel($this->container); + $groupMemberModel = new GroupMemberModel($this->container); + $userRoleModel = new ProjectUserRoleModel($this->container); + $projectPermission = new ProjectPermissionModel($this->container); $this->assertEquals(2, $userModel->create(array('username' => 'user 1'))); $this->assertEquals(3, $userModel->create(array('username' => 'user 2'))); @@ -247,10 +247,10 @@ class ProjectPermissionTest extends Base public function testGetActiveProjectIds() { - $userModel = new User($this->container); - $projectModel = new Project($this->container); - $userRoleModel = new ProjectUserRole($this->container); - $projectPermission = new ProjectPermission($this->container); + $userModel = new UserModel($this->container); + $projectModel = new ProjectModel($this->container); + $userRoleModel = new ProjectUserRoleModel($this->container); + $projectPermission = new ProjectPermissionModel($this->container); $this->assertEquals(2, $userModel->create(array('username' => 'user 1'))); $this->assertEquals(3, $userModel->create(array('username' => 'user 2'))); @@ -269,13 +269,13 @@ class ProjectPermissionTest extends Base public function testDuplicate() { - $userModel = new User($this->container); - $projectModel = new Project($this->container); - $groupModel = new Group($this->container); - $groupMemberModel = new GroupMember($this->container); - $groupRoleModel = new ProjectGroupRole($this->container); - $userRoleModel = new ProjectUserRole($this->container); - $projectPermission = new ProjectPermission($this->container); + $userModel = new UserModel($this->container); + $projectModel = new ProjectModel($this->container); + $groupModel = new GroupModel($this->container); + $groupMemberModel = new GroupMemberModel($this->container); + $groupRoleModel = new ProjectGroupRoleModel($this->container); + $userRoleModel = new ProjectUserRoleModel($this->container); + $projectPermission = new ProjectPermissionModel($this->container); $this->assertEquals(1, $projectModel->create(array('name' => 'Project 1'))); $this->assertEquals(2, $projectModel->create(array('name' => 'Project 2'))); diff --git a/tests/units/Model/ProjectTest.php b/tests/units/Model/ProjectTest.php index 6c50744b..472d7351 100644 --- a/tests/units/Model/ProjectTest.php +++ b/tests/units/Model/ProjectTest.php @@ -4,20 +4,20 @@ require_once __DIR__.'/../Base.php'; use Kanboard\Core\Translator; use Kanboard\Subscriber\ProjectModificationDateSubscriber; -use Kanboard\Model\Project; -use Kanboard\Model\User; -use Kanboard\Model\Task; -use Kanboard\Model\TaskCreation; -use Kanboard\Model\Config; -use Kanboard\Model\Category; +use Kanboard\Model\ProjectModel; +use Kanboard\Model\UserModel; +use Kanboard\Model\TaskModel; +use Kanboard\Model\TaskCreationModel; +use Kanboard\Model\ConfigModel; +use Kanboard\Model\CategoryModel; class ProjectTest extends Base { public function testCreationForAllLanguages() { - $p = new Project($this->container); + $p = new ProjectModel($this->container); - foreach ($this->container['language']->getLanguages() as $locale => $language) { + foreach ($this->container['languageModel']->getLanguages() as $locale => $language) { Translator::unload(); Translator::load($locale); $this->assertNotFalse($p->create(array('name' => 'UnitTest '.$locale)), 'Unable to create project with '.$locale.':'.$language); @@ -28,7 +28,7 @@ class ProjectTest extends Base public function testCreation() { - $p = new Project($this->container); + $p = new ProjectModel($this->container); $this->assertEquals(1, $p->create(array('name' => 'UnitTest'))); @@ -43,7 +43,7 @@ class ProjectTest extends Base public function testCreationWithDuplicateName() { - $p = new Project($this->container); + $p = new ProjectModel($this->container); $this->assertEquals(1, $p->create(array('name' => 'UnitTest'))); $this->assertEquals(2, $p->create(array('name' => 'UnitTest'))); @@ -51,7 +51,7 @@ class ProjectTest extends Base public function testCreationWithStartAndDate() { - $p = new Project($this->container); + $p = new ProjectModel($this->container); $this->assertEquals(1, $p->create(array('name' => 'UnitTest', 'start_date' => '2015-01-01', 'end_date' => '2015-12-31'))); @@ -63,9 +63,9 @@ class ProjectTest extends Base public function testCreationWithDefaultCategories() { - $p = new Project($this->container); - $c = new Config($this->container); - $cat = new Category($this->container); + $p = new ProjectModel($this->container); + $c = new ConfigModel($this->container); + $cat = new CategoryModel($this->container); // Multiple categories correctly formatted @@ -124,7 +124,7 @@ class ProjectTest extends Base public function testUpdateLastModifiedDate() { - $p = new Project($this->container); + $p = new ProjectModel($this->container); $this->assertEquals(1, $p->create(array('name' => 'UnitTest'))); $now = time(); @@ -143,7 +143,7 @@ class ProjectTest extends Base public function testGetAllIds() { - $p = new Project($this->container); + $p = new ProjectModel($this->container); $this->assertEquals(1, $p->create(array('name' => 'UnitTest'))); @@ -154,8 +154,8 @@ class ProjectTest extends Base public function testIsLastModified() { - $p = new Project($this->container); - $tc = new TaskCreation($this->container); + $p = new ProjectModel($this->container); + $tc = new TaskCreationModel($this->container); $now = time(); @@ -168,12 +168,12 @@ class ProjectTest extends Base sleep(1); $listener = new ProjectModificationDateSubscriber($this->container); - $this->container['dispatcher']->addListener(Task::EVENT_CREATE_UPDATE, array($listener, 'execute')); + $this->container['dispatcher']->addListener(TaskModel::EVENT_CREATE_UPDATE, array($listener, 'execute')); $this->assertEquals(1, $tc->create(array('title' => 'Task #1', 'project_id' => 1))); $called = $this->container['dispatcher']->getCalledListeners(); - $this->assertArrayHasKey(Task::EVENT_CREATE_UPDATE.'.Kanboard\Subscriber\ProjectModificationDateSubscriber::execute', $called); + $this->assertArrayHasKey(TaskModel::EVENT_CREATE_UPDATE.'.Kanboard\Subscriber\ProjectModificationDateSubscriber::execute', $called); $project = $p->getById(1); $this->assertNotEmpty($project); @@ -182,7 +182,7 @@ class ProjectTest extends Base public function testRemove() { - $p = new Project($this->container); + $p = new ProjectModel($this->container); $this->assertEquals(1, $p->create(array('name' => 'UnitTest'))); $this->assertTrue($p->remove(1)); @@ -191,7 +191,7 @@ class ProjectTest extends Base public function testEnable() { - $p = new Project($this->container); + $p = new ProjectModel($this->container); $this->assertEquals(1, $p->create(array('name' => 'UnitTest'))); $this->assertTrue($p->disable(1)); @@ -205,7 +205,7 @@ class ProjectTest extends Base public function testDisable() { - $p = new Project($this->container); + $p = new ProjectModel($this->container); $this->assertEquals(1, $p->create(array('name' => 'UnitTest'))); $this->assertTrue($p->disable(1)); @@ -220,7 +220,7 @@ class ProjectTest extends Base public function testEnablePublicAccess() { - $p = new Project($this->container); + $p = new ProjectModel($this->container); $this->assertEquals(1, $p->create(array('name' => 'UnitTest'))); $this->assertTrue($p->enablePublicAccess(1)); @@ -235,7 +235,7 @@ class ProjectTest extends Base public function testDisablePublicAccess() { - $p = new Project($this->container); + $p = new ProjectModel($this->container); $this->assertEquals(1, $p->create(array('name' => 'UnitTest'))); $this->assertTrue($p->enablePublicAccess(1)); @@ -251,7 +251,7 @@ class ProjectTest extends Base public function testIdentifier() { - $p = new Project($this->container); + $p = new ProjectModel($this->container); // Creation $this->assertEquals(1, $p->create(array('name' => 'UnitTest1', 'identifier' => 'test1'))); @@ -282,8 +282,8 @@ class ProjectTest extends Base public function testThatProjectCreatorAreAlsoOwner() { - $projectModel = new Project($this->container); - $userModel = new User($this->container); + $projectModel = new ProjectModel($this->container); + $userModel = new UserModel($this->container); $this->assertEquals(2, $userModel->create(array('username' => 'user1', 'name' => 'Me'))); $this->assertEquals(1, $projectModel->create(array('name' => 'My project 1'), 2)); @@ -306,7 +306,7 @@ class ProjectTest extends Base public function testPriority() { - $projectModel = new Project($this->container); + $projectModel = new ProjectModel($this->container); $this->assertEquals(1, $projectModel->create(array('name' => 'My project 2'))); $project = $projectModel->getById(1); diff --git a/tests/units/Model/ProjectUserRoleTest.php b/tests/units/Model/ProjectUserRoleTest.php index 0e06ac5e..d59b15c9 100644 --- a/tests/units/Model/ProjectUserRoleTest.php +++ b/tests/units/Model/ProjectUserRoleTest.php @@ -2,21 +2,21 @@ require_once __DIR__.'/../Base.php'; -use Kanboard\Model\Project; -use Kanboard\Model\User; -use Kanboard\Model\Group; -use Kanboard\Model\GroupMember; -use Kanboard\Model\ProjectGroupRole; -use Kanboard\Model\ProjectUserRole; -use Kanboard\Model\ProjectPermission; +use Kanboard\Model\ProjectModel; +use Kanboard\Model\UserModel; +use Kanboard\Model\GroupModel; +use Kanboard\Model\GroupMemberModel; +use Kanboard\Model\ProjectGroupRoleModel; +use Kanboard\Model\ProjectUserRoleModel; +use Kanboard\Model\ProjectPermissionModel; use Kanboard\Core\Security\Role; class ProjectUserRoleTest extends Base { public function testAddUser() { - $projectModel = new Project($this->container); - $userRoleModel = new ProjectUserRole($this->container); + $projectModel = new ProjectModel($this->container); + $userRoleModel = new ProjectUserRoleModel($this->container); $this->assertEquals(1, $projectModel->create(array('name' => 'Test'))); @@ -33,8 +33,8 @@ class ProjectUserRoleTest extends Base public function testRemoveUser() { - $projectModel = new Project($this->container); - $userRoleModel = new ProjectUserRole($this->container); + $projectModel = new ProjectModel($this->container); + $userRoleModel = new ProjectUserRoleModel($this->container); $this->assertEquals(1, $projectModel->create(array('name' => 'Test'))); @@ -47,8 +47,8 @@ class ProjectUserRoleTest extends Base public function testChangeRole() { - $projectModel = new Project($this->container); - $userRoleModel = new ProjectUserRole($this->container); + $projectModel = new ProjectModel($this->container); + $userRoleModel = new ProjectUserRoleModel($this->container); $this->assertEquals(1, $projectModel->create(array('name' => 'Test'))); @@ -65,8 +65,8 @@ class ProjectUserRoleTest extends Base public function testGetRole() { - $projectModel = new Project($this->container); - $userRoleModel = new ProjectUserRole($this->container); + $projectModel = new ProjectModel($this->container); + $userRoleModel = new ProjectUserRoleModel($this->container); $this->assertEquals(1, $projectModel->create(array('name' => 'Test'))); $this->assertEmpty($userRoleModel->getUserRole(1, 1)); @@ -85,11 +85,11 @@ class ProjectUserRoleTest extends Base public function testGetRoleWithGroups() { - $projectModel = new Project($this->container); - $groupModel = new Group($this->container); - $groupRoleModel = new ProjectGroupRole($this->container); - $groupMemberModel = new GroupMember($this->container); - $userRoleModel = new ProjectUserRole($this->container); + $projectModel = new ProjectModel($this->container); + $groupModel = new GroupModel($this->container); + $groupRoleModel = new ProjectGroupRoleModel($this->container); + $groupMemberModel = new GroupMemberModel($this->container); + $userRoleModel = new ProjectUserRoleModel($this->container); $this->assertEquals(1, $projectModel->create(array('name' => 'Test'))); $this->assertEquals(1, $groupModel->create('Group A')); @@ -103,9 +103,9 @@ class ProjectUserRoleTest extends Base public function testGetRoleWithPublicProject() { - $projectModel = new Project($this->container); - $userRoleModel = new ProjectUserRole($this->container); - $userModel = new User($this->container); + $projectModel = new ProjectModel($this->container); + $userRoleModel = new ProjectUserRoleModel($this->container); + $userModel = new UserModel($this->container); $this->assertEquals(2, $userModel->create(array('username' => 'user1', 'name' => 'User1'))); $this->assertEquals(3, $userModel->create(array('username' => 'user2', 'name' => 'User2'))); @@ -123,9 +123,9 @@ class ProjectUserRoleTest extends Base public function testGetAssignableUsersWithDisabledUsers() { - $projectModel = new Project($this->container); - $userModel = new User($this->container); - $userRoleModel = new ProjectUserRole($this->container); + $projectModel = new ProjectModel($this->container); + $userModel = new UserModel($this->container); + $userRoleModel = new ProjectUserRoleModel($this->container); $this->assertEquals(1, $projectModel->create(array('name' => 'Test'))); $this->assertEquals(2, $userModel->create(array('username' => 'user1', 'name' => 'User1'))); @@ -153,9 +153,9 @@ class ProjectUserRoleTest extends Base public function testGetAssignableUsersWithoutGroups() { - $projectModel = new Project($this->container); - $userModel = new User($this->container); - $userRoleModel = new ProjectUserRole($this->container); + $projectModel = new ProjectModel($this->container); + $userModel = new UserModel($this->container); + $userRoleModel = new ProjectUserRoleModel($this->container); $this->assertEquals(1, $projectModel->create(array('name' => 'Test'))); $this->assertEquals(2, $userModel->create(array('username' => 'user1', 'name' => 'User1'))); @@ -174,12 +174,12 @@ class ProjectUserRoleTest extends Base public function testGetAssignableUsersWithGroups() { - $projectModel = new Project($this->container); - $userModel = new User($this->container); - $groupModel = new Group($this->container); - $userRoleModel = new ProjectUserRole($this->container); - $groupRoleModel = new ProjectGroupRole($this->container); - $groupMemberModel = new GroupMember($this->container); + $projectModel = new ProjectModel($this->container); + $userModel = new UserModel($this->container); + $groupModel = new GroupModel($this->container); + $userRoleModel = new ProjectUserRoleModel($this->container); + $groupRoleModel = new ProjectGroupRoleModel($this->container); + $groupMemberModel = new GroupMemberModel($this->container); $this->assertEquals(1, $projectModel->create(array('name' => 'Test'))); @@ -211,9 +211,9 @@ class ProjectUserRoleTest extends Base public function testGetAssignableUsersList() { - $projectModel = new Project($this->container); - $userModel = new User($this->container); - $userRoleModel = new ProjectUserRole($this->container); + $projectModel = new ProjectModel($this->container); + $userModel = new UserModel($this->container); + $userRoleModel = new ProjectUserRoleModel($this->container); $this->assertEquals(1, $projectModel->create(array('name' => 'Test1'))); $this->assertEquals(2, $projectModel->create(array('name' => 'Test2'))); @@ -249,9 +249,9 @@ class ProjectUserRoleTest extends Base public function testGetAssignableUsersWithEverybodyAllowed() { - $projectModel = new Project($this->container); - $userModel = new User($this->container); - $userRoleModel = new ProjectUserRole($this->container); + $projectModel = new ProjectModel($this->container); + $userModel = new UserModel($this->container); + $userRoleModel = new ProjectUserRoleModel($this->container); $this->assertEquals(1, $projectModel->create(array('name' => 'Test', 'is_everybody_allowed' => 1))); @@ -272,10 +272,10 @@ class ProjectUserRoleTest extends Base public function testGetAssignableUsersWithDisabledUsersAndEverybodyAllowed() { - $projectModel = new Project($this->container); - $projectPermission = new ProjectPermission($this->container); - $userModel = new User($this->container); - $userRoleModel = new ProjectUserRole($this->container); + $projectModel = new ProjectModel($this->container); + $projectPermission = new ProjectPermissionModel($this->container); + $userModel = new UserModel($this->container); + $userRoleModel = new ProjectUserRoleModel($this->container); $this->assertEquals(2, $userModel->create(array('username' => 'user1', 'name' => 'User1'))); $this->assertEquals(3, $userModel->create(array('username' => 'user2', 'name' => 'User2'))); @@ -302,12 +302,12 @@ class ProjectUserRoleTest extends Base public function testGetProjectsByUser() { - $userModel = new User($this->container); - $projectModel = new Project($this->container); - $groupModel = new Group($this->container); - $groupMemberModel = new GroupMember($this->container); - $groupRoleModel = new ProjectGroupRole($this->container); - $userRoleModel = new ProjectUserRole($this->container); + $userModel = new UserModel($this->container); + $projectModel = new ProjectModel($this->container); + $groupModel = new GroupModel($this->container); + $groupMemberModel = new GroupMemberModel($this->container); + $groupRoleModel = new ProjectGroupRoleModel($this->container); + $userRoleModel = new ProjectUserRoleModel($this->container); $this->assertEquals(1, $projectModel->create(array('name' => 'Project 1'))); $this->assertEquals(2, $projectModel->create(array('name' => 'Project 2'))); @@ -364,12 +364,12 @@ class ProjectUserRoleTest extends Base public function testGetActiveProjectsByUser() { - $userModel = new User($this->container); - $projectModel = new Project($this->container); - $groupModel = new Group($this->container); - $groupMemberModel = new GroupMember($this->container); - $groupRoleModel = new ProjectGroupRole($this->container); - $userRoleModel = new ProjectUserRole($this->container); + $userModel = new UserModel($this->container); + $projectModel = new ProjectModel($this->container); + $groupModel = new GroupModel($this->container); + $groupMemberModel = new GroupMemberModel($this->container); + $groupRoleModel = new ProjectGroupRoleModel($this->container); + $userRoleModel = new ProjectUserRoleModel($this->container); $this->assertEquals(1, $projectModel->create(array('name' => 'Project 1', 'is_active' => 0))); $this->assertEquals(2, $projectModel->create(array('name' => 'Project 2'))); @@ -398,36 +398,36 @@ class ProjectUserRoleTest extends Base $this->assertTrue($userRoleModel->addUser(2, 6, Role::PROJECT_MEMBER)); $this->assertTrue($userRoleModel->addUser(2, 7, Role::PROJECT_MEMBER)); - $projects = $userRoleModel->getProjectsByUser(2, array(Project::ACTIVE)); + $projects = $userRoleModel->getProjectsByUser(2, array(ProjectModel::ACTIVE)); $this->assertCount(0, $projects); - $projects = $userRoleModel->getProjectsByUser(3, array(Project::ACTIVE)); + $projects = $userRoleModel->getProjectsByUser(3, array(ProjectModel::ACTIVE)); $this->assertCount(0, $projects); - $projects = $userRoleModel->getProjectsByUser(4, array(Project::ACTIVE)); + $projects = $userRoleModel->getProjectsByUser(4, array(ProjectModel::ACTIVE)); $this->assertCount(0, $projects); - $projects = $userRoleModel->getProjectsByUser(5, array(Project::ACTIVE)); + $projects = $userRoleModel->getProjectsByUser(5, array(ProjectModel::ACTIVE)); $this->assertCount(1, $projects); $this->assertEquals('Project 2', $projects[2]); - $projects = $userRoleModel->getProjectsByUser(6, array(Project::ACTIVE)); + $projects = $userRoleModel->getProjectsByUser(6, array(ProjectModel::ACTIVE)); $this->assertCount(1, $projects); $this->assertEquals('Project 2', $projects[2]); - $projects = $userRoleModel->getProjectsByUser(7, array(Project::ACTIVE)); + $projects = $userRoleModel->getProjectsByUser(7, array(ProjectModel::ACTIVE)); $this->assertCount(1, $projects); $this->assertEquals('Project 2', $projects[2]); } public function testGetInactiveProjectsByUser() { - $userModel = new User($this->container); - $projectModel = new Project($this->container); - $groupModel = new Group($this->container); - $groupMemberModel = new GroupMember($this->container); - $groupRoleModel = new ProjectGroupRole($this->container); - $userRoleModel = new ProjectUserRole($this->container); + $userModel = new UserModel($this->container); + $projectModel = new ProjectModel($this->container); + $groupModel = new GroupModel($this->container); + $groupMemberModel = new GroupMemberModel($this->container); + $groupRoleModel = new ProjectGroupRoleModel($this->container); + $userRoleModel = new ProjectUserRoleModel($this->container); $this->assertEquals(1, $projectModel->create(array('name' => 'Project 1', 'is_active' => 0))); $this->assertEquals(2, $projectModel->create(array('name' => 'Project 2'))); @@ -456,26 +456,26 @@ class ProjectUserRoleTest extends Base $this->assertTrue($userRoleModel->addUser(2, 6, Role::PROJECT_MEMBER)); $this->assertTrue($userRoleModel->addUser(2, 7, Role::PROJECT_MEMBER)); - $projects = $userRoleModel->getProjectsByUser(2, array(Project::INACTIVE)); + $projects = $userRoleModel->getProjectsByUser(2, array(ProjectModel::INACTIVE)); $this->assertCount(1, $projects); $this->assertEquals('Project 1', $projects[1]); - $projects = $userRoleModel->getProjectsByUser(3, array(Project::INACTIVE)); + $projects = $userRoleModel->getProjectsByUser(3, array(ProjectModel::INACTIVE)); $this->assertCount(1, $projects); $this->assertEquals('Project 1', $projects[1]); - $projects = $userRoleModel->getProjectsByUser(4, array(Project::INACTIVE)); + $projects = $userRoleModel->getProjectsByUser(4, array(ProjectModel::INACTIVE)); $this->assertCount(1, $projects); $this->assertEquals('Project 1', $projects[1]); - $projects = $userRoleModel->getProjectsByUser(5, array(Project::INACTIVE)); + $projects = $userRoleModel->getProjectsByUser(5, array(ProjectModel::INACTIVE)); $this->assertCount(0, $projects); - $projects = $userRoleModel->getProjectsByUser(6, array(Project::INACTIVE)); + $projects = $userRoleModel->getProjectsByUser(6, array(ProjectModel::INACTIVE)); $this->assertCount(1, $projects); $this->assertEquals('Project 1', $projects[1]); - $projects = $userRoleModel->getProjectsByUser(7, array(Project::INACTIVE)); + $projects = $userRoleModel->getProjectsByUser(7, array(ProjectModel::INACTIVE)); $this->assertCount(0, $projects); } } diff --git a/tests/units/Model/SubtaskTest.php b/tests/units/Model/SubtaskTest.php index 20186452..b65ee609 100644 --- a/tests/units/Model/SubtaskTest.php +++ b/tests/units/Model/SubtaskTest.php @@ -2,11 +2,11 @@ require_once __DIR__.'/../Base.php'; -use Kanboard\Model\TaskCreation; -use Kanboard\Model\Subtask; -use Kanboard\Model\Project; +use Kanboard\Model\TaskCreationModel; +use Kanboard\Model\SubtaskModel; +use Kanboard\Model\ProjectModel; use Kanboard\Core\User\UserSession; -use Kanboard\Model\TaskFinder; +use Kanboard\Model\TaskFinderModel; class SubtaskTest extends Base { @@ -46,7 +46,7 @@ class SubtaskTest extends Base $this->assertArrayHasKey('user_id', $data['changes']); $this->assertArrayHasKey('status', $data['changes']); - $this->assertEquals(Subtask::STATUS_INPROGRESS, $data['changes']['status']); + $this->assertEquals(SubtaskModel::STATUS_INPROGRESS, $data['changes']['status']); $this->assertEquals(1, $data['changes']['user_id']); } @@ -70,14 +70,14 @@ class SubtaskTest extends Base public function testCreation() { - $tc = new TaskCreation($this->container); - $s = new Subtask($this->container); - $p = new Project($this->container); + $tc = new TaskCreationModel($this->container); + $s = new SubtaskModel($this->container); + $p = new ProjectModel($this->container); $this->assertEquals(1, $p->create(array('name' => 'test'))); $this->assertEquals(1, $tc->create(array('title' => 'test 1', 'project_id' => 1))); - $this->container['dispatcher']->addListener(Subtask::EVENT_CREATE, array($this, 'onSubtaskCreated')); + $this->container['dispatcher']->addListener(SubtaskModel::EVENT_CREATE, array($this, 'onSubtaskCreated')); $this->assertEquals(1, $s->create(array('title' => 'subtask #1', 'task_id' => 1))); @@ -86,7 +86,7 @@ class SubtaskTest extends Base $this->assertEquals(1, $subtask['id']); $this->assertEquals(1, $subtask['task_id']); $this->assertEquals('subtask #1', $subtask['title']); - $this->assertEquals(Subtask::STATUS_TODO, $subtask['status']); + $this->assertEquals(SubtaskModel::STATUS_TODO, $subtask['status']); $this->assertEquals(0, $subtask['time_estimated']); $this->assertEquals(0, $subtask['time_spent']); $this->assertEquals(0, $subtask['user_id']); @@ -95,24 +95,24 @@ class SubtaskTest extends Base public function testModification() { - $tc = new TaskCreation($this->container); - $s = new Subtask($this->container); - $p = new Project($this->container); + $tc = new TaskCreationModel($this->container); + $s = new SubtaskModel($this->container); + $p = new ProjectModel($this->container); $this->assertEquals(1, $p->create(array('name' => 'test'))); $this->assertEquals(1, $tc->create(array('title' => 'test 1', 'project_id' => 1))); - $this->container['dispatcher']->addListener(Subtask::EVENT_UPDATE, array($this, 'onSubtaskUpdated')); + $this->container['dispatcher']->addListener(SubtaskModel::EVENT_UPDATE, array($this, 'onSubtaskUpdated')); $this->assertEquals(1, $s->create(array('title' => 'subtask #1', 'task_id' => 1))); - $this->assertTrue($s->update(array('id' => 1, 'user_id' => 1, 'status' => Subtask::STATUS_INPROGRESS))); + $this->assertTrue($s->update(array('id' => 1, 'user_id' => 1, 'status' => SubtaskModel::STATUS_INPROGRESS))); $subtask = $s->getById(1); $this->assertNotEmpty($subtask); $this->assertEquals(1, $subtask['id']); $this->assertEquals(1, $subtask['task_id']); $this->assertEquals('subtask #1', $subtask['title']); - $this->assertEquals(Subtask::STATUS_INPROGRESS, $subtask['status']); + $this->assertEquals(SubtaskModel::STATUS_INPROGRESS, $subtask['status']); $this->assertEquals(0, $subtask['time_estimated']); $this->assertEquals(0, $subtask['time_spent']); $this->assertEquals(1, $subtask['user_id']); @@ -121,15 +121,15 @@ class SubtaskTest extends Base public function testRemove() { - $tc = new TaskCreation($this->container); - $s = new Subtask($this->container); - $p = new Project($this->container); + $tc = new TaskCreationModel($this->container); + $s = new SubtaskModel($this->container); + $p = new ProjectModel($this->container); $this->assertEquals(1, $p->create(array('name' => 'test'))); $this->assertEquals(1, $tc->create(array('title' => 'test 1', 'project_id' => 1))); $this->assertEquals(1, $s->create(array('title' => 'subtask #1', 'task_id' => 1))); - $this->container['dispatcher']->addListener(Subtask::EVENT_DELETE, array($this, 'onSubtaskDeleted')); + $this->container['dispatcher']->addListener(SubtaskModel::EVENT_DELETE, array($this, 'onSubtaskDeleted')); $subtask = $s->getById(1); $this->assertNotEmpty($subtask); @@ -142,9 +142,9 @@ class SubtaskTest extends Base public function testToggleStatusWithoutSession() { - $tc = new TaskCreation($this->container); - $s = new Subtask($this->container); - $p = new Project($this->container); + $tc = new TaskCreationModel($this->container); + $s = new SubtaskModel($this->container); + $p = new ProjectModel($this->container); $this->assertEquals(1, $p->create(array('name' => 'test1'))); $this->assertEquals(1, $tc->create(array('title' => 'test 1', 'project_id' => 1))); @@ -153,40 +153,40 @@ class SubtaskTest extends Base $subtask = $s->getById(1); $this->assertNotEmpty($subtask); - $this->assertEquals(Subtask::STATUS_TODO, $subtask['status']); + $this->assertEquals(SubtaskModel::STATUS_TODO, $subtask['status']); $this->assertEquals(0, $subtask['user_id']); $this->assertEquals(1, $subtask['task_id']); - $this->assertEquals(Subtask::STATUS_INPROGRESS, $s->toggleStatus(1)); + $this->assertEquals(SubtaskModel::STATUS_INPROGRESS, $s->toggleStatus(1)); $subtask = $s->getById(1); $this->assertNotEmpty($subtask); - $this->assertEquals(Subtask::STATUS_INPROGRESS, $subtask['status']); + $this->assertEquals(SubtaskModel::STATUS_INPROGRESS, $subtask['status']); $this->assertEquals(0, $subtask['user_id']); $this->assertEquals(1, $subtask['task_id']); - $this->assertEquals(Subtask::STATUS_DONE, $s->toggleStatus(1)); + $this->assertEquals(SubtaskModel::STATUS_DONE, $s->toggleStatus(1)); $subtask = $s->getById(1); $this->assertNotEmpty($subtask); - $this->assertEquals(Subtask::STATUS_DONE, $subtask['status']); + $this->assertEquals(SubtaskModel::STATUS_DONE, $subtask['status']); $this->assertEquals(0, $subtask['user_id']); $this->assertEquals(1, $subtask['task_id']); - $this->assertEquals(Subtask::STATUS_TODO, $s->toggleStatus(1)); + $this->assertEquals(SubtaskModel::STATUS_TODO, $s->toggleStatus(1)); $subtask = $s->getById(1); $this->assertNotEmpty($subtask); - $this->assertEquals(Subtask::STATUS_TODO, $subtask['status']); + $this->assertEquals(SubtaskModel::STATUS_TODO, $subtask['status']); $this->assertEquals(0, $subtask['user_id']); $this->assertEquals(1, $subtask['task_id']); } public function testToggleStatusWithSession() { - $tc = new TaskCreation($this->container); - $s = new Subtask($this->container); - $p = new Project($this->container); + $tc = new TaskCreationModel($this->container); + $s = new SubtaskModel($this->container); + $p = new ProjectModel($this->container); $us = new UserSession($this->container); $this->assertEquals(1, $p->create(array('name' => 'test1'))); @@ -196,43 +196,43 @@ class SubtaskTest extends Base $subtask = $s->getById(1); $this->assertNotEmpty($subtask); - $this->assertEquals(Subtask::STATUS_TODO, $subtask['status']); + $this->assertEquals(SubtaskModel::STATUS_TODO, $subtask['status']); $this->assertEquals(0, $subtask['user_id']); $this->assertEquals(1, $subtask['task_id']); // Set the current logged user $this->container['sessionStorage']->user = array('id' => 1); - $this->assertEquals(Subtask::STATUS_INPROGRESS, $s->toggleStatus(1)); + $this->assertEquals(SubtaskModel::STATUS_INPROGRESS, $s->toggleStatus(1)); $subtask = $s->getById(1); $this->assertNotEmpty($subtask); - $this->assertEquals(Subtask::STATUS_INPROGRESS, $subtask['status']); + $this->assertEquals(SubtaskModel::STATUS_INPROGRESS, $subtask['status']); $this->assertEquals(1, $subtask['user_id']); $this->assertEquals(1, $subtask['task_id']); - $this->assertEquals(Subtask::STATUS_DONE, $s->toggleStatus(1)); + $this->assertEquals(SubtaskModel::STATUS_DONE, $s->toggleStatus(1)); $subtask = $s->getById(1); $this->assertNotEmpty($subtask); - $this->assertEquals(Subtask::STATUS_DONE, $subtask['status']); + $this->assertEquals(SubtaskModel::STATUS_DONE, $subtask['status']); $this->assertEquals(1, $subtask['user_id']); $this->assertEquals(1, $subtask['task_id']); - $this->assertEquals(Subtask::STATUS_TODO, $s->toggleStatus(1)); + $this->assertEquals(SubtaskModel::STATUS_TODO, $s->toggleStatus(1)); $subtask = $s->getById(1); $this->assertNotEmpty($subtask); - $this->assertEquals(Subtask::STATUS_TODO, $subtask['status']); + $this->assertEquals(SubtaskModel::STATUS_TODO, $subtask['status']); $this->assertEquals(1, $subtask['user_id']); $this->assertEquals(1, $subtask['task_id']); } public function testCloseAll() { - $tc = new TaskCreation($this->container); - $s = new Subtask($this->container); - $p = new Project($this->container); + $tc = new TaskCreationModel($this->container); + $s = new SubtaskModel($this->container); + $p = new ProjectModel($this->container); $this->assertEquals(1, $p->create(array('name' => 'test1'))); $this->assertEquals(1, $tc->create(array('title' => 'test 1', 'project_id' => 1))); @@ -246,15 +246,15 @@ class SubtaskTest extends Base $this->assertNotEmpty($subtasks); foreach ($subtasks as $subtask) { - $this->assertEquals(Subtask::STATUS_DONE, $subtask['status']); + $this->assertEquals(SubtaskModel::STATUS_DONE, $subtask['status']); } } public function testDuplicate() { - $tc = new TaskCreation($this->container); - $s = new Subtask($this->container); - $p = new Project($this->container); + $tc = new TaskCreationModel($this->container); + $s = new SubtaskModel($this->container); + $p = new ProjectModel($this->container); // We create a project $this->assertEquals(1, $p->create(array('name' => 'test1'))); @@ -299,9 +299,9 @@ class SubtaskTest extends Base public function testChangePosition() { - $taskCreationModel = new TaskCreation($this->container); - $subtaskModel = new Subtask($this->container); - $projectModel = new Project($this->container); + $taskCreationModel = new TaskCreationModel($this->container); + $subtaskModel = new SubtaskModel($this->container); + $projectModel = new ProjectModel($this->container); $this->assertEquals(1, $projectModel->create(array('name' => 'test1'))); $this->assertEquals(1, $taskCreationModel->create(array('title' => 'test 1', 'project_id' => 1))); @@ -364,10 +364,10 @@ class SubtaskTest extends Base public function testConvertToTask() { - $taskCreationModel = new TaskCreation($this->container); - $taskFinderModel = new TaskFinder($this->container); - $subtaskModel = new Subtask($this->container); - $projectModel = new Project($this->container); + $taskCreationModel = new TaskCreationModel($this->container); + $taskFinderModel = new TaskFinderModel($this->container); + $subtaskModel = new SubtaskModel($this->container); + $projectModel = new ProjectModel($this->container); $this->assertEquals(1, $projectModel->create(array('name' => 'test1'))); $this->assertEquals(1, $taskCreationModel->create(array('title' => 'test 1', 'project_id' => 1))); diff --git a/tests/units/Model/SubtaskTimeTrackingTest.php b/tests/units/Model/SubtaskTimeTrackingTest.php index dead3887..d5ae62ae 100644 --- a/tests/units/Model/SubtaskTimeTrackingTest.php +++ b/tests/units/Model/SubtaskTimeTrackingTest.php @@ -2,20 +2,20 @@ require_once __DIR__.'/../Base.php'; -use Kanboard\Model\TaskFinder; -use Kanboard\Model\TaskCreation; -use Kanboard\Model\Subtask; -use Kanboard\Model\SubtaskTimeTracking; -use Kanboard\Model\Project; +use Kanboard\Model\TaskFinderModel; +use Kanboard\Model\TaskCreationModel; +use Kanboard\Model\SubtaskModel; +use Kanboard\Model\SubtaskTimeTrackingModel; +use Kanboard\Model\ProjectModel; class SubtaskTimeTrackingTest extends Base { public function testHasTimer() { - $tc = new TaskCreation($this->container); - $s = new Subtask($this->container); - $st = new SubtaskTimeTracking($this->container); - $p = new Project($this->container); + $tc = new TaskCreationModel($this->container); + $s = new SubtaskModel($this->container); + $st = new SubtaskTimeTrackingModel($this->container); + $p = new ProjectModel($this->container); $this->assertEquals(1, $p->create(array('name' => 'test1'))); $this->assertEquals(1, $tc->create(array('title' => 'test 1', 'project_id' => 1, 'column_id' => 1, 'owner_id' => 1))); @@ -31,10 +31,10 @@ class SubtaskTimeTrackingTest extends Base public function testGetTimerStatus() { - $tc = new TaskCreation($this->container); - $s = new Subtask($this->container); - $st = new SubtaskTimeTracking($this->container); - $p = new Project($this->container); + $tc = new TaskCreationModel($this->container); + $s = new SubtaskModel($this->container); + $st = new SubtaskTimeTrackingModel($this->container); + $p = new ProjectModel($this->container); $this->container['sessionStorage']->user = array('id' => 1); @@ -81,10 +81,10 @@ class SubtaskTimeTrackingTest extends Base public function testLogStartTime() { - $tc = new TaskCreation($this->container); - $s = new Subtask($this->container); - $st = new SubtaskTimeTracking($this->container); - $p = new Project($this->container); + $tc = new TaskCreationModel($this->container); + $s = new SubtaskModel($this->container); + $st = new SubtaskTimeTrackingModel($this->container); + $p = new ProjectModel($this->container); $this->assertEquals(1, $p->create(array('name' => 'test1'))); $this->assertEquals(1, $tc->create(array('title' => 'test 1', 'project_id' => 1, 'column_id' => 1, 'owner_id' => 1))); @@ -103,10 +103,10 @@ class SubtaskTimeTrackingTest extends Base public function testLogStartEnd() { - $tc = new TaskCreation($this->container); - $s = new Subtask($this->container); - $st = new SubtaskTimeTracking($this->container); - $p = new Project($this->container); + $tc = new TaskCreationModel($this->container); + $s = new SubtaskModel($this->container); + $st = new SubtaskTimeTrackingModel($this->container); + $p = new ProjectModel($this->container); $this->assertEquals(1, $p->create(array('name' => 'test1'))); $this->assertEquals(1, $tc->create(array('title' => 'test 1', 'project_id' => 1, 'column_id' => 1, 'owner_id' => 1))); @@ -134,10 +134,10 @@ class SubtaskTimeTrackingTest extends Base public function testCalculateSubtaskTime() { - $tc = new TaskCreation($this->container); - $s = new Subtask($this->container); - $st = new SubtaskTimeTracking($this->container); - $p = new Project($this->container); + $tc = new TaskCreationModel($this->container); + $s = new SubtaskModel($this->container); + $st = new SubtaskTimeTrackingModel($this->container); + $p = new ProjectModel($this->container); $this->assertEquals(1, $p->create(array('name' => 'test1'))); $this->assertEquals(1, $tc->create(array('title' => 'test 1', 'project_id' => 1, 'column_id' => 1, 'owner_id' => 1))); @@ -152,10 +152,10 @@ class SubtaskTimeTrackingTest extends Base public function testUpdateSubtaskTimeSpent() { - $tc = new TaskCreation($this->container); - $s = new Subtask($this->container); - $st = new SubtaskTimeTracking($this->container); - $p = new Project($this->container); + $tc = new TaskCreationModel($this->container); + $s = new SubtaskModel($this->container); + $st = new SubtaskTimeTrackingModel($this->container); + $p = new ProjectModel($this->container); $this->assertEquals(1, $p->create(array('name' => 'test1'))); $this->assertEquals(1, $tc->create(array('title' => 'test 1', 'project_id' => 1, 'column_id' => 1, 'owner_id' => 1))); @@ -166,7 +166,7 @@ class SubtaskTimeTrackingTest extends Base $this->assertTrue($st->logStartTime(2, 1)); // Fake start time - $this->container['db']->table(SubtaskTimeTracking::TABLE)->update(array('start' => time() - 3600)); + $this->container['db']->table(SubtaskTimeTrackingModel::TABLE)->update(array('start' => time() - 3600)); $this->assertTrue($st->logEndTime(1, 1)); $this->assertTrue($st->logEndTime(2, 1)); @@ -188,11 +188,11 @@ class SubtaskTimeTrackingTest extends Base public function testUpdateTaskTimeTracking() { - $tf = new TaskFinder($this->container); - $tc = new TaskCreation($this->container); - $s = new Subtask($this->container); - $st = new SubtaskTimeTracking($this->container); - $p = new Project($this->container); + $tf = new TaskFinderModel($this->container); + $tc = new TaskCreationModel($this->container); + $s = new SubtaskModel($this->container); + $st = new SubtaskTimeTrackingModel($this->container); + $p = new ProjectModel($this->container); $this->assertEquals(1, $p->create(array('name' => 'test1'))); diff --git a/tests/units/Model/SwimlaneTest.php b/tests/units/Model/SwimlaneTest.php index 380d8c77..2594b17a 100644 --- a/tests/units/Model/SwimlaneTest.php +++ b/tests/units/Model/SwimlaneTest.php @@ -2,17 +2,17 @@ require_once __DIR__.'/../Base.php'; -use Kanboard\Model\Project; -use Kanboard\Model\TaskCreation; -use Kanboard\Model\TaskFinder; -use Kanboard\Model\Swimlane; +use Kanboard\Model\ProjectModel; +use Kanboard\Model\TaskCreationModel; +use Kanboard\Model\TaskFinderModel; +use Kanboard\Model\SwimlaneModel; class SwimlaneTest extends Base { public function testCreation() { - $p = new Project($this->container); - $s = new Swimlane($this->container); + $p = new ProjectModel($this->container); + $s = new SwimlaneModel($this->container); $this->assertEquals(1, $p->create(array('name' => 'UnitTest'))); $this->assertEquals(1, $s->create(array('project_id' => 1, 'name' => 'Swimlane #1'))); @@ -32,8 +32,8 @@ class SwimlaneTest extends Base public function testGetList() { - $p = new Project($this->container); - $s = new Swimlane($this->container); + $p = new ProjectModel($this->container); + $s = new SwimlaneModel($this->container); $this->assertEquals(1, $p->create(array('name' => 'UnitTest'))); $this->assertEquals(1, $s->create(array('project_id' => 1, 'name' => 'Swimlane #1'))); @@ -47,8 +47,8 @@ class SwimlaneTest extends Base public function testUpdate() { - $p = new Project($this->container); - $s = new Swimlane($this->container); + $p = new ProjectModel($this->container); + $s = new SwimlaneModel($this->container); $this->assertEquals(1, $p->create(array('name' => 'UnitTest'))); $this->assertEquals(1, $s->create(array('project_id' => 1, 'name' => 'Swimlane #1'))); @@ -66,8 +66,8 @@ class SwimlaneTest extends Base public function testUpdateDefaultSwimlane() { - $p = new Project($this->container); - $s = new Swimlane($this->container); + $p = new ProjectModel($this->container); + $s = new SwimlaneModel($this->container); $this->assertEquals(1, $p->create(array('name' => 'UnitTest'))); $this->assertTrue($s->updateDefault(array('id' => 1, 'default_swimlane' => 'foo', 'show_default_swimlane' => 1))); @@ -87,8 +87,8 @@ class SwimlaneTest extends Base public function testDisableEnableDefaultSwimlane() { - $projectModel = new Project($this->container); - $swimlaneModel = new Swimlane($this->container); + $projectModel = new ProjectModel($this->container); + $swimlaneModel = new SwimlaneModel($this->container); $this->assertEquals(1, $projectModel->create(array('name' => 'UnitTest'))); @@ -103,8 +103,8 @@ class SwimlaneTest extends Base public function testDisableEnable() { - $p = new Project($this->container); - $s = new Swimlane($this->container); + $p = new ProjectModel($this->container); + $s = new SwimlaneModel($this->container); $this->assertEquals(1, $p->create(array('name' => 'UnitTest'))); $this->assertEquals(1, $s->create(array('project_id' => 1, 'name' => 'Swimlane #1'))); @@ -143,10 +143,10 @@ class SwimlaneTest extends Base public function testRemove() { - $p = new Project($this->container); - $s = new Swimlane($this->container); - $tc = new TaskCreation($this->container); - $tf = new TaskFinder($this->container); + $p = new ProjectModel($this->container); + $s = new SwimlaneModel($this->container); + $tc = new TaskCreationModel($this->container); + $tf = new TaskFinderModel($this->container); $this->assertEquals(1, $p->create(array('name' => 'UnitTest'))); $this->assertEquals(1, $s->create(array('project_id' => 1, 'name' => 'Swimlane #1'))); @@ -167,8 +167,8 @@ class SwimlaneTest extends Base public function testUpdatePositions() { - $p = new Project($this->container); - $s = new Swimlane($this->container); + $p = new ProjectModel($this->container); + $s = new SwimlaneModel($this->container); $this->assertEquals(1, $p->create(array('name' => 'UnitTest'))); $this->assertEquals(1, $s->create(array('project_id' => 1, 'name' => 'Swimlane #1'))); @@ -227,8 +227,8 @@ class SwimlaneTest extends Base public function testDuplicateSwimlane() { - $p = new Project($this->container); - $s = new Swimlane($this->container); + $p = new ProjectModel($this->container); + $s = new SwimlaneModel($this->container); $this->assertEquals(1, $p->create(array('name' => 'P1'))); $this->assertEquals(2, $p->create(array('name' => 'P2'))); @@ -258,8 +258,8 @@ class SwimlaneTest extends Base public function testChangePosition() { - $projectModel = new Project($this->container); - $swimlaneModel = new Swimlane($this->container); + $projectModel = new ProjectModel($this->container); + $swimlaneModel = new SwimlaneModel($this->container); $this->assertEquals(1, $projectModel->create(array('name' => 'test1'))); $this->assertEquals(1, $swimlaneModel->create(array('project_id' => 1, 'name' => 'Swimlane #1'))); @@ -321,8 +321,8 @@ class SwimlaneTest extends Base public function testChangePositionWithInactiveSwimlane() { - $projectModel = new Project($this->container); - $swimlaneModel = new Swimlane($this->container); + $projectModel = new ProjectModel($this->container); + $swimlaneModel = new SwimlaneModel($this->container); $this->assertEquals(1, $projectModel->create(array('name' => 'test1'))); $this->assertEquals(1, $swimlaneModel->create(array('project_id' => 1, 'name' => 'Swimlane #1'))); diff --git a/tests/units/Model/TaskCreationTest.php b/tests/units/Model/TaskCreationTest.php index d6860b30..aba52ae2 100644 --- a/tests/units/Model/TaskCreationTest.php +++ b/tests/units/Model/TaskCreationTest.php @@ -2,11 +2,11 @@ require_once __DIR__.'/../Base.php'; -use Kanboard\Model\Config; -use Kanboard\Model\Task; -use Kanboard\Model\TaskCreation; -use Kanboard\Model\TaskFinder; -use Kanboard\Model\Project; +use Kanboard\Model\ConfigModel; +use Kanboard\Model\TaskModel; +use Kanboard\Model\TaskCreationModel; +use Kanboard\Model\TaskFinderModel; +use Kanboard\Model\ProjectModel; class TaskCreationTest extends Base { @@ -22,36 +22,36 @@ class TaskCreationTest extends Base public function testNoProjectId() { - $p = new Project($this->container); - $tc = new TaskCreation($this->container); - $tf = new TaskFinder($this->container); + $p = new ProjectModel($this->container); + $tc = new TaskCreationModel($this->container); + $tf = new TaskFinderModel($this->container); - $this->container['dispatcher']->addListener(Task::EVENT_CREATE_UPDATE, function () {}); - $this->container['dispatcher']->addListener(Task::EVENT_CREATE, function () {}); + $this->container['dispatcher']->addListener(TaskModel::EVENT_CREATE_UPDATE, function () {}); + $this->container['dispatcher']->addListener(TaskModel::EVENT_CREATE, function () {}); $this->assertEquals(1, $p->create(array('name' => 'test'))); $this->assertEquals(0, $tc->create(array('title' => 'test', 'project_id' => 0))); $called = $this->container['dispatcher']->getCalledListeners(); - $this->assertArrayNotHasKey(Task::EVENT_CREATE_UPDATE.'.closure', $called); - $this->assertArrayNotHasKey(Task::EVENT_CREATE.'.closure', $called); + $this->assertArrayNotHasKey(TaskModel::EVENT_CREATE_UPDATE.'.closure', $called); + $this->assertArrayNotHasKey(TaskModel::EVENT_CREATE.'.closure', $called); } public function testNoTitle() { - $p = new Project($this->container); - $tc = new TaskCreation($this->container); - $tf = new TaskFinder($this->container); + $p = new ProjectModel($this->container); + $tc = new TaskCreationModel($this->container); + $tf = new TaskFinderModel($this->container); - $this->container['dispatcher']->addListener(Task::EVENT_CREATE_UPDATE, function () {}); - $this->container['dispatcher']->addListener(Task::EVENT_CREATE, function () {}); + $this->container['dispatcher']->addListener(TaskModel::EVENT_CREATE_UPDATE, function () {}); + $this->container['dispatcher']->addListener(TaskModel::EVENT_CREATE, function () {}); $this->assertEquals(1, $p->create(array('name' => 'test'))); $this->assertEquals(1, $tc->create(array('project_id' => 1))); $called = $this->container['dispatcher']->getCalledListeners(); - $this->assertArrayHasKey(Task::EVENT_CREATE_UPDATE.'.closure', $called); - $this->assertArrayHasKey(Task::EVENT_CREATE.'.closure', $called); + $this->assertArrayHasKey(TaskModel::EVENT_CREATE_UPDATE.'.closure', $called); + $this->assertArrayHasKey(TaskModel::EVENT_CREATE.'.closure', $called); $task = $tf->getById(1); $this->assertNotEmpty($task); @@ -62,19 +62,19 @@ class TaskCreationTest extends Base public function testMinimum() { - $p = new Project($this->container); - $tc = new TaskCreation($this->container); - $tf = new TaskFinder($this->container); + $p = new ProjectModel($this->container); + $tc = new TaskCreationModel($this->container); + $tf = new TaskFinderModel($this->container); - $this->container['dispatcher']->addListener(Task::EVENT_CREATE_UPDATE, function () {}); - $this->container['dispatcher']->addListener(Task::EVENT_CREATE, array($this, 'onCreate')); + $this->container['dispatcher']->addListener(TaskModel::EVENT_CREATE_UPDATE, function () {}); + $this->container['dispatcher']->addListener(TaskModel::EVENT_CREATE, array($this, 'onCreate')); $this->assertEquals(1, $p->create(array('name' => 'test'))); $this->assertEquals(1, $tc->create(array('project_id' => 1, 'title' => 'test'))); $called = $this->container['dispatcher']->getCalledListeners(); - $this->assertArrayHasKey(Task::EVENT_CREATE_UPDATE.'.closure', $called); - $this->assertArrayHasKey(Task::EVENT_CREATE.'.TaskCreationTest::onCreate', $called); + $this->assertArrayHasKey(TaskModel::EVENT_CREATE_UPDATE.'.closure', $called); + $this->assertArrayHasKey(TaskModel::EVENT_CREATE.'.TaskCreationTest::onCreate', $called); $task = $tf->getById(1); $this->assertNotEmpty($task); @@ -108,9 +108,9 @@ class TaskCreationTest extends Base public function testColorId() { - $p = new Project($this->container); - $tc = new TaskCreation($this->container); - $tf = new TaskFinder($this->container); + $p = new ProjectModel($this->container); + $tc = new TaskCreationModel($this->container); + $tf = new TaskFinderModel($this->container); $this->assertEquals(1, $p->create(array('name' => 'test'))); $this->assertEquals(1, $tc->create(array('project_id' => 1, 'title' => 'test', 'color_id' => 'blue'))); @@ -124,9 +124,9 @@ class TaskCreationTest extends Base public function testOwnerId() { - $p = new Project($this->container); - $tc = new TaskCreation($this->container); - $tf = new TaskFinder($this->container); + $p = new ProjectModel($this->container); + $tc = new TaskCreationModel($this->container); + $tf = new TaskFinderModel($this->container); $this->assertEquals(1, $p->create(array('name' => 'test'))); $this->assertEquals(1, $tc->create(array('project_id' => 1, 'title' => 'test', 'owner_id' => 1))); @@ -140,9 +140,9 @@ class TaskCreationTest extends Base public function testCategoryId() { - $p = new Project($this->container); - $tc = new TaskCreation($this->container); - $tf = new TaskFinder($this->container); + $p = new ProjectModel($this->container); + $tc = new TaskCreationModel($this->container); + $tf = new TaskFinderModel($this->container); $this->assertEquals(1, $p->create(array('name' => 'test'))); $this->assertEquals(1, $tc->create(array('project_id' => 1, 'title' => 'test', 'category_id' => 1))); @@ -156,9 +156,9 @@ class TaskCreationTest extends Base public function testCreatorId() { - $p = new Project($this->container); - $tc = new TaskCreation($this->container); - $tf = new TaskFinder($this->container); + $p = new ProjectModel($this->container); + $tc = new TaskCreationModel($this->container); + $tf = new TaskFinderModel($this->container); $this->assertEquals(1, $p->create(array('name' => 'test'))); $this->assertEquals(1, $tc->create(array('project_id' => 1, 'title' => 'test', 'creator_id' => 1))); @@ -172,9 +172,9 @@ class TaskCreationTest extends Base public function testThatCreatorIsDefined() { - $p = new Project($this->container); - $tc = new TaskCreation($this->container); - $tf = new TaskFinder($this->container); + $p = new ProjectModel($this->container); + $tc = new TaskCreationModel($this->container); + $tf = new TaskFinderModel($this->container); $this->container['sessionStorage']->user = array('id' => 1); @@ -190,9 +190,9 @@ class TaskCreationTest extends Base public function testColumnId() { - $p = new Project($this->container); - $tc = new TaskCreation($this->container); - $tf = new TaskFinder($this->container); + $p = new ProjectModel($this->container); + $tc = new TaskCreationModel($this->container); + $tf = new TaskFinderModel($this->container); $this->assertEquals(1, $p->create(array('name' => 'test'))); $this->assertEquals(1, $tc->create(array('project_id' => 1, 'title' => 'test', 'column_id' => 2))); @@ -207,9 +207,9 @@ class TaskCreationTest extends Base public function testPosition() { - $p = new Project($this->container); - $tc = new TaskCreation($this->container); - $tf = new TaskFinder($this->container); + $p = new ProjectModel($this->container); + $tc = new TaskCreationModel($this->container); + $tf = new TaskFinderModel($this->container); $this->assertEquals(1, $p->create(array('name' => 'test'))); $this->assertEquals(1, $tc->create(array('project_id' => 1, 'title' => 'test', 'column_id' => 2))); @@ -233,9 +233,9 @@ class TaskCreationTest extends Base public function testDescription() { - $p = new Project($this->container); - $tc = new TaskCreation($this->container); - $tf = new TaskFinder($this->container); + $p = new ProjectModel($this->container); + $tc = new TaskCreationModel($this->container); + $tf = new TaskFinderModel($this->container); $this->assertEquals(1, $p->create(array('name' => 'test'))); $this->assertEquals(1, $tc->create(array('project_id' => 1, 'title' => 'test', 'description' => 'test'))); @@ -249,9 +249,9 @@ class TaskCreationTest extends Base public function testReference() { - $p = new Project($this->container); - $tc = new TaskCreation($this->container); - $tf = new TaskFinder($this->container); + $p = new ProjectModel($this->container); + $tc = new TaskCreationModel($this->container); + $tf = new TaskFinderModel($this->container); $this->assertEquals(1, $p->create(array('name' => 'test'))); $this->assertEquals(1, $tc->create(array('project_id' => 1, 'title' => 'test', 'reference' => 'test'))); @@ -267,9 +267,9 @@ class TaskCreationTest extends Base { $date = '2014-11-23'; $timestamp = strtotime('+2days'); - $p = new Project($this->container); - $tc = new TaskCreation($this->container); - $tf = new TaskFinder($this->container); + $p = new ProjectModel($this->container); + $tc = new TaskCreationModel($this->container); + $tf = new TaskFinderModel($this->container); $this->assertEquals(1, $p->create(array('name' => 'test'))); $this->assertEquals(1, $tc->create(array('project_id' => 1, 'title' => 'test', 'date_due' => $date))); @@ -293,9 +293,9 @@ class TaskCreationTest extends Base public function testDateStarted() { - $p = new Project($this->container); - $tc = new TaskCreation($this->container); - $tf = new TaskFinder($this->container); + $p = new ProjectModel($this->container); + $tc = new TaskCreationModel($this->container); + $tf = new TaskFinderModel($this->container); $this->assertEquals(1, $p->create(array('name' => 'test'))); @@ -331,9 +331,9 @@ class TaskCreationTest extends Base public function testTime() { - $p = new Project($this->container); - $tc = new TaskCreation($this->container); - $tf = new TaskFinder($this->container); + $p = new ProjectModel($this->container); + $tc = new TaskCreationModel($this->container); + $tf = new TaskFinderModel($this->container); $this->assertEquals(1, $p->create(array('name' => 'test'))); $this->assertEquals(1, $tc->create(array('project_id' => 1, 'title' => 'test', 'time_estimated' => 1.5, 'time_spent' => 2.3))); @@ -348,9 +348,9 @@ class TaskCreationTest extends Base public function testStripColumn() { - $p = new Project($this->container); - $tc = new TaskCreation($this->container); - $tf = new TaskFinder($this->container); + $p = new ProjectModel($this->container); + $tc = new TaskCreationModel($this->container); + $tf = new TaskFinderModel($this->container); $this->assertEquals(1, $p->create(array('name' => 'test'))); $this->assertEquals(1, $tc->create(array('project_id' => 1, 'title' => 'test', 'another_task' => '1'))); @@ -361,9 +361,9 @@ class TaskCreationTest extends Base public function testScore() { - $p = new Project($this->container); - $tc = new TaskCreation($this->container); - $tf = new TaskFinder($this->container); + $p = new ProjectModel($this->container); + $tc = new TaskCreationModel($this->container); + $tf = new TaskFinderModel($this->container); $this->assertEquals(1, $p->create(array('name' => 'test'))); $this->assertEquals(1, $tc->create(array('project_id' => 1, 'title' => 'test', 'score' => '3'))); @@ -376,10 +376,10 @@ class TaskCreationTest extends Base public function testDefaultColor() { - $p = new Project($this->container); - $tc = new TaskCreation($this->container); - $tf = new TaskFinder($this->container); - $c = new Config($this->container); + $p = new ProjectModel($this->container); + $tc = new TaskCreationModel($this->container); + $tf = new TaskFinderModel($this->container); + $c = new ConfigModel($this->container); $this->assertEquals(1, $p->create(array('name' => 'test'))); $this->assertEquals(1, $tc->create(array('project_id' => 1, 'title' => 'test1'))); @@ -400,9 +400,9 @@ class TaskCreationTest extends Base public function testDueDateYear2038TimestampBug() { - $p = new Project($this->container); - $tc = new TaskCreation($this->container); - $tf = new TaskFinder($this->container); + $p = new ProjectModel($this->container); + $tc = new TaskCreationModel($this->container); + $tf = new TaskFinderModel($this->container); $this->assertEquals(1, $p->create(array('name' => 'test'))); $this->assertEquals(1, $tc->create(array('project_id' => 1, 'title' => 'test', 'date_due' => strtotime('2050-01-10 12:30')))); diff --git a/tests/units/Model/TaskDuplicationTest.php b/tests/units/Model/TaskDuplicationTest.php index 8c5f5cec..79b75e54 100644 --- a/tests/units/Model/TaskDuplicationTest.php +++ b/tests/units/Model/TaskDuplicationTest.php @@ -3,25 +3,25 @@ require_once __DIR__.'/../Base.php'; use Kanboard\Core\DateParser; -use Kanboard\Model\Task; -use Kanboard\Model\TaskCreation; -use Kanboard\Model\TaskDuplication; -use Kanboard\Model\TaskFinder; -use Kanboard\Model\Project; -use Kanboard\Model\ProjectUserRole; -use Kanboard\Model\Category; -use Kanboard\Model\User; -use Kanboard\Model\Swimlane; +use Kanboard\Model\TaskModel; +use Kanboard\Model\TaskCreationModel; +use Kanboard\Model\TaskDuplicationModel; +use Kanboard\Model\TaskFinderModel; +use Kanboard\Model\ProjectModel; +use Kanboard\Model\ProjectUserRoleModel; +use Kanboard\Model\CategoryModel; +use Kanboard\Model\UserModel; +use Kanboard\Model\SwimlaneModel; use Kanboard\Core\Security\Role; class TaskDuplicationTest extends Base { public function testThatDuplicateDefineCreator() { - $td = new TaskDuplication($this->container); - $tc = new TaskCreation($this->container); - $tf = new TaskFinder($this->container); - $p = new Project($this->container); + $td = new TaskDuplicationModel($this->container); + $tc = new TaskCreationModel($this->container); + $tf = new TaskFinderModel($this->container); + $p = new ProjectModel($this->container); $this->assertEquals(1, $p->create(array('name' => 'test1'))); $this->assertEquals(1, $tc->create(array('title' => 'test', 'project_id' => 1))); @@ -45,11 +45,11 @@ class TaskDuplicationTest extends Base public function testDuplicateSameProject() { - $td = new TaskDuplication($this->container); - $tc = new TaskCreation($this->container); - $tf = new TaskFinder($this->container); - $p = new Project($this->container); - $c = new Category($this->container); + $td = new TaskDuplicationModel($this->container); + $tc = new TaskCreationModel($this->container); + $tf = new TaskFinderModel($this->container); + $p = new ProjectModel($this->container); + $c = new CategoryModel($this->container); // We create a task and a project $this->assertEquals(1, $p->create(array('name' => 'test1'))); @@ -73,20 +73,20 @@ class TaskDuplicationTest extends Base $this->assertEquals(2, $task['category_id']); $this->assertEquals(4.4, $task['time_spent']); - $this->container['dispatcher']->addListener(Task::EVENT_CREATE_UPDATE, function () {}); - $this->container['dispatcher']->addListener(Task::EVENT_CREATE, function () {}); + $this->container['dispatcher']->addListener(TaskModel::EVENT_CREATE_UPDATE, function () {}); + $this->container['dispatcher']->addListener(TaskModel::EVENT_CREATE, function () {}); // We duplicate our task $this->assertEquals(2, $td->duplicate(1)); $called = $this->container['dispatcher']->getCalledListeners(); - $this->assertArrayHasKey(Task::EVENT_CREATE_UPDATE.'.closure', $called); - $this->assertArrayHasKey(Task::EVENT_CREATE.'.closure', $called); + $this->assertArrayHasKey(TaskModel::EVENT_CREATE_UPDATE.'.closure', $called); + $this->assertArrayHasKey(TaskModel::EVENT_CREATE.'.closure', $called); // Check the values of the duplicated task $task = $tf->getById(2); $this->assertNotEmpty($task); - $this->assertEquals(Task::STATUS_OPEN, $task['is_active']); + $this->assertEquals(TaskModel::STATUS_OPEN, $task['is_active']); $this->assertEquals(1, $task['project_id']); $this->assertEquals(1, $task['owner_id']); $this->assertEquals(2, $task['category_id']); @@ -99,11 +99,11 @@ class TaskDuplicationTest extends Base public function testDuplicateAnotherProject() { - $td = new TaskDuplication($this->container); - $tc = new TaskCreation($this->container); - $tf = new TaskFinder($this->container); - $p = new Project($this->container); - $c = new Category($this->container); + $td = new TaskDuplicationModel($this->container); + $tc = new TaskCreationModel($this->container); + $tf = new TaskFinderModel($this->container); + $p = new ProjectModel($this->container); + $c = new CategoryModel($this->container); // We create 2 projects $this->assertEquals(1, $p->create(array('name' => 'test1'))); @@ -115,15 +115,15 @@ class TaskDuplicationTest extends Base // We create a task $this->assertEquals(1, $tc->create(array('title' => 'test', 'project_id' => 1, 'column_id' => 2, 'owner_id' => 1, 'category_id' => 1))); - $this->container['dispatcher']->addListener(Task::EVENT_CREATE_UPDATE, function () {}); - $this->container['dispatcher']->addListener(Task::EVENT_CREATE, function () {}); + $this->container['dispatcher']->addListener(TaskModel::EVENT_CREATE_UPDATE, function () {}); + $this->container['dispatcher']->addListener(TaskModel::EVENT_CREATE, function () {}); // We duplicate our task to the 2nd project $this->assertEquals(2, $td->duplicateToProject(1, 2)); $called = $this->container['dispatcher']->getCalledListeners(); - $this->assertArrayHasKey(Task::EVENT_CREATE_UPDATE.'.closure', $called); - $this->assertArrayHasKey(Task::EVENT_CREATE.'.closure', $called); + $this->assertArrayHasKey(TaskModel::EVENT_CREATE_UPDATE.'.closure', $called); + $this->assertArrayHasKey(TaskModel::EVENT_CREATE.'.closure', $called); // Check the values of the duplicated task $task = $tf->getById(2); @@ -139,11 +139,11 @@ class TaskDuplicationTest extends Base public function testDuplicateAnotherProjectWithCategory() { - $td = new TaskDuplication($this->container); - $tc = new TaskCreation($this->container); - $tf = new TaskFinder($this->container); - $p = new Project($this->container); - $c = new Category($this->container); + $td = new TaskDuplicationModel($this->container); + $tc = new TaskCreationModel($this->container); + $tf = new TaskFinderModel($this->container); + $p = new ProjectModel($this->container); + $c = new CategoryModel($this->container); // We create 2 projects $this->assertEquals(1, $p->create(array('name' => 'test1'))); @@ -174,11 +174,11 @@ class TaskDuplicationTest extends Base public function testDuplicateAnotherProjectWithPredefinedCategory() { - $td = new TaskDuplication($this->container); - $tc = new TaskCreation($this->container); - $tf = new TaskFinder($this->container); - $p = new Project($this->container); - $c = new Category($this->container); + $td = new TaskDuplicationModel($this->container); + $tc = new TaskCreationModel($this->container); + $tf = new TaskFinderModel($this->container); + $p = new ProjectModel($this->container); + $c = new CategoryModel($this->container); // We create 2 projects $this->assertEquals(1, $p->create(array('name' => 'test1'))); @@ -213,11 +213,11 @@ class TaskDuplicationTest extends Base public function testDuplicateAnotherProjectWithSwimlane() { - $td = new TaskDuplication($this->container); - $tc = new TaskCreation($this->container); - $tf = new TaskFinder($this->container); - $p = new Project($this->container); - $s = new Swimlane($this->container); + $td = new TaskDuplicationModel($this->container); + $tc = new TaskCreationModel($this->container); + $tf = new TaskFinderModel($this->container); + $p = new ProjectModel($this->container); + $s = new SwimlaneModel($this->container); // We create 2 projects $this->assertEquals(1, $p->create(array('name' => 'test1'))); @@ -246,11 +246,11 @@ class TaskDuplicationTest extends Base public function testDuplicateAnotherProjectWithoutSwimlane() { - $td = new TaskDuplication($this->container); - $tc = new TaskCreation($this->container); - $tf = new TaskFinder($this->container); - $p = new Project($this->container); - $s = new Swimlane($this->container); + $td = new TaskDuplicationModel($this->container); + $tc = new TaskCreationModel($this->container); + $tf = new TaskFinderModel($this->container); + $p = new ProjectModel($this->container); + $s = new SwimlaneModel($this->container); // We create 2 projects $this->assertEquals(1, $p->create(array('name' => 'test1'))); @@ -279,11 +279,11 @@ class TaskDuplicationTest extends Base public function testDuplicateAnotherProjectWithPredefinedSwimlane() { - $td = new TaskDuplication($this->container); - $tc = new TaskCreation($this->container); - $tf = new TaskFinder($this->container); - $p = new Project($this->container); - $s = new Swimlane($this->container); + $td = new TaskDuplicationModel($this->container); + $tc = new TaskCreationModel($this->container); + $tf = new TaskFinderModel($this->container); + $p = new ProjectModel($this->container); + $s = new SwimlaneModel($this->container); // We create 2 projects $this->assertEquals(1, $p->create(array('name' => 'test1'))); @@ -307,10 +307,10 @@ class TaskDuplicationTest extends Base public function testDuplicateAnotherProjectWithPredefinedColumn() { - $td = new TaskDuplication($this->container); - $tc = new TaskCreation($this->container); - $tf = new TaskFinder($this->container); - $p = new Project($this->container); + $td = new TaskDuplicationModel($this->container); + $tc = new TaskCreationModel($this->container); + $tf = new TaskFinderModel($this->container); + $p = new ProjectModel($this->container); // We create 2 projects $this->assertEquals(1, $p->create(array('name' => 'test1'))); @@ -330,11 +330,11 @@ class TaskDuplicationTest extends Base public function testDuplicateAnotherProjectWithUser() { - $td = new TaskDuplication($this->container); - $tc = new TaskCreation($this->container); - $tf = new TaskFinder($this->container); - $p = new Project($this->container); - $pp = new ProjectUserRole($this->container); + $td = new TaskDuplicationModel($this->container); + $tc = new TaskCreationModel($this->container); + $tf = new TaskFinderModel($this->container); + $p = new ProjectModel($this->container); + $pp = new ProjectUserRoleModel($this->container); // We create 2 projects $this->assertEquals(1, $p->create(array('name' => 'test1'))); @@ -356,7 +356,7 @@ class TaskDuplicationTest extends Base $this->assertEquals('test', $task['title']); // We create a new user for our project - $user = new User($this->container); + $user = new UserModel($this->container); $this->assertNotFalse($user->create(array('username' => 'unittest#1', 'password' => 'unittest'))); $this->assertTrue($pp->addUser(1, 2, Role::PROJECT_MEMBER)); $this->assertTrue($pp->addUser(2, 2, Role::PROJECT_MEMBER)); @@ -386,11 +386,11 @@ class TaskDuplicationTest extends Base public function testDuplicateAnotherProjectWithPredefinedUser() { - $td = new TaskDuplication($this->container); - $tc = new TaskCreation($this->container); - $tf = new TaskFinder($this->container); - $p = new Project($this->container); - $pr = new ProjectUserRole($this->container); + $td = new TaskDuplicationModel($this->container); + $tc = new TaskCreationModel($this->container); + $tf = new TaskFinderModel($this->container); + $p = new ProjectModel($this->container); + $pr = new ProjectUserRoleModel($this->container); // We create 2 projects $this->assertEquals(1, $p->create(array('name' => 'test1'))); @@ -421,11 +421,11 @@ class TaskDuplicationTest extends Base public function testMoveAnotherProject() { - $td = new TaskDuplication($this->container); - $tc = new TaskCreation($this->container); - $tf = new TaskFinder($this->container); - $p = new Project($this->container); - $user = new User($this->container); + $td = new TaskDuplicationModel($this->container); + $tc = new TaskCreationModel($this->container); + $tf = new TaskFinderModel($this->container); + $p = new ProjectModel($this->container); + $user = new UserModel($this->container); // We create 2 projects $this->assertEquals(1, $p->create(array('name' => 'test1'))); @@ -434,13 +434,13 @@ class TaskDuplicationTest extends Base // We create a task $this->assertEquals(1, $tc->create(array('title' => 'test', 'project_id' => 1, 'owner_id' => 1, 'category_id' => 10, 'position' => 333))); - $this->container['dispatcher']->addListener(Task::EVENT_MOVE_PROJECT, array($this, 'onMoveProject')); + $this->container['dispatcher']->addListener(TaskModel::EVENT_MOVE_PROJECT, array($this, 'onMoveProject')); // We duplicate our task to the 2nd project $this->assertTrue($td->moveToProject(1, 2)); $called = $this->container['dispatcher']->getCalledListeners(); - $this->assertArrayHasKey(Task::EVENT_MOVE_PROJECT.'.TaskDuplicationTest::onMoveProject', $called); + $this->assertArrayHasKey(TaskModel::EVENT_MOVE_PROJECT.'.TaskDuplicationTest::onMoveProject', $called); // Check the values of the moved task $task = $tf->getById(1); @@ -456,11 +456,11 @@ class TaskDuplicationTest extends Base public function testMoveAnotherProjectWithCategory() { - $td = new TaskDuplication($this->container); - $tc = new TaskCreation($this->container); - $tf = new TaskFinder($this->container); - $p = new Project($this->container); - $c = new Category($this->container); + $td = new TaskDuplicationModel($this->container); + $tc = new TaskCreationModel($this->container); + $tf = new TaskFinderModel($this->container); + $p = new ProjectModel($this->container); + $c = new CategoryModel($this->container); // We create 2 projects $this->assertEquals(1, $p->create(array('name' => 'test1'))); @@ -491,12 +491,12 @@ class TaskDuplicationTest extends Base public function testMoveAnotherProjectWithUser() { - $td = new TaskDuplication($this->container); - $tc = new TaskCreation($this->container); - $tf = new TaskFinder($this->container); - $p = new Project($this->container); - $pp = new ProjectUserRole($this->container); - $user = new User($this->container); + $td = new TaskDuplicationModel($this->container); + $tc = new TaskCreationModel($this->container); + $tf = new TaskFinderModel($this->container); + $p = new ProjectModel($this->container); + $pp = new ProjectUserRoleModel($this->container); + $user = new UserModel($this->container); // We create 2 projects $this->assertEquals(1, $p->create(array('name' => 'test1'))); @@ -524,12 +524,12 @@ class TaskDuplicationTest extends Base public function testMoveAnotherProjectWithForbiddenUser() { - $td = new TaskDuplication($this->container); - $tc = new TaskCreation($this->container); - $tf = new TaskFinder($this->container); - $p = new Project($this->container); - $pp = new ProjectUserRole($this->container); - $user = new User($this->container); + $td = new TaskDuplicationModel($this->container); + $tc = new TaskCreationModel($this->container); + $tf = new TaskFinderModel($this->container); + $p = new ProjectModel($this->container); + $pp = new ProjectUserRoleModel($this->container); + $user = new UserModel($this->container); // We create 2 projects $this->assertEquals(1, $p->create(array('name' => 'test1'))); @@ -557,11 +557,11 @@ class TaskDuplicationTest extends Base public function testMoveAnotherProjectWithSwimlane() { - $td = new TaskDuplication($this->container); - $tc = new TaskCreation($this->container); - $tf = new TaskFinder($this->container); - $p = new Project($this->container); - $s = new Swimlane($this->container); + $td = new TaskDuplicationModel($this->container); + $tc = new TaskCreationModel($this->container); + $tf = new TaskFinderModel($this->container); + $p = new ProjectModel($this->container); + $s = new SwimlaneModel($this->container); // We create 2 projects $this->assertEquals(1, $p->create(array('name' => 'test1'))); @@ -590,11 +590,11 @@ class TaskDuplicationTest extends Base public function testMoveAnotherProjectWithoutSwimlane() { - $td = new TaskDuplication($this->container); - $tc = new TaskCreation($this->container); - $tf = new TaskFinder($this->container); - $p = new Project($this->container); - $s = new Swimlane($this->container); + $td = new TaskDuplicationModel($this->container); + $tc = new TaskCreationModel($this->container); + $tf = new TaskFinderModel($this->container); + $p = new ProjectModel($this->container); + $s = new SwimlaneModel($this->container); // We create 2 projects $this->assertEquals(1, $p->create(array('name' => 'test1'))); @@ -623,47 +623,47 @@ class TaskDuplicationTest extends Base public function testCalculateRecurringTaskDueDate() { - $td = new TaskDuplication($this->container); + $td = new TaskDuplicationModel($this->container); $values = array('date_due' => 0); $td->calculateRecurringTaskDueDate($values); $this->assertEquals(0, $values['date_due']); - $values = array('date_due' => 0, 'recurrence_factor' => 0, 'recurrence_basedate' => Task::RECURRING_BASEDATE_TRIGGERDATE, 'recurrence_timeframe' => Task::RECURRING_TIMEFRAME_DAYS); + $values = array('date_due' => 0, 'recurrence_factor' => 0, 'recurrence_basedate' => TaskModel::RECURRING_BASEDATE_TRIGGERDATE, 'recurrence_timeframe' => TaskModel::RECURRING_TIMEFRAME_DAYS); $td->calculateRecurringTaskDueDate($values); $this->assertEquals(0, $values['date_due']); - $values = array('date_due' => 1431291376, 'recurrence_factor' => 1, 'recurrence_basedate' => Task::RECURRING_BASEDATE_TRIGGERDATE, 'recurrence_timeframe' => Task::RECURRING_TIMEFRAME_DAYS); + $values = array('date_due' => 1431291376, 'recurrence_factor' => 1, 'recurrence_basedate' => TaskModel::RECURRING_BASEDATE_TRIGGERDATE, 'recurrence_timeframe' => TaskModel::RECURRING_TIMEFRAME_DAYS); $td->calculateRecurringTaskDueDate($values); $this->assertEquals(time() + 86400, $values['date_due'], '', 1); - $values = array('date_due' => 1431291376, 'recurrence_factor' => -2, 'recurrence_basedate' => Task::RECURRING_BASEDATE_TRIGGERDATE, 'recurrence_timeframe' => Task::RECURRING_TIMEFRAME_DAYS); + $values = array('date_due' => 1431291376, 'recurrence_factor' => -2, 'recurrence_basedate' => TaskModel::RECURRING_BASEDATE_TRIGGERDATE, 'recurrence_timeframe' => TaskModel::RECURRING_TIMEFRAME_DAYS); $td->calculateRecurringTaskDueDate($values); $this->assertEquals(time() - 2 * 86400, $values['date_due'], '', 1); - $values = array('date_due' => 1431291376, 'recurrence_factor' => 1, 'recurrence_basedate' => Task::RECURRING_BASEDATE_DUEDATE, 'recurrence_timeframe' => Task::RECURRING_TIMEFRAME_DAYS); + $values = array('date_due' => 1431291376, 'recurrence_factor' => 1, 'recurrence_basedate' => TaskModel::RECURRING_BASEDATE_DUEDATE, 'recurrence_timeframe' => TaskModel::RECURRING_TIMEFRAME_DAYS); $td->calculateRecurringTaskDueDate($values); $this->assertEquals(1431291376 + 86400, $values['date_due'], '', 1); - $values = array('date_due' => 1431291376, 'recurrence_factor' => -1, 'recurrence_basedate' => Task::RECURRING_BASEDATE_DUEDATE, 'recurrence_timeframe' => Task::RECURRING_TIMEFRAME_DAYS); + $values = array('date_due' => 1431291376, 'recurrence_factor' => -1, 'recurrence_basedate' => TaskModel::RECURRING_BASEDATE_DUEDATE, 'recurrence_timeframe' => TaskModel::RECURRING_TIMEFRAME_DAYS); $td->calculateRecurringTaskDueDate($values); $this->assertEquals(1431291376 - 86400, $values['date_due'], '', 1); - $values = array('date_due' => 1431291376, 'recurrence_factor' => 2, 'recurrence_basedate' => Task::RECURRING_BASEDATE_DUEDATE, 'recurrence_timeframe' => Task::RECURRING_TIMEFRAME_MONTHS); + $values = array('date_due' => 1431291376, 'recurrence_factor' => 2, 'recurrence_basedate' => TaskModel::RECURRING_BASEDATE_DUEDATE, 'recurrence_timeframe' => TaskModel::RECURRING_TIMEFRAME_MONTHS); $td->calculateRecurringTaskDueDate($values); $this->assertEquals(1436561776, $values['date_due'], '', 1); - $values = array('date_due' => 1431291376, 'recurrence_factor' => 2, 'recurrence_basedate' => Task::RECURRING_BASEDATE_DUEDATE, 'recurrence_timeframe' => Task::RECURRING_TIMEFRAME_YEARS); + $values = array('date_due' => 1431291376, 'recurrence_factor' => 2, 'recurrence_basedate' => TaskModel::RECURRING_BASEDATE_DUEDATE, 'recurrence_timeframe' => TaskModel::RECURRING_TIMEFRAME_YEARS); $td->calculateRecurringTaskDueDate($values); $this->assertEquals(1494449776, $values['date_due'], '', 1); } public function testDuplicateRecurringTask() { - $td = new TaskDuplication($this->container); - $tc = new TaskCreation($this->container); - $tf = new TaskFinder($this->container); - $p = new Project($this->container); + $td = new TaskDuplicationModel($this->container); + $tc = new TaskCreationModel($this->container); + $tf = new TaskFinderModel($this->container); + $p = new ProjectModel($this->container); $dp = new DateParser($this->container); $this->assertEquals(1, $p->create(array('name' => 'test1'))); @@ -672,27 +672,27 @@ class TaskDuplicationTest extends Base 'title' => 'test', 'project_id' => 1, 'date_due' => 1436561776, - 'recurrence_status' => Task::RECURRING_STATUS_PENDING, - 'recurrence_trigger' => Task::RECURRING_TRIGGER_CLOSE, + 'recurrence_status' => TaskModel::RECURRING_STATUS_PENDING, + 'recurrence_trigger' => TaskModel::RECURRING_TRIGGER_CLOSE, 'recurrence_factor' => 2, - 'recurrence_timeframe' => Task::RECURRING_TIMEFRAME_DAYS, - 'recurrence_basedate' => Task::RECURRING_BASEDATE_TRIGGERDATE, + 'recurrence_timeframe' => TaskModel::RECURRING_TIMEFRAME_DAYS, + 'recurrence_basedate' => TaskModel::RECURRING_BASEDATE_TRIGGERDATE, ))); $this->assertEquals(2, $td->duplicateRecurringTask(1)); $task = $tf->getById(1); $this->assertNotEmpty($task); - $this->assertEquals(Task::RECURRING_STATUS_PROCESSED, $task['recurrence_status']); + $this->assertEquals(TaskModel::RECURRING_STATUS_PROCESSED, $task['recurrence_status']); $this->assertEquals(2, $task['recurrence_child']); $this->assertEquals(1436486400, $task['date_due'], '', 2); $task = $tf->getById(2); $this->assertNotEmpty($task); - $this->assertEquals(Task::RECURRING_STATUS_PENDING, $task['recurrence_status']); - $this->assertEquals(Task::RECURRING_TRIGGER_CLOSE, $task['recurrence_trigger']); - $this->assertEquals(Task::RECURRING_TIMEFRAME_DAYS, $task['recurrence_timeframe']); - $this->assertEquals(Task::RECURRING_BASEDATE_TRIGGERDATE, $task['recurrence_basedate']); + $this->assertEquals(TaskModel::RECURRING_STATUS_PENDING, $task['recurrence_status']); + $this->assertEquals(TaskModel::RECURRING_TRIGGER_CLOSE, $task['recurrence_trigger']); + $this->assertEquals(TaskModel::RECURRING_TIMEFRAME_DAYS, $task['recurrence_timeframe']); + $this->assertEquals(TaskModel::RECURRING_BASEDATE_TRIGGERDATE, $task['recurrence_basedate']); $this->assertEquals(1, $task['recurrence_parent']); $this->assertEquals(2, $task['recurrence_factor']); $this->assertEquals($dp->removeTimeFromTimestamp(strtotime('+2 days')), $task['date_due'], '', 2); diff --git a/tests/units/Model/TaskExternalLinkTest.php b/tests/units/Model/TaskExternalLinkTest.php index 3a79ff82..1327b6e1 100644 --- a/tests/units/Model/TaskExternalLinkTest.php +++ b/tests/units/Model/TaskExternalLinkTest.php @@ -2,9 +2,9 @@ require_once __DIR__.'/../Base.php'; -use Kanboard\Model\TaskCreation; -use Kanboard\Model\Project; -use Kanboard\Model\TaskExternalLink; +use Kanboard\Model\TaskCreationModel; +use Kanboard\Model\ProjectModel; +use Kanboard\Model\TaskExternalLinkModel; use Kanboard\Core\ExternalLink\ExternalLinkManager; use Kanboard\ExternalLink\WebLinkProvider; @@ -12,9 +12,9 @@ class TaskExternalLinkTest extends Base { public function testCreate() { - $projectModel = new Project($this->container); - $taskCreationModel = new TaskCreation($this->container); - $taskExternalLinkModel = new TaskExternalLink($this->container); + $projectModel = new ProjectModel($this->container); + $taskCreationModel = new TaskCreationModel($this->container); + $taskExternalLinkModel = new TaskExternalLinkModel($this->container); $this->assertEquals(1, $projectModel->create(array('name' => 'Test'))); $this->assertEquals(1, $taskCreationModel->create(array('title' => 'Test', 'project_id' => 1))); @@ -35,9 +35,9 @@ class TaskExternalLinkTest extends Base { $this->container['sessionStorage']->user = array('id' => 1); - $projectModel = new Project($this->container); - $taskCreationModel = new TaskCreation($this->container); - $taskExternalLinkModel = new TaskExternalLink($this->container); + $projectModel = new ProjectModel($this->container); + $taskCreationModel = new TaskCreationModel($this->container); + $taskExternalLinkModel = new TaskExternalLinkModel($this->container); $this->assertEquals(1, $projectModel->create(array('name' => 'Test'))); $this->assertEquals(1, $taskCreationModel->create(array('title' => 'Test', 'project_id' => 1))); @@ -56,9 +56,9 @@ class TaskExternalLinkTest extends Base public function testModification() { - $projectModel = new Project($this->container); - $taskCreationModel = new TaskCreation($this->container); - $taskExternalLinkModel = new TaskExternalLink($this->container); + $projectModel = new ProjectModel($this->container); + $taskCreationModel = new TaskCreationModel($this->container); + $taskExternalLinkModel = new TaskExternalLinkModel($this->container); $this->assertEquals(1, $projectModel->create(array('name' => 'Test'))); $this->assertEquals(1, $taskCreationModel->create(array('title' => 'Test', 'project_id' => 1))); @@ -76,9 +76,9 @@ class TaskExternalLinkTest extends Base public function testRemove() { - $projectModel = new Project($this->container); - $taskCreationModel = new TaskCreation($this->container); - $taskExternalLinkModel = new TaskExternalLink($this->container); + $projectModel = new ProjectModel($this->container); + $taskCreationModel = new TaskCreationModel($this->container); + $taskExternalLinkModel = new TaskExternalLinkModel($this->container); $this->assertEquals(1, $projectModel->create(array('name' => 'Test'))); $this->assertEquals(1, $taskCreationModel->create(array('title' => 'Test', 'project_id' => 1))); @@ -95,9 +95,9 @@ class TaskExternalLinkTest extends Base $this->container['sessionStorage']->user = array('id' => 1); $this->container['externalLinkManager'] = new ExternalLinkManager($this->container); - $projectModel = new Project($this->container); - $taskCreationModel = new TaskCreation($this->container); - $taskExternalLinkModel = new TaskExternalLink($this->container); + $projectModel = new ProjectModel($this->container); + $taskCreationModel = new TaskCreationModel($this->container); + $taskExternalLinkModel = new TaskExternalLinkModel($this->container); $webLinkProvider = new WebLinkProvider($this->container); $this->container['externalLinkManager']->register($webLinkProvider); diff --git a/tests/units/Model/TaskFileTest.php b/tests/units/Model/TaskFileTest.php index e44e092d..2faee95c 100644 --- a/tests/units/Model/TaskFileTest.php +++ b/tests/units/Model/TaskFileTest.php @@ -2,17 +2,17 @@ require_once __DIR__.'/../Base.php'; -use Kanboard\Model\TaskFile; -use Kanboard\Model\TaskCreation; -use Kanboard\Model\Project; +use Kanboard\Model\TaskFileModel; +use Kanboard\Model\TaskCreationModel; +use Kanboard\Model\ProjectModel; class TaskFileTest extends Base { public function testCreation() { - $projectModel = new Project($this->container); - $fileModel = new TaskFile($this->container); - $taskCreationModel = new TaskCreation($this->container); + $projectModel = new ProjectModel($this->container); + $fileModel = new TaskFileModel($this->container); + $taskCreationModel = new TaskCreationModel($this->container); $this->assertEquals(1, $projectModel->create(array('name' => 'test'))); $this->assertEquals(1, $taskCreationModel->create(array('project_id' => 1, 'title' => 'test'))); @@ -38,9 +38,9 @@ class TaskFileTest extends Base public function testCreationWithFileNameTooLong() { - $projectModel = new Project($this->container); - $fileModel = new TaskFile($this->container); - $taskCreationModel = new TaskCreation($this->container); + $projectModel = new ProjectModel($this->container); + $fileModel = new TaskFileModel($this->container); + $taskCreationModel = new TaskCreationModel($this->container); $this->assertEquals(1, $projectModel->create(array('name' => 'test'))); $this->assertEquals(1, $taskCreationModel->create(array('project_id' => 1, 'title' => 'test'))); @@ -60,9 +60,9 @@ class TaskFileTest extends Base { $this->container['sessionStorage']->user = array('id' => 1); - $projectModel = new Project($this->container); - $fileModel = new TaskFile($this->container); - $taskCreationModel = new TaskCreation($this->container); + $projectModel = new ProjectModel($this->container); + $fileModel = new TaskFileModel($this->container); + $taskCreationModel = new TaskCreationModel($this->container); $this->assertEquals(1, $projectModel->create(array('name' => 'test'))); $this->assertEquals(1, $taskCreationModel->create(array('project_id' => 1, 'title' => 'test'))); @@ -75,9 +75,9 @@ class TaskFileTest extends Base public function testGetAll() { - $projectModel = new Project($this->container); - $fileModel = new TaskFile($this->container); - $taskCreationModel = new TaskCreation($this->container); + $projectModel = new ProjectModel($this->container); + $fileModel = new TaskFileModel($this->container); + $taskCreationModel = new TaskCreationModel($this->container); $this->assertEquals(1, $projectModel->create(array('name' => 'test'))); $this->assertEquals(1, $taskCreationModel->create(array('project_id' => 1, 'title' => 'test'))); @@ -110,7 +110,7 @@ class TaskFileTest extends Base public function testIsImage() { - $fileModel = new TaskFile($this->container); + $fileModel = new TaskFileModel($this->container); $this->assertTrue($fileModel->isImage('test.png')); $this->assertTrue($fileModel->isImage('test.jpeg')); @@ -125,13 +125,13 @@ class TaskFileTest extends Base public function testGetThumbnailPath() { - $fileModel = new TaskFile($this->container); + $fileModel = new TaskFileModel($this->container); $this->assertEquals('thumbnails'.DIRECTORY_SEPARATOR.'test', $fileModel->getThumbnailPath('test')); } public function testGeneratePath() { - $fileModel = new TaskFile($this->container); + $fileModel = new TaskFileModel($this->container); $this->assertStringStartsWith('tasks'.DIRECTORY_SEPARATOR.'34'.DIRECTORY_SEPARATOR, $fileModel->generatePath(34, 'test.png')); $this->assertNotEquals($fileModel->generatePath(34, 'test1.png'), $fileModel->generatePath(34, 'test2.png')); @@ -140,13 +140,13 @@ class TaskFileTest extends Base public function testUploadFiles() { $fileModel = $this - ->getMockBuilder('\Kanboard\Model\TaskFile') + ->getMockBuilder('\Kanboard\Model\TaskFileModel') ->setConstructorArgs(array($this->container)) ->setMethods(array('generateThumbnailFromFile')) ->getMock(); - $projectModel = new Project($this->container); - $taskCreationModel = new TaskCreation($this->container); + $projectModel = new ProjectModel($this->container); + $taskCreationModel = new TaskCreationModel($this->container); $this->assertEquals(1, $projectModel->create(array('name' => 'test'))); $this->assertEquals(1, $taskCreationModel->create(array('project_id' => 1, 'title' => 'test'))); @@ -208,7 +208,7 @@ class TaskFileTest extends Base public function testUploadFilesWithEmptyFiles() { - $fileModel = new TaskFile($this->container); + $fileModel = new TaskFileModel($this->container); $this->assertFalse($fileModel->uploadFiles(1, array())); } @@ -233,7 +233,7 @@ class TaskFileTest extends Base ), ); - $fileModel = new TaskFile($this->container); + $fileModel = new TaskFileModel($this->container); $this->assertFalse($fileModel->uploadFiles(1, $files)); } @@ -264,20 +264,20 @@ class TaskFileTest extends Base ->with($this->equalTo('/tmp/phpYzdqkD'), $this->anything()) ->will($this->throwException(new \Kanboard\Core\ObjectStorage\ObjectStorageException('test'))); - $fileModel = new TaskFile($this->container); + $fileModel = new TaskFileModel($this->container); $this->assertFalse($fileModel->uploadFiles(1, $files)); } public function testUploadFileContent() { $fileModel = $this - ->getMockBuilder('\Kanboard\Model\TaskFile') + ->getMockBuilder('\Kanboard\Model\TaskFileModel') ->setConstructorArgs(array($this->container)) ->setMethods(array('generateThumbnailFromFile')) ->getMock(); - $projectModel = new Project($this->container); - $taskCreationModel = new TaskCreation($this->container); + $projectModel = new ProjectModel($this->container); + $taskCreationModel = new TaskCreationModel($this->container); $data = 'test'; $this->assertEquals(1, $projectModel->create(array('name' => 'test'))); @@ -305,13 +305,13 @@ class TaskFileTest extends Base public function testUploadFileContentWithObjectStorageError() { $fileModel = $this - ->getMockBuilder('\Kanboard\Model\TaskFile') + ->getMockBuilder('\Kanboard\Model\TaskFileModel') ->setConstructorArgs(array($this->container)) ->setMethods(array('generateThumbnailFromFile')) ->getMock(); - $projectModel = new Project($this->container); - $taskCreationModel = new TaskCreation($this->container); + $projectModel = new ProjectModel($this->container); + $taskCreationModel = new TaskCreationModel($this->container); $data = 'test'; $this->assertEquals(1, $projectModel->create(array('name' => 'test'))); @@ -329,13 +329,13 @@ class TaskFileTest extends Base public function testUploadScreenshot() { $fileModel = $this - ->getMockBuilder('\Kanboard\Model\TaskFile') + ->getMockBuilder('\Kanboard\Model\TaskFileModel') ->setConstructorArgs(array($this->container)) ->setMethods(array('generateThumbnailFromData')) ->getMock(); - $projectModel = new Project($this->container); - $taskCreationModel = new TaskCreation($this->container); + $projectModel = new ProjectModel($this->container); + $taskCreationModel = new TaskCreationModel($this->container); $data = 'test'; $this->assertEquals(1, $projectModel->create(array('name' => 'test'))); @@ -366,9 +366,9 @@ class TaskFileTest extends Base public function testRemove() { - $fileModel = new TaskFile($this->container); - $projectModel = new Project($this->container); - $taskCreationModel = new TaskCreation($this->container); + $fileModel = new TaskFileModel($this->container); + $projectModel = new ProjectModel($this->container); + $taskCreationModel = new TaskCreationModel($this->container); $this->assertEquals(1, $projectModel->create(array('name' => 'test'))); $this->assertEquals(1, $taskCreationModel->create(array('project_id' => 1, 'title' => 'test'))); @@ -384,9 +384,9 @@ class TaskFileTest extends Base public function testRemoveWithObjectStorageError() { - $fileModel = new TaskFile($this->container); - $projectModel = new Project($this->container); - $taskCreationModel = new TaskCreation($this->container); + $fileModel = new TaskFileModel($this->container); + $projectModel = new ProjectModel($this->container); + $taskCreationModel = new TaskCreationModel($this->container); $this->assertEquals(1, $projectModel->create(array('name' => 'test'))); $this->assertEquals(1, $taskCreationModel->create(array('project_id' => 1, 'title' => 'test'))); @@ -403,9 +403,9 @@ class TaskFileTest extends Base public function testRemoveImage() { - $fileModel = new TaskFile($this->container); - $projectModel = new Project($this->container); - $taskCreationModel = new TaskCreation($this->container); + $fileModel = new TaskFileModel($this->container); + $projectModel = new ProjectModel($this->container); + $taskCreationModel = new TaskCreationModel($this->container); $this->assertEquals(1, $projectModel->create(array('name' => 'test'))); $this->assertEquals(1, $taskCreationModel->create(array('project_id' => 1, 'title' => 'test'))); @@ -426,9 +426,9 @@ class TaskFileTest extends Base public function testRemoveAll() { - $fileModel = new TaskFile($this->container); - $projectModel = new Project($this->container); - $taskCreationModel = new TaskCreation($this->container); + $fileModel = new TaskFileModel($this->container); + $projectModel = new ProjectModel($this->container); + $taskCreationModel = new TaskCreationModel($this->container); $this->assertEquals(1, $projectModel->create(array('name' => 'test'))); $this->assertEquals(1, $taskCreationModel->create(array('project_id' => 1, 'title' => 'test'))); diff --git a/tests/units/Model/TaskFinderTest.php b/tests/units/Model/TaskFinderTest.php index ef9d7830..46792baf 100644 --- a/tests/units/Model/TaskFinderTest.php +++ b/tests/units/Model/TaskFinderTest.php @@ -2,17 +2,17 @@ require_once __DIR__.'/../Base.php'; -use Kanboard\Model\TaskCreation; -use Kanboard\Model\TaskFinder; -use Kanboard\Model\Project; +use Kanboard\Model\TaskCreationModel; +use Kanboard\Model\TaskFinderModel; +use Kanboard\Model\ProjectModel; class TaskFinderTest extends Base { public function testGetOverdueTasks() { - $tc = new TaskCreation($this->container); - $tf = new TaskFinder($this->container); - $p = new Project($this->container); + $tc = new TaskCreationModel($this->container); + $tf = new TaskFinderModel($this->container); + $p = new ProjectModel($this->container); $this->assertEquals(1, $p->create(array('name' => 'Project #1'))); $this->assertEquals(1, $tc->create(array('title' => 'Task #1', 'project_id' => 1, 'date_due' => strtotime('-1 day')))); @@ -29,9 +29,9 @@ class TaskFinderTest extends Base public function testGetOverdueTasksByProject() { - $tc = new TaskCreation($this->container); - $tf = new TaskFinder($this->container); - $p = new Project($this->container); + $tc = new TaskCreationModel($this->container); + $tf = new TaskFinderModel($this->container); + $p = new ProjectModel($this->container); $this->assertEquals(1, $p->create(array('name' => 'Project #1'))); $this->assertEquals(2, $p->create(array('name' => 'Project #2'))); @@ -50,9 +50,9 @@ class TaskFinderTest extends Base public function testGetOverdueTasksByUser() { - $tc = new TaskCreation($this->container); - $tf = new TaskFinder($this->container); - $p = new Project($this->container); + $tc = new TaskCreationModel($this->container); + $tf = new TaskFinderModel($this->container); + $p = new ProjectModel($this->container); $this->assertEquals(1, $p->create(array('name' => 'Project #1'))); $this->assertEquals(2, $p->create(array('name' => 'Project #2'))); @@ -80,9 +80,9 @@ class TaskFinderTest extends Base public function testCountByProject() { - $tc = new TaskCreation($this->container); - $tf = new TaskFinder($this->container); - $p = new Project($this->container); + $tc = new TaskCreationModel($this->container); + $tf = new TaskFinderModel($this->container); + $p = new ProjectModel($this->container); $this->assertEquals(1, $p->create(array('name' => 'Project #1'))); $this->assertEquals(2, $p->create(array('name' => 'Project #2'))); @@ -96,9 +96,9 @@ class TaskFinderTest extends Base public function testGetProjectToken() { - $taskCreationModel = new TaskCreation($this->container); - $taskFinderModel = new TaskFinder($this->container); - $projectModel = new Project($this->container); + $taskCreationModel = new TaskCreationModel($this->container); + $taskFinderModel = new TaskFinderModel($this->container); + $projectModel = new ProjectModel($this->container); $this->assertEquals(1, $projectModel->create(array('name' => 'Project #1'))); $this->assertEquals(2, $projectModel->create(array('name' => 'Project #2'))); diff --git a/tests/units/Model/TaskLinkTest.php b/tests/units/Model/TaskLinkTest.php index 8dd71830..bc574731 100644 --- a/tests/units/Model/TaskLinkTest.php +++ b/tests/units/Model/TaskLinkTest.php @@ -2,20 +2,20 @@ require_once __DIR__.'/../Base.php'; -use Kanboard\Model\TaskFinder; -use Kanboard\Model\TaskLink; -use Kanboard\Model\TaskCreation; -use Kanboard\Model\Project; +use Kanboard\Model\TaskFinderModel; +use Kanboard\Model\TaskLinkModel; +use Kanboard\Model\TaskCreationModel; +use Kanboard\Model\ProjectModel; class TaskLinkTest extends Base { // Check postgres issue: "Cardinality violation: 7 ERROR: more than one row returned by a subquery used as an expression" public function testGetTaskWithMultipleMilestoneLink() { - $tf = new TaskFinder($this->container); - $tl = new TaskLink($this->container); - $p = new Project($this->container); - $tc = new TaskCreation($this->container); + $tf = new TaskFinderModel($this->container); + $tl = new TaskLinkModel($this->container); + $p = new ProjectModel($this->container); + $tc = new TaskCreationModel($this->container); $this->assertEquals(1, $p->create(array('name' => 'test'))); $this->assertEquals(1, $tc->create(array('project_id' => 1, 'title' => 'A'))); @@ -31,9 +31,9 @@ class TaskLinkTest extends Base public function testCreateTaskLinkWithNoOpposite() { - $tl = new TaskLink($this->container); - $p = new Project($this->container); - $tc = new TaskCreation($this->container); + $tl = new TaskLinkModel($this->container); + $p = new ProjectModel($this->container); + $tc = new TaskCreationModel($this->container); $this->assertEquals(1, $p->create(array('name' => 'test'))); $this->assertEquals(1, $tc->create(array('project_id' => 1, 'title' => 'A'))); @@ -73,9 +73,9 @@ class TaskLinkTest extends Base public function testCreateTaskLinkWithOpposite() { - $tl = new TaskLink($this->container); - $p = new Project($this->container); - $tc = new TaskCreation($this->container); + $tl = new TaskLinkModel($this->container); + $p = new ProjectModel($this->container); + $tc = new TaskCreationModel($this->container); $this->assertEquals(1, $p->create(array('name' => 'test'))); $this->assertEquals(1, $tc->create(array('project_id' => 1, 'title' => 'A'))); @@ -115,9 +115,9 @@ class TaskLinkTest extends Base public function testGroupByLabel() { - $tl = new TaskLink($this->container); - $p = new Project($this->container); - $tc = new TaskCreation($this->container); + $tl = new TaskLinkModel($this->container); + $p = new ProjectModel($this->container); + $tc = new TaskCreationModel($this->container); $this->assertEquals(1, $p->create(array('name' => 'test'))); @@ -139,9 +139,9 @@ class TaskLinkTest extends Base public function testUpdate() { - $tl = new TaskLink($this->container); - $p = new Project($this->container); - $tc = new TaskCreation($this->container); + $tl = new TaskLinkModel($this->container); + $p = new ProjectModel($this->container); + $tc = new TaskCreationModel($this->container); $this->assertEquals(1, $p->create(array('name' => 'test1'))); $this->assertEquals(2, $p->create(array('name' => 'test2'))); @@ -172,9 +172,9 @@ class TaskLinkTest extends Base public function testRemove() { - $tl = new TaskLink($this->container); - $p = new Project($this->container); - $tc = new TaskCreation($this->container); + $tl = new TaskLinkModel($this->container); + $p = new ProjectModel($this->container); + $tc = new TaskCreationModel($this->container); $this->assertEquals(1, $p->create(array('name' => 'test'))); $this->assertEquals(1, $tc->create(array('project_id' => 1, 'title' => 'A'))); diff --git a/tests/units/Model/TaskMetadataTest.php b/tests/units/Model/TaskMetadataTest.php index 2683c297..b1e7eee8 100644 --- a/tests/units/Model/TaskMetadataTest.php +++ b/tests/units/Model/TaskMetadataTest.php @@ -2,17 +2,17 @@ require_once __DIR__.'/../Base.php'; -use Kanboard\Model\Project; -use Kanboard\Model\TaskCreation; -use Kanboard\Model\TaskMetadata; +use Kanboard\Model\ProjectModel; +use Kanboard\Model\TaskCreationModel; +use Kanboard\Model\TaskMetadataModel; class TaskMetadataTest extends Base { public function testOperations() { - $p = new Project($this->container); - $tm = new TaskMetadata($this->container); - $tc = new TaskCreation($this->container); + $p = new ProjectModel($this->container); + $tm = new TaskMetadataModel($this->container); + $tc = new TaskCreationModel($this->container); $this->assertEquals(1, $p->create(array('name' => 'project #1'))); $this->assertEquals(1, $tc->create(array('title' => 'task #1', 'project_id' => 1))); diff --git a/tests/units/Model/TaskModificationTest.php b/tests/units/Model/TaskModificationTest.php index 315125d5..022fb49b 100644 --- a/tests/units/Model/TaskModificationTest.php +++ b/tests/units/Model/TaskModificationTest.php @@ -2,11 +2,11 @@ require_once __DIR__.'/../Base.php'; -use Kanboard\Model\Task; -use Kanboard\Model\TaskCreation; -use Kanboard\Model\TaskModification; -use Kanboard\Model\TaskFinder; -use Kanboard\Model\Project; +use Kanboard\Model\TaskModel; +use Kanboard\Model\TaskCreationModel; +use Kanboard\Model\TaskModificationModel; +use Kanboard\Model\TaskFinderModel; +use Kanboard\Model\ProjectModel; class TaskModificationTest extends Base { @@ -42,16 +42,16 @@ class TaskModificationTest extends Base public function testThatNoEventAreFiredWhenNoChanges() { - $p = new Project($this->container); - $tc = new TaskCreation($this->container); - $tm = new TaskModification($this->container); - $tf = new TaskFinder($this->container); + $p = new ProjectModel($this->container); + $tc = new TaskCreationModel($this->container); + $tm = new TaskModificationModel($this->container); + $tf = new TaskFinderModel($this->container); $this->assertEquals(1, $p->create(array('name' => 'test'))); $this->assertEquals(1, $tc->create(array('title' => 'test', 'project_id' => 1))); - $this->container['dispatcher']->addListener(Task::EVENT_CREATE_UPDATE, array($this, 'onCreateUpdate')); - $this->container['dispatcher']->addListener(Task::EVENT_UPDATE, array($this, 'onUpdate')); + $this->container['dispatcher']->addListener(TaskModel::EVENT_CREATE_UPDATE, array($this, 'onCreateUpdate')); + $this->container['dispatcher']->addListener(TaskModel::EVENT_UPDATE, array($this, 'onUpdate')); $this->assertTrue($tm->update(array('id' => 1, 'title' => 'test'))); @@ -60,22 +60,22 @@ class TaskModificationTest extends Base public function testChangeTitle() { - $p = new Project($this->container); - $tc = new TaskCreation($this->container); - $tm = new TaskModification($this->container); - $tf = new TaskFinder($this->container); + $p = new ProjectModel($this->container); + $tc = new TaskCreationModel($this->container); + $tm = new TaskModificationModel($this->container); + $tf = new TaskFinderModel($this->container); $this->assertEquals(1, $p->create(array('name' => 'test'))); $this->assertEquals(1, $tc->create(array('title' => 'test', 'project_id' => 1))); - $this->container['dispatcher']->addListener(Task::EVENT_CREATE_UPDATE, array($this, 'onCreateUpdate')); - $this->container['dispatcher']->addListener(Task::EVENT_UPDATE, array($this, 'onUpdate')); + $this->container['dispatcher']->addListener(TaskModel::EVENT_CREATE_UPDATE, array($this, 'onCreateUpdate')); + $this->container['dispatcher']->addListener(TaskModel::EVENT_UPDATE, array($this, 'onUpdate')); $this->assertTrue($tm->update(array('id' => 1, 'title' => 'Task #1'))); $called = $this->container['dispatcher']->getCalledListeners(); - $this->assertArrayHasKey(Task::EVENT_CREATE_UPDATE.'.TaskModificationTest::onCreateUpdate', $called); - $this->assertArrayHasKey(Task::EVENT_UPDATE.'.TaskModificationTest::onUpdate', $called); + $this->assertArrayHasKey(TaskModel::EVENT_CREATE_UPDATE.'.TaskModificationTest::onCreateUpdate', $called); + $this->assertArrayHasKey(TaskModel::EVENT_UPDATE.'.TaskModificationTest::onUpdate', $called); $task = $tf->getById(1); $this->assertEquals('Task #1', $task['title']); @@ -83,10 +83,10 @@ class TaskModificationTest extends Base public function testChangeAssignee() { - $p = new Project($this->container); - $tc = new TaskCreation($this->container); - $tm = new TaskModification($this->container); - $tf = new TaskFinder($this->container); + $p = new ProjectModel($this->container); + $tc = new TaskCreationModel($this->container); + $tm = new TaskModificationModel($this->container); + $tf = new TaskFinderModel($this->container); $this->assertEquals(1, $p->create(array('name' => 'test'))); $this->assertEquals(1, $tc->create(array('title' => 'test', 'project_id' => 1))); @@ -94,12 +94,12 @@ class TaskModificationTest extends Base $task = $tf->getById(1); $this->assertEquals(0, $task['owner_id']); - $this->container['dispatcher']->addListener(Task::EVENT_ASSIGNEE_CHANGE, array($this, 'onAssigneeChange')); + $this->container['dispatcher']->addListener(TaskModel::EVENT_ASSIGNEE_CHANGE, array($this, 'onAssigneeChange')); $this->assertTrue($tm->update(array('id' => 1, 'owner_id' => 1))); $called = $this->container['dispatcher']->getCalledListeners(); - $this->assertArrayHasKey(Task::EVENT_ASSIGNEE_CHANGE.'.TaskModificationTest::onAssigneeChange', $called); + $this->assertArrayHasKey(TaskModel::EVENT_ASSIGNEE_CHANGE.'.TaskModificationTest::onAssigneeChange', $called); $task = $tf->getById(1); $this->assertEquals(1, $task['owner_id']); @@ -107,10 +107,10 @@ class TaskModificationTest extends Base public function testChangeDescription() { - $p = new Project($this->container); - $tc = new TaskCreation($this->container); - $tm = new TaskModification($this->container); - $tf = new TaskFinder($this->container); + $p = new ProjectModel($this->container); + $tc = new TaskCreationModel($this->container); + $tm = new TaskModificationModel($this->container); + $tf = new TaskFinderModel($this->container); $this->assertEquals(1, $p->create(array('name' => 'test'))); $this->assertEquals(1, $tc->create(array('title' => 'test', 'project_id' => 1))); @@ -126,10 +126,10 @@ class TaskModificationTest extends Base public function testChangeCategory() { - $p = new Project($this->container); - $tc = new TaskCreation($this->container); - $tm = new TaskModification($this->container); - $tf = new TaskFinder($this->container); + $p = new ProjectModel($this->container); + $tc = new TaskCreationModel($this->container); + $tm = new TaskModificationModel($this->container); + $tf = new TaskFinderModel($this->container); $this->assertEquals(1, $p->create(array('name' => 'test'))); $this->assertEquals(1, $tc->create(array('title' => 'test', 'project_id' => 1))); @@ -145,10 +145,10 @@ class TaskModificationTest extends Base public function testChangeColor() { - $p = new Project($this->container); - $tc = new TaskCreation($this->container); - $tm = new TaskModification($this->container); - $tf = new TaskFinder($this->container); + $p = new ProjectModel($this->container); + $tc = new TaskCreationModel($this->container); + $tm = new TaskModificationModel($this->container); + $tf = new TaskFinderModel($this->container); $this->assertEquals(1, $p->create(array('name' => 'test'))); $this->assertEquals(1, $tc->create(array('title' => 'test', 'project_id' => 1))); @@ -164,10 +164,10 @@ class TaskModificationTest extends Base public function testChangeScore() { - $p = new Project($this->container); - $tc = new TaskCreation($this->container); - $tm = new TaskModification($this->container); - $tf = new TaskFinder($this->container); + $p = new ProjectModel($this->container); + $tc = new TaskCreationModel($this->container); + $tm = new TaskModificationModel($this->container); + $tf = new TaskFinderModel($this->container); $this->assertEquals(1, $p->create(array('name' => 'test'))); $this->assertEquals(1, $tc->create(array('title' => 'test', 'project_id' => 1))); @@ -183,10 +183,10 @@ class TaskModificationTest extends Base public function testChangeDueDate() { - $p = new Project($this->container); - $tc = new TaskCreation($this->container); - $tm = new TaskModification($this->container); - $tf = new TaskFinder($this->container); + $p = new ProjectModel($this->container); + $tc = new TaskCreationModel($this->container); + $tm = new TaskModificationModel($this->container); + $tf = new TaskFinderModel($this->container); $this->assertEquals(1, $p->create(array('name' => 'test'))); $this->assertEquals(1, $tc->create(array('title' => 'test', 'project_id' => 1))); @@ -207,10 +207,10 @@ class TaskModificationTest extends Base public function testChangeStartedDate() { - $p = new Project($this->container); - $tc = new TaskCreation($this->container); - $tm = new TaskModification($this->container); - $tf = new TaskFinder($this->container); + $p = new ProjectModel($this->container); + $tc = new TaskCreationModel($this->container); + $tm = new TaskModificationModel($this->container); + $tf = new TaskFinderModel($this->container); $this->assertEquals(1, $p->create(array('name' => 'test'))); $this->assertEquals(1, $tc->create(array('title' => 'test', 'project_id' => 1))); @@ -245,10 +245,10 @@ class TaskModificationTest extends Base public function testChangeTimeEstimated() { - $p = new Project($this->container); - $tc = new TaskCreation($this->container); - $tm = new TaskModification($this->container); - $tf = new TaskFinder($this->container); + $p = new ProjectModel($this->container); + $tc = new TaskCreationModel($this->container); + $tm = new TaskModificationModel($this->container); + $tf = new TaskFinderModel($this->container); $this->assertEquals(1, $p->create(array('name' => 'test'))); $this->assertEquals(1, $tc->create(array('title' => 'test', 'project_id' => 1))); @@ -264,10 +264,10 @@ class TaskModificationTest extends Base public function testChangeTimeSpent() { - $p = new Project($this->container); - $tc = new TaskCreation($this->container); - $tm = new TaskModification($this->container); - $tf = new TaskFinder($this->container); + $p = new ProjectModel($this->container); + $tc = new TaskCreationModel($this->container); + $tm = new TaskModificationModel($this->container); + $tf = new TaskFinderModel($this->container); $this->assertEquals(1, $p->create(array('name' => 'test'))); $this->assertEquals(1, $tc->create(array('title' => 'test', 'project_id' => 1))); diff --git a/tests/units/Model/TaskPositionTest.php b/tests/units/Model/TaskPositionTest.php index 0f2e4b88..7ab6950e 100644 --- a/tests/units/Model/TaskPositionTest.php +++ b/tests/units/Model/TaskPositionTest.php @@ -2,26 +2,26 @@ require_once __DIR__.'/../Base.php'; -use Kanboard\Model\Task; -use Kanboard\Model\Column; -use Kanboard\Model\TaskStatus; -use Kanboard\Model\TaskPosition; -use Kanboard\Model\TaskCreation; -use Kanboard\Model\TaskFinder; -use Kanboard\Model\Project; -use Kanboard\Model\Swimlane; +use Kanboard\Model\TaskModel; +use Kanboard\Model\ColumnModel; +use Kanboard\Model\TaskStatusModel; +use Kanboard\Model\TaskPositionModel; +use Kanboard\Model\TaskCreationModel; +use Kanboard\Model\TaskFinderModel; +use Kanboard\Model\ProjectModel; +use Kanboard\Model\SwimlaneModel; class TaskPositionTest extends Base { public function testGetTaskProgression() { - $t = new Task($this->container); - $ts = new TaskStatus($this->container); - $tp = new TaskPosition($this->container); - $tc = new TaskCreation($this->container); - $tf = new TaskFinder($this->container); - $p = new Project($this->container); - $columnModel = new Column($this->container); + $t = new TaskModel($this->container); + $ts = new TaskStatusModel($this->container); + $tp = new TaskPositionModel($this->container); + $tc = new TaskCreationModel($this->container); + $tf = new TaskFinderModel($this->container); + $p = new ProjectModel($this->container); + $columnModel = new ColumnModel($this->container); $this->assertEquals(1, $p->create(array('name' => 'Project #1'))); $this->assertEquals(1, $tc->create(array('title' => 'Task #1', 'project_id' => 1, 'column_id' => 1))); @@ -42,10 +42,10 @@ class TaskPositionTest extends Base public function testMoveTaskToWrongPosition() { - $tp = new TaskPosition($this->container); - $tc = new TaskCreation($this->container); - $tf = new TaskFinder($this->container); - $p = new Project($this->container); + $tp = new TaskPositionModel($this->container); + $tc = new TaskCreationModel($this->container); + $tf = new TaskFinderModel($this->container); + $p = new ProjectModel($this->container); $this->assertEquals(1, $p->create(array('name' => 'Project #1'))); @@ -69,10 +69,10 @@ class TaskPositionTest extends Base public function testMoveTaskToGreaterPosition() { - $tp = new TaskPosition($this->container); - $tc = new TaskCreation($this->container); - $tf = new TaskFinder($this->container); - $p = new Project($this->container); + $tp = new TaskPositionModel($this->container); + $tc = new TaskCreationModel($this->container); + $tf = new TaskFinderModel($this->container); + $p = new ProjectModel($this->container); $this->assertEquals(1, $p->create(array('name' => 'Project #1'))); @@ -96,10 +96,10 @@ class TaskPositionTest extends Base public function testMoveTaskToEmptyColumn() { - $tp = new TaskPosition($this->container); - $tc = new TaskCreation($this->container); - $tf = new TaskFinder($this->container); - $p = new Project($this->container); + $tp = new TaskPositionModel($this->container); + $tc = new TaskCreationModel($this->container); + $tf = new TaskFinderModel($this->container); + $p = new ProjectModel($this->container); $this->assertEquals(1, $p->create(array('name' => 'Project #1'))); @@ -123,10 +123,10 @@ class TaskPositionTest extends Base public function testMoveTaskToAnotherColumn() { - $tp = new TaskPosition($this->container); - $tc = new TaskCreation($this->container); - $tf = new TaskFinder($this->container); - $p = new Project($this->container); + $tp = new TaskPositionModel($this->container); + $tc = new TaskCreationModel($this->container); + $tf = new TaskFinderModel($this->container); + $p = new ProjectModel($this->container); $this->assertEquals(1, $p->create(array('name' => 'Project #1'))); @@ -186,10 +186,10 @@ class TaskPositionTest extends Base public function testMoveTaskTop() { - $tp = new TaskPosition($this->container); - $tc = new TaskCreation($this->container); - $tf = new TaskFinder($this->container); - $p = new Project($this->container); + $tp = new TaskPositionModel($this->container); + $tc = new TaskCreationModel($this->container); + $tf = new TaskFinderModel($this->container); + $p = new ProjectModel($this->container); $this->assertEquals(1, $p->create(array('name' => 'Project #1'))); $this->assertEquals(1, $tc->create(array('title' => 'Task #1', 'project_id' => 1, 'column_id' => 1))); @@ -224,10 +224,10 @@ class TaskPositionTest extends Base public function testMoveTaskBottom() { - $tp = new TaskPosition($this->container); - $tc = new TaskCreation($this->container); - $tf = new TaskFinder($this->container); - $p = new Project($this->container); + $tp = new TaskPositionModel($this->container); + $tc = new TaskCreationModel($this->container); + $tf = new TaskFinderModel($this->container); + $p = new ProjectModel($this->container); $this->assertEquals(1, $p->create(array('name' => 'Project #1'))); $this->assertEquals(1, $tc->create(array('title' => 'Task #1', 'project_id' => 1, 'column_id' => 1))); @@ -262,10 +262,10 @@ class TaskPositionTest extends Base public function testMovePosition() { - $tp = new TaskPosition($this->container); - $tc = new TaskCreation($this->container); - $tf = new TaskFinder($this->container); - $p = new Project($this->container); + $tp = new TaskPositionModel($this->container); + $tc = new TaskCreationModel($this->container); + $tf = new TaskFinderModel($this->container); + $p = new ProjectModel($this->container); $this->assertEquals(1, $p->create(array('name' => 'Project #1'))); $counter = 1; @@ -415,11 +415,11 @@ class TaskPositionTest extends Base public function testMoveTaskSwimlane() { - $tp = new TaskPosition($this->container); - $tc = new TaskCreation($this->container); - $tf = new TaskFinder($this->container); - $p = new Project($this->container); - $s = new Swimlane($this->container); + $tp = new TaskPositionModel($this->container); + $tc = new TaskCreationModel($this->container); + $tf = new TaskFinderModel($this->container); + $p = new ProjectModel($this->container); + $s = new SwimlaneModel($this->container); $this->assertEquals(1, $p->create(array('name' => 'Project #1'))); $this->assertEquals(1, $s->create(array('project_id' => 1, 'name' => 'test 1'))); @@ -522,11 +522,11 @@ class TaskPositionTest extends Base public function testEvents() { - $tp = new TaskPosition($this->container); - $tc = new TaskCreation($this->container); - $tf = new TaskFinder($this->container); - $p = new Project($this->container); - $s = new Swimlane($this->container); + $tp = new TaskPositionModel($this->container); + $tc = new TaskCreationModel($this->container); + $tf = new TaskFinderModel($this->container); + $p = new ProjectModel($this->container); + $s = new SwimlaneModel($this->container); $this->assertEquals(1, $p->create(array('name' => 'Project #1'))); $this->assertEquals(1, $s->create(array('project_id' => 1, 'name' => 'test 1'))); @@ -534,9 +534,9 @@ class TaskPositionTest extends Base $this->assertEquals(1, $tc->create(array('title' => 'Task #1', 'project_id' => 1, 'column_id' => 1))); $this->assertEquals(2, $tc->create(array('title' => 'Task #2', 'project_id' => 1, 'column_id' => 2))); - $this->container['dispatcher']->addListener(Task::EVENT_MOVE_COLUMN, array($this, 'onMoveColumn')); - $this->container['dispatcher']->addListener(Task::EVENT_MOVE_POSITION, array($this, 'onMovePosition')); - $this->container['dispatcher']->addListener(Task::EVENT_MOVE_SWIMLANE, array($this, 'onMoveSwimlane')); + $this->container['dispatcher']->addListener(TaskModel::EVENT_MOVE_COLUMN, array($this, 'onMoveColumn')); + $this->container['dispatcher']->addListener(TaskModel::EVENT_MOVE_POSITION, array($this, 'onMovePosition')); + $this->container['dispatcher']->addListener(TaskModel::EVENT_MOVE_SWIMLANE, array($this, 'onMoveSwimlane')); // We move the task 1 to the column 2 $this->assertTrue($tp->movePosition(1, 1, 2, 1)); @@ -552,7 +552,7 @@ class TaskPositionTest extends Base $this->assertEquals(2, $task['position']); $called = $this->container['dispatcher']->getCalledListeners(); - $this->assertArrayHasKey(Task::EVENT_MOVE_COLUMN.'.TaskPositionTest::onMoveColumn', $called); + $this->assertArrayHasKey(TaskModel::EVENT_MOVE_COLUMN.'.TaskPositionTest::onMoveColumn', $called); $this->assertEquals(1, count($called)); // We move the task 1 to the position 2 @@ -569,7 +569,7 @@ class TaskPositionTest extends Base $this->assertEquals(1, $task['position']); $called = $this->container['dispatcher']->getCalledListeners(); - $this->assertArrayHasKey(Task::EVENT_MOVE_POSITION.'.TaskPositionTest::onMovePosition', $called); + $this->assertArrayHasKey(TaskModel::EVENT_MOVE_POSITION.'.TaskPositionTest::onMovePosition', $called); $this->assertEquals(2, count($called)); // Move to another swimlane @@ -588,7 +588,7 @@ class TaskPositionTest extends Base $this->assertEquals(0, $task['swimlane_id']); $called = $this->container['dispatcher']->getCalledListeners(); - $this->assertArrayHasKey(Task::EVENT_MOVE_SWIMLANE.'.TaskPositionTest::onMoveSwimlane', $called); + $this->assertArrayHasKey(TaskModel::EVENT_MOVE_SWIMLANE.'.TaskPositionTest::onMoveSwimlane', $called); $this->assertEquals(3, count($called)); } diff --git a/tests/units/Model/TaskStatusTest.php b/tests/units/Model/TaskStatusTest.php index aa48be5e..f011409d 100644 --- a/tests/units/Model/TaskStatusTest.php +++ b/tests/units/Model/TaskStatusTest.php @@ -2,23 +2,23 @@ require_once __DIR__.'/../Base.php'; -use Kanboard\Model\Swimlane; -use Kanboard\Model\Subtask; -use Kanboard\Model\Task; -use Kanboard\Model\TaskCreation; -use Kanboard\Model\TaskFinder; -use Kanboard\Model\TaskStatus; -use Kanboard\Model\Project; +use Kanboard\Model\SwimlaneModel; +use Kanboard\Model\SubtaskModel; +use Kanboard\Model\TaskModel; +use Kanboard\Model\TaskCreationModel; +use Kanboard\Model\TaskFinderModel; +use Kanboard\Model\TaskStatusModel; +use Kanboard\Model\ProjectModel; class TaskStatusTest extends Base { public function testCloseBySwimlaneAndColumn() { - $tc = new TaskCreation($this->container); - $tf = new TaskFinder($this->container); - $ts = new TaskStatus($this->container); - $p = new Project($this->container); - $s = new Swimlane($this->container); + $tc = new TaskCreationModel($this->container); + $tf = new TaskFinderModel($this->container); + $ts = new TaskStatusModel($this->container); + $p = new ProjectModel($this->container); + $s = new SwimlaneModel($this->container); $this->assertEquals(1, $p->create(array('name' => 'test'))); $this->assertEquals(1, $s->create(array('name' => 'test', 'project_id' => 1))); @@ -56,10 +56,10 @@ class TaskStatusTest extends Base public function testStatus() { - $tc = new TaskCreation($this->container); - $tf = new TaskFinder($this->container); - $ts = new TaskStatus($this->container); - $p = new Project($this->container); + $tc = new TaskCreationModel($this->container); + $tf = new TaskFinderModel($this->container); + $ts = new TaskStatusModel($this->container); + $p = new ProjectModel($this->container); $this->assertEquals(1, $p->create(array('name' => 'test'))); $this->assertEquals(1, $tc->create(array('title' => 'test', 'project_id' => 1))); @@ -70,21 +70,21 @@ class TaskStatusTest extends Base $task = $tf->getById(1); $this->assertNotEmpty($task); - $this->assertEquals(Task::STATUS_OPEN, $task['is_active']); + $this->assertEquals(TaskModel::STATUS_OPEN, $task['is_active']); $this->assertEquals(0, $task['date_completed']); $this->assertEquals(time(), $task['date_modification'], '', 1); // 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->container['dispatcher']->addListener(TaskModel::EVENT_CLOSE, array($this, 'onTaskClose')); + $this->container['dispatcher']->addListener(TaskModel::EVENT_OPEN, array($this, 'onTaskOpen')); $this->assertTrue($ts->close(1)); $this->assertTrue($ts->isClosed(1)); $task = $tf->getById(1); $this->assertNotEmpty($task); - $this->assertEquals(Task::STATUS_CLOSED, $task['is_active']); + $this->assertEquals(TaskModel::STATUS_CLOSED, $task['is_active']); $this->assertEquals(time(), $task['date_completed'], 'Bad completion timestamp', 1); $this->assertEquals(time(), $task['date_modification'], 'Bad modification timestamp', 1); @@ -95,7 +95,7 @@ class TaskStatusTest extends Base $task = $tf->getById(1); $this->assertNotEmpty($task); - $this->assertEquals(Task::STATUS_OPEN, $task['is_active']); + $this->assertEquals(TaskModel::STATUS_OPEN, $task['is_active']); $this->assertEquals(0, $task['date_completed']); $this->assertEquals(time(), $task['date_modification'], '', 1); @@ -120,10 +120,10 @@ class TaskStatusTest extends Base public function testThatAllSubtasksAreClosed() { - $ts = new TaskStatus($this->container); - $tc = new TaskCreation($this->container); - $s = new Subtask($this->container); - $p = new Project($this->container); + $ts = new TaskStatusModel($this->container); + $tc = new TaskCreationModel($this->container); + $s = new SubtaskModel($this->container); + $p = new ProjectModel($this->container); $this->assertEquals(1, $p->create(array('name' => 'test1'))); $this->assertEquals(1, $tc->create(array('title' => 'test 1', 'project_id' => 1))); @@ -137,7 +137,7 @@ class TaskStatusTest extends Base $this->assertNotEmpty($subtasks); foreach ($subtasks as $subtask) { - $this->assertEquals(Subtask::STATUS_DONE, $subtask['status']); + $this->assertEquals(SubtaskModel::STATUS_DONE, $subtask['status']); } } } diff --git a/tests/units/Model/TaskTest.php b/tests/units/Model/TaskTest.php index e9815b83..89fc4dc1 100644 --- a/tests/units/Model/TaskTest.php +++ b/tests/units/Model/TaskTest.php @@ -2,17 +2,17 @@ require_once __DIR__.'/../Base.php'; -use Kanboard\Model\Task; -use Kanboard\Model\TaskCreation; -use Kanboard\Model\Project; +use Kanboard\Model\TaskModel; +use Kanboard\Model\TaskCreationModel; +use Kanboard\Model\ProjectModel; class TaskTest extends Base { public function testRemove() { - $t = new Task($this->container); - $tc = new TaskCreation($this->container); - $p = new Project($this->container); + $t = new TaskModel($this->container); + $tc = new TaskCreationModel($this->container); + $p = new ProjectModel($this->container); $this->assertEquals(1, $p->create(array('name' => 'UnitTest'))); $this->assertEquals(1, $tc->create(array('title' => 'Task #1', 'project_id' => 1))); @@ -23,36 +23,36 @@ class TaskTest extends Base public function testGetTaskIdFromText() { - $t = new Task($this->container); + $t = new TaskModel($this->container); $this->assertEquals(123, $t->getTaskIdFromText('My task #123')); $this->assertEquals(0, $t->getTaskIdFromText('My task 123')); } public function testRecurrenceSettings() { - $t = new Task($this->container); + $t = new TaskModel($this->container); $statuses = $t->getRecurrenceStatusList(); $this->assertCount(2, $statuses); - $this->assertArrayHasKey(Task::RECURRING_STATUS_NONE, $statuses); - $this->assertArrayHasKey(Task::RECURRING_STATUS_PENDING, $statuses); - $this->assertArrayNotHasKey(Task::RECURRING_STATUS_PROCESSED, $statuses); + $this->assertArrayHasKey(TaskModel::RECURRING_STATUS_NONE, $statuses); + $this->assertArrayHasKey(TaskModel::RECURRING_STATUS_PENDING, $statuses); + $this->assertArrayNotHasKey(TaskModel::RECURRING_STATUS_PROCESSED, $statuses); $triggers = $t->getRecurrenceTriggerList(); $this->assertCount(3, $triggers); - $this->assertArrayHasKey(Task::RECURRING_TRIGGER_FIRST_COLUMN, $triggers); - $this->assertArrayHasKey(Task::RECURRING_TRIGGER_LAST_COLUMN, $triggers); - $this->assertArrayHasKey(Task::RECURRING_TRIGGER_CLOSE, $triggers); + $this->assertArrayHasKey(TaskModel::RECURRING_TRIGGER_FIRST_COLUMN, $triggers); + $this->assertArrayHasKey(TaskModel::RECURRING_TRIGGER_LAST_COLUMN, $triggers); + $this->assertArrayHasKey(TaskModel::RECURRING_TRIGGER_CLOSE, $triggers); $dates = $t->getRecurrenceBasedateList(); $this->assertCount(2, $dates); - $this->assertArrayHasKey(Task::RECURRING_BASEDATE_DUEDATE, $dates); - $this->assertArrayHasKey(Task::RECURRING_BASEDATE_TRIGGERDATE, $dates); + $this->assertArrayHasKey(TaskModel::RECURRING_BASEDATE_DUEDATE, $dates); + $this->assertArrayHasKey(TaskModel::RECURRING_BASEDATE_TRIGGERDATE, $dates); $timeframes = $t->getRecurrenceTimeframeList(); $this->assertCount(3, $timeframes); - $this->assertArrayHasKey(Task::RECURRING_TIMEFRAME_DAYS, $timeframes); - $this->assertArrayHasKey(Task::RECURRING_TIMEFRAME_MONTHS, $timeframes); - $this->assertArrayHasKey(Task::RECURRING_TIMEFRAME_YEARS, $timeframes); + $this->assertArrayHasKey(TaskModel::RECURRING_TIMEFRAME_DAYS, $timeframes); + $this->assertArrayHasKey(TaskModel::RECURRING_TIMEFRAME_MONTHS, $timeframes); + $this->assertArrayHasKey(TaskModel::RECURRING_TIMEFRAME_YEARS, $timeframes); } } diff --git a/tests/units/Model/TimezoneTest.php b/tests/units/Model/TimezoneTest.php index ac2cd6a1..8e7103d8 100644 --- a/tests/units/Model/TimezoneTest.php +++ b/tests/units/Model/TimezoneTest.php @@ -2,13 +2,13 @@ require_once __DIR__.'/../Base.php'; -use Kanboard\Model\Timezone; +use Kanboard\Model\TimezoneModel; class TimezoneTest extends Base { public function testGetTimezones() { - $timezoneModel = new Timezone($this->container); + $timezoneModel = new TimezoneModel($this->container); $this->assertNotEmpty($timezoneModel->getTimezones()); $this->assertArrayHasKey('Europe/Paris', $timezoneModel->getTimezones()); $this->assertContains('Europe/Paris', $timezoneModel->getTimezones()); @@ -20,7 +20,7 @@ class TimezoneTest extends Base public function testGetCurrentTimezone() { - $timezoneModel = new Timezone($this->container); + $timezoneModel = new TimezoneModel($this->container); $this->assertEquals('UTC', $timezoneModel->getCurrentTimezone()); $this->container['sessionStorage']->user = array('timezone' => 'Europe/Paris'); diff --git a/tests/units/Model/TransitionTest.php b/tests/units/Model/TransitionTest.php index 0c262e78..2edf9c43 100644 --- a/tests/units/Model/TransitionTest.php +++ b/tests/units/Model/TransitionTest.php @@ -2,17 +2,17 @@ require_once __DIR__.'/../Base.php'; -use Kanboard\Model\TaskCreation; -use Kanboard\Model\Transition; -use Kanboard\Model\Project; +use Kanboard\Model\TaskCreationModel; +use Kanboard\Model\TransitionModel; +use Kanboard\Model\ProjectModel; class TransitionTest extends Base { public function testSave() { - $projectModel = new Project($this->container); - $taskCreationModel = new TaskCreation($this->container); - $transitionModel = new Transition($this->container); + $projectModel = new ProjectModel($this->container); + $taskCreationModel = new TaskCreationModel($this->container); + $transitionModel = new TransitionModel($this->container); $this->assertEquals(1, $projectModel->create(array('name' => 'test'))); $this->assertEquals(1, $taskCreationModel->create(array('project_id' => 1, 'title' => 'test'))); @@ -40,9 +40,9 @@ class TransitionTest extends Base public function testGetTimeSpentByTask() { - $projectModel = new Project($this->container); - $taskCreationModel = new TaskCreation($this->container); - $transitionModel = new Transition($this->container); + $projectModel = new ProjectModel($this->container); + $taskCreationModel = new TaskCreationModel($this->container); + $transitionModel = new TransitionModel($this->container); $this->assertEquals(1, $projectModel->create(array('name' => 'test'))); $this->assertEquals(1, $taskCreationModel->create(array('project_id' => 1, 'title' => 'test'))); @@ -77,9 +77,9 @@ class TransitionTest extends Base public function testGetAllByProject() { - $projectModel = new Project($this->container); - $taskCreationModel = new TaskCreation($this->container); - $transitionModel = new Transition($this->container); + $projectModel = new ProjectModel($this->container); + $taskCreationModel = new TaskCreationModel($this->container); + $transitionModel = new TransitionModel($this->container); $this->assertEquals(1, $projectModel->create(array('name' => 'test'))); $this->assertEquals(1, $taskCreationModel->create(array('project_id' => 1, 'title' => 'test1'))); diff --git a/tests/units/Model/UserLockingTest.php b/tests/units/Model/UserLockingTest.php index c743f8eb..1fcb97fe 100644 --- a/tests/units/Model/UserLockingTest.php +++ b/tests/units/Model/UserLockingTest.php @@ -2,13 +2,13 @@ require_once __DIR__.'/../Base.php'; -use Kanboard\Model\UserLocking; +use Kanboard\Model\UserLockingModel; class UserLockingTest extends Base { public function testFailedLogin() { - $u = new UserLocking($this->container); + $u = new UserLockingModel($this->container); $this->assertEquals(0, $u->getFailedLogin('admin')); $this->assertEquals(0, $u->getFailedLogin('not_found')); @@ -23,7 +23,7 @@ class UserLockingTest extends Base public function testLocking() { - $u = new UserLocking($this->container); + $u = new UserLockingModel($this->container); $this->assertFalse($u->isLocked('admin')); $this->assertFalse($u->isLocked('not_found')); @@ -33,7 +33,7 @@ class UserLockingTest extends Base public function testCaptcha() { - $u = new UserLocking($this->container); + $u = new UserLockingModel($this->container); $this->assertTrue($u->incrementFailedLogin('admin')); $this->assertFalse($u->hasCaptcha('admin', 2)); diff --git a/tests/units/Model/UserMentionTest.php b/tests/units/Model/UserMentionTest.php index d50c9285..b41c92cd 100644 --- a/tests/units/Model/UserMentionTest.php +++ b/tests/units/Model/UserMentionTest.php @@ -4,19 +4,19 @@ require_once __DIR__.'/../Base.php'; use Kanboard\Core\Security\Role; use Kanboard\Event\GenericEvent; -use Kanboard\Model\User; -use Kanboard\Model\Task; -use Kanboard\Model\TaskCreation; -use Kanboard\Model\Project; -use Kanboard\Model\ProjectUserRole; -use Kanboard\Model\UserMention; +use Kanboard\Model\UserModel; +use Kanboard\Model\TaskModel; +use Kanboard\Model\TaskCreationModel; +use Kanboard\Model\ProjectModel; +use Kanboard\Model\ProjectUserRoleModel; +use Kanboard\Model\UserMentionModel; class UserMentionTest extends Base { public function testGetMentionedUsersWithNoMentions() { - $userModel = new User($this->container); - $userMentionModel = new UserMention($this->container); + $userModel = new UserModel($this->container); + $userMentionModel = new UserMentionModel($this->container); $this->assertNotFalse($userModel->create(array('username' => 'user1'))); $this->assertEmpty($userMentionModel->getMentionedUsers('test')); @@ -24,8 +24,8 @@ class UserMentionTest extends Base public function testGetMentionedUsersWithNotficationDisabled() { - $userModel = new User($this->container); - $userMentionModel = new UserMention($this->container); + $userModel = new UserModel($this->container); + $userMentionModel = new UserMentionModel($this->container); $this->assertNotFalse($userModel->create(array('username' => 'user1'))); $this->assertEmpty($userMentionModel->getMentionedUsers('test @user1')); @@ -33,8 +33,8 @@ class UserMentionTest extends Base public function testGetMentionedUsersWithNotficationEnabled() { - $userModel = new User($this->container); - $userMentionModel = new UserMention($this->container); + $userModel = new UserModel($this->container); + $userMentionModel = new UserMentionModel($this->container); $this->assertNotFalse($userModel->create(array('username' => 'user1'))); $this->assertNotFalse($userModel->create(array('username' => 'user2', 'name' => 'Foobar', 'notifications_enabled' => 1))); @@ -50,8 +50,8 @@ class UserMentionTest extends Base public function testGetMentionedUsersWithNotficationEnabledAndUserLoggedIn() { $this->container['sessionStorage']->user = array('id' => 3); - $userModel = new User($this->container); - $userMentionModel = new UserMention($this->container); + $userModel = new UserModel($this->container); + $userMentionModel = new UserMentionModel($this->container); $this->assertNotFalse($userModel->create(array('username' => 'user1'))); $this->assertNotFalse($userModel->create(array('username' => 'user2', 'name' => 'Foobar', 'notifications_enabled' => 1))); @@ -61,10 +61,10 @@ class UserMentionTest extends Base public function testFireEventsWithMultipleMentions() { - $projectUserRoleModel = new ProjectUserRole($this->container); - $projectModel = new Project($this->container); - $userModel = new User($this->container); - $userMentionModel = new UserMention($this->container); + $projectUserRoleModel = new ProjectUserRoleModel($this->container); + $projectModel = new ProjectModel($this->container); + $userModel = new UserModel($this->container); + $userMentionModel = new UserMentionModel($this->container); $event = new GenericEvent(array('project_id' => 1)); $this->assertEquals(2, $userModel->create(array('username' => 'user1', 'name' => 'User 1', 'notifications_enabled' => 1))); @@ -73,21 +73,21 @@ class UserMentionTest extends Base $this->assertEquals(1, $projectModel->create(array('name' => 'P1'))); $this->assertTrue($projectUserRoleModel->addUser(1, 3, Role::PROJECT_MEMBER)); - $this->container['dispatcher']->addListener(Task::EVENT_USER_MENTION, array($this, 'onUserMention')); + $this->container['dispatcher']->addListener(TaskModel::EVENT_USER_MENTION, array($this, 'onUserMention')); - $userMentionModel->fireEvents('test @user1 @user2', Task::EVENT_USER_MENTION, $event); + $userMentionModel->fireEvents('test @user1 @user2', TaskModel::EVENT_USER_MENTION, $event); $called = $this->container['dispatcher']->getCalledListeners(); - $this->assertArrayHasKey(Task::EVENT_USER_MENTION.'.UserMentionTest::onUserMention', $called); + $this->assertArrayHasKey(TaskModel::EVENT_USER_MENTION.'.UserMentionTest::onUserMention', $called); } public function testFireEventsWithNoProjectId() { - $projectUserRoleModel = new ProjectUserRole($this->container); - $projectModel = new Project($this->container); - $taskCreationModel = new TaskCreation($this->container); - $userModel = new User($this->container); - $userMentionModel = new UserMention($this->container); + $projectUserRoleModel = new ProjectUserRoleModel($this->container); + $projectModel = new ProjectModel($this->container); + $taskCreationModel = new TaskCreationModel($this->container); + $userModel = new UserModel($this->container); + $userMentionModel = new UserMentionModel($this->container); $event = new GenericEvent(array('task_id' => 1)); $this->assertEquals(2, $userModel->create(array('username' => 'user1', 'name' => 'User 1', 'notifications_enabled' => 1))); @@ -98,12 +98,12 @@ class UserMentionTest extends Base $this->assertEquals(1, $taskCreationModel->create(array('project_id' => 1, 'title' => 'Task 1'))); - $this->container['dispatcher']->addListener(Task::EVENT_USER_MENTION, array($this, 'onUserMention')); + $this->container['dispatcher']->addListener(TaskModel::EVENT_USER_MENTION, array($this, 'onUserMention')); - $userMentionModel->fireEvents('test @user1 @user2', Task::EVENT_USER_MENTION, $event); + $userMentionModel->fireEvents('test @user1 @user2', TaskModel::EVENT_USER_MENTION, $event); $called = $this->container['dispatcher']->getCalledListeners(); - $this->assertArrayHasKey(Task::EVENT_USER_MENTION.'.UserMentionTest::onUserMention', $called); + $this->assertArrayHasKey(TaskModel::EVENT_USER_MENTION.'.UserMentionTest::onUserMention', $called); } public function onUserMention($event) diff --git a/tests/units/Model/UserMetadataTest.php b/tests/units/Model/UserMetadataTest.php index 457f1fb2..fb427371 100644 --- a/tests/units/Model/UserMetadataTest.php +++ b/tests/units/Model/UserMetadataTest.php @@ -2,15 +2,15 @@ require_once __DIR__.'/../Base.php'; -use Kanboard\Model\User; -use Kanboard\Model\UserMetadata; +use Kanboard\Model\UserModel; +use Kanboard\Model\UserMetadataModel; class UserMetadataTest extends Base { public function testOperations() { - $m = new UserMetadata($this->container); - $u = new User($this->container); + $m = new UserMetadataModel($this->container); + $u = new UserModel($this->container); $this->assertEquals(2, $u->create(array('username' => 'foobar'))); diff --git a/tests/units/Model/UserNotificationFilterTest.php b/tests/units/Model/UserNotificationFilterTest.php index 73c7d905..49c7aa0a 100644 --- a/tests/units/Model/UserNotificationFilterTest.php +++ b/tests/units/Model/UserNotificationFilterTest.php @@ -2,27 +2,27 @@ require_once __DIR__.'/../Base.php'; -use Kanboard\Model\User; -use Kanboard\Model\Project; -use Kanboard\Model\UserNotificationFilter; -use Kanboard\Model\UserNotification; +use Kanboard\Model\UserModel; +use Kanboard\Model\ProjectModel; +use Kanboard\Model\UserNotificationFilterModel; +use Kanboard\Model\UserNotificationModel; class UserNotificationFilterTest extends Base { public function testGetFilters() { - $nf = new UserNotificationFilter($this->container); + $nf = new UserNotificationFilterModel($this->container); $filters = $nf->getFilters(); - $this->assertArrayHasKey(UserNotificationFilter::FILTER_NONE, $filters); - $this->assertArrayHasKey(UserNotificationFilter::FILTER_BOTH, $filters); - $this->assertArrayHasKey(UserNotificationFilter::FILTER_CREATOR, $filters); - $this->assertArrayHasKey(UserNotificationFilter::FILTER_ASSIGNEE, $filters); + $this->assertArrayHasKey(UserNotificationFilterModel::FILTER_NONE, $filters); + $this->assertArrayHasKey(UserNotificationFilterModel::FILTER_BOTH, $filters); + $this->assertArrayHasKey(UserNotificationFilterModel::FILTER_CREATOR, $filters); + $this->assertArrayHasKey(UserNotificationFilterModel::FILTER_ASSIGNEE, $filters); } public function testSaveProjectFilter() { - $nf = new UserNotificationFilter($this->container); - $p = new Project($this->container); + $nf = new UserNotificationFilterModel($this->container); + $p = new ProjectModel($this->container); $this->assertEquals(1, $p->create(array('name' => 'UnitTest1'))); $this->assertEquals(2, $p->create(array('name' => 'UnitTest2'))); @@ -35,78 +35,78 @@ class UserNotificationFilterTest extends Base public function testSaveUserFilter() { - $nf = new UserNotificationFilter($this->container); + $nf = new UserNotificationFilterModel($this->container); - $this->assertEquals(UserNotificationFilter::FILTER_BOTH, $nf->getSelectedFilter(1)); - $nf->saveFilter(1, UserNotificationFilter::FILTER_CREATOR); - $this->assertEquals(UserNotificationFilter::FILTER_CREATOR, $nf->getSelectedFilter(1)); + $this->assertEquals(UserNotificationFilterModel::FILTER_BOTH, $nf->getSelectedFilter(1)); + $nf->saveFilter(1, UserNotificationFilterModel::FILTER_CREATOR); + $this->assertEquals(UserNotificationFilterModel::FILTER_CREATOR, $nf->getSelectedFilter(1)); } public function testFilterNone() { - $u = new User($this->container); - $n = new UserNotificationFilter($this->container); + $u = new UserModel($this->container); + $n = new UserNotificationFilterModel($this->container); - $this->assertEquals(2, $u->create(array('username' => 'user1', 'notifications_filter' => UserNotificationFilter::FILTER_NONE))); + $this->assertEquals(2, $u->create(array('username' => 'user1', 'notifications_filter' => UserNotificationFilterModel::FILTER_NONE))); $this->assertTrue($n->filterNone($u->getById(2))); - $this->assertEquals(3, $u->create(array('username' => 'user2', 'notifications_filter' => UserNotificationFilter::FILTER_BOTH))); + $this->assertEquals(3, $u->create(array('username' => 'user2', 'notifications_filter' => UserNotificationFilterModel::FILTER_BOTH))); $this->assertFalse($n->filterNone($u->getById(3))); } public function testFilterCreator() { - $u = new User($this->container); - $n = new UserNotificationFilter($this->container); + $u = new UserModel($this->container); + $n = new UserNotificationFilterModel($this->container); - $this->assertEquals(2, $u->create(array('username' => 'user1', 'notifications_filter' => UserNotificationFilter::FILTER_CREATOR))); + $this->assertEquals(2, $u->create(array('username' => 'user1', 'notifications_filter' => UserNotificationFilterModel::FILTER_CREATOR))); $this->assertTrue($n->filterCreator($u->getById(2), array('task' => array('creator_id' => 2)))); - $this->assertEquals(3, $u->create(array('username' => 'user2', 'notifications_filter' => UserNotificationFilter::FILTER_CREATOR))); + $this->assertEquals(3, $u->create(array('username' => 'user2', 'notifications_filter' => UserNotificationFilterModel::FILTER_CREATOR))); $this->assertFalse($n->filterCreator($u->getById(3), array('task' => array('creator_id' => 1)))); - $this->assertEquals(4, $u->create(array('username' => 'user3', 'notifications_filter' => UserNotificationFilter::FILTER_NONE))); + $this->assertEquals(4, $u->create(array('username' => 'user3', 'notifications_filter' => UserNotificationFilterModel::FILTER_NONE))); $this->assertFalse($n->filterCreator($u->getById(4), array('task' => array('creator_id' => 2)))); } public function testFilterAssignee() { - $u = new User($this->container); - $n = new UserNotificationFilter($this->container); + $u = new UserModel($this->container); + $n = new UserNotificationFilterModel($this->container); - $this->assertEquals(2, $u->create(array('username' => 'user1', 'notifications_filter' => UserNotificationFilter::FILTER_ASSIGNEE))); + $this->assertEquals(2, $u->create(array('username' => 'user1', 'notifications_filter' => UserNotificationFilterModel::FILTER_ASSIGNEE))); $this->assertTrue($n->filterAssignee($u->getById(2), array('task' => array('owner_id' => 2)))); - $this->assertEquals(3, $u->create(array('username' => 'user2', 'notifications_filter' => UserNotificationFilter::FILTER_ASSIGNEE))); + $this->assertEquals(3, $u->create(array('username' => 'user2', 'notifications_filter' => UserNotificationFilterModel::FILTER_ASSIGNEE))); $this->assertFalse($n->filterAssignee($u->getById(3), array('task' => array('owner_id' => 1)))); - $this->assertEquals(4, $u->create(array('username' => 'user3', 'notifications_filter' => UserNotificationFilter::FILTER_NONE))); + $this->assertEquals(4, $u->create(array('username' => 'user3', 'notifications_filter' => UserNotificationFilterModel::FILTER_NONE))); $this->assertFalse($n->filterAssignee($u->getById(4), array('task' => array('owner_id' => 2)))); } public function testFilterBoth() { - $u = new User($this->container); - $n = new UserNotificationFilter($this->container); + $u = new UserModel($this->container); + $n = new UserNotificationFilterModel($this->container); - $this->assertEquals(2, $u->create(array('username' => 'user1', 'notifications_filter' => UserNotificationFilter::FILTER_BOTH))); + $this->assertEquals(2, $u->create(array('username' => 'user1', 'notifications_filter' => UserNotificationFilterModel::FILTER_BOTH))); $this->assertTrue($n->filterBoth($u->getById(2), array('task' => array('owner_id' => 2, 'creator_id' => 1)))); $this->assertTrue($n->filterBoth($u->getById(2), array('task' => array('owner_id' => 0, 'creator_id' => 2)))); - $this->assertEquals(3, $u->create(array('username' => 'user2', 'notifications_filter' => UserNotificationFilter::FILTER_BOTH))); + $this->assertEquals(3, $u->create(array('username' => 'user2', 'notifications_filter' => UserNotificationFilterModel::FILTER_BOTH))); $this->assertFalse($n->filterBoth($u->getById(3), array('task' => array('owner_id' => 1, 'creator_id' => 1)))); $this->assertFalse($n->filterBoth($u->getById(3), array('task' => array('owner_id' => 2, 'creator_id' => 1)))); - $this->assertEquals(4, $u->create(array('username' => 'user3', 'notifications_filter' => UserNotificationFilter::FILTER_NONE))); + $this->assertEquals(4, $u->create(array('username' => 'user3', 'notifications_filter' => UserNotificationFilterModel::FILTER_NONE))); $this->assertFalse($n->filterBoth($u->getById(4), array('task' => array('owner_id' => 2, 'creator_id' => 1)))); } public function testFilterProject() { - $u = new User($this->container); - $n = new UserNotification($this->container); - $nf = new UserNotificationFilter($this->container); - $p = new Project($this->container); + $u = new UserModel($this->container); + $n = new UserNotificationModel($this->container); + $nf = new UserNotificationFilterModel($this->container); + $p = new ProjectModel($this->container); $this->assertEquals(1, $p->create(array('name' => 'UnitTest1'))); $this->assertEquals(2, $p->create(array('name' => 'UnitTest2'))); @@ -115,7 +115,7 @@ class UserNotificationFilterTest extends Base $this->assertTrue($nf->filterProject($u->getById(1), array())); // User that select only some projects - $this->assertEquals(2, $u->create(array('username' => 'user2', 'notifications_filter' => UserNotificationFilter::FILTER_NONE))); + $this->assertEquals(2, $u->create(array('username' => 'user2', 'notifications_filter' => UserNotificationFilterModel::FILTER_NONE))); $n->saveSettings(2, array('notifications_enabled' => 1, 'notification_projects' => array(2 => true))); $this->assertFalse($nf->filterProject($u->getById(2), array('task' => array('project_id' => 1)))); @@ -124,20 +124,20 @@ class UserNotificationFilterTest extends Base public function testFilterUserWithNoFilter() { - $u = new User($this->container); - $n = new UserNotificationFilter($this->container); + $u = new UserModel($this->container); + $n = new UserNotificationFilterModel($this->container); - $this->assertEquals(2, $u->create(array('username' => 'user2', 'notifications_filter' => UserNotificationFilter::FILTER_NONE))); + $this->assertEquals(2, $u->create(array('username' => 'user2', 'notifications_filter' => UserNotificationFilterModel::FILTER_NONE))); $this->assertTrue($n->shouldReceiveNotification($u->getById(2), array('task' => array('project_id' => 1)))); } public function testFilterUserWithAssigneeFilter() { - $u = new User($this->container); - $n = new UserNotificationFilter($this->container); + $u = new UserModel($this->container); + $n = new UserNotificationFilterModel($this->container); - $this->assertEquals(2, $u->create(array('username' => 'user2', 'notifications_filter' => UserNotificationFilter::FILTER_ASSIGNEE))); + $this->assertEquals(2, $u->create(array('username' => 'user2', 'notifications_filter' => UserNotificationFilterModel::FILTER_ASSIGNEE))); $this->assertTrue($n->shouldReceiveNotification($u->getById(2), array('task' => array('project_id' => 1, 'owner_id' => 2)))); $this->assertFalse($n->shouldReceiveNotification($u->getById(2), array('task' => array('project_id' => 1, 'owner_id' => 1)))); @@ -145,10 +145,10 @@ class UserNotificationFilterTest extends Base public function testFilterUserWithCreatorFilter() { - $u = new User($this->container); - $n = new UserNotificationFilter($this->container); + $u = new UserModel($this->container); + $n = new UserNotificationFilterModel($this->container); - $this->assertEquals(2, $u->create(array('username' => 'user2', 'notifications_filter' => UserNotificationFilter::FILTER_CREATOR))); + $this->assertEquals(2, $u->create(array('username' => 'user2', 'notifications_filter' => UserNotificationFilterModel::FILTER_CREATOR))); $this->assertTrue($n->shouldReceiveNotification($u->getById(2), array('task' => array('project_id' => 1, 'creator_id' => 2)))); $this->assertFalse($n->shouldReceiveNotification($u->getById(2), array('task' => array('project_id' => 1, 'creator_id' => 1)))); @@ -156,10 +156,10 @@ class UserNotificationFilterTest extends Base public function testFilterUserWithBothFilter() { - $u = new User($this->container); - $n = new UserNotificationFilter($this->container); + $u = new UserModel($this->container); + $n = new UserNotificationFilterModel($this->container); - $this->assertEquals(2, $u->create(array('username' => 'user2', 'notifications_filter' => UserNotificationFilter::FILTER_BOTH))); + $this->assertEquals(2, $u->create(array('username' => 'user2', 'notifications_filter' => UserNotificationFilterModel::FILTER_BOTH))); $this->assertTrue($n->shouldReceiveNotification($u->getById(2), array('task' => array('project_id' => 1, 'creator_id' => 2, 'owner_id' => 3)))); $this->assertTrue($n->shouldReceiveNotification($u->getById(2), array('task' => array('project_id' => 1, 'creator_id' => 0, 'owner_id' => 2)))); @@ -169,15 +169,15 @@ class UserNotificationFilterTest extends Base public function testFilterUserWithBothFilterAndProjectSelected() { - $u = new User($this->container); - $n = new UserNotification($this->container); - $nf = new UserNotificationFilter($this->container); - $p = new Project($this->container); + $u = new UserModel($this->container); + $n = new UserNotificationModel($this->container); + $nf = new UserNotificationFilterModel($this->container); + $p = new ProjectModel($this->container); $this->assertEquals(1, $p->create(array('name' => 'UnitTest1'))); $this->assertEquals(2, $p->create(array('name' => 'UnitTest2'))); - $this->assertEquals(2, $u->create(array('username' => 'user2', 'notifications_filter' => UserNotificationFilter::FILTER_BOTH))); + $this->assertEquals(2, $u->create(array('username' => 'user2', 'notifications_filter' => UserNotificationFilterModel::FILTER_BOTH))); $n->saveSettings(2, array('notifications_enabled' => 1, 'notification_projects' => array(2 => true))); diff --git a/tests/units/Model/UserNotificationTest.php b/tests/units/Model/UserNotificationTest.php index a15fe226..6ee5c875 100644 --- a/tests/units/Model/UserNotificationTest.php +++ b/tests/units/Model/UserNotificationTest.php @@ -2,28 +2,28 @@ require_once __DIR__.'/../Base.php'; -use Kanboard\Model\TaskFinder; -use Kanboard\Model\TaskCreation; -use Kanboard\Model\User; -use Kanboard\Model\Group; -use Kanboard\Model\GroupMember; -use Kanboard\Model\Project; -use Kanboard\Model\ProjectPermission; -use Kanboard\Model\Task; -use Kanboard\Model\ProjectUserRole; -use Kanboard\Model\ProjectGroupRole; -use Kanboard\Model\UserNotification; -use Kanboard\Model\UserNotificationFilter; +use Kanboard\Model\TaskFinderModel; +use Kanboard\Model\TaskCreationModel; +use Kanboard\Model\UserModel; +use Kanboard\Model\GroupModel; +use Kanboard\Model\GroupMemberModel; +use Kanboard\Model\ProjectModel; +use Kanboard\Model\ProjectPermissionModel; +use Kanboard\Model\TaskModel; +use Kanboard\Model\ProjectUserRoleModel; +use Kanboard\Model\ProjectGroupRoleModel; +use Kanboard\Model\UserNotificationModel; +use Kanboard\Model\UserNotificationFilterModel; use Kanboard\Core\Security\Role; class UserNotificationTest extends Base { public function testEnableDisableNotification() { - $u = new User($this->container); - $p = new Project($this->container); - $n = new UserNotification($this->container); - $pp = new ProjectUserRole($this->container); + $u = new UserModel($this->container); + $p = new ProjectModel($this->container); + $n = new UserNotificationModel($this->container); + $pp = new ProjectUserRoleModel($this->container); $this->assertEquals(1, $p->create(array('name' => 'UnitTest1'))); $this->assertEquals(2, $u->create(array('username' => 'user1'))); @@ -38,29 +38,29 @@ class UserNotificationTest extends Base public function testReadWriteSettings() { - $n = new UserNotification($this->container); - $p = new Project($this->container); + $n = new UserNotificationModel($this->container); + $p = new ProjectModel($this->container); $this->assertEquals(1, $p->create(array('name' => 'UnitTest1'))); $n->saveSettings(1, array( 'notifications_enabled' => 1, - 'notifications_filter' => UserNotificationFilter::FILTER_CREATOR, + 'notifications_filter' => UserNotificationFilterModel::FILTER_CREATOR, 'notification_types' => array('email' => 1), 'notification_projects' => array(), )); - $this->container['userNotificationType'] + $this->container['userNotificationTypeModel'] ->expects($this->at(0)) ->method('getSelectedTypes') ->will($this->returnValue(array('email'))); - $this->container['userNotificationType'] + $this->container['userNotificationTypeModel'] ->expects($this->at(1)) ->method('getSelectedTypes') ->will($this->returnValue(array('email'))); - $this->container['userNotificationType'] + $this->container['userNotificationTypeModel'] ->expects($this->at(2)) ->method('getSelectedTypes') ->with($this->equalTo(1)) @@ -69,7 +69,7 @@ class UserNotificationTest extends Base $settings = $n->readSettings(1); $this->assertNotEmpty($settings); $this->assertEquals(1, $settings['notifications_enabled']); - $this->assertEquals(UserNotificationFilter::FILTER_CREATOR, $settings['notifications_filter']); + $this->assertEquals(UserNotificationFilterModel::FILTER_CREATOR, $settings['notifications_filter']); $this->assertEquals(array('email'), $settings['notification_types']); $this->assertEmpty($settings['notification_projects']); @@ -83,7 +83,7 @@ class UserNotificationTest extends Base $n->saveSettings(1, array( 'notifications_enabled' => 1, - 'notifications_filter' => UserNotificationFilter::FILTER_ASSIGNEE, + 'notifications_filter' => UserNotificationFilterModel::FILTER_ASSIGNEE, 'notification_types' => array('web' => 1, 'email' => 1), 'notification_projects' => array(1 => 1), )); @@ -91,20 +91,20 @@ class UserNotificationTest extends Base $settings = $n->readSettings(1); $this->assertNotEmpty($settings); $this->assertEquals(1, $settings['notifications_enabled']); - $this->assertEquals(UserNotificationFilter::FILTER_ASSIGNEE, $settings['notifications_filter']); + $this->assertEquals(UserNotificationFilterModel::FILTER_ASSIGNEE, $settings['notifications_filter']); $this->assertEquals(array('email', 'web'), $settings['notification_types']); $this->assertEquals(array(1), $settings['notification_projects']); } public function testGetGroupMembersWithNotificationEnabled() { - $userModel = new User($this->container); - $groupModel = new Group($this->container); - $groupMemberModel = new GroupMember($this->container); - $projectModel = new Project($this->container); - $userNotificationModel = new UserNotification($this->container); - $projectGroupRole = new ProjectGroupRole($this->container); - $projectUserRole = new ProjectUserRole($this->container); + $userModel = new UserModel($this->container); + $groupModel = new GroupModel($this->container); + $groupMemberModel = new GroupMemberModel($this->container); + $projectModel = new ProjectModel($this->container); + $userNotificationModel = new UserNotificationModel($this->container); + $projectGroupRole = new ProjectGroupRoleModel($this->container); + $projectUserRole = new ProjectUserRoleModel($this->container); $this->assertEquals(2, $userModel->create(array('username' => 'user1', 'email' => 'user1@here', 'notifications_enabled' => 1))); $this->assertEquals(3, $userModel->create(array('username' => 'user2', 'email' => '', 'notifications_enabled' => 1))); @@ -136,10 +136,10 @@ class UserNotificationTest extends Base public function testGetProjectMembersWithNotifications() { - $u = new User($this->container); - $p = new Project($this->container); - $n = new UserNotification($this->container); - $pp = new ProjectUserRole($this->container); + $u = new UserModel($this->container); + $p = new ProjectModel($this->container); + $n = new UserNotificationModel($this->container); + $pp = new ProjectUserRoleModel($this->container); $this->assertEquals(1, $p->create(array('name' => 'UnitTest1'))); @@ -181,10 +181,10 @@ class UserNotificationTest extends Base public function testGetUsersWithNotificationsWhenEverybodyAllowed() { - $u = new User($this->container); - $p = new Project($this->container); - $n = new UserNotification($this->container); - $pp = new ProjectPermission($this->container); + $u = new UserModel($this->container); + $p = new ProjectModel($this->container); + $n = new UserNotificationModel($this->container); + $pp = new ProjectPermissionModel($this->container); $this->assertEquals(1, $p->create(array('name' => 'UnitTest1', 'is_everybody_allowed' => 1))); $this->assertTrue($pp->isEverybodyAllowed(1)); @@ -215,12 +215,12 @@ class UserNotificationTest extends Base public function testSendNotifications() { - $u = new User($this->container); - $n = new UserNotification($this->container); - $p = new Project($this->container); - $tc = new TaskCreation($this->container); - $tf = new TaskFinder($this->container); - $pp = new ProjectPermission($this->container); + $u = new UserModel($this->container); + $n = new UserNotificationModel($this->container); + $p = new ProjectModel($this->container); + $tc = new TaskCreationModel($this->container); + $tf = new TaskFinderModel($this->container); + $pp = new ProjectPermissionModel($this->container); $this->assertEquals(1, $p->create(array('name' => 'UnitTest1', 'is_everybody_allowed' => 1))); $this->assertEquals(1, $tc->create(array('title' => 'test', 'project_id' => 1))); @@ -229,7 +229,7 @@ class UserNotificationTest extends Base $n->saveSettings(1, array( 'notifications_enabled' => 1, - 'notifications_filter' => UserNotificationFilter::FILTER_NONE, + 'notifications_filter' => UserNotificationFilterModel::FILTER_NONE, 'notification_types' => array('web' => 1, 'email' => 1), )); @@ -242,23 +242,23 @@ class UserNotificationTest extends Base ->expects($this->exactly(2)) ->method('notifyUser'); - $this->container['userNotificationType'] + $this->container['userNotificationTypeModel'] ->expects($this->at(0)) ->method('getSelectedTypes') ->will($this->returnValue(array('email', 'web'))); - $this->container['userNotificationType'] + $this->container['userNotificationTypeModel'] ->expects($this->at(1)) ->method('getType') ->with($this->equalTo('email')) ->will($this->returnValue($notifier)); - $this->container['userNotificationType'] + $this->container['userNotificationTypeModel'] ->expects($this->at(2)) ->method('getType') ->with($this->equalTo('web')) ->will($this->returnValue($notifier)); - $n->sendNotifications(Task::EVENT_CREATE, array('task' => $tf->getDetails(1))); + $n->sendNotifications(TaskModel::EVENT_CREATE, array('task' => $tf->getDetails(1))); } } diff --git a/tests/units/Model/UserNotificationTypeTest.php b/tests/units/Model/UserNotificationTypeTest.php index da22afef..29223c18 100644 --- a/tests/units/Model/UserNotificationTypeTest.php +++ b/tests/units/Model/UserNotificationTypeTest.php @@ -2,13 +2,13 @@ require_once __DIR__.'/../Base.php'; -use Kanboard\Model\UserNotificationType; +use Kanboard\Model\UserNotificationTypeModel; class UserNotificationTypeTest extends Base { public function testGetTypes() { - $nt = new UserNotificationType($this->container); + $nt = new UserNotificationTypeModel($this->container); $this->assertEmpty($nt->getTypes()); $nt->setType('email', 'Email', 'Something'); @@ -18,7 +18,7 @@ class UserNotificationTypeTest extends Base public function testGetSelectedTypes() { - $nt = new UserNotificationType($this->container); + $nt = new UserNotificationTypeModel($this->container); // No type defined $this->assertEmpty($nt->getSelectedTypes(1)); diff --git a/tests/units/Model/UserTest.php b/tests/units/Model/UserTest.php index b53acb7d..0be6172e 100644 --- a/tests/units/Model/UserTest.php +++ b/tests/units/Model/UserTest.php @@ -2,19 +2,19 @@ require_once __DIR__.'/../Base.php'; -use Kanboard\Model\User; -use Kanboard\Model\Subtask; -use Kanboard\Model\Comment; -use Kanboard\Model\TaskCreation; -use Kanboard\Model\TaskFinder; -use Kanboard\Model\Project; +use Kanboard\Model\UserModel; +use Kanboard\Model\SubtaskModel; +use Kanboard\Model\CommentModel; +use Kanboard\Model\TaskCreationModel; +use Kanboard\Model\TaskFinderModel; +use Kanboard\Model\ProjectModel; use Kanboard\Core\Security\Role; class UserTest extends Base { public function testGetByEmail() { - $u = new User($this->container); + $u = new UserModel($this->container); $this->assertNotFalse($u->create(array('username' => 'user1', 'password' => '123456', 'email' => 'user1@localhost'))); $this->assertNotFalse($u->create(array('username' => 'user2', 'password' => '123456', 'email' => ''))); @@ -24,20 +24,20 @@ class UserTest extends Base public function testGetByExternalId() { - $u = new User($this->container); + $u = new UserModel($this->container); $this->assertNotFalse($u->create(array('username' => 'user1', 'password' => '123456', 'gitlab_id' => '1234'))); $this->assertNotEmpty($u->getByExternalId('gitlab_id', '1234')); $this->assertEmpty($u->getByExternalId('gitlab_id', '')); - $u = new User($this->container); + $u = new UserModel($this->container); $this->assertNotFalse($u->create(array('username' => 'user2', 'password' => '123456', 'github_id' => 'plop'))); $this->assertNotFalse($u->create(array('username' => 'user3', 'password' => '123456', 'github_id' => ''))); $this->assertNotEmpty($u->getByExternalId('github_id', 'plop')); $this->assertEmpty($u->getByExternalId('github_id', '')); - $u = new User($this->container); + $u = new UserModel($this->container); $this->assertNotFalse($u->create(array('username' => 'user4', 'password' => '123456', 'google_id' => '1234'))); $this->assertNotFalse($u->create(array('username' => 'user5', 'password' => '123456', 'google_id' => ''))); @@ -47,7 +47,7 @@ class UserTest extends Base public function testGetByToken() { - $u = new User($this->container); + $u = new UserModel($this->container); $this->assertNotFalse($u->create(array('username' => 'user1', 'token' => 'random'))); $this->assertNotFalse($u->create(array('username' => 'user2', 'token' => ''))); @@ -57,7 +57,7 @@ class UserTest extends Base public function testGetByUsername() { - $u = new User($this->container); + $u = new UserModel($this->container); $this->assertNotFalse($u->create(array('username' => 'user1'))); $this->assertNotEmpty($u->getByUsername('user1')); @@ -67,7 +67,7 @@ class UserTest extends Base public function testExists() { - $u = new User($this->container); + $u = new UserModel($this->container); $this->assertNotFalse($u->create(array('username' => 'user1'))); $this->assertTrue($u->exists(1)); @@ -77,14 +77,14 @@ class UserTest extends Base public function testCount() { - $u = new User($this->container); + $u = new UserModel($this->container); $this->assertNotFalse($u->create(array('username' => 'user1'))); $this->assertEquals(2, $u->count()); } public function testGetAll() { - $u = new User($this->container); + $u = new UserModel($this->container); $this->assertEquals(2, $u->create(array('username' => 'you'))); $this->assertEquals(3, $u->create(array('username' => 'me', 'name' => 'Me'))); @@ -97,7 +97,7 @@ class UserTest extends Base public function testGetActiveUsersList() { - $u = new User($this->container); + $u = new UserModel($this->container); $this->assertEquals(2, $u->create(array('username' => 'you'))); $this->assertEquals(3, $u->create(array('username' => 'me', 'name' => 'Me too'))); $this->assertEquals(4, $u->create(array('username' => 'foobar', 'is_active' => 0))); @@ -115,10 +115,10 @@ class UserTest extends Base $users = $u->getActiveUsersList(true); $expected = array( - User::EVERYBODY_ID => 'Everybody', - 1 => 'admin', - 3 => 'Me too', - 2 => 'you', + UserModel::EVERYBODY_ID => 'Everybody', + 1 => 'admin', + 3 => 'Me too', + 2 => 'you', ); $this->assertEquals($expected, $users); @@ -126,7 +126,7 @@ class UserTest extends Base public function testGetFullname() { - $u = new User($this->container); + $u = new UserModel($this->container); $this->assertEquals(2, $u->create(array('username' => 'user1'))); $this->assertEquals(3, $u->create(array('username' => 'user2', 'name' => 'User #2'))); @@ -142,7 +142,7 @@ class UserTest extends Base public function testIsAdmin() { - $u = new User($this->container); + $u = new UserModel($this->container); $this->assertEquals(2, $u->create(array('username' => 'user1'))); $this->assertTrue($u->isAdmin(1)); @@ -160,7 +160,7 @@ class UserTest extends Base public function testPrepare() { - $u = new User($this->container); + $u = new UserModel($this->container); $input = array( 'username' => 'user1', @@ -237,7 +237,7 @@ class UserTest extends Base public function testCreate() { - $u = new User($this->container); + $u = new UserModel($this->container); $this->assertEquals(2, $u->create(array('username' => 'user #1', 'password' => '123456', 'name' => 'User'))); $this->assertEquals(3, $u->create(array('username' => 'user #2', 'is_ldap_user' => 1))); $this->assertEquals(4, $u->create(array('username' => 'user #3', 'role' => Role::APP_MANAGER))); @@ -280,7 +280,7 @@ class UserTest extends Base public function testUpdate() { - $u = new User($this->container); + $u = new UserModel($this->container); $this->assertEquals(2, $u->create(array('username' => 'toto', 'password' => '123456', 'name' => 'Toto'))); $this->assertEquals(3, $u->create(array('username' => 'plop', 'gitlab_id' => '123'))); @@ -300,12 +300,12 @@ class UserTest extends Base public function testRemove() { - $u = new User($this->container); - $tc = new TaskCreation($this->container); - $tf = new TaskFinder($this->container); - $p = new Project($this->container); - $s = new Subtask($this->container); - $c = new Comment($this->container); + $u = new UserModel($this->container); + $tc = new TaskCreationModel($this->container); + $tf = new TaskFinderModel($this->container); + $p = new ProjectModel($this->container); + $s = new SubtaskModel($this->container); + $c = new CommentModel($this->container); $this->assertNotFalse($u->create(array('username' => 'toto', 'password' => '123456', 'name' => 'Toto'))); $this->assertEquals(1, $p->create(array('name' => 'Project #1'))); @@ -355,7 +355,7 @@ class UserTest extends Base public function testEnableDisablePublicAccess() { - $u = new User($this->container); + $u = new UserModel($this->container); $this->assertNotFalse($u->create(array('username' => 'toto', 'password' => '123456'))); $user = $u->getById(2); @@ -380,7 +380,7 @@ class UserTest extends Base public function testEnableDisable() { - $userModel = new User($this->container); + $userModel = new UserModel($this->container); $this->assertEquals(2, $userModel->create(array('username' => 'toto'))); $this->assertTrue($userModel->isActive(2)); diff --git a/tests/units/Model/UserUnreadNotificationTest.php b/tests/units/Model/UserUnreadNotificationTest.php index eb162a40..e6716e6c 100644 --- a/tests/units/Model/UserUnreadNotificationTest.php +++ b/tests/units/Model/UserUnreadNotificationTest.php @@ -2,42 +2,42 @@ require_once __DIR__.'/../Base.php'; -use Kanboard\Model\TaskFinder; -use Kanboard\Model\TaskCreation; -use Kanboard\Model\Task; -use Kanboard\Model\Project; -use Kanboard\Model\UserUnreadNotification; +use Kanboard\Model\TaskFinderModel; +use Kanboard\Model\TaskCreationModel; +use Kanboard\Model\TaskModel; +use Kanboard\Model\ProjectModel; +use Kanboard\Model\UserUnreadNotificationModel; class UserUnreadNotificationTest extends Base { public function testHasNotification() { - $wn = new UserUnreadNotification($this->container); - $p = new Project($this->container); - $tf = new TaskFinder($this->container); - $tc = new TaskCreation($this->container); + $wn = new UserUnreadNotificationModel($this->container); + $p = new ProjectModel($this->container); + $tf = new TaskFinderModel($this->container); + $tc = new TaskCreationModel($this->container); $this->assertEquals(1, $p->create(array('name' => 'test'))); $this->assertEquals(1, $tc->create(array('title' => 'test', 'project_id' => 1))); $this->assertFalse($wn->hasNotifications(1)); - $wn->create(1, Task::EVENT_CREATE, array('task' => $tf->getDetails(1))); + $wn->create(1, TaskModel::EVENT_CREATE, array('task' => $tf->getDetails(1))); $this->assertTrue($wn->hasNotifications(1)); } public function testMarkAllAsRead() { - $wn = new UserUnreadNotification($this->container); - $p = new Project($this->container); - $tf = new TaskFinder($this->container); - $tc = new TaskCreation($this->container); + $wn = new UserUnreadNotificationModel($this->container); + $p = new ProjectModel($this->container); + $tf = new TaskFinderModel($this->container); + $tc = new TaskCreationModel($this->container); $this->assertEquals(1, $p->create(array('name' => 'test'))); $this->assertEquals(1, $tc->create(array('title' => 'test', 'project_id' => 1))); - $wn->create(1, Task::EVENT_CREATE, array('task' => $tf->getDetails(1))); + $wn->create(1, TaskModel::EVENT_CREATE, array('task' => $tf->getDetails(1))); $this->assertTrue($wn->hasNotifications(1)); $this->assertTrue($wn->markAllAsRead(1)); @@ -48,15 +48,15 @@ class UserUnreadNotificationTest extends Base public function testMarkAsRead() { - $wn = new UserUnreadNotification($this->container); - $p = new Project($this->container); - $tf = new TaskFinder($this->container); - $tc = new TaskCreation($this->container); + $wn = new UserUnreadNotificationModel($this->container); + $p = new ProjectModel($this->container); + $tf = new TaskFinderModel($this->container); + $tc = new TaskCreationModel($this->container); $this->assertEquals(1, $p->create(array('name' => 'test'))); $this->assertEquals(1, $tc->create(array('title' => 'test', 'project_id' => 1))); - $wn->create(1, Task::EVENT_CREATE, array('task' => $tf->getDetails(1))); + $wn->create(1, TaskModel::EVENT_CREATE, array('task' => $tf->getDetails(1))); $this->assertTrue($wn->hasNotifications(1)); @@ -69,16 +69,16 @@ class UserUnreadNotificationTest extends Base public function testGetAll() { - $wn = new UserUnreadNotification($this->container); - $p = new Project($this->container); - $tf = new TaskFinder($this->container); - $tc = new TaskCreation($this->container); + $wn = new UserUnreadNotificationModel($this->container); + $p = new ProjectModel($this->container); + $tf = new TaskFinderModel($this->container); + $tc = new TaskCreationModel($this->container); $this->assertEquals(1, $p->create(array('name' => 'test'))); $this->assertEquals(1, $tc->create(array('title' => 'test', 'project_id' => 1))); - $wn->create(1, Task::EVENT_CREATE, array('task' => $tf->getDetails(1))); - $wn->create(1, Task::EVENT_CREATE, array('task' => $tf->getDetails(1))); + $wn->create(1, TaskModel::EVENT_CREATE, array('task' => $tf->getDetails(1))); + $wn->create(1, TaskModel::EVENT_CREATE, array('task' => $tf->getDetails(1))); $this->assertEmpty($wn->getAll(2)); @@ -90,16 +90,16 @@ class UserUnreadNotificationTest extends Base public function testGetOne() { - $wn = new UserUnreadNotification($this->container); - $p = new Project($this->container); - $tf = new TaskFinder($this->container); - $tc = new TaskCreation($this->container); + $wn = new UserUnreadNotificationModel($this->container); + $p = new ProjectModel($this->container); + $tf = new TaskFinderModel($this->container); + $tc = new TaskCreationModel($this->container); $this->assertEquals(1, $p->create(array('name' => 'test'))); $this->assertEquals(1, $tc->create(array('title' => 'test', 'project_id' => 1))); - $wn->create(1, Task::EVENT_CREATE, array('task' => $tf->getDetails(1))); - $wn->create(1, Task::EVENT_CREATE, array('task' => $tf->getDetails(1))); + $wn->create(1, TaskModel::EVENT_CREATE, array('task' => $tf->getDetails(1))); + $wn->create(1, TaskModel::EVENT_CREATE, array('task' => $tf->getDetails(1))); $this->assertEmpty($wn->getAll(2)); diff --git a/tests/units/Notification/MailTest.php b/tests/units/Notification/MailTest.php index 8d32b497..9f077ac8 100644 --- a/tests/units/Notification/MailTest.php +++ b/tests/units/Notification/MailTest.php @@ -2,14 +2,14 @@ require_once __DIR__.'/../Base.php'; -use Kanboard\Model\TaskFinder; -use Kanboard\Model\TaskCreation; -use Kanboard\Model\Subtask; -use Kanboard\Model\Comment; -use Kanboard\Model\User; -use Kanboard\Model\TaskFile; -use Kanboard\Model\Project; -use Kanboard\Model\Task; +use Kanboard\Model\TaskFinderModel; +use Kanboard\Model\TaskCreationModel; +use Kanboard\Model\SubtaskModel; +use Kanboard\Model\CommentModel; +use Kanboard\Model\UserModel; +use Kanboard\Model\TaskFileModel; +use Kanboard\Model\ProjectModel; +use Kanboard\Model\TaskModel; use Kanboard\Notification\MailNotification; use Kanboard\Subscriber\NotificationSubscriber; @@ -18,12 +18,12 @@ class MailTest extends Base public function testGetMailContent() { $en = new MailNotification($this->container); - $p = new Project($this->container); - $tf = new TaskFinder($this->container); - $tc = new TaskCreation($this->container); - $s = new Subtask($this->container); - $c = new Comment($this->container); - $f = new TaskFile($this->container); + $p = new ProjectModel($this->container); + $tf = new TaskFinderModel($this->container); + $tc = new TaskCreationModel($this->container); + $s = new SubtaskModel($this->container); + $c = new CommentModel($this->container); + $f = new TaskFileModel($this->container); $this->assertEquals(1, $p->create(array('name' => 'test'))); $this->assertEquals(1, $tc->create(array('title' => 'test', 'project_id' => 1))); @@ -63,10 +63,10 @@ class MailTest extends Base public function testSendWithEmailAddress() { $en = new MailNotification($this->container); - $p = new Project($this->container); - $tf = new TaskFinder($this->container); - $tc = new TaskCreation($this->container); - $u = new User($this->container); + $p = new ProjectModel($this->container); + $tf = new TaskFinderModel($this->container); + $tc = new TaskCreationModel($this->container); + $u = new UserModel($this->container); $this->assertEquals(1, $p->create(array('name' => 'test'))); $this->assertEquals(1, $tc->create(array('title' => 'test', 'project_id' => 1))); @@ -88,16 +88,16 @@ class MailTest extends Base $this->stringContains('test') ); - $en->notifyUser($u->getById(1), Task::EVENT_CREATE, array('task' => $tf->getDetails(1))); + $en->notifyUser($u->getById(1), TaskModel::EVENT_CREATE, array('task' => $tf->getDetails(1))); } public function testSendWithoutEmailAddress() { $en = new MailNotification($this->container); - $p = new Project($this->container); - $tf = new TaskFinder($this->container); - $tc = new TaskCreation($this->container); - $u = new User($this->container); + $p = new ProjectModel($this->container); + $tf = new TaskFinderModel($this->container); + $tc = new TaskCreationModel($this->container); + $u = new UserModel($this->container); $this->assertEquals(1, $p->create(array('name' => 'test'))); $this->assertEquals(1, $tc->create(array('title' => 'test', 'project_id' => 1))); @@ -112,6 +112,6 @@ class MailTest extends Base ->expects($this->never()) ->method('send'); - $en->notifyUser($u->getById(1), Task::EVENT_CREATE, array('task' => $tf->getDetails(1))); + $en->notifyUser($u->getById(1), TaskModel::EVENT_CREATE, array('task' => $tf->getDetails(1))); } } diff --git a/tests/units/Notification/WebhookTest.php b/tests/units/Notification/WebhookTest.php index 5984f303..5a9eb1c7 100644 --- a/tests/units/Notification/WebhookTest.php +++ b/tests/units/Notification/WebhookTest.php @@ -2,18 +2,18 @@ require_once __DIR__.'/../Base.php'; -use Kanboard\Model\Config; -use Kanboard\Model\TaskCreation; -use Kanboard\Model\Project; +use Kanboard\Model\ConfigModel; +use Kanboard\Model\TaskCreationModel; +use Kanboard\Model\ProjectModel; use Kanboard\Subscriber\NotificationSubscriber; class WebhookTest extends Base { public function testTaskCreation() { - $c = new Config($this->container); - $p = new Project($this->container); - $tc = new TaskCreation($this->container); + $c = new ConfigModel($this->container); + $p = new ProjectModel($this->container); + $tc = new TaskCreationModel($this->container); $this->container['dispatcher']->addSubscriber(new NotificationSubscriber($this->container)); $c->save(array('webhook_url' => 'http://localhost/?task-creation')); diff --git a/tests/units/Subscriber/LdapUserPhotoSubscriberTest.php b/tests/units/Subscriber/LdapUserPhotoSubscriberTest.php index df44d232..41f40844 100644 --- a/tests/units/Subscriber/LdapUserPhotoSubscriberTest.php +++ b/tests/units/Subscriber/LdapUserPhotoSubscriberTest.php @@ -2,7 +2,7 @@ use Kanboard\Core\Security\Role; use Kanboard\Event\UserProfileSyncEvent; -use Kanboard\Model\User; +use Kanboard\Model\UserModel; use Kanboard\Subscriber\LdapUserPhotoSubscriber; use Kanboard\User\DatabaseUserProvider; use Kanboard\User\LdapUserProvider; @@ -15,7 +15,7 @@ class LdapUserPhotoSubscriberTest extends Base { $userProvider = new DatabaseUserProvider(array()); $subscriber = new LdapUserPhotoSubscriber($this->container); - $userModel = new User($this->container); + $userModel = new UserModel($this->container); $userModel->update(array('id' => 1, 'avatar_path' => 'my avatar')); $user = $userModel->getById(1); @@ -30,7 +30,7 @@ class LdapUserPhotoSubscriberTest extends Base { $userProvider = new LdapUserProvider('dn', 'admin', 'Admin', 'admin@localhost', Role::APP_ADMIN, array(), 'my photo'); $subscriber = new LdapUserPhotoSubscriber($this->container); - $userModel = new User($this->container); + $userModel = new UserModel($this->container); $user = $userModel->getById(1); $this->container['objectStorage'] @@ -49,7 +49,7 @@ class LdapUserPhotoSubscriberTest extends Base { $userProvider = new LdapUserProvider('dn', 'admin', 'Admin', 'admin@localhost', Role::APP_ADMIN, array()); $subscriber = new LdapUserPhotoSubscriber($this->container); - $userModel = new User($this->container); + $userModel = new UserModel($this->container); $user = $userModel->getById(1); $this->container['objectStorage'] @@ -66,7 +66,7 @@ class LdapUserPhotoSubscriberTest extends Base { $userProvider = new LdapUserProvider('dn', 'admin', 'Admin', 'admin@localhost', Role::APP_ADMIN, array(), 'my photo'); $subscriber = new LdapUserPhotoSubscriber($this->container); - $userModel = new User($this->container); + $userModel = new UserModel($this->container); $userModel->update(array('id' => 1, 'avatar_path' => 'my avatar')); $user = $userModel->getById(1); diff --git a/tests/units/Validator/ProjectValidatorTest.php b/tests/units/Validator/ProjectValidatorTest.php index a73e8247..07de6c25 100644 --- a/tests/units/Validator/ProjectValidatorTest.php +++ b/tests/units/Validator/ProjectValidatorTest.php @@ -3,14 +3,14 @@ require_once __DIR__.'/../Base.php'; use Kanboard\Validator\ProjectValidator; -use Kanboard\Model\Project; +use Kanboard\Model\ProjectModel; class ProjectValidatorTest extends Base { public function testValidateCreation() { $validator = new ProjectValidator($this->container); - $p = new Project($this->container); + $p = new ProjectModel($this->container); $this->assertEquals(1, $p->create(array('name' => 'UnitTest1', 'identifier' => 'test1'))); $this->assertEquals(2, $p->create(array('name' => 'UnitTest2'))); @@ -39,7 +39,7 @@ class ProjectValidatorTest extends Base public function testValidateModification() { $validator = new ProjectValidator($this->container); - $p = new Project($this->container); + $p = new ProjectModel($this->container); $this->assertEquals(1, $p->create(array('name' => 'UnitTest1', 'identifier' => 'test1'))); $this->assertEquals(2, $p->create(array('name' => 'UnitTest2', 'identifier' => 'TEST2'))); diff --git a/tests/units/Validator/TaskLinkValidatorTest.php b/tests/units/Validator/TaskLinkValidatorTest.php index 5ac4588e..5fc50e3e 100644 --- a/tests/units/Validator/TaskLinkValidatorTest.php +++ b/tests/units/Validator/TaskLinkValidatorTest.php @@ -3,18 +3,18 @@ require_once __DIR__.'/../Base.php'; use Kanboard\Validator\TaskLinkValidator; -use Kanboard\Model\TaskLink; -use Kanboard\Model\TaskCreation; -use Kanboard\Model\Project; +use Kanboard\Model\TaskLinkModel; +use Kanboard\Model\TaskCreationModel; +use Kanboard\Model\ProjectModel; class TaskLinkValidatorTest extends Base { public function testValidateCreation() { $validator = new TaskLinkValidator($this->container); - $tl = new TaskLink($this->container); - $p = new Project($this->container); - $tc = new TaskCreation($this->container); + $tl = new TaskLinkModel($this->container); + $p = new ProjectModel($this->container); + $tc = new TaskCreationModel($this->container); $this->assertEquals(1, $p->create(array('name' => 'test'))); $this->assertEquals(1, $tc->create(array('project_id' => 1, 'title' => 'A'))); @@ -46,8 +46,8 @@ class TaskLinkValidatorTest extends Base public function testValidateModification() { $validator = new TaskLinkValidator($this->container); - $p = new Project($this->container); - $tc = new TaskCreation($this->container); + $p = new ProjectModel($this->container); + $tc = new TaskCreationModel($this->container); $this->assertEquals(1, $p->create(array('name' => 'test'))); $this->assertEquals(1, $tc->create(array('project_id' => 1, 'title' => 'A'))); |