diff options
author | Morris Jobke <hey@morrisjobke.de> | 2015-03-17 18:55:44 +0100 |
---|---|---|
committer | Morris Jobke <hey@morrisjobke.de> | 2015-03-17 18:55:44 +0100 |
commit | f4b6f3cfd15aca14736e633a94ad7dac8d8e7554 (patch) | |
tree | 5d1dcc052574d571dfa498005beffd1d33b7707a /apps/files_sharing | |
parent | fbea83d4eb53cb500570a096d84a3f6eca11cb84 (diff) | |
download | nextcloud-server-f4b6f3cfd15aca14736e633a94ad7dac8d8e7554.tar.gz nextcloud-server-f4b6f3cfd15aca14736e633a94ad7dac8d8e7554.zip |
fix unit tests
Diffstat (limited to 'apps/files_sharing')
-rw-r--r-- | apps/files_sharing/tests/api.php | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/apps/files_sharing/tests/api.php b/apps/files_sharing/tests/api.php index 9256f9bcc85..78d32dd3172 100644 --- a/apps/files_sharing/tests/api.php +++ b/apps/files_sharing/tests/api.php @@ -1283,9 +1283,19 @@ class Test_Files_Sharing_Api extends TestCase { public function testDefaultExpireDate() { \Test_Files_Sharing_Api::loginHelper(\Test_Files_Sharing_Api::TEST_FILES_SHARING_API_USER1); - \OC::$server->getAppConfig()->setValue('core', 'shareapi_default_expire_date', 'yes'); - \OC::$server->getAppConfig()->setValue('core', 'shareapi_enforce_expire_date', 'yes'); - \OC::$server->getAppConfig()->setValue('core', 'shareapi_expire_after_n_days', '2'); + + // TODO drop this once all code paths use the DI version - otherwise + // the cache inside this config object is out of date because + // OC_Appconfig is used and bypasses this cache which lead to integrity + // constraint violations + $config = \OC::$server->getConfig(); + $config->deleteAppValue('core', 'shareapi_default_expire_date'); + $config->deleteAppValue('core', 'shareapi_enforce_expire_date'); + $config->deleteAppValue('core', 'shareapi_expire_after_n_days'); + + $config->setAppValue('core', 'shareapi_default_expire_date', 'yes'); + $config->setAppValue('core', 'shareapi_enforce_expire_date', 'yes'); + $config->setAppValue('core', 'shareapi_expire_after_n_days', '2'); // default expire date is set to 2 days // the time when the share was created is set to 3 days in the past @@ -1329,8 +1339,8 @@ class Test_Files_Sharing_Api extends TestCase { //cleanup $result = \OCP\Share::unshare('file', $info->getId(), \OCP\Share::SHARE_TYPE_USER, \Test_Files_Sharing_Api::TEST_FILES_SHARING_API_USER2); $this->assertTrue($result); - \OC::$server->getAppConfig()->setValue('core', 'shareapi_default_expire_date', 'no'); - \OC::$server->getAppConfig()->setValue('core', 'shareapi_enforce_expire_date', 'no'); + $config->setAppValue('core', 'shareapi_default_expire_date', 'no'); + $config->setAppValue('core', 'shareapi_enforce_expire_date', 'no'); } } |