diff options
author | Thomas Müller <thomas.mueller@tmit.eu> | 2016-02-23 15:02:08 +0100 |
---|---|---|
committer | Thomas Müller <thomas.mueller@tmit.eu> | 2016-02-23 15:02:08 +0100 |
commit | 9a0950f10bdef7a0bf3827d0fa3735ac57ccd797 (patch) | |
tree | d36344447029b3732e243d2a4ef2827e3c78dd15 /tests | |
parent | fae6643e6dd4bc308170e0ab45886f110f60a639 (diff) | |
parent | 3a65bdf4d59fe06919a064e3044cccc27aab5201 (diff) | |
download | nextcloud-server-9a0950f10bdef7a0bf3827d0fa3735ac57ccd797.tar.gz nextcloud-server-9a0950f10bdef7a0bf3827d0fa3735ac57ccd797.zip |
Merge pull request #22569 from owncloud/issue-22566-too-much-mapping-entries
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 */ |