set watch policy in test
This commit is contained in:
parent
6031ae1ad4
commit
d0dd76bb8a
|
@ -86,11 +86,12 @@ class Test_Trashbin extends \Test\TestCase {
|
|||
}
|
||||
|
||||
|
||||
|
||||
public static function tearDownAfterClass() {
|
||||
// cleanup test user
|
||||
$user = \OC::$server->getUserManager()->get(self::TEST_TRASHBIN_USER1);
|
||||
if ($user !== null) { $user->delete(); }
|
||||
if ($user !== null) {
|
||||
$user->delete();
|
||||
}
|
||||
|
||||
\OC::$server->getConfig()->setSystemValue('trashbin_retention_obligation', self::$rememberRetentionObligation);
|
||||
|
||||
|
@ -109,6 +110,18 @@ class Test_Trashbin extends \Test\TestCase {
|
|||
parent::setUp();
|
||||
|
||||
\OC::$server->getAppManager()->enableApp('files_trashbin');
|
||||
$config = \OC::$server->getConfig();
|
||||
$mockConfig = $this->getMock('\OCP\IConfig');
|
||||
$mockConfig->expects($this->any())
|
||||
->method('getSystemValue')
|
||||
->will($this->returnCallback(function ($key, $default) use ($config) {
|
||||
if ($key === 'filesystem_check_changes') {
|
||||
return \OC\Files\Cache\Watcher::CHECK_ONCE;
|
||||
} else {
|
||||
return $config->getSystemValue($key, $default);
|
||||
}
|
||||
}));
|
||||
$this->overwriteService('AllConfig', $mockConfig);
|
||||
|
||||
$this->trashRoot1 = '/' . self::TEST_TRASHBIN_USER1 . '/files_trashbin';
|
||||
$this->trashRoot2 = '/' . self::TEST_TRASHBIN_USER2 . '/files_trashbin';
|
||||
|
@ -117,6 +130,7 @@ class Test_Trashbin extends \Test\TestCase {
|
|||
}
|
||||
|
||||
protected function tearDown() {
|
||||
$this->restoreService('AllConfig');
|
||||
// disable trashbin to be able to properly clean up
|
||||
\OC::$server->getAppManager()->disableApp('files_trashbin');
|
||||
|
||||
|
@ -250,6 +264,7 @@ class Test_Trashbin extends \Test\TestCase {
|
|||
|
||||
/**
|
||||
* verify that the array contains the expected results
|
||||
*
|
||||
* @param OCP\Files\FileInfo[] $result
|
||||
* @param string[] $expected
|
||||
*/
|
||||
|
|
|
@ -74,6 +74,19 @@ class Test_Files_Versioning extends \Test\TestCase {
|
|||
protected function setUp() {
|
||||
parent::setUp();
|
||||
|
||||
$config = \OC::$server->getConfig();
|
||||
$mockConfig = $this->getMock('\OCP\IConfig');
|
||||
$mockConfig->expects($this->any())
|
||||
->method('getSystemValue')
|
||||
->will($this->returnCallback(function ($key, $default) use ($config) {
|
||||
if ($key === 'filesystem_check_changes') {
|
||||
return \OC\Files\Cache\Watcher::CHECK_ONCE;
|
||||
} else {
|
||||
return $config->getSystemValue($key, $default);
|
||||
}
|
||||
}));
|
||||
$this->overwriteService('AllConfig', $mockConfig);
|
||||
|
||||
// clear hooks
|
||||
\OC_Hook::clear();
|
||||
\OC::registerShareHooks();
|
||||
|
@ -87,6 +100,8 @@ class Test_Files_Versioning extends \Test\TestCase {
|
|||
}
|
||||
|
||||
protected function tearDown() {
|
||||
$this->restoreService('AllConfig');
|
||||
|
||||
if ($this->rootView) {
|
||||
$this->rootView->deleteAll(self::TEST_VERSIONS_USER . '/files/');
|
||||
$this->rootView->deleteAll(self::TEST_VERSIONS_USER2 . '/files/');
|
||||
|
|
Loading…
Reference in New Issue