summaryrefslogtreecommitdiff
path: root/tests/units/Model/SubtaskModelTest.php
diff options
context:
space:
mode:
Diffstat (limited to 'tests/units/Model/SubtaskModelTest.php')
-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));
+ }
}