Skip to content

Commit ac8051e

Browse files
committed
Tests only: Forward calls to getUserValue and getAppValue
Signed-off-by: Daniel Kesselberg <mail@danielkesselberg.de>
1 parent 2513b64 commit ac8051e

1 file changed

Lines changed: 14 additions & 4 deletions

File tree

apps/files_trashbin/tests/TrashbinTest.php

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,10 @@
2929
*
3030
*/
3131

32-
use OCA\Files_Sharing\AppInfo\Application;
33-
use OCA\Files_Trashbin\AppInfo\Application as TrashbinApplication;
3432
use OC\AppFramework\Bootstrap\BootContext;
3533
use OC\AppFramework\DependencyInjection\DIContainer;
34+
use OCA\Files_Sharing\AppInfo\Application;
35+
use OCA\Files_Trashbin\AppInfo\Application as TrashbinApplication;
3636
use OCP\Share\IShare;
3737

3838
/**
@@ -124,15 +124,25 @@ protected function setUp(): void {
124124
\OC::$server->getAppManager()->enableApp('files_trashbin');
125125
$config = \OC::$server->getConfig();
126126
$mockConfig = $this->createMock(\OCP\IConfig::class);
127-
$mockConfig->expects($this->any())
127+
$mockConfig
128128
->method('getSystemValue')
129-
->willReturnCallback(function ($key, $default) use ($config) {
129+
->willReturnCallback(static function ($key, $default) use ($config) {
130130
if ($key === 'filesystem_check_changes') {
131131
return \OC\Files\Cache\Watcher::CHECK_ONCE;
132132
} else {
133133
return $config->getSystemValue($key, $default);
134134
}
135135
});
136+
$mockConfig
137+
->method('getUserValue')
138+
->willReturnCallback(static function ($userId, $appName, $key, $default = '') use ($config) {
139+
return $config->getUserValue($userId, $appName, $key, $default);
140+
});
141+
$mockConfig
142+
->method('getAppValue')
143+
->willReturnCallback(static function ($appName, $key, $default = '') use ($config) {
144+
return $config->getAppValue($appName, $key, $default);
145+
});
136146
$this->overwriteService(\OC\AllConfig::class, $mockConfig);
137147

138148
$this->trashRoot1 = '/' . self::TEST_TRASHBIN_USER1 . '/files_trashbin';

0 commit comments

Comments
 (0)