diff options
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)); + } + } |