]> source.dussan.org Git - nextcloud-server.git/commitdiff
Use array key instead of value
authorLukas Reschke <lukas@owncloud.com>
Fri, 12 Dec 2014 15:42:25 +0000 (16:42 +0100)
committerLukas Reschke <lukas@owncloud.com>
Fri, 12 Dec 2014 15:42:25 +0000 (16:42 +0100)
settings/controller/userscontroller.php
tests/settings/controller/userscontrollertest.php

index dbd8118375a1a3d4b98349dbda81f260970e252d..579d38f709112d4457c48f12ae915c150b946f88 100644 (file)
@@ -91,7 +91,7 @@ class UsersController extends Controller {
         */
        private function getUsersForUID(array $userIDs) {
                $users = [];
-               foreach ($userIDs as $uid) {
+               foreach ($userIDs as $uid => $displayName) {
                        $users[] = $this->userManager->get($uid);
                }
                return $users;
index 78b855fd3f163b58f4b90d9ceb83fac5e27eb47d..89ef8bcf8a621f737c854a2d231e852345f3927a 100644 (file)
@@ -126,9 +126,20 @@ class UsersControllerTest extends \Test\TestCase {
                        ->method('getUserGroupIds')
                        ->will($this->onConsecutiveCalls(array('Users', 'Support'), array('admins', 'Support'), array('External Users')));
                $this->container['UserManager']
-                       ->expects($this->exactly(3))
+                       ->expects($this->at(0))
+                       ->method('get')
+                       ->with('foo')
+                       ->will($this->returnValue($foo));
+               $this->container['UserManager']
+                       ->expects($this->at(1))
+                       ->method('get')
+                       ->with('admin')
+                       ->will($this->returnValue($admin));
+               $this->container['UserManager']
+                       ->expects($this->at(2))
                        ->method('get')
-                       ->will($this->onConsecutiveCalls($foo, $admin, $bar));
+                       ->with('bar')
+                       ->will($this->returnValue($bar));
                $this->container['Config']
                        ->expects($this->exactly(3))
                        ->method('getUserValue')
@@ -168,7 +179,7 @@ class UsersControllerTest extends \Test\TestCase {
                                ),
                        )
                );
-               $response = $this->usersController->index(0, 10, 'pattern');
+               $response = $this->usersController->index(0, 10, 'gid', 'pattern');
                $this->assertEquals($expectedResponse, $response);
        }