diff options
author | Bernhard Reiter <ockham@raz.or.at> | 2014-09-16 00:20:52 +0200 |
---|---|---|
committer | Bernhard Reiter <ockham@raz.or.at> | 2014-10-14 00:06:07 +0200 |
commit | 7e9baafc5341bda5b8b86700f90d896b43b85185 (patch) | |
tree | cab5ac9af7ba0408c0a38849a25f8d88f5a81447 /tests | |
parent | 7963125c41b00b7e454c0fcb1406df0cabb42de0 (diff) | |
download | nextcloud-server-7e9baafc5341bda5b8b86700f90d896b43b85185.tar.gz nextcloud-server-7e9baafc5341bda5b8b86700f90d896b43b85185.zip |
Add option to include tags for shared items.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/lib/share/backend.php | 3 | ||||
-rw-r--r-- | tests/lib/tags.php | 24 |
2 files changed, 26 insertions, 1 deletions
diff --git a/tests/lib/share/backend.php b/tests/lib/share/backend.php index 50ce24e07b6..61b8f262a42 100644 --- a/tests/lib/share/backend.php +++ b/tests/lib/share/backend.php @@ -29,9 +29,10 @@ class Test_Share_Backend implements OCP\Share_Backend { private $testItem1 = 'test.txt'; private $testItem2 = 'share.txt'; + private $testId = 1; public function isValidSource($itemSource, $uidOwner) { - if ($itemSource == $this->testItem1 || $itemSource == $this->testItem2) { + if ($itemSource == $this->testItem1 || $itemSource == $this->testItem2 || $itemSource == 1) { return true; } } diff --git a/tests/lib/tags.php b/tests/lib/tags.php index 4d9b8558fd3..455b99120ab 100644 --- a/tests/lib/tags.php +++ b/tests/lib/tags.php @@ -195,4 +195,28 @@ class Test_Tags extends PHPUnit_Framework_TestCase { $this->assertEquals(array(), $tagger->getFavorites()); } + public function testShareTags() { + $test_tag = 'TestTag'; + OCP\Share::registerBackend('test', 'Test_Share_Backend'); + + $tagger = $this->tagMgr->load('test'); + $tagger->tagAs(1, $test_tag); + + $other_user = uniqid('user2_'); + OC_User::createUser($other_user, 'pass'); + + OC_User::setUserId($other_user); + $other_tagMgr = new OC\TagManager($this->tagMapper, $other_user); + $other_tagger = $other_tagMgr->load('test'); + $this->assertFalse($other_tagger->hasTag($test_tag)); + + OC_User::setUserId($this->user); + OCP\Share::shareItem('test', 1, OCP\Share::SHARE_TYPE_USER, $other_user, OCP\PERMISSION_READ); + + OC_User::setUserId($other_user); + $other_tagger = $other_tagMgr->load('test', array(), true); // Update tags, load shared ones. + $this->assertTrue($other_tagger->hasTag($test_tag)); + $this->assertContains(1, $other_tagger->getIdsForTag($test_tag)); + } + } |