Tests only: Forward calls to getUserValue and getAppValue

Signed-off-by: Daniel Kesselberg <mail@danielkesselberg.de>
This commit is contained in:
Daniel Kesselberg 2020-09-01 09:58:59 +02:00 committed by Roeland Jago Douma
parent d6b7ad7109
commit 062ce5444d
No known key found for this signature in database
GPG key ID: F941078878347C0C

View file

@ -120,15 +120,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')
->will($this->returnCallback(function ($key, $default) use ($config) {
->will($this->returnCallback(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('AllConfig', $mockConfig);
$this->trashRoot1 = '/' . self::TEST_TRASHBIN_USER1 . '/files_trashbin';