diff options
Diffstat (limited to 'tests/functionals/ApiTest.php')
-rw-r--r-- | tests/functionals/ApiTest.php | 64 |
1 files changed, 44 insertions, 20 deletions
diff --git a/tests/functionals/ApiTest.php b/tests/functionals/ApiTest.php index 262d289e..3b1c5241 100644 --- a/tests/functionals/ApiTest.php +++ b/tests/functionals/ApiTest.php @@ -162,12 +162,15 @@ class Api extends PHPUnit_Framework_TestCase 'column_id' => 2, ); - //$this->assertTrue($this->client->execute('createTask', $task)); - $this->assertTrue($this->client->createTask($task)); + $task_id = $this->client->createTask($task); + + $this->assertNotFalse($task_id); + $this->assertInternalType('int', $task_id); + $this->assertTrue($task_id > 0); } /** - * @expectedException BadFunctionCallException + * @expectedException InvalidArgumentException */ public function testCreateTaskWithBadParams() { @@ -207,12 +210,15 @@ class Api extends PHPUnit_Framework_TestCase public function testUpdateTask() { $task = $this->client->getTask(1); - $task['color_id'] = 'green'; - $task['column_id'] = 1; - $task['description'] = 'test'; - $task['date_due'] = ''; - $this->assertTrue($this->client->execute('updateTask', $task)); + $values = array(); + $values['id'] = $task['id']; + $values['color_id'] = 'green'; + $values['column_id'] = 1; + $values['description'] = 'test'; + $values['date_due'] = ''; + + $this->assertTrue($this->client->execute('updateTask', $values)); } public function testRemoveTask() @@ -241,11 +247,14 @@ class Api extends PHPUnit_Framework_TestCase 'password' => '123456', ); - $this->assertTrue($this->client->execute('createUser', $user)); + $user_id = $this->client->execute('createUser', $user); + $this->assertNotFalse($user_id); + $this->assertInternalType('int', $user_id); + $this->assertTrue($user_id > 0); } /** - * @expectedException BadFunctionCallException + * @expectedException InvalidArgumentException */ public function testCreateUserWithBadParams() { @@ -296,7 +305,7 @@ class Api extends PHPUnit_Framework_TestCase public function testGetAllowedUsers() { - $users = $this->client->getAllowedUsers(1); + $users = $this->client->getMembers(1); $this->assertNotFalse($users); $this->assertEquals(array(), $users); } @@ -305,7 +314,7 @@ class Api extends PHPUnit_Framework_TestCase { $this->assertTrue($this->client->allowUser(1, 2)); - $users = $this->client->getAllowedUsers(1); + $users = $this->client->getMembers(1); $this->assertNotFalse($users); $this->assertEquals(array(2 => 'Titi'), $users); } @@ -314,7 +323,7 @@ class Api extends PHPUnit_Framework_TestCase { $this->assertTrue($this->client->revokeUser(1, 2)); - $users = $this->client->getAllowedUsers(1); + $users = $this->client->getMembers(1); $this->assertNotFalse($users); $this->assertEquals(array(), $users); } @@ -329,7 +338,7 @@ class Api extends PHPUnit_Framework_TestCase 'column_id' => 1, ); - $this->assertTrue($this->client->execute('createTask', $task)); + $this->assertNotFalse($this->client->execute('createTask', $task)); $tasks = $this->client->getAllTasks(1, 1); $this->assertNotEmpty($tasks); @@ -341,7 +350,11 @@ class Api extends PHPUnit_Framework_TestCase 'content' => 'boo', ); - $this->assertTrue($this->client->execute('createComment', $comment)); + $comment_id = $this->client->execute('createComment', $comment); + + $this->assertNotFalse($comment_id); + $this->assertInternalType('int', $comment_id); + $this->assertTrue($comment_id > 0); } public function testGetComment() @@ -375,7 +388,11 @@ class Api extends PHPUnit_Framework_TestCase 'content' => 'blabla', ); - $this->assertTrue($this->client->execute('createComment', $comment)); + $comment_id = $this->client->createComment($comment); + + $this->assertNotFalse($comment_id); + $this->assertInternalType('int', $comment_id); + $this->assertTrue($comment_id > 0); $comments = $this->client->getAllComments($task_id); $this->assertNotFalse($comments); @@ -410,7 +427,11 @@ class Api extends PHPUnit_Framework_TestCase 'title' => 'subtask #1', ); - $this->assertTrue($this->client->execute('createSubtask', $subtask)); + $subtask_id = $this->client->createSubtask($subtask); + + $this->assertNotFalse($subtask_id); + $this->assertInternalType('int', $subtask_id); + $this->assertTrue($subtask_id > 0); } public function testGetSubtask() @@ -444,7 +465,7 @@ class Api extends PHPUnit_Framework_TestCase 'title' => 'Subtask #2', ); - $this->assertTrue($this->client->execute('createSubtask', $subtask)); + $this->assertNotFalse($this->client->execute('createSubtask', $subtask)); $subtasks = $this->client->getAllSubtasks($this->getTaskId()); $this->assertNotFalse($subtasks); @@ -483,7 +504,10 @@ class Api extends PHPUnit_Framework_TestCase 'project_id' => 1, ); - $this->assertTrue($this->client->execute('createCategory', $category)); + $cat_id = $this->client->execute('createCategory', $category); + $this->assertNotFalse($cat_id); + $this->assertInternalType('int', $cat_id); + $this->assertTrue($cat_id > 0); // Duplicate @@ -496,7 +520,7 @@ class Api extends PHPUnit_Framework_TestCase } /** - * @expectedException BadFunctionCallException + * @expectedException InvalidArgumentException */ public function testCategoryCreationWithBadParams() { |