diff options
author | Vincent Petry <pvince81@owncloud.com> | 2014-11-24 21:51:45 +0100 |
---|---|---|
committer | Vincent Petry <pvince81@owncloud.com> | 2014-12-08 22:02:00 +0100 |
commit | cae600722ed04e69c376aa0a1ef1955c93d18ddf (patch) | |
tree | 862693a24e5d6b883bf15c0b24327f2a6a086d0e /tests | |
parent | 6fb2477fb75d4c982a1568e2392d17fd7cc2fd4b (diff) | |
download | nextcloud-server-cae600722ed04e69c376aa0a1ef1955c93d18ddf.tar.gz nextcloud-server-cae600722ed04e69c376aa0a1ef1955c93d18ddf.zip |
Add getTagsForObjects in ITags
Returns the list of tags that are set on the given object ids.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/lib/tags.php | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/tests/lib/tags.php b/tests/lib/tags.php index ab714bde3df..e7bb4db29e6 100644 --- a/tests/lib/tags.php +++ b/tests/lib/tags.php @@ -132,6 +132,36 @@ class Test_Tags extends \Test\TestCase { $this->assertFalse($tagger->isEmpty()); } + public function testGetTagsForObjects() { + $defaultTags = array('Friends', 'Family', 'Work', 'Other'); + $tagger = $this->tagMgr->load($this->objectType, $defaultTags); + + $tagger->tagAs(1, 'Friends'); + $tagger->tagAs(1, 'Other'); + $tagger->tagAs(2, 'Family'); + + $tags = $tagger->getTagsForObjects(array(1)); + $this->assertEquals(1, count($tags)); + $tags = current($tags); + sort($tags); + $this->assertSame(array('Friends', 'Other'), $tags); + + $tags = $tagger->getTagsForObjects(array(1, 2)); + $this->assertEquals(2, count($tags)); + $tags1 = $tags[1]; + sort($tags1); + $this->assertSame(array('Friends', 'Other'), $tags1); + $this->assertSame(array('Family'), $tags[2]); + $this->assertEquals( + array(), + $tagger->getTagsForObjects(array(4)) + ); + $this->assertEquals( + array(), + $tagger->getTagsForObjects(array(4, 5)) + ); + } + public function testdeleteTags() { $defaultTags = array('Friends', 'Family', 'Work', 'Other'); $tagger = $this->tagMgr->load($this->objectType, $defaultTags); |