diff options
author | Frederic Guillot <fred@kanboard.net> | 2015-05-24 20:28:54 -0400 |
---|---|---|
committer | Frederic Guillot <fred@kanboard.net> | 2015-05-24 20:28:54 -0400 |
commit | 00c2e5c80ee4b6c5e5234e5b6a333bb19edd9b76 (patch) | |
tree | d6ad2135d614de68adf2fb6a8e8d702785e9ce0a /tests/functionals | |
parent | 3eb5501ca0cfc11e774514a4169c718d1e54854d (diff) |
Add file procedures to the API
Diffstat (limited to 'tests/functionals')
-rw-r--r-- | tests/functionals/ApiTest.php | 30 |
1 files changed, 29 insertions, 1 deletions
diff --git a/tests/functionals/ApiTest.php b/tests/functionals/ApiTest.php index 4ab2db99..b5039759 100644 --- a/tests/functionals/ApiTest.php +++ b/tests/functionals/ApiTest.php @@ -36,7 +36,7 @@ class Api extends PHPUnit_Framework_TestCase { $this->client = new JsonRPC\Client(API_URL); $this->client->authentication('jsonrpc', API_KEY); - $this->client->debug = true; + // $this->client->debug = true; } private function getTaskId() @@ -934,4 +934,32 @@ class Api extends PHPUnit_Framework_TestCase $this->assertTrue($this->client->removeTaskLink($task_link_id)); $this->assertEmpty($this->client->getAllTaskLinks($task_id1)); } + + public function testCreateFile() + { + $this->assertTrue($this->client->createFile(1, 1, 'My file', false, base64_encode('plain text file'))); + } + + public function testGetAllFiles() + { + $files = $this->client->getAllFiles(array('task_id' => 1)); + + $this->assertNotEmpty($files); + $this->assertCount(1, $files); + $this->assertEquals('My file', $files[0]['name']); + + $file = $this->client->getFile($files[0]['id']); + $this->assertNotEmpty($file); + $this->assertEquals('My file', $file['name']); + + $content = $this->client->downloadFile($file['id']); + $this->assertNotEmpty($content); + $this->assertEquals('plain text file', base64_decode($content)); + + $content = $this->client->downloadFile(1234567); + $this->assertEmpty($content); + + $this->assertTrue($this->client->removeFile($file['id'])); + $this->assertEmpty($this->client->getAllFiles(1)); + } }
\ No newline at end of file |