Skip to content

Commit

Permalink
fix tests / mistakes made during rebase
Browse files Browse the repository at this point in the history
Signed-off-by: Georg Ehrke <developer@georgehrke.com>
  • Loading branch information
georgehrke committed Jun 27, 2018
1 parent 0cacdd3 commit 3ffeb4a
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 20 deletions.
1 change: 1 addition & 0 deletions apps/provisioning_api/lib/Controller/AUserData.php
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ protected function getUserData(string $userId): array {
$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;
}
Expand Down
13 changes: 0 additions & 13 deletions apps/provisioning_api/lib/Controller/UsersController.php
Original file line number Diff line number Diff line change
Expand Up @@ -392,19 +392,6 @@ public function getEditableFields(): DataResponse {
}
}

// 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);
}

Expand Down
14 changes: 7 additions & 7 deletions apps/provisioning_api/tests/Controller/UsersControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -747,10 +747,6 @@ public function testGetUserDataAsAdmin() {
->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')
Expand All @@ -763,6 +759,10 @@ public function testGetUserDataAsAdmin() {
->expects($this->once())
->method('getBackendClassName')
->will($this->returnValue('Database'));
$targetUser
->expects($this->exactly(6))
->method('getUID')
->will($this->returnValue('UID'));

$expected = [
'id' => 'UID',
Expand Down Expand Up @@ -1006,7 +1006,7 @@ public function testGetUserDataAsSubAdminSelfLookup() {
->method('getEMailAddress')
->will($this->returnValue('subadmin@nextcloud.com'));
$targetUser
->expects($this->exactly(5))
->expects($this->exactly(6))
->method('getUID')
->will($this->returnValue('UID'));
$targetUser
Expand Down Expand Up @@ -1239,7 +1239,7 @@ public function testEditUserAdminUserSelfEditChangeValidQuota() {
->with('UserToEdit')
->will($this->returnValue($targetUser));
$this->groupManager
->expects($this->exactly(2))
->expects($this->exactly(3))
->method('isAdmin')
->with('UID')
->will($this->returnValue(true));
Expand Down Expand Up @@ -1274,7 +1274,7 @@ public function testEditUserAdminUserSelfEditChangeInvalidQuota() {
->with('UserToEdit')
->will($this->returnValue($targetUser));
$this->groupManager
->expects($this->exactly(2))
->expects($this->exactly(3))
->method('isAdmin')
->with('UID')
->will($this->returnValue(true));
Expand Down

0 comments on commit 3ffeb4a

Please sign in to comment.