summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/integration/GroupMemberTest.php8
-rw-r--r--tests/units/Model/GroupMemberTest.php30
2 files changed, 38 insertions, 0 deletions
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/units/Model/GroupMemberTest.php b/tests/units/Model/GroupMemberTest.php
index 16f769e8..0ff9fdf6 100644
--- a/tests/units/Model/GroupMemberTest.php
+++ b/tests/units/Model/GroupMemberTest.php
@@ -72,5 +72,35 @@ class GroupMemberTest extends Base
$this->assertCount(2, $users);
$this->assertEquals('admin', $users[0]['username']);
$this->assertEquals('user1', $users[1]['username']);
+
+ $groups = $groupMemberModel->getGroups(1);
+ $this->assertCount(1, $groups);
+ $this->assertEquals(1, $groups[0]['id']);
+ $this->assertEquals('Group A', $groups[0]['name']);
+
+ $groups = $groupMemberModel->getGroups(2);
+ $this->assertCount(1, $groups);
+ $this->assertEquals(1, $groups[0]['id']);
+ $this->assertEquals('Group A', $groups[0]['name']);
+
+ $groups = $groupMemberModel->getGroups(3);
+ $this->assertCount(1, $groups);
+ $this->assertEquals(2, $groups[0]['id']);
+ $this->assertEquals('Group B', $groups[0]['name']);
+
+ $groups = $groupMemberModel->getGroups(4);
+ $this->assertCount(1, $groups);
+ $this->assertEquals(2, $groups[0]['id']);
+ $this->assertEquals('Group B', $groups[0]['name']);
+
+ $groups = $groupMemberModel->getGroups(5);
+ $this->assertCount(2, $groups);
+ $this->assertEquals(1, $groups[0]['id']);
+ $this->assertEquals('Group A', $groups[0]['name']);
+ $this->assertEquals(2, $groups[1]['id']);
+ $this->assertEquals('Group B', $groups[1]['name']);
+
+ $groups = $groupMemberModel->getGroups(6);
+ $this->assertCount(0, $groups);
}
}