From 3ffeb4ae060d97b9306a2c243332d3a137b1e464 Mon Sep 17 00:00:00 2001 From: Georg Ehrke Date: Wed, 27 Jun 2018 19:09:09 +0200 Subject: [PATCH] fix tests / mistakes made during rebase Signed-off-by: Georg Ehrke --- apps/provisioning_api/lib/Controller/AUserData.php | 1 + .../lib/Controller/UsersController.php | 13 ------------- .../tests/Controller/UsersControllerTest.php | 14 +++++++------- 3 files changed, 8 insertions(+), 20 deletions(-) diff --git a/apps/provisioning_api/lib/Controller/AUserData.php b/apps/provisioning_api/lib/Controller/AUserData.php index 2e29cc1df1..f08fef9141 100644 --- a/apps/provisioning_api/lib/Controller/AUserData.php +++ b/apps/provisioning_api/lib/Controller/AUserData.php @@ -123,6 +123,7 @@ abstract class AUserData extends OCSController { $data[AccountManager::PROPERTY_TWITTER] = $userAccount[AccountManager::PROPERTY_TWITTER]['value']; $data['groups'] = $gids; $data['language'] = $this->config->getUserValue($targetUserObject->getUID(), 'core', 'lang'); + $data['locale'] = $this->config->getUserValue($targetUserObject->getUID(), 'core', 'locale'); return $data; } diff --git a/apps/provisioning_api/lib/Controller/UsersController.php b/apps/provisioning_api/lib/Controller/UsersController.php index 8b39de2908..52021ec248 100644 --- a/apps/provisioning_api/lib/Controller/UsersController.php +++ b/apps/provisioning_api/lib/Controller/UsersController.php @@ -392,19 +392,6 @@ class UsersController extends AUserData { } } - // Find the data - $data['id'] = $targetUserObject->getUID(); - $data['quota'] = $this->fillStorageInfo($targetUserObject->getUID()); - $data[AccountManager::PROPERTY_EMAIL] = $targetUserObject->getEMailAddress(); - $data[AccountManager::PROPERTY_DISPLAYNAME] = $targetUserObject->getDisplayName(); - $data[AccountManager::PROPERTY_PHONE] = $userAccount[AccountManager::PROPERTY_PHONE]['value']; - $data[AccountManager::PROPERTY_ADDRESS] = $userAccount[AccountManager::PROPERTY_ADDRESS]['value']; - $data[AccountManager::PROPERTY_WEBSITE] = $userAccount[AccountManager::PROPERTY_WEBSITE]['value']; - $data[AccountManager::PROPERTY_TWITTER] = $userAccount[AccountManager::PROPERTY_TWITTER]['value']; - $data['groups'] = $gids; - $data['language'] = $this->config->getUserValue($targetUserObject->getUID(), 'core', 'lang'); - $data['locale'] = $this->config->getUserValue($targetUserObject->getUID(), 'core', 'locale'); - return new DataResponse($permittedFields); } diff --git a/apps/provisioning_api/tests/Controller/UsersControllerTest.php b/apps/provisioning_api/tests/Controller/UsersControllerTest.php index 0de62bc0d1..af4d5958b5 100644 --- a/apps/provisioning_api/tests/Controller/UsersControllerTest.php +++ b/apps/provisioning_api/tests/Controller/UsersControllerTest.php @@ -747,10 +747,6 @@ class UsersControllerTest extends TestCase { ->expects($this->once()) ->method('getDisplayName') ->will($this->returnValue('Demo User')); - $targetUser - ->expects($this->exactly(5)) - ->method('getUID') - ->will($this->returnValue('UID')); $targetUser ->expects($this->once()) ->method('getHome') @@ -763,6 +759,10 @@ class UsersControllerTest extends TestCase { ->expects($this->once()) ->method('getBackendClassName') ->will($this->returnValue('Database')); + $targetUser + ->expects($this->exactly(6)) + ->method('getUID') + ->will($this->returnValue('UID')); $expected = [ 'id' => 'UID', @@ -1006,7 +1006,7 @@ class UsersControllerTest extends TestCase { ->method('getEMailAddress') ->will($this->returnValue('subadmin@nextcloud.com')); $targetUser - ->expects($this->exactly(5)) + ->expects($this->exactly(6)) ->method('getUID') ->will($this->returnValue('UID')); $targetUser @@ -1239,7 +1239,7 @@ class UsersControllerTest extends TestCase { ->with('UserToEdit') ->will($this->returnValue($targetUser)); $this->groupManager - ->expects($this->exactly(2)) + ->expects($this->exactly(3)) ->method('isAdmin') ->with('UID') ->will($this->returnValue(true)); @@ -1274,7 +1274,7 @@ class UsersControllerTest extends TestCase { ->with('UserToEdit') ->will($this->returnValue($targetUser)); $this->groupManager - ->expects($this->exactly(2)) + ->expects($this->exactly(3)) ->method('isAdmin') ->with('UID') ->will($this->returnValue(true));