summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorJoas Schilling <nickvergessen@owncloud.com>2016-02-22 15:19:09 +0100
committerJoas Schilling <nickvergessen@owncloud.com>2016-02-23 09:04:15 +0100
commitfb8b34bdd00f3ce15825becfb26eed73248581e2 (patch)
treeb603bffb19f9b0c9ad1ecf95f0e778a49afcab2a /tests
parent83d5080e78fa481db3855da8fcd75f624f8cac1c (diff)
downloadnextcloud-server-fb8b34bdd00f3ce15825becfb26eed73248581e2.tar.gz
nextcloud-server-fb8b34bdd00f3ce15825becfb26eed73248581e2.zip
Allow defining a limit and offset for getObjectIdsForTags
Diffstat (limited to 'tests')
-rw-r--r--tests/lib/systemtag/systemtagobjectmappertest.php36
1 files changed, 36 insertions, 0 deletions
diff --git a/tests/lib/systemtag/systemtagobjectmappertest.php b/tests/lib/systemtag/systemtagobjectmappertest.php
index 5c8204f6a87..f81445e5348 100644
--- a/tests/lib/systemtag/systemtagobjectmappertest.php
+++ b/tests/lib/systemtag/systemtagobjectmappertest.php
@@ -145,6 +145,42 @@ class SystemTagObjectMapperTest extends TestCase {
], $objectIds);
}
+ public function testGetObjectsForTagsLimit() {
+ $objectIds = $this->tagMapper->getObjectIdsForTags(
+ [$this->tag1->getId()],
+ 'testtype',
+ 1
+ );
+
+ $this->assertEquals([
+ 1,
+ ], $objectIds);
+ }
+
+ /**
+ * @expectedException \InvalidArgumentException
+ */
+ public function testGetObjectsForTagsLimitWithMultipleTags() {
+ $this->tagMapper->getObjectIdsForTags(
+ [$this->tag1->getId(), $this->tag2->getId(), $this->tag3->getId()],
+ 'testtype',
+ 1
+ );
+ }
+
+ public function testGetObjectsForTagsLimitOffset() {
+ $objectIds = $this->tagMapper->getObjectIdsForTags(
+ [$this->tag1->getId()],
+ 'testtype',
+ 1,
+ '1'
+ );
+
+ $this->assertEquals([
+ 2,
+ ], $objectIds);
+ }
+
/**
* @expectedException \OCP\SystemTag\TagNotFoundException
*/