diff options
author | Imbasaur <yarrusg@gmail.com> | 2016-04-29 15:20:48 +0200 |
---|---|---|
committer | Imbasaur <yarrusg@gmail.com> | 2016-04-29 15:20:48 +0200 |
commit | 7459bc1c40af72441ccdaff944ef2dc9465ba9bf (patch) | |
tree | fea088cdda93079aee9e719a1bbe8464358efbb0 /tests/integration | |
parent | 99f275e5bb033cca33eee87b0e914645730f13d1 (diff) | |
parent | 81a25cbe6328eab7c4de0befc64186610ecc7f49 (diff) |
Merge pull request #2 from fguillot/master
merge
Diffstat (limited to 'tests/integration')
-rw-r--r-- | tests/integration/Base.php | 6 | ||||
-rw-r--r-- | tests/integration/GroupMemberTest.php | 8 | ||||
-rw-r--r-- | tests/integration/MeTest.php | 10 | ||||
-rw-r--r-- | tests/integration/TaskTest.php | 36 |
4 files changed, 52 insertions, 8 deletions
diff --git a/tests/integration/Base.php b/tests/integration/Base.php index 983d0ed9..6f3ae076 100644 --- a/tests/integration/Base.php +++ b/tests/integration/Base.php @@ -35,15 +35,15 @@ abstract class Base extends PHPUnit_Framework_TestCase { $this->app = new JsonRPC\Client(API_URL); $this->app->authentication('jsonrpc', API_KEY); - // $this->app->debug = true; + $this->app->getHttpClient()->withDebug(); $this->admin = new JsonRPC\Client(API_URL); $this->admin->authentication('admin', 'admin'); - // $this->admin->debug = true; + $this->admin->getHttpClient()->withDebug(); $this->user = new JsonRPC\Client(API_URL); $this->user->authentication('user', 'password'); - // $this->user->debug = true; + $this->user->getHttpClient()->withDebug(); } protected function getProjectId() diff --git a/tests/integration/GroupMemberTest.php b/tests/integration/GroupMemberTest.php index e84c0734..d49945b5 100644 --- a/tests/integration/GroupMemberTest.php +++ b/tests/integration/GroupMemberTest.php @@ -30,6 +30,14 @@ class GroupMemberTest extends Base $this->assertFalse($this->app->isGroupMember($groupId, 2)); } + public function testGetGroups() + { + $groups = $this->app->getMemberGroups(1); + $this->assertCount(1, $groups); + $this->assertEquals(1, $groups[0]['id']); + $this->assertEquals('My Group A', $groups[0]['name']); + } + public function testRemove() { $groupId = $this->getGroupId(); diff --git a/tests/integration/MeTest.php b/tests/integration/MeTest.php index 21f61756..1b028b84 100644 --- a/tests/integration/MeTest.php +++ b/tests/integration/MeTest.php @@ -15,7 +15,7 @@ class MeTest extends Base } /** - * @expectedException JsonRPC\AccessDeniedException + * @expectedException JsonRPC\Exception\AccessDeniedException */ public function testNotAllowedAppProcedure() { @@ -23,7 +23,7 @@ class MeTest extends Base } /** - * @expectedException JsonRPC\AccessDeniedException + * @expectedException JsonRPC\Exception\AccessDeniedException */ public function testNotAllowedUserProcedure() { @@ -31,7 +31,7 @@ class MeTest extends Base } /** - * @expectedException JsonRPC\AccessDeniedException + * @expectedException JsonRPC\Exception\AccessDeniedException */ public function testNotAllowedProjectForUser() { @@ -140,7 +140,7 @@ class MeTest extends Base } /** - * @expectedException JsonRPC\AccessDeniedException + * @expectedException JsonRPC\Exception\AccessDeniedException */ public function testGetAdminTask() { @@ -148,7 +148,7 @@ class MeTest extends Base } /** - * @expectedException JsonRPC\AccessDeniedException + * @expectedException JsonRPC\Exception\AccessDeniedException */ public function testGetProjectActivityDenied() { diff --git a/tests/integration/TaskTest.php b/tests/integration/TaskTest.php index 6d500da4..0c398761 100644 --- a/tests/integration/TaskTest.php +++ b/tests/integration/TaskTest.php @@ -4,6 +4,42 @@ require_once __DIR__.'/Base.php'; class TaskTest extends Base { + public function testSearchTasks() + { + $project_id1 = $this->app->createProject('My project'); + $project_id2 = $this->app->createProject('My project'); + $this->assertNotFalse($project_id1); + $this->assertNotFalse($project_id2); + + $this->assertNotFalse($this->app->createTask(array('project_id' => $project_id1, 'title' => 'T1'))); + $this->assertNotFalse($this->app->createTask(array('project_id' => $project_id1, 'title' => 'T2'))); + $this->assertNotFalse($this->app->createTask(array('project_id' => $project_id2, 'title' => 'T3'))); + + $tasks = $this->app->searchTasks($project_id1, 't2'); + $this->assertCount(1, $tasks); + $this->assertEquals('T2', $tasks[0]['title']); + + $tasks = $this->app->searchTasks(array('project_id' => $project_id2, 'query' => 'assignee:nobody')); + $this->assertCount(1, $tasks); + $this->assertEquals('T3', $tasks[0]['title']); + } + + public function testPriorityAttribute() + { + $project_id = $this->app->createProject('My project'); + $this->assertNotFalse($project_id); + + $task_id = $this->app->createTask(array('project_id' => $project_id, 'title' => 'My task', 'priority' => 2)); + + $task = $this->app->getTask($task_id); + $this->assertEquals(2, $task['priority']); + + $this->assertTrue($this->app->updateTask(array('id' => $task_id, 'project_id' => $project_id, 'priority' => 3))); + + $task = $this->app->getTask($task_id); + $this->assertEquals(3, $task['priority']); + } + public function testChangeAssigneeToAssignableUser() { $project_id = $this->app->createProject('My project'); |