$this->config
->expects($this->at(0))
->method('getUserValue')
- ->with('UserToGet', 'core', 'enabled', 'true')
+ ->with('UID', 'core', 'enabled', 'true')
->will($this->returnValue('true'));
$this->api
->expects($this->once())
->method('fillStorageInfo')
- ->with('UserToGet')
+ ->with('UID')
->will($this->returnValue(['DummyValue']));
$targetUser
->expects($this->once())
->method('getDisplayName')
->will($this->returnValue('Demo User'));
+ $targetUser
+ ->expects($this->exactly(2))
+ ->method('getUID')
+ ->will($this->returnValue('UID'));
$expected = new \OC\OCS\Result(
[
$this->config
->expects($this->at(0))
->method('getUserValue')
- ->with('UserToGet', 'core', 'enabled', 'true')
+ ->with('UID', 'core', 'enabled', 'true')
->will($this->returnValue('true'));
$this->api
->expects($this->once())
->method('fillStorageInfo')
- ->with('UserToGet')
+ ->with('UID')
->will($this->returnValue(['DummyValue']));
$targetUser
->expects($this->once())
->method('getDisplayName')
->will($this->returnValue('Demo User'));
+ $targetUser
+ ->expects($this->exactly(2))
+ ->method('getUID')
+ ->will($this->returnValue('UID'));
$expected = new \OC\OCS\Result(
[
$loggedInUser
->expects($this->exactly(2))
->method('getUID')
- ->will($this->returnValue('subadmin'));
+ ->will($this->returnValue('UID'));
$targetUser = $this->getMockBuilder('OCP\IUser')
->disableOriginalConstructor()
->getMock();
$this->groupManager
->expects($this->once())
->method('isAdmin')
- ->with('subadmin')
+ ->with('UID')
->will($this->returnValue(false));
$subAdminManager = $this->getMockBuilder('OC\SubAdmin')
->disableOriginalConstructor()
$this->api
->expects($this->once())
->method('fillStorageInfo')
- ->with('subadmin')
+ ->with('UID')
->will($this->returnValue(['DummyValue']));
$targetUser
->expects($this->once())
->expects($this->once())
->method('getEMailAddress')
->will($this->returnValue('subadmin@owncloud.org'));
+ $targetUser
+ ->expects($this->exactly(2))
+ ->method('getUID')
+ ->will($this->returnValue('UID'));
$expected = new \OC\OCS\Result([
'quota' => ['DummyValue'],
$loggedInUser
->expects($this->any())
->method('getUID')
- ->will($this->returnValue('UserToEdit'));
+ ->will($this->returnValue('UID'));
$targetUser = $this->getMockBuilder('OCP\IUser')
->disableOriginalConstructor()
->getMock();
->expects($this->once())
->method('setDisplayName')
->with('NewDisplayName');
+ $targetUser
+ ->expects($this->any())
+ ->method('getUID')
+ ->will($this->returnValue('UID'));
$expected = new \OC\OCS\Result(null, 100);
$this->assertEquals($expected, $this->api->editUser(['userid' => 'UserToEdit', '_put' => ['key' => 'display', 'value' => 'NewDisplayName']]));
$loggedInUser
->expects($this->any())
->method('getUID')
- ->will($this->returnValue('UserToEdit'));
+ ->will($this->returnValue('UID'));
$targetUser = $this->getMockBuilder('OCP\IUser')
->disableOriginalConstructor()
->getMock();
->expects($this->once())
->method('setEMailAddress')
->with('demo@owncloud.org');
+ $targetUser
+ ->expects($this->any())
+ ->method('getUID')
+ ->will($this->returnValue('UID'));
$expected = new \OC\OCS\Result(null, 100);
$this->assertEquals($expected, $this->api->editUser(['userid' => 'UserToEdit', '_put' => ['key' => 'email', 'value' => 'demo@owncloud.org']]));
$loggedInUser
->expects($this->any())
->method('getUID')
- ->will($this->returnValue('UserToEdit'));
+ ->will($this->returnValue('UID'));
$targetUser = $this->getMockBuilder('OCP\IUser')
->disableOriginalConstructor()
->getMock();
->method('get')
->with('UserToEdit')
->will($this->returnValue($targetUser));
+ $targetUser
+ ->expects($this->any())
+ ->method('getUID')
+ ->will($this->returnValue('UID'));
$expected = new \OC\OCS\Result(null, 102);
$this->assertEquals($expected, $this->api->editUser(['userid' => 'UserToEdit', '_put' => ['key' => 'email', 'value' => 'demo.org']]));
$loggedInUser
->expects($this->any())
->method('getUID')
- ->will($this->returnValue('UserToEdit'));
+ ->will($this->returnValue('UID'));
$targetUser = $this->getMockBuilder('OCP\IUser')
->disableOriginalConstructor()
->getMock();
->expects($this->once())
->method('setPassword')
->with('NewPassword');
+ $targetUser
+ ->expects($this->any())
+ ->method('getUID')
+ ->will($this->returnValue('UID'));
$expected = new \OC\OCS\Result(null, 100);
$this->assertEquals($expected, $this->api->editUser(['userid' => 'UserToEdit', '_put' => ['key' => 'password', 'value' => 'NewPassword']]));
$loggedInUser
->expects($this->any())
->method('getUID')
- ->will($this->returnValue('UserToEdit'));
+ ->will($this->returnValue('UID'));
$targetUser = $this->getMockBuilder('OCP\IUser')
->disableOriginalConstructor()
->getMock();
->method('get')
->with('UserToEdit')
->will($this->returnValue($targetUser));
+ $targetUser
+ ->expects($this->any())
+ ->method('getUID')
+ ->will($this->returnValue('UID'));
$expected = new \OC\OCS\Result(null, 997);
$this->assertEquals($expected, $this->api->editUser(['userid' => 'UserToEdit', '_put' => ['key' => 'quota', 'value' => 'NewQuota']]));
$loggedInUser
->expects($this->any())
->method('getUID')
- ->will($this->returnValue('UserToEdit'));
+ ->will($this->returnValue('UID'));
$targetUser = $this->getMockBuilder('\OCP\IUser')->disableOriginalConstructor()->getMock();
$targetUser->expects($this->once())
->method('setQuota')
$this->groupManager
->expects($this->once())
->method('isAdmin')
- ->with('UserToEdit')
+ ->with('UID')
->will($this->returnValue(true));
+ $targetUser
+ ->expects($this->any())
+ ->method('getUID')
+ ->will($this->returnValue('UID'));
$expected = new \OC\OCS\Result(null, 100);
$this->assertEquals($expected, $this->api->editUser(['userid' => 'UserToEdit', '_put' => ['key' => 'quota', 'value' => '3042824']]));
$loggedInUser
->expects($this->any())
->method('getUID')
- ->will($this->returnValue('UserToEdit'));
+ ->will($this->returnValue('UID'));
$targetUser = $this->getMockBuilder('\OCP\IUser')->disableOriginalConstructor()->getMock();
$this->userSession
->expects($this->once())
$this->groupManager
->expects($this->once())
->method('isAdmin')
- ->with('UserToEdit')
+ ->with('UID')
->will($this->returnValue(true));
+ $targetUser
+ ->expects($this->any())
+ ->method('getUID')
+ ->will($this->returnValue('UID'));
$expected = new \OC\OCS\Result(null, 103, 'Invalid quota value ABC');
$this->assertEquals($expected, $this->api->editUser(['userid' => 'UserToEdit', '_put' => ['key' => 'quota', 'value' => 'ABC']]));
->expects($this->once())
->method('getSubAdmin')
->will($this->returnValue($subAdminManager));
+ $targetUser
+ ->expects($this->any())
+ ->method('getUID')
+ ->will($this->returnValue('UID'));
$expected = new \OC\OCS\Result(null, 100);
$this->assertEquals($expected, $this->api->editUser(['userid' => 'UserToEdit', '_put' => ['key' => 'quota', 'value' => '3042824']]));
->expects($this->once())
->method('getSubAdmin')
->will($this->returnValue($subAdminManager));
+ $targetUser
+ ->expects($this->any())
+ ->method('getUID')
+ ->will($this->returnValue('UID'));
$expected = new \OC\OCS\Result(null, 100);
$this->assertEquals($expected, $this->api->editUser(['userid' => 'UserToEdit', '_put' => ['key' => 'quota', 'value' => '3042824']]));
->expects($this->once())
->method('getSubAdmin')
->will($this->returnValue($subAdminManager));
+ $targetUser
+ ->expects($this->any())
+ ->method('getUID')
+ ->will($this->returnValue('UID'));
$expected = new \OC\OCS\Result(null, 997);
$this->assertEquals($expected, $this->api->editUser(['userid' => 'UserToEdit', '_put' => ['key' => 'quota', 'value' => '3042824']]));
$loggedInUser
->expects($this->any())
->method('getUID')
- ->will($this->returnValue('UserToDelete'));
+ ->will($this->returnValue('UID'));
$targetUser = $this->getMockBuilder('\OCP\IUser')->disableOriginalConstructor()->getMock();
$targetUser
->expects($this->once())
->method('getUID')
- ->will($this->returnValue('UserToDelete'));
+ ->will($this->returnValue('UID'));
$this->userSession
->expects($this->once())
->method('getUser')
$targetUser
->expects($this->once())
->method('getUID')
- ->will($this->returnValue('UserToDelete'));
+ ->will($this->returnValue('UID'));
$this->userSession
->expects($this->once())
->method('getUser')
$targetUser
->expects($this->once())
->method('getUID')
- ->will($this->returnValue('UserToDelete'));
+ ->will($this->returnValue('UID'));
$this->userSession
->expects($this->once())
->method('getUser')
$targetUser
->expects($this->once())
->method('getUID')
- ->will($this->returnValue('UserToDelete'));
+ ->will($this->returnValue('UID'));
$this->userSession
->expects($this->once())
->method('getUser')
$targetUser
->expects($this->once())
->method('getUID')
- ->will($this->returnValue('UserToDelete'));
+ ->will($this->returnValue('UID'));
$this->userSession
->expects($this->once())
->method('getUser')
$targetUser
->expects($this->once())
->method('getUID')
- ->will($this->returnValue('UserToDelete'));
+ ->will($this->returnValue('UID'));
$this->userSession
->expects($this->once())
->method('getUser')
->method('getUID')
->will($this->returnValue('admin'));
$targetUser = $this->getMockBuilder('\OCP\IUser')->disableOriginalConstructor()->getMock();
+ $targetUser
+ ->expects($this->once())
+ ->method('getUID')
+ ->will($this->returnValue('admin'));
$targetGroup = $this->getMockBuilder('\OCP\IGroup')->disableOriginalConstructor()->getMock();
$targetGroup
->expects($this->once())
$this->userManager
->expects($this->once())
->method('get')
- ->with('admin')
+ ->with('Admin')
->will($this->returnValue($targetUser));
$subAdminManager = $this->getMockBuilder('OC\SubAdmin')
->disableOriginalConstructor()->getMock();
->will($this->returnValue(true));
$expected = new \OC\OCS\Result(null, 105, 'Cannot remove yourself from the admin group');
- $this->assertEquals($expected, $this->api->removeFromGroup(['userid' => 'admin', '_delete' => ['groupid' => 'admin']]));
+ $this->assertEquals($expected, $this->api->removeFromGroup(['userid' => 'Admin', '_delete' => ['groupid' => 'admin']]));
}
public function testRemoveFromGroupAsSubAdminFromSubAdmin() {
->method('getUID')
->will($this->returnValue('subadmin'));
$targetUser = $this->getMockBuilder('\OCP\IUser')->disableOriginalConstructor()->getMock();
+ $targetUser
+ ->expects($this->once())
+ ->method('getUID')
+ ->will($this->returnValue('subadmin'));
$targetGroup = $this->getMockBuilder('\OCP\IGroup')->disableOriginalConstructor()->getMock();
$targetGroup
->expects($this->any())
$this->userManager
->expects($this->once())
->method('get')
- ->with('subadmin')
+ ->with('SubAdmin')
->will($this->returnValue($targetUser));
$subAdminManager = $this->getMockBuilder('OC\SubAdmin')
->disableOriginalConstructor()->getMock();
->will($this->returnValue(false));
$expected = new \OC\OCS\Result(null, 105, 'Cannot remove yourself from this group as you are a SubAdmin');
- $this->assertEquals($expected, $this->api->removeFromGroup(['userid' => 'subadmin', '_delete' => ['groupid' => 'subadmin']]));
+ $this->assertEquals($expected, $this->api->removeFromGroup(['userid' => 'SubAdmin', '_delete' => ['groupid' => 'subadmin']]));
}
public function testRemoveFromGroupSuccessful() {