summaryrefslogtreecommitdiff
path: root/tests/units/Model
diff options
context:
space:
mode:
Diffstat (limited to 'tests/units/Model')
-rw-r--r--tests/units/Model/TaskModificationTest.php32
1 files changed, 31 insertions, 1 deletions
diff --git a/tests/units/Model/TaskModificationTest.php b/tests/units/Model/TaskModificationTest.php
index a8ace25a..5cbc44e6 100644
--- a/tests/units/Model/TaskModificationTest.php
+++ b/tests/units/Model/TaskModificationTest.php
@@ -7,6 +7,7 @@ use Kanboard\Model\TaskCreationModel;
use Kanboard\Model\TaskModificationModel;
use Kanboard\Model\TaskFinderModel;
use Kanboard\Model\ProjectModel;
+use Kanboard\Model\TaskTagModel;
class TaskModificationTest extends Base
{
@@ -45,7 +46,6 @@ class TaskModificationTest extends Base
$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)));
@@ -280,4 +280,34 @@ class TaskModificationTest extends Base
$task = $tf->getById(1);
$this->assertEquals(13.3, $task['time_spent']);
}
+
+ public function testChangeTags()
+ {
+ $projectModel = new ProjectModel($this->container);
+ $taskCreationModel = new TaskCreationModel($this->container);
+ $taskModificationModel = new TaskModificationModel($this->container);
+ $taskTagModel = new TaskTagModel($this->container);
+
+ $this->assertEquals(1, $projectModel->create(array('name' => 'test')));
+ $this->assertEquals(1, $taskCreationModel->create(array('title' => 'test', 'project_id' => 1, 'tags' => array('tag1', 'tag2'))));
+ $this->assertTrue($taskModificationModel->update(array('id' => 1, 'tags' => array('tag2'))));
+
+ $tags = $taskTagModel->getList(1);
+ $this->assertEquals(array(2 => 'tag2'), $tags);
+ }
+
+ public function testRemoveAllTags()
+ {
+ $projectModel = new ProjectModel($this->container);
+ $taskCreationModel = new TaskCreationModel($this->container);
+ $taskModificationModel = new TaskModificationModel($this->container);
+ $taskTagModel = new TaskTagModel($this->container);
+
+ $this->assertEquals(1, $projectModel->create(array('name' => 'test')));
+ $this->assertEquals(1, $taskCreationModel->create(array('title' => 'test', 'project_id' => 1, 'tags' => array('tag1', 'tag2'))));
+ $this->assertTrue($taskModificationModel->update(array('id' => 1)));
+
+ $tags = $taskTagModel->getList(1);
+ $this->assertEquals(array(), $tags);
+ }
}