Skip to content

Commit

Permalink
Tests only: Forward calls to getUserValue and getAppValue
Browse files Browse the repository at this point in the history
Signed-off-by: Daniel Kesselberg <[email protected]>
  • Loading branch information
kesselb committed Sep 1, 2020
1 parent 2513b64 commit 3552878
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions apps/files_trashbin/tests/TrashbinTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -124,15 +124,25 @@ protected function setUp(): void {
\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';
Expand Down

0 comments on commit 3552878

Please sign in to comment.