->method('getUID')
->will($this->returnValue('UserToEdit'));
$targetUser = $this->getMock('\OCP\IUser');
+ $targetUser->expects($this->once())
+ ->method('setQuota')
+ ->with('2.9 MB');
$this->userSession
->expects($this->once())
->method('getUser')
->method('isAdmin')
->with('UserToEdit')
->will($this->returnValue(true));
- $this->config
- ->expects($this->once())
- ->method('setUserValue')
- ->with('UserToEdit', 'files', 'quota', '2.9 MB');
$expected = new \OC_OCS_Result(null, 100);
$this->assertEquals($expected, $this->api->editUser(['userid' => 'UserToEdit', '_put' => ['key' => 'quota', 'value' => '3042824']]));
->method('getUID')
->will($this->returnValue('admin'));
$targetUser = $this->getMock('\OCP\IUser');
+ $targetUser->expects($this->once())
+ ->method('setQuota')
+ ->with('2.9 MB');
$this->userSession
->expects($this->once())
->method('getUser')
->expects($this->once())
->method('getSubAdmin')
->will($this->returnValue($subAdminManager));
- $this->config
- ->expects($this->once())
- ->method('setUserValue')
- ->with('UserToEdit', 'files', 'quota', '2.9 MB');
$expected = new \OC_OCS_Result(null, 100);
$this->assertEquals($expected, $this->api->editUser(['userid' => 'UserToEdit', '_put' => ['key' => 'quota', 'value' => '3042824']]));
->method('getUID')
->will($this->returnValue('subadmin'));
$targetUser = $this->getMock('\OCP\IUser');
+ $targetUser->expects($this->once())
+ ->method('setQuota')
+ ->with('2.9 MB');
$this->userSession
->expects($this->once())
->method('getUser')
->expects($this->once())
->method('getSubAdmin')
->will($this->returnValue($subAdminManager));
- $this->config
- ->expects($this->once())
- ->method('setUserValue')
- ->with('UserToEdit', 'files', 'quota', '2.9 MB');
$expected = new \OC_OCS_Result(null, 100);
$this->assertEquals($expected, $this->api->editUser(['userid' => 'UserToEdit', '_put' => ['key' => 'quota', 'value' => '3042824']]));
$this->equalTo('myquota'))
->will($this->returnValue(array('42 GB')));
- $config->expects($this->once())
- ->method('setUserValue')
- ->with($this->equalTo('alice'),
- $this->equalTo('files'),
- $this->equalTo('quota'),
- $this->equalTo('42 GB'))
- ->will($this->returnValue(true));
+ $user = $this->getMock('\OCP\IUser');
+ $user->expects($this->once())
+ ->method('setQuota')
+ ->with('42 GB');
+
+ $userMgr->expects($this->once())
+ ->method('get')
+ ->with('alice')
+ ->will($this->returnValue($user));
$uid = 'alice';
$dn = 'uid=alice,dc=foo,dc=bar';
$this->equalTo('myquota'))
->will($this->returnValue(false));
- $config->expects($this->once())
- ->method('setUserValue')
- ->with($this->equalTo('alice'),
- $this->equalTo('files'),
- $this->equalTo('quota'),
- $this->equalTo('25 GB'))
- ->will($this->returnValue(true));
+ $user = $this->getMock('\OCP\IUser');
+ $user->expects($this->once())
+ ->method('setQuota')
+ ->with('25 GB');
+
+ $userMgr->expects($this->once())
+ ->method('get')
+ ->with('alice')
+ ->will($this->returnValue($user));
$uid = 'alice';
$dn = 'uid=alice,dc=foo,dc=bar';
$this->equalTo('myquota'))
->will($this->returnValue(array('27 GB')));
- $config->expects($this->once())
- ->method('setUserValue')
- ->with($this->equalTo('alice'),
- $this->equalTo('files'),
- $this->equalTo('quota'),
- $this->equalTo('27 GB'))
- ->will($this->returnValue(true));
+ $user = $this->getMock('\OCP\IUser');
+ $user->expects($this->once())
+ ->method('setQuota')
+ ->with('27 GB');
+
+ $userMgr->expects($this->once())
+ ->method('get')
+ ->with('alice')
+ ->will($this->returnValue($user));
$uid = 'alice';
$dn = 'uid=alice,dc=foo,dc=bar';
$access->expects($this->never())
->method('readAttribute');
- $config->expects($this->once())
- ->method('setUserValue')
- ->with($this->equalTo('alice'),
- $this->equalTo('files'),
- $this->equalTo('quota'),
- $this->equalTo($readQuota))
- ->will($this->returnValue(true));
+ $user = $this->getMock('\OCP\IUser');
+ $user->expects($this->once())
+ ->method('setQuota')
+ ->with($readQuota);
+
+ $userMgr->expects($this->once())
+ ->method('get')
+ ->with('alice')
+ ->will($this->returnValue($user));
$uid = 'alice';
$dn = 'uid=alice,dc=foo,dc=bar';