summaryrefslogtreecommitdiff
path: root/tests/integration/GroupMemberTest.php
diff options
context:
space:
mode:
Diffstat (limited to 'tests/integration/GroupMemberTest.php')
-rw-r--r--tests/integration/GroupMemberTest.php39
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));
+ }
+}