From 6d2430701c9af8029da34140a9e2176b9e904f9c Mon Sep 17 00:00:00 2001 From: Julien Veyssier Date: Mon, 23 Aug 2021 19:00:59 +0200 Subject: [PATCH] fix UserController tests failing because of max_quota app value not provided by mocks Signed-off-by: Julien Veyssier --- .../tests/Controller/UsersControllerTest.php | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/apps/provisioning_api/tests/Controller/UsersControllerTest.php b/apps/provisioning_api/tests/Controller/UsersControllerTest.php index 238bac3430735..cc638c89a6393 100644 --- a/apps/provisioning_api/tests/Controller/UsersControllerTest.php +++ b/apps/provisioning_api/tests/Controller/UsersControllerTest.php @@ -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()) @@ -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()) @@ -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())