Skip to content

Commit

Permalink
fix UserController tests failing because of max_quota app value not p…
Browse files Browse the repository at this point in the history
…rovided by mocks

Signed-off-by: Julien Veyssier <eneiluj@posteo.net>
  • Loading branch information
Julien Veyssier committed Jul 30, 2021
1 parent 7170c03 commit 7cc1b62
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions apps/provisioning_api/tests/Controller/UsersControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -1755,6 +1755,15 @@ public function testEditUserRegularUserSelfEditChangeQuota() {
}

public function testEditUserAdminUserSelfEditChangeValidQuota() {
$this->config
->expects($this->once())
->method('getAppValue')
->willReturnCallback(function ($appid, $key, $default) {
if ($key === 'max_quota') {
return '-1';
}
return null;
});
$loggedInUser = $this->getMockBuilder(IUser::class)->disableOriginalConstructor()->getMock();
$loggedInUser
->expects($this->any())
Expand Down Expand Up @@ -1834,6 +1843,15 @@ public function testEditUserAdminUserSelfEditChangeInvalidQuota() {
}

public function testEditUserAdminUserEditChangeValidQuota() {
$this->config
->expects($this->once())
->method('getAppValue')
->willReturnCallback(function ($appid, $key, $default) {
if ($key === 'max_quota') {
return '-1';
}
return null;
});
$loggedInUser = $this->getMockBuilder(IUser::class)->disableOriginalConstructor()->getMock();
$loggedInUser
->expects($this->any())
Expand Down Expand Up @@ -2082,6 +2100,15 @@ public function testEditUserAdminEditChangeLanguageInvalidLanguage() {
}

public function testEditUserSubadminUserAccessible() {
$this->config
->expects($this->once())
->method('getAppValue')
->willReturnCallback(function ($appid, $key, $default) {
if ($key === 'max_quota') {
return '-1';
}
return null;
});
$loggedInUser = $this->getMockBuilder(IUser::class)->disableOriginalConstructor()->getMock();
$loggedInUser
->expects($this->any())
Expand Down

0 comments on commit 7cc1b62

Please sign in to comment.