diff options
author | Thomas Müller <thomas.mueller@tmit.eu> | 2015-04-14 11:00:20 +0200 |
---|---|---|
committer | Thomas Müller <thomas.mueller@tmit.eu> | 2015-04-14 11:00:20 +0200 |
commit | 88cc52c408c82c1eb8a416358fb6f87f60b22da7 (patch) | |
tree | 8686d72755e5b0c0cc17e8e2086c5c28005c51f8 /tests | |
parent | 75adee1ebd088819d6c3737bd7069419f268bf0d (diff) | |
download | nextcloud-server-88cc52c408c82c1eb8a416358fb6f87f60b22da7.tar.gz nextcloud-server-88cc52c408c82c1eb8a416358fb6f87f60b22da7.zip |
Avoid php message "Invalid argument supplied for foreach()" - refs #15590
Diffstat (limited to 'tests')
-rw-r--r-- | tests/lib/group/manager.php | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/tests/lib/group/manager.php b/tests/lib/group/manager.php index 76996a2b9bb..0f3573f96e1 100644 --- a/tests/lib/group/manager.php +++ b/tests/lib/group/manager.php @@ -846,4 +846,39 @@ class Manager extends \Test\TestCase { $groups = $manager->getUserGroups($user1); $this->assertEquals(array(), $groups); } + + public function testGetUserIdGroups() { + /** + * @var \PHPUnit_Framework_MockObject_MockObject | \OC_Group_Backend $backend + */ + $backend = $this->getMock('\OC_Group_Database'); + $backend->expects($this->any()) + ->method('getUserGroups') + ->with('user1') + ->will($this->returnValue(null)); +// $backend->expects($this->any()) +// ->method('groupExists') +// ->with('group1') +// ->will($this->returnValue(true)); +// $backend->expects($this->once()) +// ->method('implementsActions') +// ->will($this->returnValue(true)); +// $backend->expects($this->once()) +// ->method('inGroup') +// ->will($this->returnValue(true)); +// $backend->expects($this->once()) +// ->method('removeFromGroup') +// ->will($this->returnValue(true)); + + /** + * @var \OC\User\Manager $userManager + */ + $userManager = $this->getMock('\OC\User\Manager'); + $manager = new \OC\Group\Manager($userManager); + $manager->addBackend($backend); + + $groups = $manager->getUserIdGroups('user1'); + $this->assertEquals([], $groups); + } + } |