aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBjoern Schiessle <schiessle@owncloud.com>2014-07-28 17:19:19 +0200
committerBjoern Schiessle <schiessle@owncloud.com>2014-07-30 15:32:20 +0200
commit60b1a6e75f0a3bc0a8b912061f5b0462a20e6d52 (patch)
tree69f0ed8403618914977623793e1007499d27b751
parent0b8135dcc468bc35fee96595c1fadb0636c6db3e (diff)
downloadnextcloud-server-60b1a6e75f0a3bc0a8b912061f5b0462a20e6d52.tar.gz
nextcloud-server-60b1a6e75f0a3bc0a8b912061f5b0462a20e6d52.zip
add unit test
-rw-r--r--tests/lib/share/share.php26
1 files changed, 26 insertions, 0 deletions
diff --git a/tests/lib/share/share.php b/tests/lib/share/share.php
index 24dedb619f8..bb827eece73 100644
--- a/tests/lib/share/share.php
+++ b/tests/lib/share/share.php
@@ -631,6 +631,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);