diff options
author | voxsim <Simon Vocella> | 2014-09-15 18:37:54 +0200 |
---|---|---|
committer | voxsim <Simon Vocella> | 2014-09-15 18:37:54 +0200 |
commit | 1366133d2bba33391b25a57ad0182b317fe3ecb6 (patch) | |
tree | 4264c6bad95599835580ff39b6bfa21ea899d2af /tests/lib/group | |
parent | a49610e18a07d04dd3ed861e15b64a94b8a45e19 (diff) | |
download | nextcloud-server-1366133d2bba33391b25a57ad0182b317fe3ecb6.tar.gz nextcloud-server-1366133d2bba33391b25a57ad0182b317fe3ecb6.zip |
add more logic in displayNamesInGroup for big user bases
Diffstat (limited to 'tests/lib/group')
-rw-r--r-- | tests/lib/group/manager.php | 44 |
1 files changed, 33 insertions, 11 deletions
diff --git a/tests/lib/group/manager.php b/tests/lib/group/manager.php index d4a1a737837..70d9783946a 100644 --- a/tests/lib/group/manager.php +++ b/tests/lib/group/manager.php @@ -369,17 +369,31 @@ class Manager extends \PHPUnit_Framework_TestCase { } })); + $backend->expects($this->once()) + ->method('implementsActions') + ->will($this->returnValue(true)); + + $backend->expects($this->once()) + ->method('countUsersInGroup') + ->with('testgroup', '') + ->will($this->returnValue(2)); + /** * @var \OC\User\Manager $userManager */ $userManager = $this->getMock('\OC\User\Manager'); $userBackend = $this->getMock('\OC_User_Backend'); - $userManager->expects($this->once()) + $userManager->expects($this->any()) ->method('search') ->with('user3') - ->will($this->returnValue(array('user3' => new User('user3', $userBackend), - 'user33' => new User('user33', $userBackend)))); + ->will($this->returnCallback(function($search, $limit, $offset) use ($userBackend) { + switch($offset) { + case 0 : return array('user3' => new User('user3', $userBackend), + 'user33' => new User('user33', $userBackend)); + case 2 : return array(); + } + })); $userManager->expects($this->any()) ->method('get') @@ -435,12 +449,16 @@ class Manager extends \PHPUnit_Framework_TestCase { $userManager = $this->getMock('\OC\User\Manager'); $userBackend = $this->getMock('\OC_User_Backend'); - $userManager->expects($this->once()) + $userManager->expects($this->any()) ->method('search') ->with('user3') - ->will($this->returnValue(array('user3' => new User('user3', $userBackend), - 'user33' => new User('user33', $userBackend), - 'user333' => new User('user333', $userBackend)))); + ->will($this->returnCallback(function($search, $limit, $offset) use ($userBackend) { + switch($offset) { + case 0 : return array('user3' => new User('user3', $userBackend), + 'user33' => new User('user33', $userBackend)); + case 2 : return array('user333' => new User('user333', $userBackend)); + } + })); $userManager->expects($this->any()) ->method('get') @@ -498,12 +516,16 @@ class Manager extends \PHPUnit_Framework_TestCase { $userManager = $this->getMock('\OC\User\Manager'); $userBackend = $this->getMock('\OC_User_Backend'); - $userManager->expects($this->once()) + $userManager->expects($this->any()) ->method('search') ->with('user3') - ->will($this->returnValue(array('user3' => new User('user3', $userBackend), - 'user33' => new User('user33', $userBackend), - 'user333' => new User('user333', $userBackend)))); + ->will($this->returnCallback(function($search, $limit, $offset) use ($userBackend) { + switch($offset) { + case 0 : return array('user3' => new User('user3', $userBackend), + 'user33' => new User('user33', $userBackend)); + case 2 : return array('user333' => new User('user333', $userBackend)); + } + })); $userManager->expects($this->any()) ->method('get') |