summaryrefslogtreecommitdiff
path: root/tests/units/Model
diff options
context:
space:
mode:
authorFrederic Guillot <fred@kanboard.net>2017-03-12 21:36:52 -0400
committerFrederic Guillot <fred@kanboard.net>2017-03-12 21:36:52 -0400
commit9b34631135f29480dda3ed2df463fbb5aab7c9e4 (patch)
tree46da2f342a440cc699b7aa9c61bd18d0d2ea01f5 /tests/units/Model
parentf6b42eb8024b7db959f6d75118b3de0f96301262 (diff)
Simplify dashboard to use new tasks list view
Diffstat (limited to 'tests/units/Model')
-rw-r--r--tests/units/Model/SubtaskModelTest.php29
1 files changed, 29 insertions, 0 deletions
diff --git a/tests/units/Model/SubtaskModelTest.php b/tests/units/Model/SubtaskModelTest.php
index eed37cf3..8ad054d1 100644
--- a/tests/units/Model/SubtaskModelTest.php
+++ b/tests/units/Model/SubtaskModelTest.php
@@ -172,4 +172,33 @@ class SubtaskModelTest extends Base
$this->assertEquals(1, $subtaskModel->getProjectId(1));
$this->assertEquals(0, $subtaskModel->getProjectId(2));
}
+
+ public function testGetAllByTaskIds()
+ {
+ $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)));
+ $this->assertEquals(1, $subtaskModel->create(array('title' => 'subtask #1', 'task_id' => 1)));
+
+ $this->assertCount(0, $subtaskModel->getAllByTaskIds(array()));
+ $this->assertCount(1, $subtaskModel->getAllByTaskIds(array(1)));
+ }
+
+ public function testGetAllByTaskIdsAndAssignee()
+ {
+ $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)));
+ $this->assertEquals(1, $subtaskModel->create(array('title' => 'subtask #1', 'task_id' => 1, 'user_id' => 1)));
+
+ $this->assertCount(0, $subtaskModel->getAllByTaskIdsAndAssignee(array(), 1));
+ $this->assertCount(0, $subtaskModel->getAllByTaskIdsAndAssignee(array(1), 2));
+ $this->assertCount(1, $subtaskModel->getAllByTaskIdsAndAssignee(array(1), 1));
+ }
}