summaryrefslogtreecommitdiff
path: root/tests/units/Model
diff options
context:
space:
mode:
authorFrederic Guillot <fred@kanboard.net>2016-05-28 19:48:22 -0400
committerFrederic Guillot <fred@kanboard.net>2016-05-28 19:48:22 -0400
commit14713b0ec7ed93ca45578da069ad4e19a7d8addf (patch)
tree79972d53f6091a1ddb17f64a6a05a5523f5d5168 /tests/units/Model
parent936376ffe74c583d3cb819e98f53a85137fdf8bc (diff)
Rename all models
Diffstat (limited to 'tests/units/Model')
-rw-r--r--tests/units/Model/ActionTest.php176
-rw-r--r--tests/units/Model/BoardTest.php34
-rw-r--r--tests/units/Model/CategoryTest.php64
-rw-r--r--tests/units/Model/ColorTest.php22
-rw-r--r--tests/units/Model/ColumnTest.php52
-rw-r--r--tests/units/Model/CommentTest.php30
-rw-r--r--tests/units/Model/ConfigTest.php14
-rw-r--r--tests/units/Model/CurrencyTest.php12
-rw-r--r--tests/units/Model/CustomFilterTest.php24
-rw-r--r--tests/units/Model/GroupMemberTest.php16
-rw-r--r--tests/units/Model/GroupTest.php12
-rw-r--r--tests/units/Model/LanguageTest.php16
-rw-r--r--tests/units/Model/LastLoginTest.php6
-rw-r--r--tests/units/Model/LinkTest.php14
-rw-r--r--tests/units/Model/NotificationTest.php32
-rw-r--r--tests/units/Model/PasswordResetTest.php24
-rw-r--r--tests/units/Model/ProjectActivityTest.php38
-rw-r--r--tests/units/Model/ProjectDailyColumnStatsTest.php44
-rw-r--r--tests/units/Model/ProjectDailyStatsTest.php16
-rw-r--r--tests/units/Model/ProjectDuplicationTest.php168
-rw-r--r--tests/units/Model/ProjectFileTest.php42
-rw-r--r--tests/units/Model/ProjectGroupRoleTest.php128
-rw-r--r--tests/units/Model/ProjectMetadataTest.php16
-rw-r--r--tests/units/Model/ProjectNotificationTypeTest.php10
-rw-r--r--tests/units/Model/ProjectPermissionTest.php112
-rw-r--r--tests/units/Model/ProjectTest.php58
-rw-r--r--tests/units/Model/ProjectUserRoleTest.php150
-rw-r--r--tests/units/Model/SubtaskTest.php108
-rw-r--r--tests/units/Model/SubtaskTimeTrackingTest.php70
-rw-r--r--tests/units/Model/SwimlaneTest.php56
-rw-r--r--tests/units/Model/TaskCreationTest.php150
-rw-r--r--tests/units/Model/TaskDuplicationTest.php254
-rw-r--r--tests/units/Model/TaskExternalLinkTest.php36
-rw-r--r--tests/units/Model/TaskFileTest.php90
-rw-r--r--tests/units/Model/TaskFinderTest.php36
-rw-r--r--tests/units/Model/TaskLinkTest.php46
-rw-r--r--tests/units/Model/TaskMetadataTest.php12
-rw-r--r--tests/units/Model/TaskModificationTest.php114
-rw-r--r--tests/units/Model/TaskPositionTest.php118
-rw-r--r--tests/units/Model/TaskStatusTest.php52
-rw-r--r--tests/units/Model/TaskTest.php38
-rw-r--r--tests/units/Model/TimezoneTest.php6
-rw-r--r--tests/units/Model/TransitionTest.php24
-rw-r--r--tests/units/Model/UserLockingTest.php8
-rw-r--r--tests/units/Model/UserMentionTest.php58
-rw-r--r--tests/units/Model/UserMetadataTest.php8
-rw-r--r--tests/units/Model/UserNotificationFilterTest.php112
-rw-r--r--tests/units/Model/UserNotificationTest.php102
-rw-r--r--tests/units/Model/UserNotificationTypeTest.php6
-rw-r--r--tests/units/Model/UserTest.php66
-rw-r--r--tests/units/Model/UserUnreadNotificationTest.php64
51 files changed, 1482 insertions, 1482 deletions
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));