diff options
Diffstat (limited to 'tests/functionals/UserApiTest.php')
-rw-r--r-- | tests/functionals/UserApiTest.php | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/tests/functionals/UserApiTest.php b/tests/functionals/UserApiTest.php index e2c693dd..96df14ff 100644 --- a/tests/functionals/UserApiTest.php +++ b/tests/functionals/UserApiTest.php @@ -121,6 +121,7 @@ class UserApi extends PHPUnit_Framework_TestCase { $profile = $this->user->getMe(); $this->assertNotEmpty($profile); + $this->assertEquals(2, $profile['id']); $this->assertEquals('user', $profile['username']); } @@ -138,6 +139,18 @@ class UserApi extends PHPUnit_Framework_TestCase $this->assertEquals('my project', $projects[2]); } + public function testGetMyProjects() + { + $projects = $this->user->getMyProjects(); + $this->assertNotEmpty($projects); + $this->assertCount(1, $projects); + $this->assertEquals(2, $projects[0]['id']); + $this->assertEquals('my project', $projects[0]['name']); + $this->assertNotEmpty($projects[0]['url']['calendar']); + $this->assertNotEmpty($projects[0]['url']['board']); + $this->assertNotEmpty($projects[0]['url']['list']); + } + public function testGetProjectById() { $project = $this->user->getProjectById(2); @@ -172,6 +185,20 @@ class UserApi extends PHPUnit_Framework_TestCase $this->user->getTask(2); } + /** + * @expectedException JsonRPC\AccessDeniedException + */ + public function testGetProjectActivityDenied() + { + $this->user->getProjectActivity(1); + } + + public function testGetProjectActivityAllowed() + { + $activity = $this->user->getProjectActivity(2); + $this->assertNotEmpty($activity); + } + public function testGetMyActivityStream() { $activity = $this->user->getMyActivityStream(); @@ -222,4 +249,32 @@ class UserApi extends PHPUnit_Framework_TestCase { $this->assertNotEmpty($this->user->getBoard(2)); } + + public function testCreateOverdueTask() + { + $this->assertNotFalse($this->user->createTask(array( + 'title' => 'overdue task', + 'project_id' => 2, + 'date_due' => date('Y-m-d', strtotime('-2days')), + 'owner_id' => 2, + ))); + } + + public function testGetMyOverdueTasks() + { + $tasks = $this->user->getMyOverdueTasks(); + $this->assertNotEmpty($tasks); + $this->assertCount(1, $tasks); + $this->assertEquals('overdue task', $tasks[0]['title']); + $this->assertEquals('my project', $tasks[0]['project_name']); + } + + public function testGetOverdueTasksByProject() + { + $tasks = $this->user->getOverdueTasksByProject(2); + $this->assertNotEmpty($tasks); + $this->assertCount(1, $tasks); + $this->assertEquals('overdue task', $tasks[0]['title']); + $this->assertEquals('my project', $tasks[0]['project_name']); + } } |