summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/lib/tags.php30
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);