]> source.dussan.org Git - nextcloud-server.git/commitdiff
Tests only: Forward calls to getUserValue and getAppValue 22528/head
authorDaniel Kesselberg <mail@danielkesselberg.de>
Tue, 1 Sep 2020 07:58:59 +0000 (09:58 +0200)
committerDaniel Kesselberg <mail@danielkesselberg.de>
Tue, 1 Sep 2020 09:39:26 +0000 (11:39 +0200)
Signed-off-by: Daniel Kesselberg <mail@danielkesselberg.de>
apps/files_trashbin/tests/TrashbinTest.php

index 96a76e1e2fe8484d2c87bfdf16d8c869dbf391b1..4835cb925cf4e52917829e55924767e35b489367 100644 (file)
  *
  */
 
-use OCA\Files_Sharing\AppInfo\Application;
-use OCA\Files_Trashbin\AppInfo\Application as TrashbinApplication;
 use OC\AppFramework\Bootstrap\BootContext;
 use OC\AppFramework\DependencyInjection\DIContainer;
+use OCA\Files_Sharing\AppInfo\Application;
+use OCA\Files_Trashbin\AppInfo\Application as TrashbinApplication;
 use OCP\Share\IShare;
 
 /**
@@ -124,15 +124,25 @@ class TrashbinTest extends \Test\TestCase {
                \OC::$server->getAppManager()->enableApp('files_trashbin');
                $config = \OC::$server->getConfig();
                $mockConfig = $this->createMock(\OCP\IConfig::class);
-               $mockConfig->expects($this->any())
+               $mockConfig
                        ->method('getSystemValue')
-                       ->willReturnCallback(function ($key, $default) use ($config) {
+                       ->willReturnCallback(static function ($key, $default) use ($config) {
                                if ($key === 'filesystem_check_changes') {
                                        return \OC\Files\Cache\Watcher::CHECK_ONCE;
                                } else {
                                        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(\OC\AllConfig::class, $mockConfig);
 
                $this->trashRoot1 = '/' . self::TEST_TRASHBIN_USER1 . '/files_trashbin';