diff options
author | Morris Jobke <hey@morrisjobke.de> | 2017-08-15 10:03:21 +0200 |
---|---|---|
committer | Morris Jobke <hey@morrisjobke.de> | 2017-08-15 10:09:47 +0200 |
commit | f640b56bfac72d2c3fd394fe6564e93020243b7f (patch) | |
tree | 7649aea33898034cd1784d2250380e175c525591 /apps | |
parent | e0f479a4eb7f297dbe5156b16f42b896c4ceadd4 (diff) | |
download | nextcloud-server-f640b56bfac72d2c3fd394fe6564e93020243b7f.tar.gz nextcloud-server-f640b56bfac72d2c3fd394fe6564e93020243b7f.zip |
Cleanup unused methods
Signed-off-by: Morris Jobke <hey@morrisjobke.de>
Diffstat (limited to 'apps')
-rw-r--r-- | apps/files_sharing/tests/ApiTest.php | 63 |
1 files changed, 0 insertions, 63 deletions
diff --git a/apps/files_sharing/tests/ApiTest.php b/apps/files_sharing/tests/ApiTest.php index 67e50554696..77b409aac06 100644 --- a/apps/files_sharing/tests/ApiTest.php +++ b/apps/files_sharing/tests/ApiTest.php @@ -1225,69 +1225,6 @@ class ApiTest extends TestCase { \OCP\Share::shareItem('file', $info->getId(), \OCP\Share::SHARE_TYPE_LINK, self::TEST_FILES_SHARING_API_USER2, 31); } - public function testDefaultExpireDate() { - self::loginHelper(self::TEST_FILES_SHARING_API_USER1); - - // 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 - // user defined expire date is set to +2 days from now on - // -> link should be already expired by the default expire date but the user - // share should still exists. - $now = time(); - $dateFormat = 'Y-m-d H:i:s'; - $shareCreated = $now - 3 * 24 * 60 * 60; - $expireDate = date($dateFormat, $now + 2 * 24 * 60 * 60); - - $info = \OC\Files\Filesystem::getFileInfo($this->filename); - $this->assertTrue($info instanceof \OC\Files\FileInfo); - - $result = \OCP\Share::shareItem('file', $info->getId(), \OCP\Share::SHARE_TYPE_LINK, null, \OCP\Constants::PERMISSION_READ); - $this->assertTrue(is_string($result)); - - $result = \OCP\Share::shareItem('file', $info->getId(), \OCP\Share::SHARE_TYPE_USER, self::TEST_FILES_SHARING_API_USER2, 31); - $this->assertTrue($result); - - $result = \OCP\Share::setExpirationDate('file', $info->getId() , $expireDate, $now); - $this->assertTrue($result); - - //manipulate stime so that both shares are older then the default expire date - $statement = "UPDATE `*PREFIX*share` SET `stime` = ? WHERE `share_type` = ?"; - $query = \OCP\DB::prepare($statement); - $result = $query->execute(array($shareCreated, \OCP\Share::SHARE_TYPE_LINK)); - $this->assertSame(1, $result); - $query = \OCP\DB::prepare($statement); - $result = $query->execute(array($shareCreated, \OCP\Share::SHARE_TYPE_USER)); - $this->assertSame(1, $result); - - // now the link share should expire because of enforced default expire date - // the user share should still exist - $result = \OCP\Share::getItemShared('file', $info->getId()); - $this->assertTrue(is_array($result)); - $this->assertSame(1, count($result)); - $share = reset($result); - $this->assertSame(\OCP\Share::SHARE_TYPE_USER, $share['share_type']); - - //cleanup - $result = \OCP\Share::unshare('file', $info->getId(), \OCP\Share::SHARE_TYPE_USER, self::TEST_FILES_SHARING_API_USER2); - $this->assertTrue($result); - $config->setAppValue('core', 'shareapi_default_expire_date', 'no'); - $config->setAppValue('core', 'shareapi_enforce_expire_date', 'no'); - - } - public function datesProvider() { $date = new \DateTime(); $date->add(new \DateInterval('P5D')); |