aboutsummaryrefslogtreecommitdiffstats
path: root/tests/lib/share/share.php
diff options
context:
space:
mode:
authorThomas Müller <thomas.mueller@tmit.eu>2014-01-21 12:07:08 +0100
committerThomas Müller <thomas.mueller@tmit.eu>2014-01-21 12:07:08 +0100
commita3ea5aa2ac85fea812e25e2578db4cf86a0d3418 (patch)
tree8f4cdc6f1b01d249086f5ad4432df2d3ab298c76 /tests/lib/share/share.php
parent6746ad0a7315d1ee06f7b1804b7c9457755f6648 (diff)
downloadnextcloud-server-a3ea5aa2ac85fea812e25e2578db4cf86a0d3418.tar.gz
nextcloud-server-a3ea5aa2ac85fea812e25e2578db4cf86a0d3418.zip
fixing comment + adding unit test for checkPasswordProtectedShare
Diffstat (limited to 'tests/lib/share/share.php')
-rw-r--r--tests/lib/share/share.php42
1 files changed, 42 insertions, 0 deletions
diff --git a/tests/lib/share/share.php b/tests/lib/share/share.php
index 2fe2837019f..d6acee6c924 100644
--- a/tests/lib/share/share.php
+++ b/tests/lib/share/share.php
@@ -25,6 +25,8 @@ class Test_Share extends PHPUnit_Framework_TestCase {
protected $userBackend;
protected $user1;
protected $user2;
+ protected $user3;
+ protected $user4;
protected $groupBackend;
protected $group1;
protected $group2;
@@ -656,4 +658,44 @@ class Test_Share extends PHPUnit_Framework_TestCase {
'Failed asserting that the share of the test.txt file by user 2 has been removed.'
);
}
+
+ /**
+ * @dataProvider checkPasswordProtectedShareDataProvider
+ * @param $expected
+ * @param $item
+ */
+ public function testCheckPasswordProtectedShare($expected, $item) {
+ \OC::$session->set('public_link_authenticated', 100);
+ $result = \OCP\Share::checkPasswordProtectedShare($item);
+ $this->assertEquals($expected, $result);
+ }
+
+ function checkPasswordProtectedShareDataProvider() {
+ return array(
+ array(true, array()),
+ array(true, array('share_with' => null)),
+ array(true, array('share_with' => '')),
+ array(true, array('share_with' => '1234567890', 'share_type' => '1')),
+ array(true, array('share_with' => '1234567890', 'share_type' => 1)),
+ array(true, array('share_with' => '1234567890', 'share_type' => '3', 'id' => 100)),
+ array(true, array('share_with' => '1234567890', 'share_type' => 3, 'id' => 100)),
+ array(false, array('share_with' => '1234567890', 'share_type' => '3', 'id' => 101)),
+ array(false, array('share_with' => '1234567890', 'share_type' => 3, 'id' => 101)),
+ );
+
+ /*
+ if (!isset($linkItem['share_with'])) {
+ return true;
+ }
+
+ if ($linkItem['share_type'] != \OCP\Share::SHARE_TYPE_LINK) {
+ return true;
+ }
+
+ if ( \OC::$session->exists('public_link_authenticated')
+ && \OC::$session->get('public_link_authenticated') === $linkItem['id'] ) {
+ return true;
+ }
+ * */
+ }
}