summaryrefslogtreecommitdiff
path: root/tests/integration
diff options
context:
space:
mode:
authorFrederic Guillot <fred@kanboard.net>2016-12-17 17:02:29 -0500
committerFrederic Guillot <fred@kanboard.net>2016-12-17 17:02:29 -0500
commit11861044695e5a6553e5ca2b4db8f2fd57702f7f (patch)
tree08ef63bd6d0a3f8e625f14e616088775f7d0bf61 /tests/integration
parentddeb89e2c6622f197d1b7738042182b34d5054ed (diff)
Add API calls to manage tags
Diffstat (limited to 'tests/integration')
-rw-r--r--tests/integration/TagProcedureTest.php58
-rw-r--r--tests/integration/TaskTagProcedureTest.php27
2 files changed, 85 insertions, 0 deletions
diff --git a/tests/integration/TagProcedureTest.php b/tests/integration/TagProcedureTest.php
new file mode 100644
index 00000000..f15efa3c
--- /dev/null
+++ b/tests/integration/TagProcedureTest.php
@@ -0,0 +1,58 @@
+<?php
+
+require_once __DIR__.'/BaseProcedureTest.php';
+
+class TagProcedureTest extends BaseProcedureTest
+{
+ protected $projectName = 'My project with tags';
+
+ public function testAll()
+ {
+ $this->assertCreateTeamProject();
+ $this->assertCreateTag();
+ $this->assertGetProjectTags();
+ $this->assertGetAllTags();
+ $this->assertUpdateTag();
+ $this->assertRemoveTag();
+ }
+
+ public function assertCreateTag()
+ {
+ $this->assertNotFalse($this->app->createTag($this->projectId, 'some tag'));
+ }
+
+ public function assertGetProjectTags()
+ {
+ $tags = $this->app->getTagsByProject($this->projectId);
+ $this->assertCount(1, $tags);
+ $this->assertEquals('some tag', $tags[0]['name']);
+ }
+
+ public function assertGetAllTags()
+ {
+ $tags = $this->app->getAllTags();
+ $this->assertCount(1, $tags);
+ $this->assertEquals('some tag', $tags[0]['name']);
+ }
+
+ public function assertUpdateTag()
+ {
+ $tags = $this->app->getAllTags();
+ $this->assertCount(1, $tags);
+ $this->assertTrue($this->app->updateTag($tags[0]['id'], 'another tag'));
+
+ $tags = $this->app->getAllTags();
+ $this->assertCount(1, $tags);
+ $this->assertEquals('another tag', $tags[0]['name']);
+ }
+
+ public function assertRemoveTag()
+ {
+ $tags = $this->app->getAllTags();
+ $this->assertCount(1, $tags);
+ $this->assertTrue($this->app->removeTag($tags[0]['id']));
+
+ $tags = $this->app->getAllTags();
+ $this->assertCount(0, $tags);
+ }
+}
diff --git a/tests/integration/TaskTagProcedureTest.php b/tests/integration/TaskTagProcedureTest.php
new file mode 100644
index 00000000..ae6139d3
--- /dev/null
+++ b/tests/integration/TaskTagProcedureTest.php
@@ -0,0 +1,27 @@
+<?php
+
+require_once __DIR__.'/BaseProcedureTest.php';
+
+class TaskTagProcedureTest extends BaseProcedureTest
+{
+ protected $projectName = 'My project with tasks and tags';
+
+ public function testAll()
+ {
+ $this->assertCreateTeamProject();
+ $this->assertCreateTask();
+ $this->assertSetTaskTags();
+ $this->assertGetTaskTags();
+ }
+
+ public function assertSetTaskTags()
+ {
+ $this->assertTrue($this->app->setTaskTags($this->projectId, $this->taskId, array('tag1', 'tag2')));
+ }
+
+ public function assertGetTaskTags()
+ {
+ $tags = $this->app->getTaskTags($this->taskId);
+ $this->assertEquals(array('tag1', 'tag2'), array_values($tags));
+ }
+}