From 561b590c77e0898518956a4126f3c3aba7bb38a1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=B4me=20Chilliet?= Date: Tue, 26 Nov 2024 17:37:09 +0100 Subject: [PATCH] chore(trashbin): Fix configuration mocking in trashbin tests MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Côme Chilliet --- apps/files_trashbin/tests/TrashbinTest.php | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/apps/files_trashbin/tests/TrashbinTest.php b/apps/files_trashbin/tests/TrashbinTest.php index d16e90f74e9..4710ea8c3e9 100644 --- a/apps/files_trashbin/tests/TrashbinTest.php +++ b/apps/files_trashbin/tests/TrashbinTest.php @@ -115,8 +115,11 @@ class TrashbinTest extends \Test\TestCase { Server::get(IAppManager::class)->enableApp('files_trashbin'); $config = Server::get(IConfig::class); - $mockConfig = $this->createMock(IConfig::class); - $mockConfig + $mockConfig = $this->getMockBuilder(AllConfig::class) + ->onlyMethods(['getSystemValue']) + ->setConstructorArgs([Server::get(\OC\SystemConfig::class)]) + ->getMock(); + $mockConfig->expects($this->any()) ->method('getSystemValue') ->willReturnCallback(static function ($key, $default) use ($config) { if ($key === 'filesystem_check_changes') { @@ -125,16 +128,6 @@ class TrashbinTest extends \Test\TestCase { return $config->getSystemValue($key, $default); } }); - $mockConfig - ->method('getUserValue') - ->willReturnCallback(static function ($userId, $appName, $key, $default = '') use ($config) { - return $config->getUserValue($userId, $appName, $key, $default); - }); - $mockConfig - ->method('getAppValue') - ->willReturnCallback(static function ($appName, $key, $default = '') use ($config) { - return $config->getAppValue($appName, $key, $default); - }); $this->overwriteService(AllConfig::class, $mockConfig); $this->trashRoot1 = '/' . self::TEST_TRASHBIN_USER1 . '/files_trashbin';