summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorJoas Schilling <nickvergessen@owncloud.com>2015-11-06 10:40:09 +0100
committerJoas Schilling <nickvergessen@owncloud.com>2015-11-09 09:51:06 +0100
commitad64a2408132c93b94802f3b6aa44aca56b6d764 (patch)
treefad832d6c2e1df706d82f7e31378ac53a279f2d7 /tests
parent71b18939dcd198b1868d7a73deb767523e5188f3 (diff)
downloadnextcloud-server-ad64a2408132c93b94802f3b6aa44aca56b6d764.tar.gz
nextcloud-server-ad64a2408132c93b94802f3b6aa44aca56b6d764.zip
Make sure that group names are strings not integers
Diffstat (limited to 'tests')
-rw-r--r--tests/lib/group/manager.php26
1 files changed, 26 insertions, 0 deletions
diff --git a/tests/lib/group/manager.php b/tests/lib/group/manager.php
index e3e2a96e46d..6cf473b9156 100644
--- a/tests/lib/group/manager.php
+++ b/tests/lib/group/manager.php
@@ -304,6 +304,32 @@ class Manager extends \Test\TestCase {
$this->assertEquals('group1', $group1->getGID());
}
+ public function testGetUserGroupIds() {
+ /** @var \PHPUnit_Framework_MockObject_MockObject|\OC\Group\Manager $manager */
+ $manager = $this->getMockBuilder('OC\Group\Manager')
+ ->disableOriginalConstructor()
+ ->setMethods(['getUserGroups'])
+ ->getMock();
+ $manager->expects($this->once())
+ ->method('getUserGroups')
+ ->willReturn([
+ '123' => '123',
+ 'abc' => 'abc',
+ ]);
+
+ /** @var \OC\User\User $user */
+ $user = $this->getMockBuilder('OC\User\User')
+ ->disableOriginalConstructor()
+ ->getMock();
+
+ $groups = $manager->getUserGroupIds($user);
+ $this->assertEquals(2, count($groups));
+
+ foreach ($groups as $group) {
+ $this->assertInternalType('string', $group);
+ }
+ }
+
public function testInGroup() {
/**
* @var \PHPUnit_Framework_MockObject_MockObject | \OC_Group_Backend $backend