Rename all models
This commit is contained in:
@@ -3,10 +3,10 @@
|
||||
require_once __DIR__.'/../Base.php';
|
||||
|
||||
use Kanboard\Event\GenericEvent;
|
||||
use Kanboard\Model\Task;
|
||||
use Kanboard\Model\TaskCreation;
|
||||
use Kanboard\Model\Comment;
|
||||
use Kanboard\Model\Project;
|
||||
use Kanboard\Model\TaskModel;
|
||||
use Kanboard\Model\TaskCreationModel;
|
||||
use Kanboard\Model\CommentModel;
|
||||
use Kanboard\Model\ProjectModel;
|
||||
use Kanboard\Action\CommentCreationMoveTaskColumn;
|
||||
|
||||
class CommentCreationMoveTaskColumnTest extends Base
|
||||
@@ -15,9 +15,9 @@ class CommentCreationMoveTaskColumnTest extends Base
|
||||
{
|
||||
$this->container['sessionStorage']->user = array('id' => 1);
|
||||
|
||||
$projectModel = new Project($this->container);
|
||||
$commentModel = new Comment($this->container);
|
||||
$taskCreationModel = new TaskCreation($this->container);
|
||||
$projectModel = new ProjectModel($this->container);
|
||||
$commentModel = new CommentModel($this->container);
|
||||
$taskCreationModel = new TaskCreationModel($this->container);
|
||||
|
||||
$this->assertEquals(1, $projectModel->create(array('name' => 'test1')));
|
||||
$this->assertEquals(1, $taskCreationModel->create(array('project_id' => 1, 'title' => 'test')));
|
||||
@@ -28,7 +28,7 @@ class CommentCreationMoveTaskColumnTest extends Base
|
||||
$action->setProjectId(1);
|
||||
$action->setParam('column_id', 2);
|
||||
|
||||
$this->assertTrue($action->execute($event, Task::EVENT_MOVE_COLUMN));
|
||||
$this->assertTrue($action->execute($event, TaskModel::EVENT_MOVE_COLUMN));
|
||||
|
||||
$comment = $commentModel->getById(1);
|
||||
$this->assertNotEmpty($comment);
|
||||
@@ -39,8 +39,8 @@ class CommentCreationMoveTaskColumnTest extends Base
|
||||
|
||||
public function testWithUserNotLogged()
|
||||
{
|
||||
$projectModel = new Project($this->container);
|
||||
$taskCreationModel = new TaskCreation($this->container);
|
||||
$projectModel = new ProjectModel($this->container);
|
||||
$taskCreationModel = new TaskCreationModel($this->container);
|
||||
|
||||
$this->assertEquals(1, $projectModel->create(array('name' => 'test1')));
|
||||
$this->assertEquals(1, $taskCreationModel->create(array('project_id' => 1, 'title' => 'test')));
|
||||
@@ -51,6 +51,6 @@ class CommentCreationMoveTaskColumnTest extends Base
|
||||
$action->setProjectId(1);
|
||||
$action->setParam('column_id', 2);
|
||||
|
||||
$this->assertFalse($action->execute($event, Task::EVENT_MOVE_COLUMN));
|
||||
$this->assertFalse($action->execute($event, TaskModel::EVENT_MOVE_COLUMN));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,11 +3,11 @@
|
||||
require_once __DIR__.'/../Base.php';
|
||||
|
||||
use Kanboard\Event\GenericEvent;
|
||||
use Kanboard\Model\TaskCreation;
|
||||
use Kanboard\Model\Comment;
|
||||
use Kanboard\Model\Project;
|
||||
use Kanboard\Model\ProjectUserRole;
|
||||
use Kanboard\Model\User;
|
||||
use Kanboard\Model\TaskCreationModel;
|
||||
use Kanboard\Model\CommentModel;
|
||||
use Kanboard\Model\ProjectModel;
|
||||
use Kanboard\Model\ProjectUserRoleModel;
|
||||
use Kanboard\Model\UserModel;
|
||||
use Kanboard\Action\CommentCreation;
|
||||
use Kanboard\Core\Security\Role;
|
||||
|
||||
@@ -15,11 +15,11 @@ class CommentCreationTest extends Base
|
||||
{
|
||||
public function testSuccess()
|
||||
{
|
||||
$userModel = new User($this->container);
|
||||
$projectModel = new Project($this->container);
|
||||
$projectUserRoleModel = new ProjectUserRole($this->container);
|
||||
$commentModel = new Comment($this->container);
|
||||
$taskCreationModel = new TaskCreation($this->container);
|
||||
$userModel = new UserModel($this->container);
|
||||
$projectModel = new ProjectModel($this->container);
|
||||
$projectUserRoleModel = new ProjectUserRoleModel($this->container);
|
||||
$commentModel = new CommentModel($this->container);
|
||||
$taskCreationModel = new TaskCreationModel($this->container);
|
||||
|
||||
$this->assertEquals(1, $projectModel->create(array('name' => 'test1')));
|
||||
$this->assertEquals(1, $taskCreationModel->create(array('project_id' => 1, 'title' => 'test')));
|
||||
@@ -44,10 +44,10 @@ class CommentCreationTest extends Base
|
||||
|
||||
public function testWithUserNotAssignable()
|
||||
{
|
||||
$userModel = new User($this->container);
|
||||
$projectModel = new Project($this->container);
|
||||
$commentModel = new Comment($this->container);
|
||||
$taskCreationModel = new TaskCreation($this->container);
|
||||
$userModel = new UserModel($this->container);
|
||||
$projectModel = new ProjectModel($this->container);
|
||||
$commentModel = new CommentModel($this->container);
|
||||
$taskCreationModel = new TaskCreationModel($this->container);
|
||||
|
||||
$this->assertEquals(1, $projectModel->create(array('name' => 'test1')));
|
||||
$this->assertEquals(1, $taskCreationModel->create(array('project_id' => 1, 'title' => 'test')));
|
||||
@@ -71,9 +71,9 @@ class CommentCreationTest extends Base
|
||||
|
||||
public function testWithNoComment()
|
||||
{
|
||||
$userModel = new User($this->container);
|
||||
$projectModel = new Project($this->container);
|
||||
$taskCreationModel = new TaskCreation($this->container);
|
||||
$userModel = new UserModel($this->container);
|
||||
$projectModel = new ProjectModel($this->container);
|
||||
$taskCreationModel = new TaskCreationModel($this->container);
|
||||
|
||||
$this->assertEquals(1, $projectModel->create(array('name' => 'test1')));
|
||||
$this->assertEquals(1, $taskCreationModel->create(array('project_id' => 1, 'title' => 'test')));
|
||||
|
||||
@@ -3,21 +3,21 @@
|
||||
require_once __DIR__.'/../Base.php';
|
||||
|
||||
use Kanboard\Event\GenericEvent;
|
||||
use Kanboard\Model\Category;
|
||||
use Kanboard\Model\TaskCreation;
|
||||
use Kanboard\Model\TaskFinder;
|
||||
use Kanboard\Model\Project;
|
||||
use Kanboard\Model\Task;
|
||||
use Kanboard\Model\CategoryModel;
|
||||
use Kanboard\Model\TaskCreationModel;
|
||||
use Kanboard\Model\TaskFinderModel;
|
||||
use Kanboard\Model\ProjectModel;
|
||||
use Kanboard\Model\TaskModel;
|
||||
use Kanboard\Action\TaskAssignCategoryColor;
|
||||
|
||||
class TaskAssignCategoryColorTest extends Base
|
||||
{
|
||||
public function testChangeCategory()
|
||||
{
|
||||
$categoryModel = new Category($this->container);
|
||||
$projectModel = new Project($this->container);
|
||||
$taskCreationModel = new TaskCreation($this->container);
|
||||
$taskFinderModel = new TaskFinder($this->container);
|
||||
$categoryModel = new CategoryModel($this->container);
|
||||
$projectModel = new ProjectModel($this->container);
|
||||
$taskCreationModel = new TaskCreationModel($this->container);
|
||||
$taskFinderModel = new TaskFinderModel($this->container);
|
||||
|
||||
$this->assertEquals(1, $projectModel->create(array('name' => 'test1')));
|
||||
$this->assertEquals(1, $taskCreationModel->create(array('project_id' => 1, 'title' => 'test')));
|
||||
@@ -30,7 +30,7 @@ class TaskAssignCategoryColorTest extends Base
|
||||
$action->setParam('color_id', 'red');
|
||||
$action->setParam('category_id', 1);
|
||||
|
||||
$this->assertTrue($action->execute($event, Task::EVENT_CREATE_UPDATE));
|
||||
$this->assertTrue($action->execute($event, TaskModel::EVENT_CREATE_UPDATE));
|
||||
|
||||
$task = $taskFinderModel->getById(1);
|
||||
$this->assertNotEmpty($task);
|
||||
@@ -39,9 +39,9 @@ class TaskAssignCategoryColorTest extends Base
|
||||
|
||||
public function testWithWrongColor()
|
||||
{
|
||||
$categoryModel = new Category($this->container);
|
||||
$projectModel = new Project($this->container);
|
||||
$taskCreationModel = new TaskCreation($this->container);
|
||||
$categoryModel = new CategoryModel($this->container);
|
||||
$projectModel = new ProjectModel($this->container);
|
||||
$taskCreationModel = new TaskCreationModel($this->container);
|
||||
|
||||
$this->assertEquals(1, $projectModel->create(array('name' => 'test1')));
|
||||
$this->assertEquals(1, $taskCreationModel->create(array('project_id' => 1, 'title' => 'test')));
|
||||
@@ -54,6 +54,6 @@ class TaskAssignCategoryColorTest extends Base
|
||||
$action->setParam('color_id', 'red');
|
||||
$action->setParam('category_id', 1);
|
||||
|
||||
$this->assertFalse($action->execute($event, Task::EVENT_CREATE_UPDATE));
|
||||
$this->assertFalse($action->execute($event, TaskModel::EVENT_CREATE_UPDATE));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,20 +3,20 @@
|
||||
require_once __DIR__.'/../Base.php';
|
||||
|
||||
use Kanboard\Event\GenericEvent;
|
||||
use Kanboard\Model\Category;
|
||||
use Kanboard\Model\TaskCreation;
|
||||
use Kanboard\Model\TaskFinder;
|
||||
use Kanboard\Model\Project;
|
||||
use Kanboard\Model\CategoryModel;
|
||||
use Kanboard\Model\TaskCreationModel;
|
||||
use Kanboard\Model\TaskFinderModel;
|
||||
use Kanboard\Model\ProjectModel;
|
||||
use Kanboard\Action\TaskAssignCategoryLabel;
|
||||
|
||||
class TaskAssignCategoryLabelTest extends Base
|
||||
{
|
||||
public function testChangeCategory()
|
||||
{
|
||||
$categoryModel = new Category($this->container);
|
||||
$projectModel = new Project($this->container);
|
||||
$taskCreationModel = new TaskCreation($this->container);
|
||||
$taskFinderModel = new TaskFinder($this->container);
|
||||
$categoryModel = new CategoryModel($this->container);
|
||||
$projectModel = new ProjectModel($this->container);
|
||||
$taskCreationModel = new TaskCreationModel($this->container);
|
||||
$taskFinderModel = new TaskFinderModel($this->container);
|
||||
|
||||
$this->assertEquals(1, $projectModel->create(array('name' => 'test1')));
|
||||
$this->assertEquals(1, $taskCreationModel->create(array('project_id' => 1, 'title' => 'test')));
|
||||
@@ -39,9 +39,9 @@ class TaskAssignCategoryLabelTest extends Base
|
||||
|
||||
public function testWithWrongLabel()
|
||||
{
|
||||
$categoryModel = new Category($this->container);
|
||||
$projectModel = new Project($this->container);
|
||||
$taskCreationModel = new TaskCreation($this->container);
|
||||
$categoryModel = new CategoryModel($this->container);
|
||||
$projectModel = new ProjectModel($this->container);
|
||||
$taskCreationModel = new TaskCreationModel($this->container);
|
||||
|
||||
$this->assertEquals(1, $projectModel->create(array('name' => 'test1')));
|
||||
$this->assertEquals(1, $taskCreationModel->create(array('project_id' => 1, 'title' => 'test')));
|
||||
@@ -60,9 +60,9 @@ class TaskAssignCategoryLabelTest extends Base
|
||||
|
||||
public function testWithExistingCategory()
|
||||
{
|
||||
$categoryModel = new Category($this->container);
|
||||
$projectModel = new Project($this->container);
|
||||
$taskCreationModel = new TaskCreation($this->container);
|
||||
$categoryModel = new CategoryModel($this->container);
|
||||
$projectModel = new ProjectModel($this->container);
|
||||
$taskCreationModel = new TaskCreationModel($this->container);
|
||||
|
||||
$this->assertEquals(1, $projectModel->create(array('name' => 'test1')));
|
||||
$this->assertEquals(1, $categoryModel->create(array('name' => 'c1', 'project_id' => 1)));
|
||||
|
||||
@@ -2,11 +2,11 @@
|
||||
|
||||
require_once __DIR__.'/../Base.php';
|
||||
|
||||
use Kanboard\Model\TaskCreation;
|
||||
use Kanboard\Model\TaskFinder;
|
||||
use Kanboard\Model\Project;
|
||||
use Kanboard\Model\TaskLink;
|
||||
use Kanboard\Model\Category;
|
||||
use Kanboard\Model\TaskCreationModel;
|
||||
use Kanboard\Model\TaskFinderModel;
|
||||
use Kanboard\Model\ProjectModel;
|
||||
use Kanboard\Model\TaskLinkModel;
|
||||
use Kanboard\Model\CategoryModel;
|
||||
use Kanboard\Event\TaskLinkEvent;
|
||||
use Kanboard\Action\TaskAssignCategoryLink;
|
||||
|
||||
@@ -14,10 +14,10 @@ class TaskAssignCategoryLinkTest extends Base
|
||||
{
|
||||
public function testAssignCategory()
|
||||
{
|
||||
$tc = new TaskCreation($this->container);
|
||||
$tf = new TaskFinder($this->container);
|
||||
$p = new Project($this->container);
|
||||
$c = new Category($this->container);
|
||||
$tc = new TaskCreationModel($this->container);
|
||||
$tf = new TaskFinderModel($this->container);
|
||||
$p = new ProjectModel($this->container);
|
||||
$c = new CategoryModel($this->container);
|
||||
|
||||
$action = new TaskAssignCategoryLink($this->container);
|
||||
$action->setProjectId(1);
|
||||
@@ -35,7 +35,7 @@ class TaskAssignCategoryLinkTest extends Base
|
||||
'link_id' => 2,
|
||||
));
|
||||
|
||||
$this->assertTrue($action->execute($event, TaskLink::EVENT_CREATE_UPDATE));
|
||||
$this->assertTrue($action->execute($event, TaskLinkModel::EVENT_CREATE_UPDATE));
|
||||
|
||||
$task = $tf->getById(1);
|
||||
$this->assertEquals(1, $task['category_id']);
|
||||
@@ -43,10 +43,10 @@ class TaskAssignCategoryLinkTest extends Base
|
||||
|
||||
public function testWhenLinkDontMatch()
|
||||
{
|
||||
$tc = new TaskCreation($this->container);
|
||||
$tf = new TaskFinder($this->container);
|
||||
$p = new Project($this->container);
|
||||
$c = new Category($this->container);
|
||||
$tc = new TaskCreationModel($this->container);
|
||||
$tf = new TaskFinderModel($this->container);
|
||||
$p = new ProjectModel($this->container);
|
||||
$c = new CategoryModel($this->container);
|
||||
|
||||
$action = new TaskAssignCategoryLink($this->container);
|
||||
$action->setProjectId(1);
|
||||
@@ -64,14 +64,14 @@ class TaskAssignCategoryLinkTest extends Base
|
||||
'link_id' => 2,
|
||||
));
|
||||
|
||||
$this->assertFalse($action->execute($event, TaskLink::EVENT_CREATE_UPDATE));
|
||||
$this->assertFalse($action->execute($event, TaskLinkModel::EVENT_CREATE_UPDATE));
|
||||
}
|
||||
|
||||
public function testThatExistingCategoryWillNotChange()
|
||||
{
|
||||
$tc = new TaskCreation($this->container);
|
||||
$p = new Project($this->container);
|
||||
$c = new Category($this->container);
|
||||
$tc = new TaskCreationModel($this->container);
|
||||
$p = new ProjectModel($this->container);
|
||||
$c = new CategoryModel($this->container);
|
||||
|
||||
$action = new TaskAssignCategoryLink($this->container);
|
||||
$action->setProjectId(1);
|
||||
@@ -90,6 +90,6 @@ class TaskAssignCategoryLinkTest extends Base
|
||||
'link_id' => 2,
|
||||
));
|
||||
|
||||
$this->assertFalse($action->execute($event, TaskLink::EVENT_CREATE_UPDATE));
|
||||
$this->assertFalse($action->execute($event, TaskLinkModel::EVENT_CREATE_UPDATE));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,21 +3,21 @@
|
||||
require_once __DIR__.'/../Base.php';
|
||||
|
||||
use Kanboard\Event\GenericEvent;
|
||||
use Kanboard\Model\Category;
|
||||
use Kanboard\Model\TaskCreation;
|
||||
use Kanboard\Model\TaskFinder;
|
||||
use Kanboard\Model\Project;
|
||||
use Kanboard\Model\Task;
|
||||
use Kanboard\Model\CategoryModel;
|
||||
use Kanboard\Model\TaskCreationModel;
|
||||
use Kanboard\Model\TaskFinderModel;
|
||||
use Kanboard\Model\ProjectModel;
|
||||
use Kanboard\Model\TaskModel;
|
||||
use Kanboard\Action\TaskAssignColorCategory;
|
||||
|
||||
class TaskAssignColorCategoryTest extends Base
|
||||
{
|
||||
public function testChangeColor()
|
||||
{
|
||||
$categoryModel = new Category($this->container);
|
||||
$projectModel = new Project($this->container);
|
||||
$taskCreationModel = new TaskCreation($this->container);
|
||||
$taskFinderModel = new TaskFinder($this->container);
|
||||
$categoryModel = new CategoryModel($this->container);
|
||||
$projectModel = new ProjectModel($this->container);
|
||||
$taskCreationModel = new TaskCreationModel($this->container);
|
||||
$taskFinderModel = new TaskFinderModel($this->container);
|
||||
|
||||
$this->assertEquals(1, $projectModel->create(array('name' => 'test1')));
|
||||
$this->assertEquals(1, $taskCreationModel->create(array('project_id' => 1, 'title' => 'test')));
|
||||
@@ -30,7 +30,7 @@ class TaskAssignColorCategoryTest extends Base
|
||||
$action->setParam('color_id', 'red');
|
||||
$action->setParam('category_id', 1);
|
||||
|
||||
$this->assertTrue($action->execute($event, Task::EVENT_CREATE_UPDATE));
|
||||
$this->assertTrue($action->execute($event, TaskModel::EVENT_CREATE_UPDATE));
|
||||
|
||||
$task = $taskFinderModel->getById(1);
|
||||
$this->assertNotEmpty($task);
|
||||
@@ -39,8 +39,8 @@ class TaskAssignColorCategoryTest extends Base
|
||||
|
||||
public function testWithWrongCategory()
|
||||
{
|
||||
$projectModel = new Project($this->container);
|
||||
$taskCreationModel = new TaskCreation($this->container);
|
||||
$projectModel = new ProjectModel($this->container);
|
||||
$taskCreationModel = new TaskCreationModel($this->container);
|
||||
|
||||
$this->assertEquals(1, $projectModel->create(array('name' => 'test1')));
|
||||
$this->assertEquals(1, $taskCreationModel->create(array('project_id' => 1, 'title' => 'test')));
|
||||
@@ -52,6 +52,6 @@ class TaskAssignColorCategoryTest extends Base
|
||||
$action->setParam('color_id', 'red');
|
||||
$action->setParam('category_id', 1);
|
||||
|
||||
$this->assertFalse($action->execute($event, Task::EVENT_CREATE_UPDATE));
|
||||
$this->assertFalse($action->execute($event, TaskModel::EVENT_CREATE_UPDATE));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,19 +3,19 @@
|
||||
require_once __DIR__.'/../Base.php';
|
||||
|
||||
use Kanboard\Event\GenericEvent;
|
||||
use Kanboard\Model\TaskCreation;
|
||||
use Kanboard\Model\TaskFinder;
|
||||
use Kanboard\Model\Project;
|
||||
use Kanboard\Model\Task;
|
||||
use Kanboard\Model\TaskCreationModel;
|
||||
use Kanboard\Model\TaskFinderModel;
|
||||
use Kanboard\Model\ProjectModel;
|
||||
use Kanboard\Model\TaskModel;
|
||||
use Kanboard\Action\TaskAssignColorColumn;
|
||||
|
||||
class TaskAssignColorColumnTest extends Base
|
||||
{
|
||||
public function testChangeColumn()
|
||||
{
|
||||
$projectModel = new Project($this->container);
|
||||
$taskCreationModel = new TaskCreation($this->container);
|
||||
$taskFinderModel = new TaskFinder($this->container);
|
||||
$projectModel = new ProjectModel($this->container);
|
||||
$taskCreationModel = new TaskCreationModel($this->container);
|
||||
$taskFinderModel = new TaskFinderModel($this->container);
|
||||
|
||||
$this->assertEquals(1, $projectModel->create(array('name' => 'test1')));
|
||||
$this->assertEquals(1, $taskCreationModel->create(array('project_id' => 1, 'title' => 'test')));
|
||||
@@ -27,7 +27,7 @@ class TaskAssignColorColumnTest extends Base
|
||||
$action->setParam('color_id', 'red');
|
||||
$action->setParam('column_id', 2);
|
||||
|
||||
$this->assertTrue($action->execute($event, Task::EVENT_MOVE_COLUMN));
|
||||
$this->assertTrue($action->execute($event, TaskModel::EVENT_MOVE_COLUMN));
|
||||
|
||||
$task = $taskFinderModel->getById(1);
|
||||
$this->assertNotEmpty($task);
|
||||
@@ -36,8 +36,8 @@ class TaskAssignColorColumnTest extends Base
|
||||
|
||||
public function testWithWrongCategory()
|
||||
{
|
||||
$projectModel = new Project($this->container);
|
||||
$taskCreationModel = new TaskCreation($this->container);
|
||||
$projectModel = new ProjectModel($this->container);
|
||||
$taskCreationModel = new TaskCreationModel($this->container);
|
||||
|
||||
$this->assertEquals(1, $projectModel->create(array('name' => 'test1')));
|
||||
$this->assertEquals(1, $taskCreationModel->create(array('project_id' => 1, 'title' => 'test')));
|
||||
@@ -49,6 +49,6 @@ class TaskAssignColorColumnTest extends Base
|
||||
$action->setParam('color_id', 'red');
|
||||
$action->setParam('column_id', 2);
|
||||
|
||||
$this->assertFalse($action->execute($event, Task::EVENT_MOVE_COLUMN));
|
||||
$this->assertFalse($action->execute($event, TaskModel::EVENT_MOVE_COLUMN));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,19 +3,19 @@
|
||||
require_once __DIR__.'/../Base.php';
|
||||
|
||||
use Kanboard\Event\GenericEvent;
|
||||
use Kanboard\Model\TaskCreation;
|
||||
use Kanboard\Model\TaskFinder;
|
||||
use Kanboard\Model\Project;
|
||||
use Kanboard\Model\TaskLink;
|
||||
use Kanboard\Model\TaskCreationModel;
|
||||
use Kanboard\Model\TaskFinderModel;
|
||||
use Kanboard\Model\ProjectModel;
|
||||
use Kanboard\Model\TaskLinkModel;
|
||||
use Kanboard\Action\TaskAssignColorLink;
|
||||
|
||||
class TaskAssignColorLinkTest extends Base
|
||||
{
|
||||
public function testChangeColor()
|
||||
{
|
||||
$projectModel = new Project($this->container);
|
||||
$taskCreationModel = new TaskCreation($this->container);
|
||||
$taskFinderModel = new TaskFinder($this->container);
|
||||
$projectModel = new ProjectModel($this->container);
|
||||
$taskCreationModel = new TaskCreationModel($this->container);
|
||||
$taskFinderModel = new TaskFinderModel($this->container);
|
||||
|
||||
$this->assertEquals(1, $projectModel->create(array('name' => 'test1')));
|
||||
$this->assertEquals(1, $taskCreationModel->create(array('project_id' => 1, 'title' => 'test')));
|
||||
@@ -27,7 +27,7 @@ class TaskAssignColorLinkTest extends Base
|
||||
$action->setParam('color_id', 'red');
|
||||
$action->setParam('link_id', 1);
|
||||
|
||||
$this->assertTrue($action->execute($event, TaskLink::EVENT_CREATE_UPDATE));
|
||||
$this->assertTrue($action->execute($event, TaskLinkModel::EVENT_CREATE_UPDATE));
|
||||
|
||||
$task = $taskFinderModel->getById(1);
|
||||
$this->assertNotEmpty($task);
|
||||
@@ -36,8 +36,8 @@ class TaskAssignColorLinkTest extends Base
|
||||
|
||||
public function testWithWrongLink()
|
||||
{
|
||||
$projectModel = new Project($this->container);
|
||||
$taskCreationModel = new TaskCreation($this->container);
|
||||
$projectModel = new ProjectModel($this->container);
|
||||
$taskCreationModel = new TaskCreationModel($this->container);
|
||||
|
||||
$this->assertEquals(1, $projectModel->create(array('name' => 'test1')));
|
||||
$this->assertEquals(1, $taskCreationModel->create(array('project_id' => 1, 'title' => 'test')));
|
||||
@@ -49,6 +49,6 @@ class TaskAssignColorLinkTest extends Base
|
||||
$action->setParam('color_id', 'red');
|
||||
$action->setParam('link_id', 1);
|
||||
|
||||
$this->assertFalse($action->execute($event, TaskLink::EVENT_CREATE_UPDATE));
|
||||
$this->assertFalse($action->execute($event, TaskLinkModel::EVENT_CREATE_UPDATE));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,21 +3,21 @@
|
||||
require_once __DIR__.'/../Base.php';
|
||||
|
||||
use Kanboard\Event\GenericEvent;
|
||||
use Kanboard\Model\Category;
|
||||
use Kanboard\Model\TaskCreation;
|
||||
use Kanboard\Model\TaskFinder;
|
||||
use Kanboard\Model\Project;
|
||||
use Kanboard\Model\Task;
|
||||
use Kanboard\Model\CategoryModel;
|
||||
use Kanboard\Model\TaskCreationModel;
|
||||
use Kanboard\Model\TaskFinderModel;
|
||||
use Kanboard\Model\ProjectModel;
|
||||
use Kanboard\Model\TaskModel;
|
||||
use Kanboard\Action\TaskAssignColorPriority;
|
||||
|
||||
class TaskAssignColorPriorityTest extends Base
|
||||
{
|
||||
public function testChangeColor()
|
||||
{
|
||||
$categoryModel = new Category($this->container);
|
||||
$projectModel = new Project($this->container);
|
||||
$taskCreationModel = new TaskCreation($this->container);
|
||||
$taskFinderModel = new TaskFinder($this->container);
|
||||
$categoryModel = new CategoryModel($this->container);
|
||||
$projectModel = new ProjectModel($this->container);
|
||||
$taskCreationModel = new TaskCreationModel($this->container);
|
||||
$taskFinderModel = new TaskFinderModel($this->container);
|
||||
|
||||
$this->assertEquals(1, $projectModel->create(array('name' => 'test1')));
|
||||
$this->assertEquals(1, $taskCreationModel->create(array('project_id' => 1, 'title' => 'test')));
|
||||
@@ -30,7 +30,7 @@ class TaskAssignColorPriorityTest extends Base
|
||||
$action->setParam('color_id', 'red');
|
||||
$action->setParam('priority', 1);
|
||||
|
||||
$this->assertTrue($action->execute($event, Task::EVENT_CREATE_UPDATE));
|
||||
$this->assertTrue($action->execute($event, TaskModel::EVENT_CREATE_UPDATE));
|
||||
|
||||
$task = $taskFinderModel->getById(1);
|
||||
$this->assertNotEmpty($task);
|
||||
@@ -39,8 +39,8 @@ class TaskAssignColorPriorityTest extends Base
|
||||
|
||||
public function testWithWrongPriority()
|
||||
{
|
||||
$projectModel = new Project($this->container);
|
||||
$taskCreationModel = new TaskCreation($this->container);
|
||||
$projectModel = new ProjectModel($this->container);
|
||||
$taskCreationModel = new TaskCreationModel($this->container);
|
||||
|
||||
$this->assertEquals(1, $projectModel->create(array('name' => 'test1')));
|
||||
$this->assertEquals(1, $taskCreationModel->create(array('project_id' => 1, 'title' => 'test')));
|
||||
@@ -52,6 +52,6 @@ class TaskAssignColorPriorityTest extends Base
|
||||
$action->setParam('color_id', 'red');
|
||||
$action->setParam('priority', 1);
|
||||
|
||||
$this->assertFalse($action->execute($event, Task::EVENT_CREATE_UPDATE));
|
||||
$this->assertFalse($action->execute($event, TaskModel::EVENT_CREATE_UPDATE));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,19 +3,19 @@
|
||||
require_once __DIR__.'/../Base.php';
|
||||
|
||||
use Kanboard\Event\GenericEvent;
|
||||
use Kanboard\Model\TaskCreation;
|
||||
use Kanboard\Model\TaskFinder;
|
||||
use Kanboard\Model\Project;
|
||||
use Kanboard\Model\Task;
|
||||
use Kanboard\Model\TaskCreationModel;
|
||||
use Kanboard\Model\TaskFinderModel;
|
||||
use Kanboard\Model\ProjectModel;
|
||||
use Kanboard\Model\TaskModel;
|
||||
use Kanboard\Action\TaskAssignColorUser;
|
||||
|
||||
class TaskAssignColorUserTest extends Base
|
||||
{
|
||||
public function testChangeColor()
|
||||
{
|
||||
$projectModel = new Project($this->container);
|
||||
$taskCreationModel = new TaskCreation($this->container);
|
||||
$taskFinderModel = new TaskFinder($this->container);
|
||||
$projectModel = new ProjectModel($this->container);
|
||||
$taskCreationModel = new TaskCreationModel($this->container);
|
||||
$taskFinderModel = new TaskFinderModel($this->container);
|
||||
|
||||
$this->assertEquals(1, $projectModel->create(array('name' => 'test1')));
|
||||
$this->assertEquals(1, $taskCreationModel->create(array('project_id' => 1, 'title' => 'test')));
|
||||
@@ -27,7 +27,7 @@ class TaskAssignColorUserTest extends Base
|
||||
$action->setParam('color_id', 'red');
|
||||
$action->setParam('user_id', 1);
|
||||
|
||||
$this->assertTrue($action->execute($event, Task::EVENT_ASSIGNEE_CHANGE));
|
||||
$this->assertTrue($action->execute($event, TaskModel::EVENT_ASSIGNEE_CHANGE));
|
||||
|
||||
$task = $taskFinderModel->getById(1);
|
||||
$this->assertNotEmpty($task);
|
||||
@@ -36,8 +36,8 @@ class TaskAssignColorUserTest extends Base
|
||||
|
||||
public function testWithWrongUser()
|
||||
{
|
||||
$projectModel = new Project($this->container);
|
||||
$taskCreationModel = new TaskCreation($this->container);
|
||||
$projectModel = new ProjectModel($this->container);
|
||||
$taskCreationModel = new TaskCreationModel($this->container);
|
||||
|
||||
$this->assertEquals(1, $projectModel->create(array('name' => 'test1')));
|
||||
$this->assertEquals(1, $taskCreationModel->create(array('project_id' => 1, 'title' => 'test')));
|
||||
@@ -49,6 +49,6 @@ class TaskAssignColorUserTest extends Base
|
||||
$action->setParam('color_id', 'red');
|
||||
$action->setParam('user_id', 1);
|
||||
|
||||
$this->assertFalse($action->execute($event, Task::EVENT_ASSIGNEE_CHANGE));
|
||||
$this->assertFalse($action->execute($event, TaskModel::EVENT_ASSIGNEE_CHANGE));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,10 +3,10 @@
|
||||
require_once __DIR__.'/../Base.php';
|
||||
|
||||
use Kanboard\Event\GenericEvent;
|
||||
use Kanboard\Model\TaskCreation;
|
||||
use Kanboard\Model\TaskFinder;
|
||||
use Kanboard\Model\Project;
|
||||
use Kanboard\Model\Task;
|
||||
use Kanboard\Model\TaskCreationModel;
|
||||
use Kanboard\Model\TaskFinderModel;
|
||||
use Kanboard\Model\ProjectModel;
|
||||
use Kanboard\Model\TaskModel;
|
||||
use Kanboard\Action\TaskAssignCurrentUserColumn;
|
||||
|
||||
class TaskAssignCurrentUserColumnTest extends Base
|
||||
@@ -15,9 +15,9 @@ class TaskAssignCurrentUserColumnTest extends Base
|
||||
{
|
||||
$this->container['sessionStorage']->user = array('id' => 1);
|
||||
|
||||
$projectModel = new Project($this->container);
|
||||
$taskCreationModel = new TaskCreation($this->container);
|
||||
$taskFinderModel = new TaskFinder($this->container);
|
||||
$projectModel = new ProjectModel($this->container);
|
||||
$taskCreationModel = new TaskCreationModel($this->container);
|
||||
$taskFinderModel = new TaskFinderModel($this->container);
|
||||
|
||||
$this->assertEquals(1, $projectModel->create(array('name' => 'test1')));
|
||||
$this->assertEquals(1, $taskCreationModel->create(array('project_id' => 1, 'title' => 'test')));
|
||||
@@ -28,7 +28,7 @@ class TaskAssignCurrentUserColumnTest extends Base
|
||||
$action->setProjectId(1);
|
||||
$action->setParam('column_id', 2);
|
||||
|
||||
$this->assertTrue($action->execute($event, Task::EVENT_MOVE_COLUMN));
|
||||
$this->assertTrue($action->execute($event, TaskModel::EVENT_MOVE_COLUMN));
|
||||
|
||||
$task = $taskFinderModel->getById(1);
|
||||
$this->assertNotEmpty($task);
|
||||
@@ -39,8 +39,8 @@ class TaskAssignCurrentUserColumnTest extends Base
|
||||
{
|
||||
$this->container['sessionStorage']->user = array('id' => 1);
|
||||
|
||||
$projectModel = new Project($this->container);
|
||||
$taskCreationModel = new TaskCreation($this->container);
|
||||
$projectModel = new ProjectModel($this->container);
|
||||
$taskCreationModel = new TaskCreationModel($this->container);
|
||||
|
||||
$this->assertEquals(1, $projectModel->create(array('name' => 'test1')));
|
||||
$this->assertEquals(1, $taskCreationModel->create(array('project_id' => 1, 'title' => 'test')));
|
||||
@@ -51,13 +51,13 @@ class TaskAssignCurrentUserColumnTest extends Base
|
||||
$action->setProjectId(1);
|
||||
$action->setParam('column_id', 2);
|
||||
|
||||
$this->assertFalse($action->execute($event, Task::EVENT_MOVE_COLUMN));
|
||||
$this->assertFalse($action->execute($event, TaskModel::EVENT_MOVE_COLUMN));
|
||||
}
|
||||
|
||||
public function testWithNoUserSession()
|
||||
{
|
||||
$projectModel = new Project($this->container);
|
||||
$taskCreationModel = new TaskCreation($this->container);
|
||||
$projectModel = new ProjectModel($this->container);
|
||||
$taskCreationModel = new TaskCreationModel($this->container);
|
||||
|
||||
$this->assertEquals(1, $projectModel->create(array('name' => 'test1')));
|
||||
$this->assertEquals(1, $taskCreationModel->create(array('project_id' => 1, 'title' => 'test')));
|
||||
@@ -68,6 +68,6 @@ class TaskAssignCurrentUserColumnTest extends Base
|
||||
$action->setProjectId(1);
|
||||
$action->setParam('column_id', 2);
|
||||
|
||||
$this->assertFalse($action->execute($event, Task::EVENT_MOVE_COLUMN));
|
||||
$this->assertFalse($action->execute($event, TaskModel::EVENT_MOVE_COLUMN));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,10 +3,10 @@
|
||||
require_once __DIR__.'/../Base.php';
|
||||
|
||||
use Kanboard\Event\GenericEvent;
|
||||
use Kanboard\Model\TaskCreation;
|
||||
use Kanboard\Model\TaskFinder;
|
||||
use Kanboard\Model\Project;
|
||||
use Kanboard\Model\Task;
|
||||
use Kanboard\Model\TaskCreationModel;
|
||||
use Kanboard\Model\TaskFinderModel;
|
||||
use Kanboard\Model\ProjectModel;
|
||||
use Kanboard\Model\TaskModel;
|
||||
use Kanboard\Action\TaskAssignCurrentUser;
|
||||
|
||||
class TaskAssignCurrentUserTest extends Base
|
||||
@@ -15,9 +15,9 @@ class TaskAssignCurrentUserTest extends Base
|
||||
{
|
||||
$this->container['sessionStorage']->user = array('id' => 1);
|
||||
|
||||
$projectModel = new Project($this->container);
|
||||
$taskCreationModel = new TaskCreation($this->container);
|
||||
$taskFinderModel = new TaskFinder($this->container);
|
||||
$projectModel = new ProjectModel($this->container);
|
||||
$taskCreationModel = new TaskCreationModel($this->container);
|
||||
$taskFinderModel = new TaskFinderModel($this->container);
|
||||
|
||||
$this->assertEquals(1, $projectModel->create(array('name' => 'test1')));
|
||||
$this->assertEquals(1, $taskCreationModel->create(array('project_id' => 1, 'title' => 'test')));
|
||||
@@ -27,7 +27,7 @@ class TaskAssignCurrentUserTest extends Base
|
||||
$action = new TaskAssignCurrentUser($this->container);
|
||||
$action->setProjectId(1);
|
||||
|
||||
$this->assertTrue($action->execute($event, Task::EVENT_CREATE));
|
||||
$this->assertTrue($action->execute($event, TaskModel::EVENT_CREATE));
|
||||
|
||||
$task = $taskFinderModel->getById(1);
|
||||
$this->assertNotEmpty($task);
|
||||
@@ -36,8 +36,8 @@ class TaskAssignCurrentUserTest extends Base
|
||||
|
||||
public function testWithNoUserSession()
|
||||
{
|
||||
$projectModel = new Project($this->container);
|
||||
$taskCreationModel = new TaskCreation($this->container);
|
||||
$projectModel = new ProjectModel($this->container);
|
||||
$taskCreationModel = new TaskCreationModel($this->container);
|
||||
|
||||
$this->assertEquals(1, $projectModel->create(array('name' => 'test1')));
|
||||
$this->assertEquals(1, $taskCreationModel->create(array('project_id' => 1, 'title' => 'test')));
|
||||
@@ -47,6 +47,6 @@ class TaskAssignCurrentUserTest extends Base
|
||||
$action = new TaskAssignCurrentUser($this->container);
|
||||
$action->setProjectId(1);
|
||||
|
||||
$this->assertFalse($action->execute($event, Task::EVENT_CREATE));
|
||||
$this->assertFalse($action->execute($event, TaskModel::EVENT_CREATE));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,19 +3,19 @@
|
||||
require_once __DIR__.'/../Base.php';
|
||||
|
||||
use Kanboard\Event\GenericEvent;
|
||||
use Kanboard\Model\TaskCreation;
|
||||
use Kanboard\Model\TaskFinder;
|
||||
use Kanboard\Model\Project;
|
||||
use Kanboard\Model\Task;
|
||||
use Kanboard\Model\TaskCreationModel;
|
||||
use Kanboard\Model\TaskFinderModel;
|
||||
use Kanboard\Model\ProjectModel;
|
||||
use Kanboard\Model\TaskModel;
|
||||
use Kanboard\Action\TaskAssignSpecificUser;
|
||||
|
||||
class TaskAssignSpecificUserTest extends Base
|
||||
{
|
||||
public function testChangeUser()
|
||||
{
|
||||
$projectModel = new Project($this->container);
|
||||
$taskCreationModel = new TaskCreation($this->container);
|
||||
$taskFinderModel = new TaskFinder($this->container);
|
||||
$projectModel = new ProjectModel($this->container);
|
||||
$taskCreationModel = new TaskCreationModel($this->container);
|
||||
$taskFinderModel = new TaskFinderModel($this->container);
|
||||
|
||||
$this->assertEquals(1, $projectModel->create(array('name' => 'test1')));
|
||||
$this->assertEquals(1, $taskCreationModel->create(array('project_id' => 1, 'title' => 'test', 'owner_id' => 0)));
|
||||
@@ -27,7 +27,7 @@ class TaskAssignSpecificUserTest extends Base
|
||||
$action->setParam('column_id', 2);
|
||||
$action->setParam('user_id', 1);
|
||||
|
||||
$this->assertTrue($action->execute($event, Task::EVENT_MOVE_COLUMN));
|
||||
$this->assertTrue($action->execute($event, TaskModel::EVENT_MOVE_COLUMN));
|
||||
|
||||
$task = $taskFinderModel->getById(1);
|
||||
$this->assertNotEmpty($task);
|
||||
@@ -36,8 +36,8 @@ class TaskAssignSpecificUserTest extends Base
|
||||
|
||||
public function testWithWrongColumn()
|
||||
{
|
||||
$projectModel = new Project($this->container);
|
||||
$taskCreationModel = new TaskCreation($this->container);
|
||||
$projectModel = new ProjectModel($this->container);
|
||||
$taskCreationModel = new TaskCreationModel($this->container);
|
||||
|
||||
$this->assertEquals(1, $projectModel->create(array('name' => 'test1')));
|
||||
$this->assertEquals(1, $taskCreationModel->create(array('project_id' => 1, 'title' => 'test')));
|
||||
@@ -49,6 +49,6 @@ class TaskAssignSpecificUserTest extends Base
|
||||
$action->setParam('column_id', 2);
|
||||
$action->setParam('user_id', 1);
|
||||
|
||||
$this->assertFalse($action->execute($event, Task::EVENT_MOVE_COLUMN));
|
||||
$this->assertFalse($action->execute($event, TaskModel::EVENT_MOVE_COLUMN));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,11 +3,11 @@
|
||||
require_once __DIR__.'/../Base.php';
|
||||
|
||||
use Kanboard\Event\GenericEvent;
|
||||
use Kanboard\Model\TaskCreation;
|
||||
use Kanboard\Model\TaskFinder;
|
||||
use Kanboard\Model\Project;
|
||||
use Kanboard\Model\ProjectUserRole;
|
||||
use Kanboard\Model\User;
|
||||
use Kanboard\Model\TaskCreationModel;
|
||||
use Kanboard\Model\TaskFinderModel;
|
||||
use Kanboard\Model\ProjectModel;
|
||||
use Kanboard\Model\ProjectUserRoleModel;
|
||||
use Kanboard\Model\UserModel;
|
||||
use Kanboard\Action\TaskAssignUser;
|
||||
use Kanboard\Core\Security\Role;
|
||||
|
||||
@@ -15,11 +15,11 @@ class TaskAssignUserTest extends Base
|
||||
{
|
||||
public function testChangeUser()
|
||||
{
|
||||
$userModel = new User($this->container);
|
||||
$projectModel = new Project($this->container);
|
||||
$projectUserRoleModel = new ProjectUserRole($this->container);
|
||||
$taskCreationModel = new TaskCreation($this->container);
|
||||
$taskFinderModel = new TaskFinder($this->container);
|
||||
$userModel = new UserModel($this->container);
|
||||
$projectModel = new ProjectModel($this->container);
|
||||
$projectUserRoleModel = new ProjectUserRoleModel($this->container);
|
||||
$taskCreationModel = new TaskCreationModel($this->container);
|
||||
$taskFinderModel = new TaskFinderModel($this->container);
|
||||
|
||||
$this->assertEquals(1, $projectModel->create(array('name' => 'test1')));
|
||||
$this->assertEquals(1, $taskCreationModel->create(array('project_id' => 1, 'title' => 'test', 'owner_id' => 0)));
|
||||
@@ -41,8 +41,8 @@ class TaskAssignUserTest extends Base
|
||||
|
||||
public function testWithNotAssignableUser()
|
||||
{
|
||||
$projectModel = new Project($this->container);
|
||||
$taskCreationModel = new TaskCreation($this->container);
|
||||
$projectModel = new ProjectModel($this->container);
|
||||
$taskCreationModel = new TaskCreationModel($this->container);
|
||||
|
||||
$this->assertEquals(1, $projectModel->create(array('name' => 'test1')));
|
||||
$this->assertEquals(1, $taskCreationModel->create(array('project_id' => 1, 'title' => 'test')));
|
||||
|
||||
@@ -3,19 +3,19 @@
|
||||
require_once __DIR__.'/../Base.php';
|
||||
|
||||
use Kanboard\Event\GenericEvent;
|
||||
use Kanboard\Model\TaskCreation;
|
||||
use Kanboard\Model\TaskFinder;
|
||||
use Kanboard\Model\Project;
|
||||
use Kanboard\Model\Task;
|
||||
use Kanboard\Model\TaskCreationModel;
|
||||
use Kanboard\Model\TaskFinderModel;
|
||||
use Kanboard\Model\ProjectModel;
|
||||
use Kanboard\Model\TaskModel;
|
||||
use Kanboard\Action\TaskCloseColumn;
|
||||
|
||||
class TaskCloseColumnTest extends Base
|
||||
{
|
||||
public function testClose()
|
||||
{
|
||||
$projectModel = new Project($this->container);
|
||||
$taskCreationModel = new TaskCreation($this->container);
|
||||
$taskFinderModel = new TaskFinder($this->container);
|
||||
$projectModel = new ProjectModel($this->container);
|
||||
$taskCreationModel = new TaskCreationModel($this->container);
|
||||
$taskFinderModel = new TaskFinderModel($this->container);
|
||||
|
||||
$this->assertEquals(1, $projectModel->create(array('name' => 'test1')));
|
||||
$this->assertEquals(1, $taskCreationModel->create(array('project_id' => 1, 'title' => 'test')));
|
||||
@@ -26,7 +26,7 @@ class TaskCloseColumnTest extends Base
|
||||
$action->setProjectId(1);
|
||||
$action->setParam('column_id', 2);
|
||||
|
||||
$this->assertTrue($action->execute($event, Task::EVENT_MOVE_COLUMN));
|
||||
$this->assertTrue($action->execute($event, TaskModel::EVENT_MOVE_COLUMN));
|
||||
|
||||
$task = $taskFinderModel->getById(1);
|
||||
$this->assertNotEmpty($task);
|
||||
@@ -35,8 +35,8 @@ class TaskCloseColumnTest extends Base
|
||||
|
||||
public function testWithWrongColumn()
|
||||
{
|
||||
$projectModel = new Project($this->container);
|
||||
$taskCreationModel = new TaskCreation($this->container);
|
||||
$projectModel = new ProjectModel($this->container);
|
||||
$taskCreationModel = new TaskCreationModel($this->container);
|
||||
|
||||
$this->assertEquals(1, $projectModel->create(array('name' => 'test1')));
|
||||
$this->assertEquals(1, $taskCreationModel->create(array('project_id' => 1, 'title' => 'test')));
|
||||
@@ -47,6 +47,6 @@ class TaskCloseColumnTest extends Base
|
||||
$action->setProjectId(1);
|
||||
$action->setParam('column_id', 2);
|
||||
|
||||
$this->assertFalse($action->execute($event, Task::EVENT_MOVE_COLUMN));
|
||||
$this->assertFalse($action->execute($event, TaskModel::EVENT_MOVE_COLUMN));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,25 +3,25 @@
|
||||
require_once __DIR__.'/../Base.php';
|
||||
|
||||
use Kanboard\Event\TaskListEvent;
|
||||
use Kanboard\Model\TaskCreation;
|
||||
use Kanboard\Model\TaskFinder;
|
||||
use Kanboard\Model\Project;
|
||||
use Kanboard\Model\Task;
|
||||
use Kanboard\Model\TaskCreationModel;
|
||||
use Kanboard\Model\TaskFinderModel;
|
||||
use Kanboard\Model\ProjectModel;
|
||||
use Kanboard\Model\TaskModel;
|
||||
use Kanboard\Action\TaskCloseNoActivity;
|
||||
|
||||
class TaskCloseNoActivityTest extends Base
|
||||
{
|
||||
public function testClose()
|
||||
{
|
||||
$projectModel = new Project($this->container);
|
||||
$taskCreationModel = new TaskCreation($this->container);
|
||||
$taskFinderModel = new TaskFinder($this->container);
|
||||
$projectModel = new ProjectModel($this->container);
|
||||
$taskCreationModel = new TaskCreationModel($this->container);
|
||||
$taskFinderModel = new TaskFinderModel($this->container);
|
||||
|
||||
$this->assertEquals(1, $projectModel->create(array('name' => 'test1')));
|
||||
$this->assertEquals(1, $taskCreationModel->create(array('project_id' => 1, 'title' => 'test')));
|
||||
$this->assertEquals(2, $taskCreationModel->create(array('project_id' => 1, 'title' => 'test')));
|
||||
|
||||
$this->container['db']->table(Task::TABLE)->eq('id', 1)->update(array('date_modification' => strtotime('-10days')));
|
||||
$this->container['db']->table(TaskModel::TABLE)->eq('id', 1)->update(array('date_modification' => strtotime('-10days')));
|
||||
|
||||
$tasks = $taskFinderModel->getAll(1);
|
||||
$event = new TaskListEvent(array('tasks' => $tasks, 'project_id' => 1));
|
||||
@@ -30,7 +30,7 @@ class TaskCloseNoActivityTest extends Base
|
||||
$action->setProjectId(1);
|
||||
$action->setParam('duration', 2);
|
||||
|
||||
$this->assertTrue($action->execute($event, Task::EVENT_DAILY_CRONJOB));
|
||||
$this->assertTrue($action->execute($event, TaskModel::EVENT_DAILY_CRONJOB));
|
||||
|
||||
$task = $taskFinderModel->getById(1);
|
||||
$this->assertNotEmpty($task);
|
||||
|
||||
@@ -3,18 +3,18 @@
|
||||
require_once __DIR__.'/../Base.php';
|
||||
|
||||
use Kanboard\Event\GenericEvent;
|
||||
use Kanboard\Model\TaskCreation;
|
||||
use Kanboard\Model\TaskFinder;
|
||||
use Kanboard\Model\Project;
|
||||
use Kanboard\Model\TaskCreationModel;
|
||||
use Kanboard\Model\TaskFinderModel;
|
||||
use Kanboard\Model\ProjectModel;
|
||||
use Kanboard\Action\TaskClose;
|
||||
|
||||
class TaskCloseTest extends Base
|
||||
{
|
||||
public function testClose()
|
||||
{
|
||||
$projectModel = new Project($this->container);
|
||||
$taskCreationModel = new TaskCreation($this->container);
|
||||
$taskFinderModel = new TaskFinder($this->container);
|
||||
$projectModel = new ProjectModel($this->container);
|
||||
$taskCreationModel = new TaskCreationModel($this->container);
|
||||
$taskFinderModel = new TaskFinderModel($this->container);
|
||||
|
||||
$this->assertEquals(1, $projectModel->create(array('name' => 'test1')));
|
||||
$this->assertEquals(1, $taskCreationModel->create(array('project_id' => 1, 'title' => 'test')));
|
||||
@@ -34,8 +34,8 @@ class TaskCloseTest extends Base
|
||||
|
||||
public function testWithNoTaskId()
|
||||
{
|
||||
$projectModel = new Project($this->container);
|
||||
$taskCreationModel = new TaskCreation($this->container);
|
||||
$projectModel = new ProjectModel($this->container);
|
||||
$taskCreationModel = new TaskCreationModel($this->container);
|
||||
|
||||
$this->assertEquals(1, $projectModel->create(array('name' => 'test1')));
|
||||
$this->assertEquals(1, $taskCreationModel->create(array('project_id' => 1, 'title' => 'test')));
|
||||
|
||||
@@ -3,16 +3,16 @@
|
||||
require_once __DIR__.'/../Base.php';
|
||||
|
||||
use Kanboard\Event\GenericEvent;
|
||||
use Kanboard\Model\TaskFinder;
|
||||
use Kanboard\Model\Project;
|
||||
use Kanboard\Model\TaskFinderModel;
|
||||
use Kanboard\Model\ProjectModel;
|
||||
use Kanboard\Action\TaskCreation as TaskCreationAction;
|
||||
|
||||
class TaskCreationActionTest extends Base
|
||||
{
|
||||
public function testSuccess()
|
||||
{
|
||||
$projectModel = new Project($this->container);
|
||||
$taskFinderModel = new TaskFinder($this->container);
|
||||
$projectModel = new ProjectModel($this->container);
|
||||
$taskFinderModel = new TaskFinderModel($this->container);
|
||||
|
||||
$this->assertEquals(1, $projectModel->create(array('name' => 'test1')));
|
||||
|
||||
@@ -33,7 +33,7 @@ class TaskCreationActionTest extends Base
|
||||
|
||||
public function testWithNoTitle()
|
||||
{
|
||||
$projectModel = new Project($this->container);
|
||||
$projectModel = new ProjectModel($this->container);
|
||||
|
||||
$this->assertEquals(1, $projectModel->create(array('name' => 'test1')));
|
||||
|
||||
|
||||
@@ -3,19 +3,19 @@
|
||||
require_once __DIR__.'/../Base.php';
|
||||
|
||||
use Kanboard\Event\GenericEvent;
|
||||
use Kanboard\Model\Task;
|
||||
use Kanboard\Model\TaskFinder;
|
||||
use Kanboard\Model\TaskCreation;
|
||||
use Kanboard\Model\Project;
|
||||
use Kanboard\Model\TaskModel;
|
||||
use Kanboard\Model\TaskFinderModel;
|
||||
use Kanboard\Model\TaskCreationModel;
|
||||
use Kanboard\Model\ProjectModel;
|
||||
use Kanboard\Action\TaskDuplicateAnotherProject;
|
||||
|
||||
class TaskDuplicateAnotherProjectTest extends Base
|
||||
{
|
||||
public function testSuccess()
|
||||
{
|
||||
$projectModel = new Project($this->container);
|
||||
$taskCreationModel = new TaskCreation($this->container);
|
||||
$taskFinderModel = new TaskFinder($this->container);
|
||||
$projectModel = new ProjectModel($this->container);
|
||||
$taskCreationModel = new TaskCreationModel($this->container);
|
||||
$taskFinderModel = new TaskFinderModel($this->container);
|
||||
|
||||
$this->assertEquals(1, $projectModel->create(array('name' => 'test1')));
|
||||
$this->assertEquals(2, $projectModel->create(array('name' => 'test2')));
|
||||
@@ -28,7 +28,7 @@ class TaskDuplicateAnotherProjectTest extends Base
|
||||
$action->setParam('project_id', 2);
|
||||
$action->setParam('column_id', 2);
|
||||
|
||||
$this->assertTrue($action->execute($event, Task::EVENT_CLOSE));
|
||||
$this->assertTrue($action->execute($event, TaskModel::EVENT_CLOSE));
|
||||
|
||||
$task = $taskFinderModel->getById(2);
|
||||
$this->assertNotEmpty($task);
|
||||
@@ -38,7 +38,7 @@ class TaskDuplicateAnotherProjectTest extends Base
|
||||
|
||||
public function testWithWrongColumn()
|
||||
{
|
||||
$projectModel = new Project($this->container);
|
||||
$projectModel = new ProjectModel($this->container);
|
||||
|
||||
$this->assertEquals(1, $projectModel->create(array('name' => 'test1')));
|
||||
$this->assertEquals(2, $projectModel->create(array('name' => 'test2')));
|
||||
@@ -50,6 +50,6 @@ class TaskDuplicateAnotherProjectTest extends Base
|
||||
$action->setParam('project_id', 2);
|
||||
$action->setParam('column_id', 2);
|
||||
|
||||
$this->assertFalse($action->execute($event, Task::EVENT_CLOSE));
|
||||
$this->assertFalse($action->execute($event, TaskModel::EVENT_CLOSE));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,28 +3,28 @@
|
||||
require_once __DIR__.'/../Base.php';
|
||||
|
||||
use Kanboard\Event\TaskListEvent;
|
||||
use Kanboard\Model\TaskCreation;
|
||||
use Kanboard\Model\TaskFinder;
|
||||
use Kanboard\Model\Project;
|
||||
use Kanboard\Model\Task;
|
||||
use Kanboard\Model\User;
|
||||
use Kanboard\Model\TaskCreationModel;
|
||||
use Kanboard\Model\TaskFinderModel;
|
||||
use Kanboard\Model\ProjectModel;
|
||||
use Kanboard\Model\TaskModel;
|
||||
use Kanboard\Model\UserModel;
|
||||
use Kanboard\Action\TaskEmailNoActivity;
|
||||
|
||||
class TaskEmailNoActivityTest extends Base
|
||||
{
|
||||
public function testSendEmail()
|
||||
{
|
||||
$userModel = new User($this->container);
|
||||
$projectModel = new Project($this->container);
|
||||
$taskCreationModel = new TaskCreation($this->container);
|
||||
$taskFinderModel = new TaskFinder($this->container);
|
||||
$userModel = new UserModel($this->container);
|
||||
$projectModel = new ProjectModel($this->container);
|
||||
$taskCreationModel = new TaskCreationModel($this->container);
|
||||
$taskFinderModel = new TaskFinderModel($this->container);
|
||||
|
||||
$this->assertEquals(2, $userModel->create(array('username' => 'test', 'email' => 'chuck@norris', 'name' => 'Chuck Norris')));
|
||||
$this->assertEquals(1, $projectModel->create(array('name' => 'test1')));
|
||||
$this->assertEquals(1, $taskCreationModel->create(array('project_id' => 1, 'title' => 'test')));
|
||||
$this->assertEquals(2, $taskCreationModel->create(array('project_id' => 1, 'title' => 'test')));
|
||||
|
||||
$this->container['db']->table(Task::TABLE)->eq('id', 1)->update(array('date_modification' => strtotime('-10days')));
|
||||
$this->container['db']->table(TaskModel::TABLE)->eq('id', 1)->update(array('date_modification' => strtotime('-10days')));
|
||||
|
||||
$tasks = $taskFinderModel->getAll(1);
|
||||
$event = new TaskListEvent(array('tasks' => $tasks, 'project_id' => 1));
|
||||
@@ -40,22 +40,22 @@ class TaskEmailNoActivityTest extends Base
|
||||
->method('send')
|
||||
->with('chuck@norris', 'Chuck Norris', 'Old tasks', $this->anything());
|
||||
|
||||
$this->assertTrue($action->execute($event, Task::EVENT_DAILY_CRONJOB));
|
||||
$this->assertTrue($action->execute($event, TaskModel::EVENT_DAILY_CRONJOB));
|
||||
}
|
||||
|
||||
public function testUserWithNoEmail()
|
||||
{
|
||||
$userModel = new User($this->container);
|
||||
$projectModel = new Project($this->container);
|
||||
$taskCreationModel = new TaskCreation($this->container);
|
||||
$taskFinderModel = new TaskFinder($this->container);
|
||||
$userModel = new UserModel($this->container);
|
||||
$projectModel = new ProjectModel($this->container);
|
||||
$taskCreationModel = new TaskCreationModel($this->container);
|
||||
$taskFinderModel = new TaskFinderModel($this->container);
|
||||
|
||||
$this->assertEquals(2, $userModel->create(array('username' => 'test', 'name' => 'Chuck Norris')));
|
||||
$this->assertEquals(1, $projectModel->create(array('name' => 'test1')));
|
||||
$this->assertEquals(1, $taskCreationModel->create(array('project_id' => 1, 'title' => 'test')));
|
||||
$this->assertEquals(2, $taskCreationModel->create(array('project_id' => 1, 'title' => 'test')));
|
||||
|
||||
$this->container['db']->table(Task::TABLE)->eq('id', 1)->update(array('date_modification' => strtotime('-10days')));
|
||||
$this->container['db']->table(TaskModel::TABLE)->eq('id', 1)->update(array('date_modification' => strtotime('-10days')));
|
||||
|
||||
$tasks = $taskFinderModel->getAll(1);
|
||||
$event = new TaskListEvent(array('tasks' => $tasks, 'project_id' => 1));
|
||||
@@ -70,15 +70,15 @@ class TaskEmailNoActivityTest extends Base
|
||||
->expects($this->never())
|
||||
->method('send');
|
||||
|
||||
$this->assertFalse($action->execute($event, Task::EVENT_DAILY_CRONJOB));
|
||||
$this->assertFalse($action->execute($event, TaskModel::EVENT_DAILY_CRONJOB));
|
||||
}
|
||||
|
||||
public function testTooRecent()
|
||||
{
|
||||
$userModel = new User($this->container);
|
||||
$projectModel = new Project($this->container);
|
||||
$taskCreationModel = new TaskCreation($this->container);
|
||||
$taskFinderModel = new TaskFinder($this->container);
|
||||
$userModel = new UserModel($this->container);
|
||||
$projectModel = new ProjectModel($this->container);
|
||||
$taskCreationModel = new TaskCreationModel($this->container);
|
||||
$taskFinderModel = new TaskFinderModel($this->container);
|
||||
|
||||
$this->assertEquals(2, $userModel->create(array('username' => 'test', 'email' => 'chuck@norris', 'name' => 'Chuck Norris')));
|
||||
$this->assertEquals(1, $projectModel->create(array('name' => 'test1')));
|
||||
@@ -98,6 +98,6 @@ class TaskEmailNoActivityTest extends Base
|
||||
->expects($this->never())
|
||||
->method('send');
|
||||
|
||||
$this->assertFalse($action->execute($event, Task::EVENT_DAILY_CRONJOB));
|
||||
$this->assertFalse($action->execute($event, TaskModel::EVENT_DAILY_CRONJOB));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,19 +3,19 @@
|
||||
require_once __DIR__.'/../Base.php';
|
||||
|
||||
use Kanboard\Event\GenericEvent;
|
||||
use Kanboard\Model\Task;
|
||||
use Kanboard\Model\TaskCreation;
|
||||
use Kanboard\Model\Project;
|
||||
use Kanboard\Model\User;
|
||||
use Kanboard\Model\TaskModel;
|
||||
use Kanboard\Model\TaskCreationModel;
|
||||
use Kanboard\Model\ProjectModel;
|
||||
use Kanboard\Model\UserModel;
|
||||
use Kanboard\Action\TaskEmail;
|
||||
|
||||
class TaskEmailTest extends Base
|
||||
{
|
||||
public function testSuccess()
|
||||
{
|
||||
$userModel = new User($this->container);
|
||||
$projectModel = new Project($this->container);
|
||||
$taskCreationModel = new TaskCreation($this->container);
|
||||
$userModel = new UserModel($this->container);
|
||||
$projectModel = new ProjectModel($this->container);
|
||||
$taskCreationModel = new TaskCreationModel($this->container);
|
||||
|
||||
$this->assertEquals(1, $projectModel->create(array('name' => 'test1')));
|
||||
$this->assertEquals(1, $taskCreationModel->create(array('project_id' => 1, 'title' => 'test')));
|
||||
@@ -38,12 +38,12 @@ class TaskEmailTest extends Base
|
||||
$this->stringContains('test')
|
||||
);
|
||||
|
||||
$this->assertTrue($action->execute($event, Task::EVENT_CLOSE));
|
||||
$this->assertTrue($action->execute($event, TaskModel::EVENT_CLOSE));
|
||||
}
|
||||
|
||||
public function testWithWrongColumn()
|
||||
{
|
||||
$projectModel = new Project($this->container);
|
||||
$projectModel = new ProjectModel($this->container);
|
||||
|
||||
$this->assertEquals(1, $projectModel->create(array('name' => 'test1')));
|
||||
|
||||
@@ -55,6 +55,6 @@ class TaskEmailTest extends Base
|
||||
$action->setParam('user_id', 1);
|
||||
$action->setParam('subject', 'My email subject');
|
||||
|
||||
$this->assertFalse($action->execute($event, Task::EVENT_CLOSE));
|
||||
$this->assertFalse($action->execute($event, TaskModel::EVENT_CLOSE));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,19 +3,19 @@
|
||||
require_once __DIR__.'/../Base.php';
|
||||
|
||||
use Kanboard\Event\GenericEvent;
|
||||
use Kanboard\Model\Task;
|
||||
use Kanboard\Model\TaskFinder;
|
||||
use Kanboard\Model\TaskCreation;
|
||||
use Kanboard\Model\Project;
|
||||
use Kanboard\Model\TaskModel;
|
||||
use Kanboard\Model\TaskFinderModel;
|
||||
use Kanboard\Model\TaskCreationModel;
|
||||
use Kanboard\Model\ProjectModel;
|
||||
use Kanboard\Action\TaskMoveAnotherProject;
|
||||
|
||||
class TaskMoveAnotherProjectTest extends Base
|
||||
{
|
||||
public function testSuccess()
|
||||
{
|
||||
$projectModel = new Project($this->container);
|
||||
$taskCreationModel = new TaskCreation($this->container);
|
||||
$taskFinderModel = new TaskFinder($this->container);
|
||||
$projectModel = new ProjectModel($this->container);
|
||||
$taskCreationModel = new TaskCreationModel($this->container);
|
||||
$taskFinderModel = new TaskFinderModel($this->container);
|
||||
|
||||
$this->assertEquals(1, $projectModel->create(array('name' => 'test1')));
|
||||
$this->assertEquals(2, $projectModel->create(array('name' => 'test2')));
|
||||
@@ -28,7 +28,7 @@ class TaskMoveAnotherProjectTest extends Base
|
||||
$action->setParam('project_id', 2);
|
||||
$action->setParam('column_id', 2);
|
||||
|
||||
$this->assertTrue($action->execute($event, Task::EVENT_CLOSE));
|
||||
$this->assertTrue($action->execute($event, TaskModel::EVENT_CLOSE));
|
||||
|
||||
$task = $taskFinderModel->getById(1);
|
||||
$this->assertNotEmpty($task);
|
||||
@@ -39,7 +39,7 @@ class TaskMoveAnotherProjectTest extends Base
|
||||
|
||||
public function testWithWrongColumn()
|
||||
{
|
||||
$projectModel = new Project($this->container);
|
||||
$projectModel = new ProjectModel($this->container);
|
||||
|
||||
$this->assertEquals(1, $projectModel->create(array('name' => 'test1')));
|
||||
$this->assertEquals(2, $projectModel->create(array('name' => 'test2')));
|
||||
@@ -51,6 +51,6 @@ class TaskMoveAnotherProjectTest extends Base
|
||||
$action->setParam('project_id', 2);
|
||||
$action->setParam('column_id', 2);
|
||||
|
||||
$this->assertFalse($action->execute($event, Task::EVENT_CLOSE));
|
||||
$this->assertFalse($action->execute($event, TaskModel::EVENT_CLOSE));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,19 +3,19 @@
|
||||
require_once __DIR__.'/../Base.php';
|
||||
|
||||
use Kanboard\Event\GenericEvent;
|
||||
use Kanboard\Model\Task;
|
||||
use Kanboard\Model\TaskFinder;
|
||||
use Kanboard\Model\TaskCreation;
|
||||
use Kanboard\Model\Project;
|
||||
use Kanboard\Model\TaskModel;
|
||||
use Kanboard\Model\TaskFinderModel;
|
||||
use Kanboard\Model\TaskCreationModel;
|
||||
use Kanboard\Model\ProjectModel;
|
||||
use Kanboard\Action\TaskMoveColumnAssigned;
|
||||
|
||||
class TaskMoveColumnAssignedTest extends Base
|
||||
{
|
||||
public function testSuccess()
|
||||
{
|
||||
$projectModel = new Project($this->container);
|
||||
$taskCreationModel = new TaskCreation($this->container);
|
||||
$taskFinderModel = new TaskFinder($this->container);
|
||||
$projectModel = new ProjectModel($this->container);
|
||||
$taskCreationModel = new TaskCreationModel($this->container);
|
||||
$taskFinderModel = new TaskFinderModel($this->container);
|
||||
|
||||
$this->assertEquals(1, $projectModel->create(array('name' => 'test1')));
|
||||
$this->assertEquals(2, $projectModel->create(array('name' => 'test2')));
|
||||
@@ -28,7 +28,7 @@ class TaskMoveColumnAssignedTest extends Base
|
||||
$action->setParam('src_column_id', 1);
|
||||
$action->setParam('dest_column_id', 2);
|
||||
|
||||
$this->assertTrue($action->execute($event, Task::EVENT_ASSIGNEE_CHANGE));
|
||||
$this->assertTrue($action->execute($event, TaskModel::EVENT_ASSIGNEE_CHANGE));
|
||||
|
||||
$task = $taskFinderModel->getById(1);
|
||||
$this->assertNotEmpty($task);
|
||||
@@ -38,7 +38,7 @@ class TaskMoveColumnAssignedTest extends Base
|
||||
|
||||
public function testWithWrongColumn()
|
||||
{
|
||||
$projectModel = new Project($this->container);
|
||||
$projectModel = new ProjectModel($this->container);
|
||||
|
||||
$this->assertEquals(1, $projectModel->create(array('name' => 'test1')));
|
||||
$this->assertEquals(2, $projectModel->create(array('name' => 'test2')));
|
||||
@@ -50,6 +50,6 @@ class TaskMoveColumnAssignedTest extends Base
|
||||
$action->setParam('src_column_id', 1);
|
||||
$action->setParam('dest_column_id', 2);
|
||||
|
||||
$this->assertFalse($action->execute($event, Task::EVENT_ASSIGNEE_CHANGE));
|
||||
$this->assertFalse($action->execute($event, TaskModel::EVENT_ASSIGNEE_CHANGE));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,21 +3,21 @@
|
||||
require_once __DIR__.'/../Base.php';
|
||||
|
||||
use Kanboard\Event\GenericEvent;
|
||||
use Kanboard\Model\Category;
|
||||
use Kanboard\Model\Task;
|
||||
use Kanboard\Model\TaskFinder;
|
||||
use Kanboard\Model\TaskCreation;
|
||||
use Kanboard\Model\Project;
|
||||
use Kanboard\Model\CategoryModel;
|
||||
use Kanboard\Model\TaskModel;
|
||||
use Kanboard\Model\TaskFinderModel;
|
||||
use Kanboard\Model\TaskCreationModel;
|
||||
use Kanboard\Model\ProjectModel;
|
||||
use Kanboard\Action\TaskMoveColumnCategoryChange;
|
||||
|
||||
class TaskMoveColumnCategoryChangeTest extends Base
|
||||
{
|
||||
public function testSuccess()
|
||||
{
|
||||
$projectModel = new Project($this->container);
|
||||
$taskCreationModel = new TaskCreation($this->container);
|
||||
$taskFinderModel = new TaskFinder($this->container);
|
||||
$categoryModel = new Category($this->container);
|
||||
$projectModel = new ProjectModel($this->container);
|
||||
$taskCreationModel = new TaskCreationModel($this->container);
|
||||
$taskFinderModel = new TaskFinderModel($this->container);
|
||||
$categoryModel = new CategoryModel($this->container);
|
||||
|
||||
$this->assertEquals(1, $projectModel->create(array('name' => 'test1')));
|
||||
$this->assertEquals(2, $projectModel->create(array('name' => 'test2')));
|
||||
@@ -31,7 +31,7 @@ class TaskMoveColumnCategoryChangeTest extends Base
|
||||
$action->setParam('category_id', 1);
|
||||
$action->setParam('dest_column_id', 2);
|
||||
|
||||
$this->assertTrue($action->execute($event, Task::EVENT_UPDATE));
|
||||
$this->assertTrue($action->execute($event, TaskModel::EVENT_UPDATE));
|
||||
|
||||
$task = $taskFinderModel->getById(1);
|
||||
$this->assertNotEmpty($task);
|
||||
@@ -41,9 +41,9 @@ class TaskMoveColumnCategoryChangeTest extends Base
|
||||
|
||||
public function testWithWrongColumn()
|
||||
{
|
||||
$projectModel = new Project($this->container);
|
||||
$taskCreationModel = new TaskCreation($this->container);
|
||||
$categoryModel = new Category($this->container);
|
||||
$projectModel = new ProjectModel($this->container);
|
||||
$taskCreationModel = new TaskCreationModel($this->container);
|
||||
$categoryModel = new CategoryModel($this->container);
|
||||
|
||||
$this->assertEquals(1, $projectModel->create(array('name' => 'test1')));
|
||||
$this->assertEquals(2, $projectModel->create(array('name' => 'test2')));
|
||||
@@ -57,14 +57,14 @@ class TaskMoveColumnCategoryChangeTest extends Base
|
||||
$action->setParam('category_id', 1);
|
||||
$action->setParam('dest_column_id', 2);
|
||||
|
||||
$this->assertFalse($action->execute($event, Task::EVENT_UPDATE));
|
||||
$this->assertFalse($action->execute($event, TaskModel::EVENT_UPDATE));
|
||||
}
|
||||
|
||||
public function testWithWrongCategory()
|
||||
{
|
||||
$projectModel = new Project($this->container);
|
||||
$taskCreationModel = new TaskCreation($this->container);
|
||||
$categoryModel = new Category($this->container);
|
||||
$projectModel = new ProjectModel($this->container);
|
||||
$taskCreationModel = new TaskCreationModel($this->container);
|
||||
$categoryModel = new CategoryModel($this->container);
|
||||
|
||||
$this->assertEquals(1, $projectModel->create(array('name' => 'test1')));
|
||||
$this->assertEquals(2, $projectModel->create(array('name' => 'test2')));
|
||||
@@ -79,6 +79,6 @@ class TaskMoveColumnCategoryChangeTest extends Base
|
||||
$action->setParam('category_id', 1);
|
||||
$action->setParam('dest_column_id', 2);
|
||||
|
||||
$this->assertFalse($action->execute($event, Task::EVENT_UPDATE));
|
||||
$this->assertFalse($action->execute($event, TaskModel::EVENT_UPDATE));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,19 +3,19 @@
|
||||
require_once __DIR__.'/../Base.php';
|
||||
|
||||
use Kanboard\Event\GenericEvent;
|
||||
use Kanboard\Model\Task;
|
||||
use Kanboard\Model\TaskFinder;
|
||||
use Kanboard\Model\TaskCreation;
|
||||
use Kanboard\Model\Project;
|
||||
use Kanboard\Model\TaskModel;
|
||||
use Kanboard\Model\TaskFinderModel;
|
||||
use Kanboard\Model\TaskCreationModel;
|
||||
use Kanboard\Model\ProjectModel;
|
||||
use Kanboard\Action\TaskMoveColumnUnAssigned;
|
||||
|
||||
class TaskMoveColumnUnAssignedTest extends Base
|
||||
{
|
||||
public function testSuccess()
|
||||
{
|
||||
$projectModel = new Project($this->container);
|
||||
$taskCreationModel = new TaskCreation($this->container);
|
||||
$taskFinderModel = new TaskFinder($this->container);
|
||||
$projectModel = new ProjectModel($this->container);
|
||||
$taskCreationModel = new TaskCreationModel($this->container);
|
||||
$taskFinderModel = new TaskFinderModel($this->container);
|
||||
|
||||
$this->assertEquals(1, $projectModel->create(array('name' => 'test1')));
|
||||
$this->assertEquals(2, $projectModel->create(array('name' => 'test2')));
|
||||
@@ -28,7 +28,7 @@ class TaskMoveColumnUnAssignedTest extends Base
|
||||
$action->setParam('src_column_id', 1);
|
||||
$action->setParam('dest_column_id', 2);
|
||||
|
||||
$this->assertTrue($action->execute($event, Task::EVENT_ASSIGNEE_CHANGE));
|
||||
$this->assertTrue($action->execute($event, TaskModel::EVENT_ASSIGNEE_CHANGE));
|
||||
|
||||
$task = $taskFinderModel->getById(1);
|
||||
$this->assertNotEmpty($task);
|
||||
@@ -38,7 +38,7 @@ class TaskMoveColumnUnAssignedTest extends Base
|
||||
|
||||
public function testWithWrongColumn()
|
||||
{
|
||||
$projectModel = new Project($this->container);
|
||||
$projectModel = new ProjectModel($this->container);
|
||||
|
||||
$this->assertEquals(1, $projectModel->create(array('name' => 'test1')));
|
||||
$this->assertEquals(2, $projectModel->create(array('name' => 'test2')));
|
||||
@@ -50,12 +50,12 @@ class TaskMoveColumnUnAssignedTest extends Base
|
||||
$action->setParam('src_column_id', 1);
|
||||
$action->setParam('dest_column_id', 2);
|
||||
|
||||
$this->assertFalse($action->execute($event, Task::EVENT_ASSIGNEE_CHANGE));
|
||||
$this->assertFalse($action->execute($event, TaskModel::EVENT_ASSIGNEE_CHANGE));
|
||||
}
|
||||
|
||||
public function testWithWrongUser()
|
||||
{
|
||||
$projectModel = new Project($this->container);
|
||||
$projectModel = new ProjectModel($this->container);
|
||||
|
||||
$this->assertEquals(1, $projectModel->create(array('name' => 'test1')));
|
||||
$this->assertEquals(2, $projectModel->create(array('name' => 'test2')));
|
||||
@@ -67,6 +67,6 @@ class TaskMoveColumnUnAssignedTest extends Base
|
||||
$action->setParam('src_column_id', 1);
|
||||
$action->setParam('dest_column_id', 2);
|
||||
|
||||
$this->assertFalse($action->execute($event, Task::EVENT_ASSIGNEE_CHANGE));
|
||||
$this->assertFalse($action->execute($event, TaskModel::EVENT_ASSIGNEE_CHANGE));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,18 +3,18 @@
|
||||
require_once __DIR__.'/../Base.php';
|
||||
|
||||
use Kanboard\Event\GenericEvent;
|
||||
use Kanboard\Model\TaskCreation;
|
||||
use Kanboard\Model\TaskFinder;
|
||||
use Kanboard\Model\Project;
|
||||
use Kanboard\Model\TaskCreationModel;
|
||||
use Kanboard\Model\TaskFinderModel;
|
||||
use Kanboard\Model\ProjectModel;
|
||||
use Kanboard\Action\TaskOpen;
|
||||
|
||||
class TaskOpenTest extends Base
|
||||
{
|
||||
public function testClose()
|
||||
{
|
||||
$projectModel = new Project($this->container);
|
||||
$taskCreationModel = new TaskCreation($this->container);
|
||||
$taskFinderModel = new TaskFinder($this->container);
|
||||
$projectModel = new ProjectModel($this->container);
|
||||
$taskCreationModel = new TaskCreationModel($this->container);
|
||||
$taskFinderModel = new TaskFinderModel($this->container);
|
||||
|
||||
$this->assertEquals(1, $projectModel->create(array('name' => 'test1')));
|
||||
$this->assertEquals(1, $taskCreationModel->create(array('project_id' => 1, 'title' => 'test', 'is_active' => 0)));
|
||||
@@ -34,8 +34,8 @@ class TaskOpenTest extends Base
|
||||
|
||||
public function testWithNoTaskId()
|
||||
{
|
||||
$projectModel = new Project($this->container);
|
||||
$taskCreationModel = new TaskCreation($this->container);
|
||||
$projectModel = new ProjectModel($this->container);
|
||||
$taskCreationModel = new TaskCreationModel($this->container);
|
||||
|
||||
$this->assertEquals(1, $projectModel->create(array('name' => 'test1')));
|
||||
$this->assertEquals(1, $taskCreationModel->create(array('project_id' => 1, 'title' => 'test')));
|
||||
|
||||
@@ -3,19 +3,19 @@
|
||||
require_once __DIR__.'/../Base.php';
|
||||
|
||||
use Kanboard\Event\GenericEvent;
|
||||
use Kanboard\Model\TaskCreation;
|
||||
use Kanboard\Model\TaskFinder;
|
||||
use Kanboard\Model\Project;
|
||||
use Kanboard\Model\Task;
|
||||
use Kanboard\Model\TaskCreationModel;
|
||||
use Kanboard\Model\TaskFinderModel;
|
||||
use Kanboard\Model\ProjectModel;
|
||||
use Kanboard\Model\TaskModel;
|
||||
use Kanboard\Action\TaskUpdateStartDate;
|
||||
|
||||
class TaskUpdateStartDateTest extends Base
|
||||
{
|
||||
public function testClose()
|
||||
{
|
||||
$projectModel = new Project($this->container);
|
||||
$taskCreationModel = new TaskCreation($this->container);
|
||||
$taskFinderModel = new TaskFinder($this->container);
|
||||
$projectModel = new ProjectModel($this->container);
|
||||
$taskCreationModel = new TaskCreationModel($this->container);
|
||||
$taskFinderModel = new TaskFinderModel($this->container);
|
||||
|
||||
$this->assertEquals(1, $projectModel->create(array('name' => 'test1')));
|
||||
$this->assertEquals(1, $taskCreationModel->create(array('project_id' => 1, 'title' => 'test')));
|
||||
@@ -26,7 +26,7 @@ class TaskUpdateStartDateTest extends Base
|
||||
$action->setProjectId(1);
|
||||
$action->setParam('column_id', 2);
|
||||
|
||||
$this->assertTrue($action->execute($event, Task::EVENT_MOVE_COLUMN));
|
||||
$this->assertTrue($action->execute($event, TaskModel::EVENT_MOVE_COLUMN));
|
||||
|
||||
$task = $taskFinderModel->getById(1);
|
||||
$this->assertNotEmpty($task);
|
||||
@@ -35,8 +35,8 @@ class TaskUpdateStartDateTest extends Base
|
||||
|
||||
public function testWithWrongColumn()
|
||||
{
|
||||
$projectModel = new Project($this->container);
|
||||
$taskCreationModel = new TaskCreation($this->container);
|
||||
$projectModel = new ProjectModel($this->container);
|
||||
$taskCreationModel = new TaskCreationModel($this->container);
|
||||
|
||||
$this->assertEquals(1, $projectModel->create(array('name' => 'test1')));
|
||||
$this->assertEquals(1, $taskCreationModel->create(array('project_id' => 1, 'title' => 'test')));
|
||||
@@ -47,6 +47,6 @@ class TaskUpdateStartDateTest extends Base
|
||||
$action->setProjectId(1);
|
||||
$action->setParam('column_id', 2);
|
||||
|
||||
$this->assertFalse($action->execute($event, Task::EVENT_MOVE_COLUMN));
|
||||
$this->assertFalse($action->execute($event, TaskModel::EVENT_MOVE_COLUMN));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,17 +2,17 @@
|
||||
|
||||
require_once __DIR__.'/../Base.php';
|
||||
|
||||
use Kanboard\Model\TaskCreation;
|
||||
use Kanboard\Model\Project;
|
||||
use Kanboard\Model\Task;
|
||||
use Kanboard\Model\TaskCreationModel;
|
||||
use Kanboard\Model\ProjectModel;
|
||||
use Kanboard\Model\TaskModel;
|
||||
use Kanboard\Analytic\AverageLeadCycleTimeAnalytic;
|
||||
|
||||
class AverageLeadCycleTimeAnalyticTest extends Base
|
||||
{
|
||||
public function testBuild()
|
||||
{
|
||||
$taskCreationModel = new TaskCreation($this->container);
|
||||
$projectModel = new Project($this->container);
|
||||
$taskCreationModel = new TaskCreationModel($this->container);
|
||||
$projectModel = new ProjectModel($this->container);
|
||||
$averageLeadCycleTimeAnalytic = new AverageLeadCycleTimeAnalytic($this->container);
|
||||
$now = time();
|
||||
|
||||
@@ -26,19 +26,19 @@ class AverageLeadCycleTimeAnalyticTest extends Base
|
||||
$this->assertEquals(5, $taskCreationModel->create(array('project_id' => 1, 'title' => 'test')));
|
||||
|
||||
// LT=3600 CT=1800
|
||||
$this->container['db']->table(Task::TABLE)->eq('id', 1)->update(array('date_completed' => $now + 3600, 'date_started' => $now + 1800));
|
||||
$this->container['db']->table(TaskModel::TABLE)->eq('id', 1)->update(array('date_completed' => $now + 3600, 'date_started' => $now + 1800));
|
||||
|
||||
// LT=1800 CT=900
|
||||
$this->container['db']->table(Task::TABLE)->eq('id', 2)->update(array('date_completed' => $now + 1800, 'date_started' => $now + 900));
|
||||
$this->container['db']->table(TaskModel::TABLE)->eq('id', 2)->update(array('date_completed' => $now + 1800, 'date_started' => $now + 900));
|
||||
|
||||
// LT=3600 CT=0
|
||||
$this->container['db']->table(Task::TABLE)->eq('id', 3)->update(array('date_completed' => $now + 3600));
|
||||
$this->container['db']->table(TaskModel::TABLE)->eq('id', 3)->update(array('date_completed' => $now + 3600));
|
||||
|
||||
// LT=2*3600 CT=0
|
||||
$this->container['db']->table(Task::TABLE)->eq('id', 4)->update(array('date_completed' => $now + 2 * 3600));
|
||||
$this->container['db']->table(TaskModel::TABLE)->eq('id', 4)->update(array('date_completed' => $now + 2 * 3600));
|
||||
|
||||
// CT=0
|
||||
$this->container['db']->table(Task::TABLE)->eq('id', 5)->update(array('date_started' => $now + 900));
|
||||
$this->container['db']->table(TaskModel::TABLE)->eq('id', 5)->update(array('date_started' => $now + 900));
|
||||
|
||||
$stats = $averageLeadCycleTimeAnalytic->build(1);
|
||||
|
||||
@@ -51,7 +51,7 @@ class AverageLeadCycleTimeAnalyticTest extends Base
|
||||
|
||||
public function testBuildWithNoTasks()
|
||||
{
|
||||
$projectModel = new Project($this->container);
|
||||
$projectModel = new ProjectModel($this->container);
|
||||
$averageLeadCycleTimeAnalytic = new AverageLeadCycleTimeAnalytic($this->container);
|
||||
|
||||
$this->assertEquals(1, $projectModel->create(array('name' => 'test1')));
|
||||
|
||||
@@ -2,19 +2,19 @@
|
||||
|
||||
require_once __DIR__.'/../Base.php';
|
||||
|
||||
use Kanboard\Model\TaskCreation;
|
||||
use Kanboard\Model\Project;
|
||||
use Kanboard\Model\Transition;
|
||||
use Kanboard\Model\Task;
|
||||
use Kanboard\Model\TaskFinder;
|
||||
use Kanboard\Model\TaskCreationModel;
|
||||
use Kanboard\Model\ProjectModel;
|
||||
use Kanboard\Model\TransitionModel;
|
||||
use Kanboard\Model\TaskModel;
|
||||
use Kanboard\Model\TaskFinderModel;
|
||||
use Kanboard\Analytic\AverageTimeSpentColumnAnalytic;
|
||||
|
||||
class AverageTimeSpentColumnAnalyticTest extends Base
|
||||
{
|
||||
public function testAverageWithNoTransitions()
|
||||
{
|
||||
$taskCreationModel = new TaskCreation($this->container);
|
||||
$projectModel = new Project($this->container);
|
||||
$taskCreationModel = new TaskCreationModel($this->container);
|
||||
$projectModel = new ProjectModel($this->container);
|
||||
$averageLeadCycleTimeAnalytic = new AverageTimeSpentColumnAnalytic($this->container);
|
||||
|
||||
$this->assertEquals(1, $projectModel->create(array('name' => 'test1')));
|
||||
@@ -24,8 +24,8 @@ class AverageTimeSpentColumnAnalyticTest extends Base
|
||||
|
||||
$now = time();
|
||||
|
||||
$this->container['db']->table(Task::TABLE)->eq('id', 1)->update(array('date_completed' => $now + 3600));
|
||||
$this->container['db']->table(Task::TABLE)->eq('id', 2)->update(array('date_completed' => $now + 1800));
|
||||
$this->container['db']->table(TaskModel::TABLE)->eq('id', 1)->update(array('date_completed' => $now + 3600));
|
||||
$this->container['db']->table(TaskModel::TABLE)->eq('id', 2)->update(array('date_completed' => $now + 1800));
|
||||
|
||||
$stats = $averageLeadCycleTimeAnalytic->build(1);
|
||||
|
||||
@@ -52,10 +52,10 @@ class AverageTimeSpentColumnAnalyticTest extends Base
|
||||
|
||||
public function testAverageWithTransitions()
|
||||
{
|
||||
$transitionModel = new Transition($this->container);
|
||||
$taskFinderModel = new TaskFinder($this->container);
|
||||
$taskCreationModel = new TaskCreation($this->container);
|
||||
$projectModel = new Project($this->container);
|
||||
$transitionModel = new TransitionModel($this->container);
|
||||
$taskFinderModel = new TaskFinderModel($this->container);
|
||||
$taskCreationModel = new TaskCreationModel($this->container);
|
||||
$projectModel = new ProjectModel($this->container);
|
||||
$averageLeadCycleTimeAnalytic = new AverageTimeSpentColumnAnalytic($this->container);
|
||||
|
||||
$this->assertEquals(1, $projectModel->create(array('name' => 'test1')));
|
||||
@@ -64,8 +64,8 @@ class AverageTimeSpentColumnAnalyticTest extends Base
|
||||
$this->assertEquals(2, $taskCreationModel->create(array('project_id' => 1, 'title' => 'test')));
|
||||
|
||||
$now = time();
|
||||
$this->container['db']->table(Task::TABLE)->eq('id', 1)->update(array('date_completed' => $now + 3600));
|
||||
$this->container['db']->table(Task::TABLE)->eq('id', 2)->update(array('date_completed' => $now + 1800));
|
||||
$this->container['db']->table(TaskModel::TABLE)->eq('id', 1)->update(array('date_completed' => $now + 3600));
|
||||
$this->container['db']->table(TaskModel::TABLE)->eq('id', 2)->update(array('date_completed' => $now + 1800));
|
||||
|
||||
foreach (array(1, 2) as $task_id) {
|
||||
$task = $taskFinderModel->getById($task_id);
|
||||
|
||||
@@ -2,16 +2,16 @@
|
||||
|
||||
require_once __DIR__.'/../Base.php';
|
||||
|
||||
use Kanboard\Model\TaskCreation;
|
||||
use Kanboard\Model\Project;
|
||||
use Kanboard\Model\TaskCreationModel;
|
||||
use Kanboard\Model\ProjectModel;
|
||||
use Kanboard\Analytic\EstimatedTimeComparisonAnalytic;
|
||||
|
||||
class EstimatedTimeComparisonAnalyticTest extends Base
|
||||
{
|
||||
public function testBuild()
|
||||
{
|
||||
$taskCreationModel = new TaskCreation($this->container);
|
||||
$projectModel = new Project($this->container);
|
||||
$taskCreationModel = new TaskCreationModel($this->container);
|
||||
$projectModel = new ProjectModel($this->container);
|
||||
$estimatedTimeComparisonAnalytic = new EstimatedTimeComparisonAnalytic($this->container);
|
||||
|
||||
$this->assertEquals(1, $projectModel->create(array('name' => 'test1')));
|
||||
@@ -41,8 +41,8 @@ class EstimatedTimeComparisonAnalyticTest extends Base
|
||||
|
||||
public function testBuildWithNoClosedTask()
|
||||
{
|
||||
$taskCreationModel = new TaskCreation($this->container);
|
||||
$projectModel = new Project($this->container);
|
||||
$taskCreationModel = new TaskCreationModel($this->container);
|
||||
$projectModel = new ProjectModel($this->container);
|
||||
$estimatedTimeComparisonAnalytic = new EstimatedTimeComparisonAnalytic($this->container);
|
||||
|
||||
$this->assertEquals(1, $projectModel->create(array('name' => 'test1')));
|
||||
@@ -70,8 +70,8 @@ class EstimatedTimeComparisonAnalyticTest extends Base
|
||||
|
||||
public function testBuildWithOnlyClosedTask()
|
||||
{
|
||||
$taskCreationModel = new TaskCreation($this->container);
|
||||
$projectModel = new Project($this->container);
|
||||
$taskCreationModel = new TaskCreationModel($this->container);
|
||||
$projectModel = new ProjectModel($this->container);
|
||||
$estimatedTimeComparisonAnalytic = new EstimatedTimeComparisonAnalytic($this->container);
|
||||
|
||||
$this->assertEquals(1, $projectModel->create(array('name' => 'test1')));
|
||||
|
||||
@@ -2,15 +2,15 @@
|
||||
|
||||
require_once __DIR__.'/../Base.php';
|
||||
|
||||
use Kanboard\Model\TaskCreation;
|
||||
use Kanboard\Model\Project;
|
||||
use Kanboard\Model\TaskCreationModel;
|
||||
use Kanboard\Model\ProjectModel;
|
||||
use Kanboard\Analytic\TaskDistributionAnalytic;
|
||||
|
||||
class TaskDistributionAnalyticTest extends Base
|
||||
{
|
||||
public function testBuild()
|
||||
{
|
||||
$projectModel = new Project($this->container);
|
||||
$projectModel = new ProjectModel($this->container);
|
||||
$taskDistributionModel = new TaskDistributionAnalytic($this->container);
|
||||
|
||||
$this->assertEquals(1, $projectModel->create(array('name' => 'test1')));
|
||||
@@ -49,7 +49,7 @@ class TaskDistributionAnalyticTest extends Base
|
||||
|
||||
private function createTasks($column_id, $nb_active, $nb_inactive)
|
||||
{
|
||||
$taskCreationModel = new TaskCreation($this->container);
|
||||
$taskCreationModel = new TaskCreationModel($this->container);
|
||||
|
||||
for ($i = 0; $i < $nb_active; $i++) {
|
||||
$this->assertNotFalse($taskCreationModel->create(array('project_id' => 1, 'title' => 'test', 'column_id' => $column_id, 'is_active' => 1)));
|
||||
|
||||
@@ -2,10 +2,10 @@
|
||||
|
||||
require_once __DIR__.'/../Base.php';
|
||||
|
||||
use Kanboard\Model\TaskCreation;
|
||||
use Kanboard\Model\Project;
|
||||
use Kanboard\Model\ProjectUserRole;
|
||||
use Kanboard\Model\User;
|
||||
use Kanboard\Model\TaskCreationModel;
|
||||
use Kanboard\Model\ProjectModel;
|
||||
use Kanboard\Model\ProjectUserRoleModel;
|
||||
use Kanboard\Model\UserModel;
|
||||
use Kanboard\Analytic\UserDistributionAnalytic;
|
||||
use Kanboard\Core\Security\Role;
|
||||
|
||||
@@ -13,9 +13,9 @@ class UserDistributionAnalyticTest extends Base
|
||||
{
|
||||
public function testBuild()
|
||||
{
|
||||
$projectModel = new Project($this->container);
|
||||
$projectUserRoleModel = new ProjectUserRole($this->container);
|
||||
$userModel = new User($this->container);
|
||||
$projectModel = new ProjectModel($this->container);
|
||||
$projectUserRoleModel = new ProjectUserRoleModel($this->container);
|
||||
$userModel = new UserModel($this->container);
|
||||
$userDistributionModel = new UserDistributionAnalytic($this->container);
|
||||
|
||||
$this->assertEquals(1, $projectModel->create(array('name' => 'test1')));
|
||||
@@ -70,7 +70,7 @@ class UserDistributionAnalyticTest extends Base
|
||||
|
||||
private function createTasks($user_id, $nb_active, $nb_inactive)
|
||||
{
|
||||
$taskCreationModel = new TaskCreation($this->container);
|
||||
$taskCreationModel = new TaskCreationModel($this->container);
|
||||
|
||||
for ($i = 0; $i < $nb_active; $i++) {
|
||||
$this->assertNotFalse($taskCreationModel->create(array('project_id' => 1, 'title' => 'test', 'owner_id' => $user_id, 'is_active' => 1)));
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
require_once __DIR__.'/../Base.php';
|
||||
|
||||
use Kanboard\Auth\DatabaseAuth;
|
||||
use Kanboard\Model\User;
|
||||
use Kanboard\Model\UserModel;
|
||||
|
||||
class DatabaseAuthTest extends Base
|
||||
{
|
||||
@@ -41,7 +41,7 @@ class DatabaseAuthTest extends Base
|
||||
|
||||
public function testIsvalidSession()
|
||||
{
|
||||
$userModel = new User($this->container);
|
||||
$userModel = new UserModel($this->container);
|
||||
$provider = new DatabaseAuth($this->container);
|
||||
|
||||
$this->assertFalse($provider->isValidSession());
|
||||
|
||||
@@ -63,8 +63,8 @@ abstract class Base extends PHPUnit_Framework_TestCase
|
||||
->setMethods(array('send'))
|
||||
->getMock();
|
||||
|
||||
$this->container['userNotificationType'] = $this
|
||||
->getMockBuilder('\Kanboard\Model\UserNotificationType')
|
||||
$this->container['userNotificationTypeModel'] = $this
|
||||
->getMockBuilder('\Kanboard\Model\UserNotificationTypeModel')
|
||||
->setConstructorArgs(array($this->container))
|
||||
->setMethods(array('getType', 'getSelectedTypes'))
|
||||
->getMock();
|
||||
|
||||
@@ -7,10 +7,10 @@ use Kanboard\Action\TaskAssignColorColumn;
|
||||
use Kanboard\Action\TaskClose;
|
||||
use Kanboard\Action\TaskCloseColumn;
|
||||
use Kanboard\Action\TaskUpdateStartDate;
|
||||
use Kanboard\Model\Action;
|
||||
use Kanboard\Model\Task;
|
||||
use Kanboard\Model\Project;
|
||||
use Kanboard\Model\ProjectUserRole;
|
||||
use Kanboard\Model\ActionModel;
|
||||
use Kanboard\Model\TaskModel;
|
||||
use Kanboard\Model\ProjectModel;
|
||||
use Kanboard\Model\ProjectUserRoleModel;
|
||||
use Kanboard\Core\Security\Role;
|
||||
|
||||
class ActionManagerTest extends Base
|
||||
@@ -79,16 +79,16 @@ class ActionManagerTest extends Base
|
||||
|
||||
$events = $actionManager->getCompatibleEvents('\\'.get_class($actionTaskAssignColorColumn));
|
||||
$this->assertCount(2, $events);
|
||||
$this->assertArrayHasKey(Task::EVENT_CREATE, $events);
|
||||
$this->assertArrayHasKey(Task::EVENT_MOVE_COLUMN, $events);
|
||||
$this->assertNotEmpty($events[Task::EVENT_CREATE]);
|
||||
$this->assertNotEmpty($events[Task::EVENT_MOVE_COLUMN]);
|
||||
$this->assertArrayHasKey(TaskModel::EVENT_CREATE, $events);
|
||||
$this->assertArrayHasKey(TaskModel::EVENT_MOVE_COLUMN, $events);
|
||||
$this->assertNotEmpty($events[TaskModel::EVENT_CREATE]);
|
||||
$this->assertNotEmpty($events[TaskModel::EVENT_MOVE_COLUMN]);
|
||||
}
|
||||
|
||||
public function testAttachEventsWithoutUserSession()
|
||||
{
|
||||
$projectModel = new Project($this->container);
|
||||
$actionModel = new Action($this->container);
|
||||
$projectModel = new ProjectModel($this->container);
|
||||
$actionModel = new ActionModel($this->container);
|
||||
$actionTaskAssignColorColumn = new TaskAssignColorColumn($this->container);
|
||||
$actionManager = new ActionManager($this->container);
|
||||
$actionManager->register($actionTaskAssignColorColumn);
|
||||
@@ -101,13 +101,13 @@ class ActionManagerTest extends Base
|
||||
$this->assertEquals(1, $projectModel->create(array('name' =>'test')));
|
||||
$this->assertEquals(1, $actionModel->create(array(
|
||||
'project_id' => 1,
|
||||
'event_name' => Task::EVENT_CREATE,
|
||||
'event_name' => TaskModel::EVENT_CREATE,
|
||||
'action_name' => key($actions),
|
||||
'params' => array('column_id' => 1, 'color_id' => 'red'),
|
||||
)));
|
||||
|
||||
$actionManager->attachEvents();
|
||||
$listeners = $this->container['dispatcher']->getListeners(Task::EVENT_CREATE);
|
||||
$listeners = $this->container['dispatcher']->getListeners(TaskModel::EVENT_CREATE);
|
||||
$this->assertCount(1, $listeners);
|
||||
$this->assertInstanceOf(get_class($actionTaskAssignColorColumn), $listeners[0][0]);
|
||||
|
||||
@@ -118,9 +118,9 @@ class ActionManagerTest extends Base
|
||||
{
|
||||
$this->container['sessionStorage']->user = array('id' => 1);
|
||||
|
||||
$projectModel = new Project($this->container);
|
||||
$projectUserRoleModel = new ProjectUserRole($this->container);
|
||||
$actionModel = new Action($this->container);
|
||||
$projectModel = new ProjectModel($this->container);
|
||||
$projectUserRoleModel = new ProjectUserRoleModel($this->container);
|
||||
$actionModel = new ActionModel($this->container);
|
||||
$actionTaskAssignColorColumn = new TaskAssignColorColumn($this->container);
|
||||
$actionManager = new ActionManager($this->container);
|
||||
$actionManager->register($actionTaskAssignColorColumn);
|
||||
@@ -134,21 +134,21 @@ class ActionManagerTest extends Base
|
||||
|
||||
$this->assertEquals(1, $actionModel->create(array(
|
||||
'project_id' => 1,
|
||||
'event_name' => Task::EVENT_CREATE,
|
||||
'event_name' => TaskModel::EVENT_CREATE,
|
||||
'action_name' => key($actions),
|
||||
'params' => array('column_id' => 1, 'color_id' => 'red'),
|
||||
)));
|
||||
|
||||
$this->assertEquals(2, $actionModel->create(array(
|
||||
'project_id' => 2,
|
||||
'event_name' => Task::EVENT_MOVE_COLUMN,
|
||||
'event_name' => TaskModel::EVENT_MOVE_COLUMN,
|
||||
'action_name' => key($actions),
|
||||
'params' => array('column_id' => 1, 'color_id' => 'red'),
|
||||
)));
|
||||
|
||||
$actionManager->attachEvents();
|
||||
|
||||
$listeners = $this->container['dispatcher']->getListeners(Task::EVENT_MOVE_COLUMN);
|
||||
$listeners = $this->container['dispatcher']->getListeners(TaskModel::EVENT_MOVE_COLUMN);
|
||||
$this->assertCount(1, $listeners);
|
||||
$this->assertInstanceOf(get_class($actionTaskAssignColorColumn), $listeners[0][0]);
|
||||
|
||||
@@ -157,9 +157,9 @@ class ActionManagerTest extends Base
|
||||
|
||||
public function testThatEachListenerAreDifferentInstance()
|
||||
{
|
||||
$projectModel = new Project($this->container);
|
||||
$projectUserRoleModel = new ProjectUserRole($this->container);
|
||||
$actionModel = new Action($this->container);
|
||||
$projectModel = new ProjectModel($this->container);
|
||||
$projectUserRoleModel = new ProjectUserRoleModel($this->container);
|
||||
$actionModel = new ActionModel($this->container);
|
||||
$actionTaskAssignColorColumn = new TaskAssignColorColumn($this->container);
|
||||
$actionManager = new ActionManager($this->container);
|
||||
$actionManager->register($actionTaskAssignColorColumn);
|
||||
@@ -169,21 +169,21 @@ class ActionManagerTest extends Base
|
||||
|
||||
$this->assertEquals(1, $actionModel->create(array(
|
||||
'project_id' => 1,
|
||||
'event_name' => Task::EVENT_MOVE_COLUMN,
|
||||
'event_name' => TaskModel::EVENT_MOVE_COLUMN,
|
||||
'action_name' => key($actions),
|
||||
'params' => array('column_id' => 2, 'color_id' => 'green'),
|
||||
)));
|
||||
|
||||
$this->assertEquals(2, $actionModel->create(array(
|
||||
'project_id' => 1,
|
||||
'event_name' => Task::EVENT_MOVE_COLUMN,
|
||||
'event_name' => TaskModel::EVENT_MOVE_COLUMN,
|
||||
'action_name' => key($actions),
|
||||
'params' => array('column_id' => 1, 'color_id' => 'red'),
|
||||
)));
|
||||
|
||||
$actionManager->attachEvents();
|
||||
|
||||
$listeners = $this->container['dispatcher']->getListeners(Task::EVENT_MOVE_COLUMN);
|
||||
$listeners = $this->container['dispatcher']->getListeners(TaskModel::EVENT_MOVE_COLUMN);
|
||||
$this->assertCount(2, $listeners);
|
||||
$this->assertFalse($listeners[0][0] === $listeners[1][0]);
|
||||
|
||||
|
||||
@@ -5,17 +5,17 @@ require_once __DIR__.'/../../Base.php';
|
||||
use Kanboard\Core\Filter\LexerBuilder;
|
||||
use Kanboard\Filter\TaskAssigneeFilter;
|
||||
use Kanboard\Filter\TaskTitleFilter;
|
||||
use Kanboard\Model\Project;
|
||||
use Kanboard\Model\TaskCreation;
|
||||
use Kanboard\Model\TaskFinder;
|
||||
use Kanboard\Model\ProjectModel;
|
||||
use Kanboard\Model\TaskCreationModel;
|
||||
use Kanboard\Model\TaskFinderModel;
|
||||
|
||||
class LexerBuilderTest extends Base
|
||||
{
|
||||
public function testBuilderThatReturnResult()
|
||||
{
|
||||
$project = new Project($this->container);
|
||||
$taskCreation = new TaskCreation($this->container);
|
||||
$taskFinder = new TaskFinder($this->container);
|
||||
$project = new ProjectModel($this->container);
|
||||
$taskCreation = new TaskCreationModel($this->container);
|
||||
$taskFinder = new TaskFinderModel($this->container);
|
||||
$query = $taskFinder->getExtendedQuery();
|
||||
|
||||
$this->assertEquals(1, $project->create(array('name' => 'Project')));
|
||||
@@ -33,9 +33,9 @@ class LexerBuilderTest extends Base
|
||||
|
||||
public function testBuilderThatReturnNothing()
|
||||
{
|
||||
$project = new Project($this->container);
|
||||
$taskCreation = new TaskCreation($this->container);
|
||||
$taskFinder = new TaskFinder($this->container);
|
||||
$project = new ProjectModel($this->container);
|
||||
$taskCreation = new TaskCreationModel($this->container);
|
||||
$taskFinder = new TaskFinderModel($this->container);
|
||||
$query = $taskFinder->getExtendedQuery();
|
||||
|
||||
$this->assertEquals(1, $project->create(array('name' => 'Project')));
|
||||
@@ -52,9 +52,9 @@ class LexerBuilderTest extends Base
|
||||
|
||||
public function testBuilderWithEmptyInput()
|
||||
{
|
||||
$project = new Project($this->container);
|
||||
$taskCreation = new TaskCreation($this->container);
|
||||
$taskFinder = new TaskFinder($this->container);
|
||||
$project = new ProjectModel($this->container);
|
||||
$taskCreation = new TaskCreationModel($this->container);
|
||||
$taskFinder = new TaskFinderModel($this->container);
|
||||
$query = $taskFinder->getExtendedQuery();
|
||||
|
||||
$this->assertEquals(1, $project->create(array('name' => 'Project')));
|
||||
@@ -71,9 +71,9 @@ class LexerBuilderTest extends Base
|
||||
|
||||
public function testBuilderWithMultipleMatches()
|
||||
{
|
||||
$project = new Project($this->container);
|
||||
$taskCreation = new TaskCreation($this->container);
|
||||
$taskFinder = new TaskFinder($this->container);
|
||||
$project = new ProjectModel($this->container);
|
||||
$taskCreation = new TaskCreationModel($this->container);
|
||||
$taskFinder = new TaskFinderModel($this->container);
|
||||
$query = $taskFinder->getExtendedQuery();
|
||||
|
||||
$this->assertEquals(1, $project->create(array('name' => 'Project')));
|
||||
@@ -91,7 +91,7 @@ class LexerBuilderTest extends Base
|
||||
|
||||
public function testClone()
|
||||
{
|
||||
$taskFinder = new TaskFinder($this->container);
|
||||
$taskFinder = new TaskFinderModel($this->container);
|
||||
$query = $taskFinder->getExtendedQuery();
|
||||
|
||||
$builder = new LexerBuilder();
|
||||
|
||||
@@ -3,10 +3,10 @@
|
||||
use Kanboard\Core\Filter\OrCriteria;
|
||||
use Kanboard\Filter\TaskAssigneeFilter;
|
||||
use Kanboard\Filter\TaskTitleFilter;
|
||||
use Kanboard\Model\Project;
|
||||
use Kanboard\Model\TaskCreation;
|
||||
use Kanboard\Model\TaskFinder;
|
||||
use Kanboard\Model\User;
|
||||
use Kanboard\Model\ProjectModel;
|
||||
use Kanboard\Model\TaskCreationModel;
|
||||
use Kanboard\Model\TaskFinderModel;
|
||||
use Kanboard\Model\UserModel;
|
||||
|
||||
require_once __DIR__.'/../../Base.php';
|
||||
|
||||
@@ -14,10 +14,10 @@ class OrCriteriaTest extends Base
|
||||
{
|
||||
public function testWithSameFilter()
|
||||
{
|
||||
$taskFinder = new TaskFinder($this->container);
|
||||
$taskCreation = new TaskCreation($this->container);
|
||||
$projectModel = new Project($this->container);
|
||||
$userModel = new User($this->container);
|
||||
$taskFinder = new TaskFinderModel($this->container);
|
||||
$taskCreation = new TaskCreationModel($this->container);
|
||||
$projectModel = new ProjectModel($this->container);
|
||||
$userModel = new UserModel($this->container);
|
||||
$query = $taskFinder->getExtendedQuery();
|
||||
|
||||
$this->assertEquals(2, $userModel->create(array('username' => 'foobar', 'name' => 'Foo Bar')));
|
||||
@@ -36,10 +36,10 @@ class OrCriteriaTest extends Base
|
||||
|
||||
public function testWithDifferentFilter()
|
||||
{
|
||||
$taskFinder = new TaskFinder($this->container);
|
||||
$taskCreation = new TaskCreation($this->container);
|
||||
$projectModel = new Project($this->container);
|
||||
$userModel = new User($this->container);
|
||||
$taskFinder = new TaskFinderModel($this->container);
|
||||
$taskCreation = new TaskCreationModel($this->container);
|
||||
$projectModel = new ProjectModel($this->container);
|
||||
$userModel = new UserModel($this->container);
|
||||
$query = $taskFinder->getExtendedQuery();
|
||||
|
||||
$this->assertEquals(2, $userModel->create(array('username' => 'foobar', 'name' => 'Foo Bar')));
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
require_once __DIR__.'/../../Base.php';
|
||||
|
||||
use Kanboard\Model\Group;
|
||||
use Kanboard\Model\GroupModel;
|
||||
use Kanboard\Core\Group\GroupManager;
|
||||
use Kanboard\Group\DatabaseBackendGroupProvider;
|
||||
|
||||
@@ -10,7 +10,7 @@ class GroupManagerTest extends Base
|
||||
{
|
||||
public function testFind()
|
||||
{
|
||||
$groupModel = new Group($this->container);
|
||||
$groupModel = new GroupModel($this->container);
|
||||
$groupManager = new GroupManager;
|
||||
|
||||
$this->assertEquals(1, $groupModel->create('Group 1'));
|
||||
|
||||
@@ -3,15 +3,15 @@
|
||||
require_once __DIR__.'/../../Base.php';
|
||||
|
||||
use Kanboard\Core\User\GroupSync;
|
||||
use Kanboard\Model\Group;
|
||||
use Kanboard\Model\GroupMember;
|
||||
use Kanboard\Model\GroupModel;
|
||||
use Kanboard\Model\GroupMemberModel;
|
||||
|
||||
class GroupSyncTest extends Base
|
||||
{
|
||||
public function testAddGroups()
|
||||
{
|
||||
$group = new Group($this->container);
|
||||
$groupMember = new GroupMember($this->container);
|
||||
$group = new GroupModel($this->container);
|
||||
$groupMember = new GroupMemberModel($this->container);
|
||||
$groupSync = new GroupSync($this->container);
|
||||
|
||||
$this->assertEquals(1, $group->create('My Group 1', 'externalId1'));
|
||||
@@ -30,8 +30,8 @@ class GroupSyncTest extends Base
|
||||
|
||||
public function testRemoveGroups()
|
||||
{
|
||||
$group = new Group($this->container);
|
||||
$groupMember = new GroupMember($this->container);
|
||||
$group = new GroupModel($this->container);
|
||||
$groupMember = new GroupMemberModel($this->container);
|
||||
$groupSync = new GroupSync($this->container);
|
||||
|
||||
$this->assertEquals(1, $group->create('My Group 1', 'externalId1'));
|
||||
@@ -50,8 +50,8 @@ class GroupSyncTest extends Base
|
||||
|
||||
public function testBoth()
|
||||
{
|
||||
$group = new Group($this->container);
|
||||
$groupMember = new GroupMember($this->container);
|
||||
$group = new GroupModel($this->container);
|
||||
$groupMember = new GroupMemberModel($this->container);
|
||||
$groupSync = new GroupSync($this->container);
|
||||
|
||||
$this->assertEquals(1, $group->create('My Group 1', 'externalId1'));
|
||||
@@ -74,8 +74,8 @@ class GroupSyncTest extends Base
|
||||
|
||||
public function testThatInternalGroupsAreNotTouched()
|
||||
{
|
||||
$group = new Group($this->container);
|
||||
$groupMember = new GroupMember($this->container);
|
||||
$group = new GroupModel($this->container);
|
||||
$groupMember = new GroupMemberModel($this->container);
|
||||
$groupSync = new GroupSync($this->container);
|
||||
|
||||
$this->assertEquals(1, $group->create('My Group 1'));
|
||||
|
||||
@@ -2,21 +2,21 @@
|
||||
|
||||
require_once __DIR__ . '/../Base.php';
|
||||
|
||||
use Kanboard\Model\TaskCreation;
|
||||
use Kanboard\Model\TaskCreationModel;
|
||||
use Kanboard\Export\TaskExport;
|
||||
use Kanboard\Model\Project;
|
||||
use Kanboard\Model\Category;
|
||||
use Kanboard\Model\Swimlane;
|
||||
use Kanboard\Model\ProjectModel;
|
||||
use Kanboard\Model\CategoryModel;
|
||||
use Kanboard\Model\SwimlaneModel;
|
||||
|
||||
class TaskExportTest extends Base
|
||||
{
|
||||
public function testExport()
|
||||
{
|
||||
$tc = new TaskCreation($this->container);
|
||||
$p = new Project($this->container);
|
||||
$c = new Category($this->container);
|
||||
$tc = new TaskCreationModel($this->container);
|
||||
$p = new ProjectModel($this->container);
|
||||
$c = new CategoryModel($this->container);
|
||||
$e = new TaskExport($this->container);
|
||||
$s = new Swimlane($this->container);
|
||||
$s = new SwimlaneModel($this->container);
|
||||
|
||||
$this->assertEquals(1, $p->create(array('name' => 'Export Project')));
|
||||
|
||||
|
||||
@@ -2,18 +2,18 @@
|
||||
|
||||
require_once __DIR__ . '/../Base.php';
|
||||
|
||||
use Kanboard\Model\TaskCreation;
|
||||
use Kanboard\Model\Transition;
|
||||
use Kanboard\Model\TaskCreationModel;
|
||||
use Kanboard\Model\TransitionModel;
|
||||
use Kanboard\Export\TransitionExport;
|
||||
use Kanboard\Model\Project;
|
||||
use Kanboard\Model\ProjectModel;
|
||||
|
||||
class TransitionExportTest extends Base
|
||||
{
|
||||
public function testExport()
|
||||
{
|
||||
$projectModel = new Project($this->container);
|
||||
$taskCreationModel = new TaskCreation($this->container);
|
||||
$transitionModel = new Transition($this->container);
|
||||
$projectModel = new ProjectModel($this->container);
|
||||
$taskCreationModel = new TaskCreationModel($this->container);
|
||||
$transitionModel = new TransitionModel($this->container);
|
||||
$transitionExportModel = new TransitionExport($this->container);
|
||||
|
||||
$this->assertEquals(1, $projectModel->create(array('name' => 'test')));
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
<?php
|
||||
|
||||
use Kanboard\Filter\ProjectActivityCreationDateFilter;
|
||||
use Kanboard\Model\Project;
|
||||
use Kanboard\Model\ProjectActivity;
|
||||
use Kanboard\Model\TaskCreation;
|
||||
use Kanboard\Model\TaskFinder;
|
||||
use Kanboard\Model\Task;
|
||||
use Kanboard\Model\ProjectModel;
|
||||
use Kanboard\Model\ProjectActivityModel;
|
||||
use Kanboard\Model\TaskCreationModel;
|
||||
use Kanboard\Model\TaskFinderModel;
|
||||
use Kanboard\Model\TaskModel;
|
||||
|
||||
require_once __DIR__.'/../Base.php';
|
||||
|
||||
@@ -13,14 +13,14 @@ class ProjectActivityCreationDateFilterTest extends Base
|
||||
{
|
||||
public function testWithToday()
|
||||
{
|
||||
$taskFinder = new TaskFinder($this->container);
|
||||
$taskCreation = new TaskCreation($this->container);
|
||||
$projectModel = new Project($this->container);
|
||||
$projectActivityModel = new ProjectActivity($this->container);
|
||||
$taskFinder = new TaskFinderModel($this->container);
|
||||
$taskCreation = new TaskCreationModel($this->container);
|
||||
$projectModel = new ProjectModel($this->container);
|
||||
$projectActivityModel = new ProjectActivityModel($this->container);
|
||||
|
||||
$this->assertEquals(1, $projectModel->create(array('name' => 'P1')));
|
||||
$this->assertEquals(1, $taskCreation->create(array('title' => 'Test', 'project_id' => 1)));
|
||||
$this->assertNotFalse($projectActivityModel->createEvent(1, 1, 1, Task::EVENT_CREATE, array('task' => $taskFinder->getById(1))));
|
||||
$this->assertNotFalse($projectActivityModel->createEvent(1, 1, 1, TaskModel::EVENT_CREATE, array('task' => $taskFinder->getById(1))));
|
||||
|
||||
$query = $projectActivityModel->getQuery();
|
||||
$filter = new ProjectActivityCreationDateFilter('today');
|
||||
@@ -33,14 +33,14 @@ class ProjectActivityCreationDateFilterTest extends Base
|
||||
|
||||
public function testWithYesterday()
|
||||
{
|
||||
$taskFinder = new TaskFinder($this->container);
|
||||
$taskCreation = new TaskCreation($this->container);
|
||||
$projectModel = new Project($this->container);
|
||||
$projectActivityModel = new ProjectActivity($this->container);
|
||||
$taskFinder = new TaskFinderModel($this->container);
|
||||
$taskCreation = new TaskCreationModel($this->container);
|
||||
$projectModel = new ProjectModel($this->container);
|
||||
$projectActivityModel = new ProjectActivityModel($this->container);
|
||||
|
||||
$this->assertEquals(1, $projectModel->create(array('name' => 'P1')));
|
||||
$this->assertEquals(1, $taskCreation->create(array('title' => 'Test', 'project_id' => 1)));
|
||||
$this->assertNotFalse($projectActivityModel->createEvent(1, 1, 1, Task::EVENT_CREATE, array('task' => $taskFinder->getById(1))));
|
||||
$this->assertNotFalse($projectActivityModel->createEvent(1, 1, 1, TaskModel::EVENT_CREATE, array('task' => $taskFinder->getById(1))));
|
||||
|
||||
$query = $projectActivityModel->getQuery();
|
||||
$filter = new ProjectActivityCreationDateFilter('yesterday');
|
||||
@@ -53,14 +53,14 @@ class ProjectActivityCreationDateFilterTest extends Base
|
||||
|
||||
public function testWithStrtotimeString()
|
||||
{
|
||||
$taskFinder = new TaskFinder($this->container);
|
||||
$taskCreation = new TaskCreation($this->container);
|
||||
$projectModel = new Project($this->container);
|
||||
$projectActivityModel = new ProjectActivity($this->container);
|
||||
$taskFinder = new TaskFinderModel($this->container);
|
||||
$taskCreation = new TaskCreationModel($this->container);
|
||||
$projectModel = new ProjectModel($this->container);
|
||||
$projectActivityModel = new ProjectActivityModel($this->container);
|
||||
|
||||
$this->assertEquals(1, $projectModel->create(array('name' => 'P1')));
|
||||
$this->assertEquals(1, $taskCreation->create(array('title' => 'Test', 'project_id' => 1)));
|
||||
$this->assertNotFalse($projectActivityModel->createEvent(1, 1, 1, Task::EVENT_CREATE, array('task' => $taskFinder->getById(1))));
|
||||
$this->assertNotFalse($projectActivityModel->createEvent(1, 1, 1, TaskModel::EVENT_CREATE, array('task' => $taskFinder->getById(1))));
|
||||
|
||||
$query = $projectActivityModel->getQuery();
|
||||
$filter = new ProjectActivityCreationDateFilter('<=last week');
|
||||
@@ -73,14 +73,14 @@ class ProjectActivityCreationDateFilterTest extends Base
|
||||
|
||||
public function testWithIsoDate()
|
||||
{
|
||||
$taskFinder = new TaskFinder($this->container);
|
||||
$taskCreation = new TaskCreation($this->container);
|
||||
$projectModel = new Project($this->container);
|
||||
$projectActivityModel = new ProjectActivity($this->container);
|
||||
$taskFinder = new TaskFinderModel($this->container);
|
||||
$taskCreation = new TaskCreationModel($this->container);
|
||||
$projectModel = new ProjectModel($this->container);
|
||||
$projectActivityModel = new ProjectActivityModel($this->container);
|
||||
|
||||
$this->assertEquals(1, $projectModel->create(array('name' => 'P1')));
|
||||
$this->assertEquals(1, $taskCreation->create(array('title' => 'Test', 'project_id' => 1)));
|
||||
$this->assertNotFalse($projectActivityModel->createEvent(1, 1, 1, Task::EVENT_CREATE, array('task' => $taskFinder->getById(1))));
|
||||
$this->assertNotFalse($projectActivityModel->createEvent(1, 1, 1, TaskModel::EVENT_CREATE, array('task' => $taskFinder->getById(1))));
|
||||
|
||||
$query = $projectActivityModel->getQuery();
|
||||
$filter = new ProjectActivityCreationDateFilter(date('Y-m-d'));
|
||||
@@ -93,14 +93,14 @@ class ProjectActivityCreationDateFilterTest extends Base
|
||||
|
||||
public function testWithOperatorAndIsoDate()
|
||||
{
|
||||
$taskFinder = new TaskFinder($this->container);
|
||||
$taskCreation = new TaskCreation($this->container);
|
||||
$projectModel = new Project($this->container);
|
||||
$projectActivityModel = new ProjectActivity($this->container);
|
||||
$taskFinder = new TaskFinderModel($this->container);
|
||||
$taskCreation = new TaskCreationModel($this->container);
|
||||
$projectModel = new ProjectModel($this->container);
|
||||
$projectActivityModel = new ProjectActivityModel($this->container);
|
||||
|
||||
$this->assertEquals(1, $projectModel->create(array('name' => 'P1')));
|
||||
$this->assertEquals(1, $taskCreation->create(array('title' => 'Test', 'project_id' => 1)));
|
||||
$this->assertNotFalse($projectActivityModel->createEvent(1, 1, 1, Task::EVENT_CREATE, array('task' => $taskFinder->getById(1))));
|
||||
$this->assertNotFalse($projectActivityModel->createEvent(1, 1, 1, TaskModel::EVENT_CREATE, array('task' => $taskFinder->getById(1))));
|
||||
|
||||
$query = $projectActivityModel->getQuery();
|
||||
$filter = new ProjectActivityCreationDateFilter('>='.date('Y-m-d'));
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
<?php
|
||||
|
||||
use Kanboard\Filter\ProjectActivityCreatorFilter;
|
||||
use Kanboard\Model\Project;
|
||||
use Kanboard\Model\ProjectActivity;
|
||||
use Kanboard\Model\TaskCreation;
|
||||
use Kanboard\Model\TaskFinder;
|
||||
use Kanboard\Model\Task;
|
||||
use Kanboard\Model\ProjectModel;
|
||||
use Kanboard\Model\ProjectActivityModel;
|
||||
use Kanboard\Model\TaskCreationModel;
|
||||
use Kanboard\Model\TaskFinderModel;
|
||||
use Kanboard\Model\TaskModel;
|
||||
|
||||
require_once __DIR__.'/../Base.php';
|
||||
|
||||
@@ -13,14 +13,14 @@ class ProjectActivityCreatorFilterTest extends Base
|
||||
{
|
||||
public function testWithUsername()
|
||||
{
|
||||
$taskFinder = new TaskFinder($this->container);
|
||||
$taskCreation = new TaskCreation($this->container);
|
||||
$projectModel = new Project($this->container);
|
||||
$projectActivityModel = new ProjectActivity($this->container);
|
||||
$taskFinder = new TaskFinderModel($this->container);
|
||||
$taskCreation = new TaskCreationModel($this->container);
|
||||
$projectModel = new ProjectModel($this->container);
|
||||
$projectActivityModel = new ProjectActivityModel($this->container);
|
||||
|
||||
$this->assertEquals(1, $projectModel->create(array('name' => 'P1')));
|
||||
$this->assertEquals(1, $taskCreation->create(array('title' => 'Test', 'project_id' => 1)));
|
||||
$this->assertNotFalse($projectActivityModel->createEvent(1, 1, 1, Task::EVENT_CREATE, array('task' => $taskFinder->getById(1))));
|
||||
$this->assertNotFalse($projectActivityModel->createEvent(1, 1, 1, TaskModel::EVENT_CREATE, array('task' => $taskFinder->getById(1))));
|
||||
|
||||
$query = $projectActivityModel->getQuery();
|
||||
$filter = new ProjectActivityCreatorFilter('admin');
|
||||
@@ -32,14 +32,14 @@ class ProjectActivityCreatorFilterTest extends Base
|
||||
|
||||
public function testWithAnotherUsername()
|
||||
{
|
||||
$taskFinder = new TaskFinder($this->container);
|
||||
$taskCreation = new TaskCreation($this->container);
|
||||
$projectModel = new Project($this->container);
|
||||
$projectActivityModel = new ProjectActivity($this->container);
|
||||
$taskFinder = new TaskFinderModel($this->container);
|
||||
$taskCreation = new TaskCreationModel($this->container);
|
||||
$projectModel = new ProjectModel($this->container);
|
||||
$projectActivityModel = new ProjectActivityModel($this->container);
|
||||
|
||||
$this->assertEquals(1, $projectModel->create(array('name' => 'P1')));
|
||||
$this->assertEquals(1, $taskCreation->create(array('title' => 'Test', 'project_id' => 1)));
|
||||
$this->assertNotFalse($projectActivityModel->createEvent(1, 1, 1, Task::EVENT_CREATE, array('task' => $taskFinder->getById(1))));
|
||||
$this->assertNotFalse($projectActivityModel->createEvent(1, 1, 1, TaskModel::EVENT_CREATE, array('task' => $taskFinder->getById(1))));
|
||||
|
||||
$query = $projectActivityModel->getQuery();
|
||||
$filter = new ProjectActivityCreatorFilter('John Doe');
|
||||
@@ -51,14 +51,14 @@ class ProjectActivityCreatorFilterTest extends Base
|
||||
|
||||
public function testWithCurrentUser()
|
||||
{
|
||||
$taskFinder = new TaskFinder($this->container);
|
||||
$taskCreation = new TaskCreation($this->container);
|
||||
$projectModel = new Project($this->container);
|
||||
$projectActivityModel = new ProjectActivity($this->container);
|
||||
$taskFinder = new TaskFinderModel($this->container);
|
||||
$taskCreation = new TaskCreationModel($this->container);
|
||||
$projectModel = new ProjectModel($this->container);
|
||||
$projectActivityModel = new ProjectActivityModel($this->container);
|
||||
|
||||
$this->assertEquals(1, $projectModel->create(array('name' => 'P1')));
|
||||
$this->assertEquals(1, $taskCreation->create(array('title' => 'Test', 'project_id' => 1)));
|
||||
$this->assertNotFalse($projectActivityModel->createEvent(1, 1, 1, Task::EVENT_CREATE, array('task' => $taskFinder->getById(1))));
|
||||
$this->assertNotFalse($projectActivityModel->createEvent(1, 1, 1, TaskModel::EVENT_CREATE, array('task' => $taskFinder->getById(1))));
|
||||
|
||||
$query = $projectActivityModel->getQuery();
|
||||
$filter = new ProjectActivityCreatorFilter('me');
|
||||
@@ -71,14 +71,14 @@ class ProjectActivityCreatorFilterTest extends Base
|
||||
|
||||
public function testWithAnotherCurrentUser()
|
||||
{
|
||||
$taskFinder = new TaskFinder($this->container);
|
||||
$taskCreation = new TaskCreation($this->container);
|
||||
$projectModel = new Project($this->container);
|
||||
$projectActivityModel = new ProjectActivity($this->container);
|
||||
$taskFinder = new TaskFinderModel($this->container);
|
||||
$taskCreation = new TaskCreationModel($this->container);
|
||||
$projectModel = new ProjectModel($this->container);
|
||||
$projectActivityModel = new ProjectActivityModel($this->container);
|
||||
|
||||
$this->assertEquals(1, $projectModel->create(array('name' => 'P1')));
|
||||
$this->assertEquals(1, $taskCreation->create(array('title' => 'Test', 'project_id' => 1)));
|
||||
$this->assertNotFalse($projectActivityModel->createEvent(1, 1, 1, Task::EVENT_CREATE, array('task' => $taskFinder->getById(1))));
|
||||
$this->assertNotFalse($projectActivityModel->createEvent(1, 1, 1, TaskModel::EVENT_CREATE, array('task' => $taskFinder->getById(1))));
|
||||
|
||||
$query = $projectActivityModel->getQuery();
|
||||
$filter = new ProjectActivityCreatorFilter('me');
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
<?php
|
||||
|
||||
use Kanboard\Filter\ProjectActivityProjectIdFilter;
|
||||
use Kanboard\Model\Project;
|
||||
use Kanboard\Model\ProjectActivity;
|
||||
use Kanboard\Model\TaskCreation;
|
||||
use Kanboard\Model\TaskFinder;
|
||||
use Kanboard\Model\Task;
|
||||
use Kanboard\Model\ProjectModel;
|
||||
use Kanboard\Model\ProjectActivityModel;
|
||||
use Kanboard\Model\TaskCreationModel;
|
||||
use Kanboard\Model\TaskFinderModel;
|
||||
use Kanboard\Model\TaskModel;
|
||||
|
||||
require_once __DIR__.'/../Base.php';
|
||||
|
||||
@@ -13,10 +13,10 @@ class ProjectActivityProjectIdFilterTest extends Base
|
||||
{
|
||||
public function testFilterByProjectId()
|
||||
{
|
||||
$taskFinder = new TaskFinder($this->container);
|
||||
$taskCreation = new TaskCreation($this->container);
|
||||
$projectModel = new Project($this->container);
|
||||
$projectActivityModel = new ProjectActivity($this->container);
|
||||
$taskFinder = new TaskFinderModel($this->container);
|
||||
$taskCreation = new TaskCreationModel($this->container);
|
||||
$projectModel = new ProjectModel($this->container);
|
||||
$projectActivityModel = new ProjectActivityModel($this->container);
|
||||
$query = $projectActivityModel->getQuery();
|
||||
|
||||
$this->assertEquals(1, $projectModel->create(array('name' => 'P1')));
|
||||
@@ -25,8 +25,8 @@ class ProjectActivityProjectIdFilterTest extends Base
|
||||
$this->assertEquals(1, $taskCreation->create(array('title' => 'Test', 'project_id' => 1)));
|
||||
$this->assertEquals(2, $taskCreation->create(array('title' => 'Test', 'project_id' => 2)));
|
||||
|
||||
$this->assertNotFalse($projectActivityModel->createEvent(1, 1, 1, Task::EVENT_CREATE, array('task' => $taskFinder->getById(1))));
|
||||
$this->assertNotFalse($projectActivityModel->createEvent(2, 2, 1, Task::EVENT_CREATE, array('task' => $taskFinder->getById(2))));
|
||||
$this->assertNotFalse($projectActivityModel->createEvent(1, 1, 1, TaskModel::EVENT_CREATE, array('task' => $taskFinder->getById(1))));
|
||||
$this->assertNotFalse($projectActivityModel->createEvent(2, 2, 1, TaskModel::EVENT_CREATE, array('task' => $taskFinder->getById(2))));
|
||||
|
||||
$filter = new ProjectActivityProjectIdFilter(1);
|
||||
$filter->withQuery($query)->apply();
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
<?php
|
||||
|
||||
use Kanboard\Filter\ProjectActivityProjectIdsFilter;
|
||||
use Kanboard\Model\Project;
|
||||
use Kanboard\Model\ProjectActivity;
|
||||
use Kanboard\Model\TaskCreation;
|
||||
use Kanboard\Model\TaskFinder;
|
||||
use Kanboard\Model\Task;
|
||||
use Kanboard\Model\ProjectModel;
|
||||
use Kanboard\Model\ProjectActivityModel;
|
||||
use Kanboard\Model\TaskCreationModel;
|
||||
use Kanboard\Model\TaskFinderModel;
|
||||
use Kanboard\Model\TaskModel;
|
||||
|
||||
require_once __DIR__.'/../Base.php';
|
||||
|
||||
@@ -13,10 +13,10 @@ class ProjectActivityProjectIdsFilterTest extends Base
|
||||
{
|
||||
public function testFilterByProjectIds()
|
||||
{
|
||||
$taskFinder = new TaskFinder($this->container);
|
||||
$taskCreation = new TaskCreation($this->container);
|
||||
$projectModel = new Project($this->container);
|
||||
$projectActivityModel = new ProjectActivity($this->container);
|
||||
$taskFinder = new TaskFinderModel($this->container);
|
||||
$taskCreation = new TaskCreationModel($this->container);
|
||||
$projectModel = new ProjectModel($this->container);
|
||||
$projectActivityModel = new ProjectActivityModel($this->container);
|
||||
$query = $projectActivityModel->getQuery();
|
||||
|
||||
$this->assertEquals(1, $projectModel->create(array('name' => 'P1')));
|
||||
@@ -27,9 +27,9 @@ class ProjectActivityProjectIdsFilterTest extends Base
|
||||
$this->assertEquals(2, $taskCreation->create(array('title' => 'Test', 'project_id' => 2)));
|
||||
$this->assertEquals(3, $taskCreation->create(array('title' => 'Test', 'project_id' => 3)));
|
||||
|
||||
$this->assertNotFalse($projectActivityModel->createEvent(1, 1, 1, Task::EVENT_CREATE, array('task' => $taskFinder->getById(1))));
|
||||
$this->assertNotFalse($projectActivityModel->createEvent(2, 2, 1, Task::EVENT_CREATE, array('task' => $taskFinder->getById(2))));
|
||||
$this->assertNotFalse($projectActivityModel->createEvent(3, 3, 1, Task::EVENT_CREATE, array('task' => $taskFinder->getById(3))));
|
||||
$this->assertNotFalse($projectActivityModel->createEvent(1, 1, 1, TaskModel::EVENT_CREATE, array('task' => $taskFinder->getById(1))));
|
||||
$this->assertNotFalse($projectActivityModel->createEvent(2, 2, 1, TaskModel::EVENT_CREATE, array('task' => $taskFinder->getById(2))));
|
||||
$this->assertNotFalse($projectActivityModel->createEvent(3, 3, 1, TaskModel::EVENT_CREATE, array('task' => $taskFinder->getById(3))));
|
||||
|
||||
$filter = new ProjectActivityProjectIdsFilter(array(1, 2));
|
||||
$filter->withQuery($query)->apply();
|
||||
@@ -38,10 +38,10 @@ class ProjectActivityProjectIdsFilterTest extends Base
|
||||
|
||||
public function testWithEmptyArgument()
|
||||
{
|
||||
$taskFinder = new TaskFinder($this->container);
|
||||
$taskCreation = new TaskCreation($this->container);
|
||||
$projectModel = new Project($this->container);
|
||||
$projectActivityModel = new ProjectActivity($this->container);
|
||||
$taskFinder = new TaskFinderModel($this->container);
|
||||
$taskCreation = new TaskCreationModel($this->container);
|
||||
$projectModel = new ProjectModel($this->container);
|
||||
$projectActivityModel = new ProjectActivityModel($this->container);
|
||||
$query = $projectActivityModel->getQuery();
|
||||
|
||||
$this->assertEquals(1, $projectModel->create(array('name' => 'P1')));
|
||||
@@ -52,9 +52,9 @@ class ProjectActivityProjectIdsFilterTest extends Base
|
||||
$this->assertEquals(2, $taskCreation->create(array('title' => 'Test', 'project_id' => 2)));
|
||||
$this->assertEquals(3, $taskCreation->create(array('title' => 'Test', 'project_id' => 3)));
|
||||
|
||||
$this->assertNotFalse($projectActivityModel->createEvent(1, 1, 1, Task::EVENT_CREATE, $taskFinder->getById(1)));
|
||||
$this->assertNotFalse($projectActivityModel->createEvent(2, 2, 1, Task::EVENT_CREATE, $taskFinder->getById(2)));
|
||||
$this->assertNotFalse($projectActivityModel->createEvent(3, 3, 1, Task::EVENT_CREATE, $taskFinder->getById(3)));
|
||||
$this->assertNotFalse($projectActivityModel->createEvent(1, 1, 1, TaskModel::EVENT_CREATE, $taskFinder->getById(1)));
|
||||
$this->assertNotFalse($projectActivityModel->createEvent(2, 2, 1, TaskModel::EVENT_CREATE, $taskFinder->getById(2)));
|
||||
$this->assertNotFalse($projectActivityModel->createEvent(3, 3, 1, TaskModel::EVENT_CREATE, $taskFinder->getById(3)));
|
||||
|
||||
$filter = new ProjectActivityProjectIdsFilter(array());
|
||||
$filter->withQuery($query)->apply();
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
<?php
|
||||
|
||||
use Kanboard\Filter\ProjectActivityProjectNameFilter;
|
||||
use Kanboard\Model\Project;
|
||||
use Kanboard\Model\ProjectActivity;
|
||||
use Kanboard\Model\TaskCreation;
|
||||
use Kanboard\Model\TaskFinder;
|
||||
use Kanboard\Model\Task;
|
||||
use Kanboard\Model\ProjectModel;
|
||||
use Kanboard\Model\ProjectActivityModel;
|
||||
use Kanboard\Model\TaskCreationModel;
|
||||
use Kanboard\Model\TaskFinderModel;
|
||||
use Kanboard\Model\TaskModel;
|
||||
|
||||
require_once __DIR__.'/../Base.php';
|
||||
|
||||
@@ -13,10 +13,10 @@ class ProjectActivityProjectNameFilterTest extends Base
|
||||
{
|
||||
public function testFilterByProjectName()
|
||||
{
|
||||
$taskFinder = new TaskFinder($this->container);
|
||||
$taskCreation = new TaskCreation($this->container);
|
||||
$projectModel = new Project($this->container);
|
||||
$projectActivityModel = new ProjectActivity($this->container);
|
||||
$taskFinder = new TaskFinderModel($this->container);
|
||||
$taskCreation = new TaskCreationModel($this->container);
|
||||
$projectModel = new ProjectModel($this->container);
|
||||
$projectActivityModel = new ProjectActivityModel($this->container);
|
||||
$query = $projectActivityModel->getQuery();
|
||||
|
||||
$this->assertEquals(1, $projectModel->create(array('name' => 'P1')));
|
||||
@@ -25,8 +25,8 @@ class ProjectActivityProjectNameFilterTest extends Base
|
||||
$this->assertEquals(1, $taskCreation->create(array('title' => 'Test', 'project_id' => 1)));
|
||||
$this->assertEquals(2, $taskCreation->create(array('title' => 'Test', 'project_id' => 2)));
|
||||
|
||||
$this->assertNotFalse($projectActivityModel->createEvent(1, 1, 1, Task::EVENT_CREATE, array('task' => $taskFinder->getById(1))));
|
||||
$this->assertNotFalse($projectActivityModel->createEvent(2, 2, 1, Task::EVENT_CREATE, array('task' => $taskFinder->getById(2))));
|
||||
$this->assertNotFalse($projectActivityModel->createEvent(1, 1, 1, TaskModel::EVENT_CREATE, array('task' => $taskFinder->getById(1))));
|
||||
$this->assertNotFalse($projectActivityModel->createEvent(2, 2, 1, TaskModel::EVENT_CREATE, array('task' => $taskFinder->getById(2))));
|
||||
|
||||
$filter = new ProjectActivityProjectNameFilter('P1');
|
||||
$filter->withQuery($query)->apply();
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
<?php
|
||||
|
||||
use Kanboard\Filter\ProjectActivityTaskIdFilter;
|
||||
use Kanboard\Model\Project;
|
||||
use Kanboard\Model\ProjectActivity;
|
||||
use Kanboard\Model\TaskCreation;
|
||||
use Kanboard\Model\TaskFinder;
|
||||
use Kanboard\Model\Task;
|
||||
use Kanboard\Model\ProjectModel;
|
||||
use Kanboard\Model\ProjectActivityModel;
|
||||
use Kanboard\Model\TaskCreationModel;
|
||||
use Kanboard\Model\TaskFinderModel;
|
||||
use Kanboard\Model\TaskModel;
|
||||
|
||||
require_once __DIR__.'/../Base.php';
|
||||
|
||||
@@ -13,10 +13,10 @@ class ProjectActivityTaskIdFilterTest extends Base
|
||||
{
|
||||
public function testFilterByTaskId()
|
||||
{
|
||||
$taskFinder = new TaskFinder($this->container);
|
||||
$taskCreation = new TaskCreation($this->container);
|
||||
$projectModel = new Project($this->container);
|
||||
$projectActivityModel = new ProjectActivity($this->container);
|
||||
$taskFinder = new TaskFinderModel($this->container);
|
||||
$taskCreation = new TaskCreationModel($this->container);
|
||||
$projectModel = new ProjectModel($this->container);
|
||||
$projectActivityModel = new ProjectActivityModel($this->container);
|
||||
$query = $projectActivityModel->getQuery();
|
||||
|
||||
$this->assertEquals(1, $projectModel->create(array('name' => 'P1')));
|
||||
@@ -24,8 +24,8 @@ class ProjectActivityTaskIdFilterTest extends Base
|
||||
$this->assertEquals(1, $taskCreation->create(array('title' => 'Test', 'project_id' => 1)));
|
||||
$this->assertEquals(2, $taskCreation->create(array('title' => 'Test', 'project_id' => 1)));
|
||||
|
||||
$this->assertNotFalse($projectActivityModel->createEvent(1, 1, 1, Task::EVENT_CREATE, array('task' => $taskFinder->getById(1))));
|
||||
$this->assertNotFalse($projectActivityModel->createEvent(1, 2, 1, Task::EVENT_CREATE, array('task' => $taskFinder->getById(2))));
|
||||
$this->assertNotFalse($projectActivityModel->createEvent(1, 1, 1, TaskModel::EVENT_CREATE, array('task' => $taskFinder->getById(1))));
|
||||
$this->assertNotFalse($projectActivityModel->createEvent(1, 2, 1, TaskModel::EVENT_CREATE, array('task' => $taskFinder->getById(2))));
|
||||
|
||||
$filter = new ProjectActivityTaskIdFilter(1);
|
||||
$filter->withQuery($query)->apply();
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
<?php
|
||||
|
||||
use Kanboard\Filter\ProjectActivityTaskStatusFilter;
|
||||
use Kanboard\Model\Project;
|
||||
use Kanboard\Model\ProjectActivity;
|
||||
use Kanboard\Model\TaskCreation;
|
||||
use Kanboard\Model\TaskFinder;
|
||||
use Kanboard\Model\Task;
|
||||
use Kanboard\Model\TaskStatus;
|
||||
use Kanboard\Model\ProjectModel;
|
||||
use Kanboard\Model\ProjectActivityModel;
|
||||
use Kanboard\Model\TaskCreationModel;
|
||||
use Kanboard\Model\TaskFinderModel;
|
||||
use Kanboard\Model\TaskModel;
|
||||
use Kanboard\Model\TaskStatusModel;
|
||||
|
||||
require_once __DIR__.'/../Base.php';
|
||||
|
||||
@@ -14,19 +14,19 @@ class ProjectActivityTaskStatusFilterTest extends Base
|
||||
{
|
||||
public function testFilterByTaskStatus()
|
||||
{
|
||||
$taskFinder = new TaskFinder($this->container);
|
||||
$taskCreation = new TaskCreation($this->container);
|
||||
$taskStatus = new TaskStatus($this->container);
|
||||
$projectModel = new Project($this->container);
|
||||
$projectActivityModel = new ProjectActivity($this->container);
|
||||
$taskFinder = new TaskFinderModel($this->container);
|
||||
$taskCreation = new TaskCreationModel($this->container);
|
||||
$taskStatus = new TaskStatusModel($this->container);
|
||||
$projectModel = new ProjectModel($this->container);
|
||||
$projectActivityModel = new ProjectActivityModel($this->container);
|
||||
|
||||
$this->assertEquals(1, $projectModel->create(array('name' => 'P1')));
|
||||
|
||||
$this->assertEquals(1, $taskCreation->create(array('title' => 'Test', 'project_id' => 1)));
|
||||
$this->assertEquals(2, $taskCreation->create(array('title' => 'Test', 'project_id' => 1)));
|
||||
|
||||
$this->assertNotFalse($projectActivityModel->createEvent(1, 1, 1, Task::EVENT_CREATE, array('task' => $taskFinder->getById(1))));
|
||||
$this->assertNotFalse($projectActivityModel->createEvent(1, 2, 1, Task::EVENT_CREATE, array('task' => $taskFinder->getById(2))));
|
||||
$this->assertNotFalse($projectActivityModel->createEvent(1, 1, 1, TaskModel::EVENT_CREATE, array('task' => $taskFinder->getById(1))));
|
||||
$this->assertNotFalse($projectActivityModel->createEvent(1, 2, 1, TaskModel::EVENT_CREATE, array('task' => $taskFinder->getById(2))));
|
||||
|
||||
$this->assertTrue($taskStatus->close(1));
|
||||
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
<?php
|
||||
|
||||
use Kanboard\Filter\ProjectActivityTaskTitleFilter;
|
||||
use Kanboard\Model\Project;
|
||||
use Kanboard\Model\ProjectActivity;
|
||||
use Kanboard\Model\TaskCreation;
|
||||
use Kanboard\Model\TaskFinder;
|
||||
use Kanboard\Model\Task;
|
||||
use Kanboard\Model\ProjectModel;
|
||||
use Kanboard\Model\ProjectActivityModel;
|
||||
use Kanboard\Model\TaskCreationModel;
|
||||
use Kanboard\Model\TaskFinderModel;
|
||||
use Kanboard\Model\TaskModel;
|
||||
|
||||
require_once __DIR__.'/../Base.php';
|
||||
|
||||
@@ -13,10 +13,10 @@ class ProjectActivityTaskTitleFilterTest extends Base
|
||||
{
|
||||
public function testWithFullTitle()
|
||||
{
|
||||
$taskFinder = new TaskFinder($this->container);
|
||||
$taskCreation = new TaskCreation($this->container);
|
||||
$projectModel = new Project($this->container);
|
||||
$projectActivityModel = new ProjectActivity($this->container);
|
||||
$taskFinder = new TaskFinderModel($this->container);
|
||||
$taskCreation = new TaskCreationModel($this->container);
|
||||
$projectModel = new ProjectModel($this->container);
|
||||
$projectActivityModel = new ProjectActivityModel($this->container);
|
||||
$query = $projectActivityModel->getQuery();
|
||||
|
||||
$this->assertEquals(1, $projectModel->create(array('name' => 'P1')));
|
||||
@@ -24,8 +24,8 @@ class ProjectActivityTaskTitleFilterTest extends Base
|
||||
$this->assertEquals(1, $taskCreation->create(array('title' => 'Test1', 'project_id' => 1)));
|
||||
$this->assertEquals(2, $taskCreation->create(array('title' => 'Test2', 'project_id' => 1)));
|
||||
|
||||
$this->assertNotFalse($projectActivityModel->createEvent(1, 1, 1, Task::EVENT_CREATE, array('task' => $taskFinder->getById(1))));
|
||||
$this->assertNotFalse($projectActivityModel->createEvent(1, 2, 1, Task::EVENT_CREATE, array('task' => $taskFinder->getById(2))));
|
||||
$this->assertNotFalse($projectActivityModel->createEvent(1, 1, 1, TaskModel::EVENT_CREATE, array('task' => $taskFinder->getById(1))));
|
||||
$this->assertNotFalse($projectActivityModel->createEvent(1, 2, 1, TaskModel::EVENT_CREATE, array('task' => $taskFinder->getById(2))));
|
||||
|
||||
$filter = new ProjectActivityTaskTitleFilter('test2');
|
||||
$filter->withQuery($query)->apply();
|
||||
@@ -34,10 +34,10 @@ class ProjectActivityTaskTitleFilterTest extends Base
|
||||
|
||||
public function testWithPartialTitle()
|
||||
{
|
||||
$taskFinder = new TaskFinder($this->container);
|
||||
$taskCreation = new TaskCreation($this->container);
|
||||
$projectModel = new Project($this->container);
|
||||
$projectActivityModel = new ProjectActivity($this->container);
|
||||
$taskFinder = new TaskFinderModel($this->container);
|
||||
$taskCreation = new TaskCreationModel($this->container);
|
||||
$projectModel = new ProjectModel($this->container);
|
||||
$projectActivityModel = new ProjectActivityModel($this->container);
|
||||
$query = $projectActivityModel->getQuery();
|
||||
|
||||
$this->assertEquals(1, $projectModel->create(array('name' => 'P1')));
|
||||
@@ -45,8 +45,8 @@ class ProjectActivityTaskTitleFilterTest extends Base
|
||||
$this->assertEquals(1, $taskCreation->create(array('title' => 'Test1', 'project_id' => 1)));
|
||||
$this->assertEquals(2, $taskCreation->create(array('title' => 'Test2', 'project_id' => 1)));
|
||||
|
||||
$this->assertNotFalse($projectActivityModel->createEvent(1, 1, 1, Task::EVENT_CREATE, array('task' => $taskFinder->getById(1))));
|
||||
$this->assertNotFalse($projectActivityModel->createEvent(1, 2, 1, Task::EVENT_CREATE, array('task' => $taskFinder->getById(2))));
|
||||
$this->assertNotFalse($projectActivityModel->createEvent(1, 1, 1, TaskModel::EVENT_CREATE, array('task' => $taskFinder->getById(1))));
|
||||
$this->assertNotFalse($projectActivityModel->createEvent(1, 2, 1, TaskModel::EVENT_CREATE, array('task' => $taskFinder->getById(2))));
|
||||
|
||||
$filter = new ProjectActivityTaskTitleFilter('test');
|
||||
$filter->withQuery($query)->apply();
|
||||
@@ -55,10 +55,10 @@ class ProjectActivityTaskTitleFilterTest extends Base
|
||||
|
||||
public function testWithId()
|
||||
{
|
||||
$taskFinder = new TaskFinder($this->container);
|
||||
$taskCreation = new TaskCreation($this->container);
|
||||
$projectModel = new Project($this->container);
|
||||
$projectActivityModel = new ProjectActivity($this->container);
|
||||
$taskFinder = new TaskFinderModel($this->container);
|
||||
$taskCreation = new TaskCreationModel($this->container);
|
||||
$projectModel = new ProjectModel($this->container);
|
||||
$projectActivityModel = new ProjectActivityModel($this->container);
|
||||
$query = $projectActivityModel->getQuery();
|
||||
|
||||
$this->assertEquals(1, $projectModel->create(array('name' => 'P1')));
|
||||
@@ -66,8 +66,8 @@ class ProjectActivityTaskTitleFilterTest extends Base
|
||||
$this->assertEquals(1, $taskCreation->create(array('title' => 'Test1', 'project_id' => 1)));
|
||||
$this->assertEquals(2, $taskCreation->create(array('title' => 'Test2', 'project_id' => 1)));
|
||||
|
||||
$this->assertNotFalse($projectActivityModel->createEvent(1, 1, 1, Task::EVENT_CREATE, array('task' => $taskFinder->getById(1))));
|
||||
$this->assertNotFalse($projectActivityModel->createEvent(1, 2, 1, Task::EVENT_CREATE, array('task' => $taskFinder->getById(2))));
|
||||
$this->assertNotFalse($projectActivityModel->createEvent(1, 1, 1, TaskModel::EVENT_CREATE, array('task' => $taskFinder->getById(1))));
|
||||
$this->assertNotFalse($projectActivityModel->createEvent(1, 2, 1, TaskModel::EVENT_CREATE, array('task' => $taskFinder->getById(2))));
|
||||
|
||||
$filter = new ProjectActivityTaskTitleFilter('#2');
|
||||
$filter->withQuery($query)->apply();
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
<?php
|
||||
|
||||
use Kanboard\Filter\TaskAssigneeFilter;
|
||||
use Kanboard\Model\Project;
|
||||
use Kanboard\Model\TaskCreation;
|
||||
use Kanboard\Model\TaskFinder;
|
||||
use Kanboard\Model\User;
|
||||
use Kanboard\Model\ProjectModel;
|
||||
use Kanboard\Model\TaskCreationModel;
|
||||
use Kanboard\Model\TaskFinderModel;
|
||||
use Kanboard\Model\UserModel;
|
||||
|
||||
require_once __DIR__.'/../Base.php';
|
||||
|
||||
@@ -12,9 +12,9 @@ class TaskAssigneeFilterTest extends Base
|
||||
{
|
||||
public function testWithIntegerAssigneeId()
|
||||
{
|
||||
$taskFinder = new TaskFinder($this->container);
|
||||
$taskCreation = new TaskCreation($this->container);
|
||||
$projectModel = new Project($this->container);
|
||||
$taskFinder = new TaskFinderModel($this->container);
|
||||
$taskCreation = new TaskCreationModel($this->container);
|
||||
$projectModel = new ProjectModel($this->container);
|
||||
$query = $taskFinder->getExtendedQuery();
|
||||
|
||||
$this->assertEquals(1, $projectModel->create(array('name' => 'Test')));
|
||||
@@ -37,9 +37,9 @@ class TaskAssigneeFilterTest extends Base
|
||||
|
||||
public function testWithStringAssigneeId()
|
||||
{
|
||||
$taskFinder = new TaskFinder($this->container);
|
||||
$taskCreation = new TaskCreation($this->container);
|
||||
$projectModel = new Project($this->container);
|
||||
$taskFinder = new TaskFinderModel($this->container);
|
||||
$taskCreation = new TaskCreationModel($this->container);
|
||||
$projectModel = new ProjectModel($this->container);
|
||||
$query = $taskFinder->getExtendedQuery();
|
||||
|
||||
$this->assertEquals(1, $projectModel->create(array('name' => 'Test')));
|
||||
@@ -62,9 +62,9 @@ class TaskAssigneeFilterTest extends Base
|
||||
|
||||
public function testWithUsername()
|
||||
{
|
||||
$taskFinder = new TaskFinder($this->container);
|
||||
$taskCreation = new TaskCreation($this->container);
|
||||
$projectModel = new Project($this->container);
|
||||
$taskFinder = new TaskFinderModel($this->container);
|
||||
$taskCreation = new TaskCreationModel($this->container);
|
||||
$projectModel = new ProjectModel($this->container);
|
||||
$query = $taskFinder->getExtendedQuery();
|
||||
|
||||
$this->assertEquals(1, $projectModel->create(array('name' => 'Test')));
|
||||
@@ -87,10 +87,10 @@ class TaskAssigneeFilterTest extends Base
|
||||
|
||||
public function testWithName()
|
||||
{
|
||||
$taskFinder = new TaskFinder($this->container);
|
||||
$taskCreation = new TaskCreation($this->container);
|
||||
$projectModel = new Project($this->container);
|
||||
$userModel = new User($this->container);
|
||||
$taskFinder = new TaskFinderModel($this->container);
|
||||
$taskCreation = new TaskCreationModel($this->container);
|
||||
$projectModel = new ProjectModel($this->container);
|
||||
$userModel = new UserModel($this->container);
|
||||
$query = $taskFinder->getExtendedQuery();
|
||||
|
||||
$this->assertEquals(2, $userModel->create(array('username' => 'foobar', 'name' => 'Foo Bar')));
|
||||
@@ -114,9 +114,9 @@ class TaskAssigneeFilterTest extends Base
|
||||
|
||||
public function testWithNobody()
|
||||
{
|
||||
$taskFinder = new TaskFinder($this->container);
|
||||
$taskCreation = new TaskCreation($this->container);
|
||||
$projectModel = new Project($this->container);
|
||||
$taskFinder = new TaskFinderModel($this->container);
|
||||
$taskCreation = new TaskCreationModel($this->container);
|
||||
$projectModel = new ProjectModel($this->container);
|
||||
$query = $taskFinder->getExtendedQuery();
|
||||
|
||||
$this->assertEquals(1, $projectModel->create(array('name' => 'Test')));
|
||||
@@ -132,9 +132,9 @@ class TaskAssigneeFilterTest extends Base
|
||||
|
||||
public function testWithCurrentUser()
|
||||
{
|
||||
$taskFinder = new TaskFinder($this->container);
|
||||
$taskCreation = new TaskCreation($this->container);
|
||||
$projectModel = new Project($this->container);
|
||||
$taskFinder = new TaskFinderModel($this->container);
|
||||
$taskCreation = new TaskCreationModel($this->container);
|
||||
$projectModel = new ProjectModel($this->container);
|
||||
$query = $taskFinder->getExtendedQuery();
|
||||
|
||||
$this->assertEquals(1, $projectModel->create(array('name' => 'Test')));
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
<?php
|
||||
|
||||
use Kanboard\Filter\TaskCommentFilter;
|
||||
use Kanboard\Model\Comment;
|
||||
use Kanboard\Model\Project;
|
||||
use Kanboard\Model\TaskCreation;
|
||||
use Kanboard\Model\TaskFinder;
|
||||
use Kanboard\Model\CommentModel;
|
||||
use Kanboard\Model\ProjectModel;
|
||||
use Kanboard\Model\TaskCreationModel;
|
||||
use Kanboard\Model\TaskFinderModel;
|
||||
|
||||
require_once __DIR__.'/../Base.php';
|
||||
|
||||
@@ -12,10 +12,10 @@ class TaskCommentFilterTest extends Base
|
||||
{
|
||||
public function testMatch()
|
||||
{
|
||||
$taskFinder = new TaskFinder($this->container);
|
||||
$taskCreation = new TaskCreation($this->container);
|
||||
$commentModel = new Comment($this->container);
|
||||
$projectModel = new Project($this->container);
|
||||
$taskFinder = new TaskFinderModel($this->container);
|
||||
$taskCreation = new TaskCreationModel($this->container);
|
||||
$commentModel = new CommentModel($this->container);
|
||||
$projectModel = new ProjectModel($this->container);
|
||||
$query = $taskFinder->getExtendedQuery();
|
||||
|
||||
$this->assertEquals(1, $projectModel->create(array('name' => 'Test')));
|
||||
@@ -32,10 +32,10 @@ class TaskCommentFilterTest extends Base
|
||||
|
||||
public function testNoMatch()
|
||||
{
|
||||
$taskFinder = new TaskFinder($this->container);
|
||||
$taskCreation = new TaskCreation($this->container);
|
||||
$commentModel = new Comment($this->container);
|
||||
$projectModel = new Project($this->container);
|
||||
$taskFinder = new TaskFinderModel($this->container);
|
||||
$taskCreation = new TaskCreationModel($this->container);
|
||||
$commentModel = new CommentModel($this->container);
|
||||
$projectModel = new ProjectModel($this->container);
|
||||
$query = $taskFinder->getExtendedQuery();
|
||||
|
||||
$this->assertEquals(1, $projectModel->create(array('name' => 'Test')));
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
<?php
|
||||
|
||||
use Kanboard\Filter\TaskCreatorFilter;
|
||||
use Kanboard\Model\Project;
|
||||
use Kanboard\Model\TaskCreation;
|
||||
use Kanboard\Model\TaskFinder;
|
||||
use Kanboard\Model\User;
|
||||
use Kanboard\Model\ProjectModel;
|
||||
use Kanboard\Model\TaskCreationModel;
|
||||
use Kanboard\Model\TaskFinderModel;
|
||||
use Kanboard\Model\UserModel;
|
||||
|
||||
require_once __DIR__.'/../Base.php';
|
||||
|
||||
@@ -12,9 +12,9 @@ class TaskCreatorFilterTest extends Base
|
||||
{
|
||||
public function testWithIntegerAssigneeId()
|
||||
{
|
||||
$taskFinder = new TaskFinder($this->container);
|
||||
$taskCreation = new TaskCreation($this->container);
|
||||
$projectModel = new Project($this->container);
|
||||
$taskFinder = new TaskFinderModel($this->container);
|
||||
$taskCreation = new TaskCreationModel($this->container);
|
||||
$projectModel = new ProjectModel($this->container);
|
||||
$query = $taskFinder->getExtendedQuery();
|
||||
|
||||
$this->assertEquals(1, $projectModel->create(array('name' => 'Test')));
|
||||
@@ -37,9 +37,9 @@ class TaskCreatorFilterTest extends Base
|
||||
|
||||
public function testWithStringAssigneeId()
|
||||
{
|
||||
$taskFinder = new TaskFinder($this->container);
|
||||
$taskCreation = new TaskCreation($this->container);
|
||||
$projectModel = new Project($this->container);
|
||||
$taskFinder = new TaskFinderModel($this->container);
|
||||
$taskCreation = new TaskCreationModel($this->container);
|
||||
$projectModel = new ProjectModel($this->container);
|
||||
$query = $taskFinder->getExtendedQuery();
|
||||
|
||||
$this->assertEquals(1, $projectModel->create(array('name' => 'Test')));
|
||||
@@ -62,9 +62,9 @@ class TaskCreatorFilterTest extends Base
|
||||
|
||||
public function testWithUsername()
|
||||
{
|
||||
$taskFinder = new TaskFinder($this->container);
|
||||
$taskCreation = new TaskCreation($this->container);
|
||||
$projectModel = new Project($this->container);
|
||||
$taskFinder = new TaskFinderModel($this->container);
|
||||
$taskCreation = new TaskCreationModel($this->container);
|
||||
$projectModel = new ProjectModel($this->container);
|
||||
$query = $taskFinder->getExtendedQuery();
|
||||
|
||||
$this->assertEquals(1, $projectModel->create(array('name' => 'Test')));
|
||||
@@ -87,10 +87,10 @@ class TaskCreatorFilterTest extends Base
|
||||
|
||||
public function testWithName()
|
||||
{
|
||||
$taskFinder = new TaskFinder($this->container);
|
||||
$taskCreation = new TaskCreation($this->container);
|
||||
$projectModel = new Project($this->container);
|
||||
$userModel = new User($this->container);
|
||||
$taskFinder = new TaskFinderModel($this->container);
|
||||
$taskCreation = new TaskCreationModel($this->container);
|
||||
$projectModel = new ProjectModel($this->container);
|
||||
$userModel = new UserModel($this->container);
|
||||
$query = $taskFinder->getExtendedQuery();
|
||||
|
||||
$this->assertEquals(2, $userModel->create(array('username' => 'foobar', 'name' => 'Foo Bar')));
|
||||
@@ -114,9 +114,9 @@ class TaskCreatorFilterTest extends Base
|
||||
|
||||
public function testWithNobody()
|
||||
{
|
||||
$taskFinder = new TaskFinder($this->container);
|
||||
$taskCreation = new TaskCreation($this->container);
|
||||
$projectModel = new Project($this->container);
|
||||
$taskFinder = new TaskFinderModel($this->container);
|
||||
$taskCreation = new TaskCreationModel($this->container);
|
||||
$projectModel = new ProjectModel($this->container);
|
||||
$query = $taskFinder->getExtendedQuery();
|
||||
|
||||
$this->assertEquals(1, $projectModel->create(array('name' => 'Test')));
|
||||
@@ -132,9 +132,9 @@ class TaskCreatorFilterTest extends Base
|
||||
|
||||
public function testWithCurrentUser()
|
||||
{
|
||||
$taskFinder = new TaskFinder($this->container);
|
||||
$taskCreation = new TaskCreation($this->container);
|
||||
$projectModel = new Project($this->container);
|
||||
$taskFinder = new TaskFinderModel($this->container);
|
||||
$taskCreation = new TaskCreationModel($this->container);
|
||||
$projectModel = new ProjectModel($this->container);
|
||||
$query = $taskFinder->getExtendedQuery();
|
||||
|
||||
$this->assertEquals(1, $projectModel->create(array('name' => 'Test')));
|
||||
|
||||
@@ -3,14 +3,14 @@
|
||||
require_once __DIR__.'/../Base.php';
|
||||
|
||||
use Kanboard\Helper\AssetHelper;
|
||||
use Kanboard\Model\Config;
|
||||
use Kanboard\Model\ConfigModel;
|
||||
|
||||
class AssetHelperTest extends Base
|
||||
{
|
||||
public function testCustomCss()
|
||||
{
|
||||
$h = new AssetHelper($this->container);
|
||||
$c = new Config($this->container);
|
||||
$c = new ConfigModel($this->container);
|
||||
|
||||
$this->assertEmpty($h->customCss());
|
||||
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
<?php
|
||||
|
||||
use Kanboard\Helper\ProjectActivityHelper;
|
||||
use Kanboard\Model\Project;
|
||||
use Kanboard\Model\ProjectActivity;
|
||||
use Kanboard\Model\Task;
|
||||
use Kanboard\Model\TaskCreation;
|
||||
use Kanboard\Model\TaskFinder;
|
||||
use Kanboard\Model\ProjectModel;
|
||||
use Kanboard\Model\ProjectActivityModel;
|
||||
use Kanboard\Model\TaskModel;
|
||||
use Kanboard\Model\TaskCreationModel;
|
||||
use Kanboard\Model\TaskFinderModel;
|
||||
|
||||
require_once __DIR__.'/../Base.php';
|
||||
|
||||
@@ -13,10 +13,10 @@ class ProjectActivityHelperTest extends Base
|
||||
{
|
||||
public function testGetProjectEvents()
|
||||
{
|
||||
$taskFinder = new TaskFinder($this->container);
|
||||
$taskCreation = new TaskCreation($this->container);
|
||||
$projectModel = new Project($this->container);
|
||||
$projectActivityModel = new ProjectActivity($this->container);
|
||||
$taskFinder = new TaskFinderModel($this->container);
|
||||
$taskCreation = new TaskCreationModel($this->container);
|
||||
$projectModel = new ProjectModel($this->container);
|
||||
$projectActivityModel = new ProjectActivityModel($this->container);
|
||||
|
||||
$this->assertEquals(1, $projectModel->create(array('name' => 'P1')));
|
||||
|
||||
@@ -24,9 +24,9 @@ class ProjectActivityHelperTest extends Base
|
||||
$this->assertEquals(2, $taskCreation->create(array('title' => 'Test', 'project_id' => 1)));
|
||||
$this->assertEquals(3, $taskCreation->create(array('title' => 'Test', 'project_id' => 1)));
|
||||
|
||||
$this->assertNotFalse($projectActivityModel->createEvent(1, 1, 1, Task::EVENT_CREATE, array('task' => $taskFinder->getById(1))));
|
||||
$this->assertNotFalse($projectActivityModel->createEvent(1, 2, 1, Task::EVENT_CREATE, array('task' => $taskFinder->getById(2))));
|
||||
$this->assertNotFalse($projectActivityModel->createEvent(1, 3, 1, Task::EVENT_CREATE, array('task' => $taskFinder->getById(3))));
|
||||
$this->assertNotFalse($projectActivityModel->createEvent(1, 1, 1, TaskModel::EVENT_CREATE, array('task' => $taskFinder->getById(1))));
|
||||
$this->assertNotFalse($projectActivityModel->createEvent(1, 2, 1, TaskModel::EVENT_CREATE, array('task' => $taskFinder->getById(2))));
|
||||
$this->assertNotFalse($projectActivityModel->createEvent(1, 3, 1, TaskModel::EVENT_CREATE, array('task' => $taskFinder->getById(3))));
|
||||
|
||||
$helper = new ProjectActivityHelper($this->container);
|
||||
$events = $helper->getProjectEvents(1);
|
||||
@@ -41,10 +41,10 @@ class ProjectActivityHelperTest extends Base
|
||||
|
||||
public function testGetProjectsEvents()
|
||||
{
|
||||
$taskFinder = new TaskFinder($this->container);
|
||||
$taskCreation = new TaskCreation($this->container);
|
||||
$projectModel = new Project($this->container);
|
||||
$projectActivityModel = new ProjectActivity($this->container);
|
||||
$taskFinder = new TaskFinderModel($this->container);
|
||||
$taskCreation = new TaskCreationModel($this->container);
|
||||
$projectModel = new ProjectModel($this->container);
|
||||
$projectActivityModel = new ProjectActivityModel($this->container);
|
||||
|
||||
$this->assertEquals(1, $projectModel->create(array('name' => 'P1')));
|
||||
$this->assertEquals(2, $projectModel->create(array('name' => 'P2')));
|
||||
@@ -54,9 +54,9 @@ class ProjectActivityHelperTest extends Base
|
||||
$this->assertEquals(2, $taskCreation->create(array('title' => 'Test', 'project_id' => 2)));
|
||||
$this->assertEquals(3, $taskCreation->create(array('title' => 'Test', 'project_id' => 3)));
|
||||
|
||||
$this->assertNotFalse($projectActivityModel->createEvent(1, 1, 1, Task::EVENT_CREATE, array('task' => $taskFinder->getById(1))));
|
||||
$this->assertNotFalse($projectActivityModel->createEvent(2, 2, 1, Task::EVENT_CREATE, array('task' => $taskFinder->getById(2))));
|
||||
$this->assertNotFalse($projectActivityModel->createEvent(3, 3, 1, Task::EVENT_CREATE, array('task' => $taskFinder->getById(3))));
|
||||
$this->assertNotFalse($projectActivityModel->createEvent(1, 1, 1, TaskModel::EVENT_CREATE, array('task' => $taskFinder->getById(1))));
|
||||
$this->assertNotFalse($projectActivityModel->createEvent(2, 2, 1, TaskModel::EVENT_CREATE, array('task' => $taskFinder->getById(2))));
|
||||
$this->assertNotFalse($projectActivityModel->createEvent(3, 3, 1, TaskModel::EVENT_CREATE, array('task' => $taskFinder->getById(3))));
|
||||
|
||||
$helper = new ProjectActivityHelper($this->container);
|
||||
$events = $helper->getProjectsEvents(array(1, 2));
|
||||
@@ -71,18 +71,18 @@ class ProjectActivityHelperTest extends Base
|
||||
|
||||
public function testGetTaskEvents()
|
||||
{
|
||||
$taskFinder = new TaskFinder($this->container);
|
||||
$taskCreation = new TaskCreation($this->container);
|
||||
$projectModel = new Project($this->container);
|
||||
$projectActivityModel = new ProjectActivity($this->container);
|
||||
$taskFinder = new TaskFinderModel($this->container);
|
||||
$taskCreation = new TaskCreationModel($this->container);
|
||||
$projectModel = new ProjectModel($this->container);
|
||||
$projectActivityModel = new ProjectActivityModel($this->container);
|
||||
|
||||
$this->assertEquals(1, $projectModel->create(array('name' => 'P1')));
|
||||
|
||||
$this->assertEquals(1, $taskCreation->create(array('title' => 'Test', 'project_id' => 1)));
|
||||
$this->assertEquals(2, $taskCreation->create(array('title' => 'Test', 'project_id' => 1)));
|
||||
|
||||
$this->assertNotFalse($projectActivityModel->createEvent(1, 1, 1, Task::EVENT_CREATE, array('task' => $taskFinder->getById(1))));
|
||||
$this->assertNotFalse($projectActivityModel->createEvent(1, 2, 1, Task::EVENT_CREATE, array('task' => $taskFinder->getById(2))));
|
||||
$this->assertNotFalse($projectActivityModel->createEvent(1, 1, 1, TaskModel::EVENT_CREATE, array('task' => $taskFinder->getById(1))));
|
||||
$this->assertNotFalse($projectActivityModel->createEvent(1, 2, 1, TaskModel::EVENT_CREATE, array('task' => $taskFinder->getById(2))));
|
||||
|
||||
$helper = new ProjectActivityHelper($this->container);
|
||||
$events = $helper->getTaskEvents(1);
|
||||
|
||||
@@ -3,16 +3,16 @@
|
||||
require_once __DIR__.'/../Base.php';
|
||||
|
||||
use Kanboard\Helper\TextHelper;
|
||||
use Kanboard\Model\Project;
|
||||
use Kanboard\Model\TaskCreation;
|
||||
use Kanboard\Model\ProjectModel;
|
||||
use Kanboard\Model\TaskCreationModel;
|
||||
|
||||
class TextHelperTest extends Base
|
||||
{
|
||||
public function testMarkdownTaskLink()
|
||||
{
|
||||
$helper = new TextHelper($this->container);
|
||||
$projectModel = new Project($this->container);
|
||||
$taskCreationModel = new TaskCreation($this->container);
|
||||
$projectModel = new ProjectModel($this->container);
|
||||
$taskCreationModel = new TaskCreationModel($this->container);
|
||||
|
||||
$this->assertEquals(1, $projectModel->create(array('name' => 'Project #1')));
|
||||
$this->assertTrue($projectModel->enablePublicAccess(1));
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
require_once __DIR__.'/../Base.php';
|
||||
|
||||
use Kanboard\Helper\UrlHelper;
|
||||
use Kanboard\Model\Config;
|
||||
use Kanboard\Model\ConfigModel;
|
||||
use Kanboard\Core\Http\Request;
|
||||
|
||||
class UrlHelperTest extends Base
|
||||
@@ -115,7 +115,7 @@ class UrlHelperTest extends Base
|
||||
$h = new UrlHelper($this->container);
|
||||
$this->assertEquals('http://kb:1234/', $h->base());
|
||||
|
||||
$c = new Config($this->container);
|
||||
$c = new ConfigModel($this->container);
|
||||
$c->save(array('application_url' => 'https://mykanboard/'));
|
||||
$this->container['memoryCache']->flush();
|
||||
|
||||
|
||||
@@ -4,13 +4,12 @@ require_once __DIR__.'/../Base.php';
|
||||
|
||||
use Kanboard\Core\User\UserSession;
|
||||
use Kanboard\Helper\UserHelper;
|
||||
use Kanboard\Model\Project;
|
||||
use Kanboard\Model\ProjectUserRole;
|
||||
use Kanboard\Model\TaskCreation;
|
||||
use Kanboard\Model\TaskFinder;
|
||||
use Kanboard\Model\User as UserModel;
|
||||
use Kanboard\Model\ProjectModel;
|
||||
use Kanboard\Model\ProjectUserRoleModel;
|
||||
use Kanboard\Model\TaskCreationModel;
|
||||
use Kanboard\Model\TaskFinderModel;
|
||||
use Kanboard\Core\Security\Role;
|
||||
use Kanboard\Model\User;
|
||||
use Kanboard\Model\UserModel;
|
||||
|
||||
class UserHelperTest extends Base
|
||||
{
|
||||
@@ -76,7 +75,7 @@ class UserHelperTest extends Base
|
||||
public function testHasProjectAccessForAdmins()
|
||||
{
|
||||
$helper = new UserHelper($this->container);
|
||||
$project = new Project($this->container);
|
||||
$project = new ProjectModel($this->container);
|
||||
|
||||
$this->container['sessionStorage']->user = array(
|
||||
'id' => 2,
|
||||
@@ -92,7 +91,7 @@ class UserHelperTest extends Base
|
||||
public function testHasProjectAccessForManagers()
|
||||
{
|
||||
$helper = new UserHelper($this->container);
|
||||
$project = new Project($this->container);
|
||||
$project = new ProjectModel($this->container);
|
||||
|
||||
$this->container['sessionStorage']->user = array(
|
||||
'id' => 2,
|
||||
@@ -108,7 +107,7 @@ class UserHelperTest extends Base
|
||||
public function testHasProjectAccessForUsers()
|
||||
{
|
||||
$helper = new UserHelper($this->container);
|
||||
$project = new Project($this->container);
|
||||
$project = new ProjectModel($this->container);
|
||||
|
||||
$this->container['sessionStorage']->user = array(
|
||||
'id' => 2,
|
||||
@@ -125,8 +124,8 @@ class UserHelperTest extends Base
|
||||
{
|
||||
$helper = new UserHelper($this->container);
|
||||
$user = new UserModel($this->container);
|
||||
$project = new Project($this->container);
|
||||
$projectUserRole = new ProjectUserRole($this->container);
|
||||
$project = new ProjectModel($this->container);
|
||||
$projectUserRole = new ProjectUserRoleModel($this->container);
|
||||
|
||||
$this->container['sessionStorage']->user = array(
|
||||
'id' => 2,
|
||||
@@ -153,8 +152,8 @@ class UserHelperTest extends Base
|
||||
{
|
||||
$helper = new UserHelper($this->container);
|
||||
$user = new UserModel($this->container);
|
||||
$project = new Project($this->container);
|
||||
$projectUserRole = new ProjectUserRole($this->container);
|
||||
$project = new ProjectModel($this->container);
|
||||
$projectUserRole = new ProjectUserRoleModel($this->container);
|
||||
|
||||
$this->container['sessionStorage']->user = array(
|
||||
'id' => 2,
|
||||
@@ -181,8 +180,8 @@ class UserHelperTest extends Base
|
||||
{
|
||||
$helper = new UserHelper($this->container);
|
||||
$user = new UserModel($this->container);
|
||||
$project = new Project($this->container);
|
||||
$projectUserRole = new ProjectUserRole($this->container);
|
||||
$project = new ProjectModel($this->container);
|
||||
$projectUserRole = new ProjectUserRoleModel($this->container);
|
||||
|
||||
$this->container['sessionStorage']->user = array(
|
||||
'id' => 2,
|
||||
@@ -209,8 +208,8 @@ class UserHelperTest extends Base
|
||||
{
|
||||
$helper = new UserHelper($this->container);
|
||||
$user = new UserModel($this->container);
|
||||
$project = new Project($this->container);
|
||||
$projectUserRole = new ProjectUserRole($this->container);
|
||||
$project = new ProjectModel($this->container);
|
||||
$projectUserRole = new ProjectUserRoleModel($this->container);
|
||||
|
||||
$this->container['sessionStorage']->user = array(
|
||||
'id' => 2,
|
||||
@@ -235,11 +234,11 @@ class UserHelperTest extends Base
|
||||
|
||||
public function testCanRemoveTask()
|
||||
{
|
||||
$taskCreationModel = new TaskCreation($this->container);
|
||||
$taskFinderModel = new TaskFinder($this->container);
|
||||
$taskCreationModel = new TaskCreationModel($this->container);
|
||||
$taskFinderModel = new TaskFinderModel($this->container);
|
||||
$helper = new UserHelper($this->container);
|
||||
$projectModel = new Project($this->container);
|
||||
$userModel = new User($this->container);
|
||||
$projectModel = new ProjectModel($this->container);
|
||||
$userModel = new UserModel($this->container);
|
||||
$userSessionModel = new UserSession($this->container);
|
||||
|
||||
$this->assertNotFalse($userModel->create(array('username' => 'toto', 'password' => '123456')));
|
||||
@@ -278,7 +277,7 @@ class UserHelperTest extends Base
|
||||
$this->assertTrue($helper->canRemoveTask($task));
|
||||
|
||||
// User #2 can remove his own TaskViewController
|
||||
$user = $userModel->getbyId(2);
|
||||
$user = $userModel->getById(2);
|
||||
$this->assertNotEmpty($user);
|
||||
$userSessionModel->initialize($user);
|
||||
|
||||
|
||||
@@ -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),
|
||||
)));
|
||||
|
||||
@@ -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')));
|
||||
|
||||
@@ -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')));
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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')));
|
||||
|
||||
|
||||
@@ -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)));
|
||||
|
||||
@@ -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')));
|
||||
|
||||
@@ -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));
|
||||
|
||||
|
||||
@@ -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)));
|
||||
|
||||
@@ -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'));
|
||||
|
||||
@@ -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));
|
||||
|
||||
@@ -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());
|
||||
|
||||
@@ -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'));
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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()));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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'));
|
||||
|
||||
@@ -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());
|
||||
|
||||
@@ -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)));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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')));
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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')));
|
||||
|
||||
@@ -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')));
|
||||
|
||||
@@ -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')));
|
||||
|
||||
@@ -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')));
|
||||
|
||||
|
||||
@@ -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')));
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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)));
|
||||
|
||||
@@ -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')));
|
||||
|
||||
|
||||
@@ -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')));
|
||||
|
||||
@@ -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'))));
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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')));
|
||||
|
||||
@@ -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')));
|
||||
|
||||
@@ -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')));
|
||||
|
||||
@@ -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)));
|
||||
|
||||
@@ -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)));
|
||||
|
||||
@@ -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));
|
||||
}
|
||||
|
||||
|
||||
@@ -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']);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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');
|
||||
|
||||
@@ -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')));
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user