diff options
author | Joas Schilling <nickvergessen@gmx.de> | 2014-12-09 13:27:38 +0100 |
---|---|---|
committer | Joas Schilling <nickvergessen@gmx.de> | 2014-12-09 13:27:38 +0100 |
commit | f53f25eafe2e7cad28eabccd7ca5acebab488170 (patch) | |
tree | 0edc65f4e4fb156aefb6807e559b1e2d00b91e93 /tests | |
parent | 1a16238d5d2a9579e02687e7e76acd1737039de8 (diff) | |
parent | cae600722ed04e69c376aa0a1ef1955c93d18ddf (diff) | |
download | nextcloud-server-f53f25eafe2e7cad28eabccd7ca5acebab488170.tar.gz nextcloud-server-f53f25eafe2e7cad28eabccd7ca5acebab488170.zip |
Merge pull request #12409 from owncloud/tags-getTagsForObjectIds
Add getTagsForObjects in ITags
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 533e6a19add..78f5085df39 100644 --- a/tests/lib/tags.php +++ b/tests/lib/tags.php @@ -136,6 +136,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); |