diff options
author | Frederic Guillot <fred@kanboard.net> | 2016-01-22 21:23:12 -0500 |
---|---|---|
committer | Frederic Guillot <fred@kanboard.net> | 2016-01-22 21:23:12 -0500 |
commit | ad8fcf035ab92d8cd06179959000b9a1681b1505 (patch) | |
tree | 80f4e35b16c1c1a6d4c473983bc6cb62b9519494 /tests/integration/GroupMemberTest.php | |
parent | f27bcec2d92af83ee7205c84954cda9d7b2fc55d (diff) |
Add new API procedures for groups, roles and project permissions
Diffstat (limited to 'tests/integration/GroupMemberTest.php')
-rw-r--r-- | tests/integration/GroupMemberTest.php | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/tests/integration/GroupMemberTest.php b/tests/integration/GroupMemberTest.php new file mode 100644 index 00000000..e84c0734 --- /dev/null +++ b/tests/integration/GroupMemberTest.php @@ -0,0 +1,39 @@ +<?php + +require_once __DIR__.'/Base.php'; + +class GroupMemberTest extends Base +{ + public function testAddMember() + { + $this->assertNotFalse($this->app->createGroup('My Group A')); + $this->assertNotFalse($this->app->createGroup('My Group B')); + + $groupId = $this->getGroupId(); + $this->assertTrue($this->app->addGroupMember($groupId, 1)); + } + + public function testGetMembers() + { + $groups = $this->app->getAllGroups(); + $members = $this->app->getGroupMembers($groups[0]['id']); + $this->assertCount(1, $members); + $this->assertEquals('admin', $members[0]['username']); + + $this->assertSame(array(), $this->app->getGroupMembers($groups[1]['id'])); + } + + public function testIsGroupMember() + { + $groupId = $this->getGroupId(); + $this->assertTrue($this->app->isGroupMember($groupId, 1)); + $this->assertFalse($this->app->isGroupMember($groupId, 2)); + } + + public function testRemove() + { + $groupId = $this->getGroupId(); + $this->assertTrue($this->app->removeGroupMember($groupId, 1)); + $this->assertFalse($this->app->isGroupMember($groupId, 1)); + } +} |