diff options
author | Joas Schilling <nickvergessen@owncloud.com> | 2016-02-22 15:19:09 +0100 |
---|---|---|
committer | Joas Schilling <nickvergessen@owncloud.com> | 2016-02-23 09:04:15 +0100 |
commit | fb8b34bdd00f3ce15825becfb26eed73248581e2 (patch) | |
tree | b603bffb19f9b0c9ad1ecf95f0e778a49afcab2a /tests | |
parent | 83d5080e78fa481db3855da8fcd75f624f8cac1c (diff) | |
download | nextcloud-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.php | 36 |
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 */ |