diff options
author | Bjoern Schiessle <schiessle@owncloud.com> | 2014-07-28 17:19:19 +0200 |
---|---|---|
committer | Bjoern Schiessle <schiessle@owncloud.com> | 2014-07-28 22:45:03 +0200 |
commit | 1bba2664175e7d8065748edef46705197ccaaa12 (patch) | |
tree | 809f5155e7ef4aa10ec13b049cc7736bafe544d1 /tests | |
parent | 4e87ac2bb9604deb327ccc9a8e5e1ee98046e774 (diff) | |
download | nextcloud-server-1bba2664175e7d8065748edef46705197ccaaa12.tar.gz nextcloud-server-1bba2664175e7d8065748edef46705197ccaaa12.zip |
add unit test
Diffstat (limited to 'tests')
-rw-r--r-- | tests/lib/share/share.php | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/tests/lib/share/share.php b/tests/lib/share/share.php index 0e3dfe8291d..264d0d4f9c3 100644 --- a/tests/lib/share/share.php +++ b/tests/lib/share/share.php @@ -598,6 +598,32 @@ class Test_Share extends PHPUnit_Framework_TestCase { ); } + public function testShareItemWithLinkAndDefaultExpireDate() { + OC_User::setUserId($this->user1); + + \OC_Appconfig::setValue('core', 'shareapi_default_expire_date', 'yes'); + \OC_Appconfig::setValue('core', 'shareapi_expire_after_n_days', '2'); + + $token = OCP\Share::shareItem('test', 'test.txt', OCP\Share::SHARE_TYPE_LINK, null, OCP\PERMISSION_READ); + $this->assertInternalType( + 'string', + $token, + 'Failed asserting that user 1 successfully shared text.txt as link with token.' + ); + + // share should have default expire date + + $row = $this->getShareByValidToken($token); + $this->assertNotEmpty( + $row['expiration'], + 'Failed asserting that the returned row has an default expiration date.' + ); + + \OC_Appconfig::deleteKey('core', 'shareapi_default_expire_date'); + \OC_Appconfig::deleteKey('core', 'shareapi_expire_after_n_days'); + + } + public function testUnshareAll() { $this->shareUserTestFileWithUser($this->user1, $this->user2); $this->shareUserTestFileWithUser($this->user2, $this->user3); |