diff options
Diffstat (limited to 'tests/functionals/ApiTest.php')
-rw-r--r-- | tests/functionals/ApiTest.php | 84 |
1 files changed, 77 insertions, 7 deletions
diff --git a/tests/functionals/ApiTest.php b/tests/functionals/ApiTest.php index b5039759..642288b8 100644 --- a/tests/functionals/ApiTest.php +++ b/tests/functionals/ApiTest.php @@ -348,11 +348,6 @@ class Api extends PHPUnit_Framework_TestCase $this->assertEquals('Swimlane A', $swimlanes[2]['name']); } - public function testRemoveSwimlane() - { - $this->assertTrue($this->client->removeSwimlane(1, 2)); - } - public function testCreateTask() { $task = array( @@ -408,6 +403,42 @@ class Api extends PHPUnit_Framework_TestCase $this->assertEmpty($tasks); } + public function testMoveTaskSwimlane() + { + $task_id = $this->getTaskId(); + + $task = $this->client->getTask($task_id); + $this->assertNotFalse($task); + $this->assertTrue(is_array($task)); + $this->assertEquals(1, $task['position']); + $this->assertEquals(2, $task['column_id']); + $this->assertEquals(0, $task['swimlane_id']); + + $moved_timestamp = $task['date_moved']; + sleep(1); + $this->assertTrue($this->client->moveTaskPosition(1, $task_id, 4, 1, 2)); + + $task = $this->client->getTask($task_id); + $this->assertNotFalse($task); + $this->assertTrue(is_array($task)); + $this->assertEquals(1, $task['position']); + $this->assertEquals(4, $task['column_id']); + $this->assertEquals(2, $task['swimlane_id']); + $this->assertNotEquals($moved_timestamp, $task['date_moved']); + } + + public function testRemoveSwimlane() + { + $this->assertTrue($this->client->removeSwimlane(1, 2)); + + $task = $this->client->getTask($this->getTaskId()); + $this->assertNotFalse($task); + $this->assertTrue(is_array($task)); + $this->assertEquals(1, $task['position']); + $this->assertEquals(4, $task['column_id']); + $this->assertEquals(0, $task['swimlane_id']); + } + public function testUpdateTask() { $task = $this->client->getTask(1); @@ -415,7 +446,6 @@ class Api extends PHPUnit_Framework_TestCase $values = array(); $values['id'] = $task['id']; $values['color_id'] = 'green'; - $values['column_id'] = 1; $values['description'] = 'test'; $values['date_due'] = ''; @@ -937,7 +967,7 @@ class Api extends PHPUnit_Framework_TestCase public function testCreateFile() { - $this->assertTrue($this->client->createFile(1, 1, 'My file', false, base64_encode('plain text file'))); + $this->assertEquals(1, $this->client->createFile(1, 1, 'My file', base64_encode('plain text file'))); } public function testGetAllFiles() @@ -962,4 +992,44 @@ class Api extends PHPUnit_Framework_TestCase $this->assertTrue($this->client->removeFile($file['id'])); $this->assertEmpty($this->client->getAllFiles(1)); } + + public function testRemoveAllFiles() + { + $this->assertEquals(1, $this->client->createFile(1, 1, 'My file 1', base64_encode('plain text file'))); + $this->assertEquals(2, $this->client->createFile(1, 1, 'My file 2', base64_encode('plain text file'))); + + $files = $this->client->getAllFiles(array('task_id' => 1)); + $this->assertNotEmpty($files); + $this->assertCount(2, $files); + + $this->assertTrue($this->client->removeAllFiles(array('task_id' => 1))); + + $files = $this->client->getAllFiles(array('task_id' => 1)); + $this->assertEmpty($files); + } + + public function testCreateTaskWithReference() + { + $task = array( + 'title' => 'Task with external ticket number', + 'reference' => 'TICKET-1234', + 'project_id' => 1, + 'description' => '[Link to my ticket](http://my-ticketing-system/1234)', + ); + + $task_id = $this->client->createTask($task); + + $this->assertNotFalse($task_id); + $this->assertInternalType('int', $task_id); + $this->assertTrue($task_id > 0); + } + + public function testGetTaskByReference() + { + $task = $this->client->getTaskByReference(array('project_id' => 1, 'reference' => 'TICKET-1234')); + + $this->assertNotEmpty($task); + $this->assertEquals('Task with external ticket number', $task['title']); + $this->assertEquals('TICKET-1234', $task['reference']); + } }
\ No newline at end of file |