summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorVincent Petry <pvince81@owncloud.com>2015-11-09 11:11:11 +0100
committerVincent Petry <pvince81@owncloud.com>2015-11-09 11:11:11 +0100
commit0110fe001dd29cbe82b1a8f69c5566ec50d3bdfb (patch)
tree4faf16d000e7951d939101c4f7747fadbda83ac8 /tests
parent1095d22e48b84364713ce2cc320a93bc51b63329 (diff)
parentad64a2408132c93b94802f3b6aa44aca56b6d764 (diff)
downloadnextcloud-server-0110fe001dd29cbe82b1a8f69c5566ec50d3bdfb.tar.gz
nextcloud-server-0110fe001dd29cbe82b1a8f69c5566ec50d3bdfb.zip
Merge pull request #20387 from owncloud/backport-20348-integer-group-names
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