summaryrefslogtreecommitdiff
path: root/tests/integration
diff options
context:
space:
mode:
Diffstat (limited to 'tests/integration')
-rw-r--r--tests/integration/CommentProcedureTest.php3
-rw-r--r--tests/integration/TagProcedureTest.php58
-rw-r--r--tests/integration/TaskMetadataProcedureTest.php45
-rw-r--r--tests/integration/TaskTagProcedureTest.php54
4 files changed, 160 insertions, 0 deletions
diff --git a/tests/integration/CommentProcedureTest.php b/tests/integration/CommentProcedureTest.php
index 881d938c..0a969420 100644
--- a/tests/integration/CommentProcedureTest.php
+++ b/tests/integration/CommentProcedureTest.php
@@ -35,10 +35,12 @@ class CommentProcedureTest extends BaseProcedureTest
$this->assertNotEmpty($comment);
$this->assertEquals(1, $comment['user_id']);
$this->assertEquals('foobar', $comment['comment']);
+ $this->assertEquals($comment['date_creation'], $comment['date_modification']);
}
public function assertUpdateComment()
{
+ sleep(1); // Integration test fails because its too fast
$this->assertTrue($this->app->execute('updateComment', array(
'id' => $this->commentId,
'content' => 'test',
@@ -46,6 +48,7 @@ class CommentProcedureTest extends BaseProcedureTest
$comment = $this->app->getComment($this->commentId);
$this->assertEquals('test', $comment['comment']);
+ $this->assertNotEquals($comment['date_creation'], $comment['date_modification']);
}
public function assertGetAllComments()
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/TaskMetadataProcedureTest.php b/tests/integration/TaskMetadataProcedureTest.php
new file mode 100644
index 00000000..9b9b2f39
--- /dev/null
+++ b/tests/integration/TaskMetadataProcedureTest.php
@@ -0,0 +1,45 @@
+<?php
+
+require_once __DIR__.'/BaseProcedureTest.php';
+
+class TaskMetadataProcedureTest extends BaseProcedureTest
+{
+ protected $projectName = 'My project to test tasks metadata';
+ protected $metaKey = 'MyTestMetaKey';
+
+ public function testAll()
+ {
+ $this->assertCreateTeamProject();
+ $this->assertCreateTask();
+ $this->assertSaveTaskMetadata();
+ $this->assertGetTaskMetadata();
+ $this->assertGetTaskMetadataByName();
+ $this->assertRemoveTaskMetadata();
+ }
+
+ public function assertSaveTaskMetadata()
+ {
+ $this->assertTrue($this->app->saveTaskMetadata($this->taskId, array($this->metaKey => 'metaValue1')));
+ }
+
+ public function assertGetTaskMetadata()
+ {
+ $metaData = $this->app->getTaskMetadata(($this->taskId));
+ $this->assertArrayHasKey($this->metaKey, $metaData);
+ $this->assertEquals('metaValue1', $metaData[$this->metaKey]);
+ }
+
+ public function assertGetTaskMetadataByName()
+ {
+ $metaValue = $this->app->getTaskMetadataByName($this->taskId, $this->metaKey);
+ $this->assertEquals('metaValue1', $metaValue, 'Did not return correct metadata value');
+ }
+
+ public function assertRemoveTaskMetadata()
+ {
+ $result = $this->app->removeTaskMetadata($this->taskId, $this->metaKey);
+ $this->assertTrue($result, 'Did not remove metakey with success');
+ $metaValue = $this->app->getTaskMetadataByName($this->taskId, $this->metaKey);
+ $this->assertEquals('', $metaValue, 'Did not return an empty string due to metadata being deleted');
+ }
+}
diff --git a/tests/integration/TaskTagProcedureTest.php b/tests/integration/TaskTagProcedureTest.php
new file mode 100644
index 00000000..4b820c9a
--- /dev/null
+++ b/tests/integration/TaskTagProcedureTest.php
@@ -0,0 +1,54 @@
+<?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();
+ $this->assertCreateTaskWithTags();
+ $this->assertUpdateTaskWithTags();
+ }
+
+ 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));
+ }
+
+ public function assertCreateTaskWithTags()
+ {
+ $this->taskId = $this->app->createTask(array(
+ 'title' => $this->taskTitle,
+ 'project_id' => $this->projectId,
+ 'tags' => array('tag A', 'tag B'),
+ ));
+
+ $this->assertNotFalse($this->taskId);
+
+ $tags = $this->app->getTaskTags($this->taskId);
+ $this->assertEquals(array('tag A', 'tag B'), array_values($tags));
+ }
+
+ public function assertUpdateTaskWithTags()
+ {
+ $this->assertTrue($this->app->updateTask(array(
+ 'id' => $this->taskId,
+ 'tags' => array('tag C'),
+ )));
+
+ $tags = $this->app->getTaskTags($this->taskId);
+ $this->assertEquals(array('tag C'), array_values($tags));
+ }
+}