summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorCôme Chilliet <come.chilliet@nextcloud.com>2023-03-03 10:35:50 +0100
committerCôme Chilliet <come.chilliet@nextcloud.com>2023-03-14 14:25:05 +0100
commite7c6ff17094e2a810040385f56f51875541aa256 (patch)
treea7a0f7304391911aec606065957ac293c082a61a /tests
parentee38128f3d1454fd95333e4eed782949c4ae1dcd (diff)
downloadnextcloud-server-e7c6ff17094e2a810040385f56f51875541aa256.tar.gz
nextcloud-server-e7c6ff17094e2a810040385f56f51875541aa256.zip
Add chunking in SystemTagObjectMapper::getTagIdsForObjects
This avoids crashing on Oracle with more than 1000 objects Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/lib/SystemTag/SystemTagObjectMapperTest.php21
1 files changed, 16 insertions, 5 deletions
diff --git a/tests/lib/SystemTag/SystemTagObjectMapperTest.php b/tests/lib/SystemTag/SystemTagObjectMapperTest.php
index c988db69c30..e77709c781f 100644
--- a/tests/lib/SystemTag/SystemTagObjectMapperTest.php
+++ b/tests/lib/SystemTag/SystemTagObjectMapperTest.php
@@ -141,6 +141,17 @@ class SystemTagObjectMapperTest extends TestCase {
$this->assertEquals([], $tagIdMapping);
}
+ public function testGetTagIdsForALotOfObjects() {
+ $ids = range(1, 10500);
+ $tagIdMapping = $this->tagMapper->getTagIdsForObjects(
+ $ids,
+ 'testtype'
+ );
+
+ $this->assertEquals(10500, count($tagIdMapping));
+ $this->assertEquals([$this->tag1->getId(), $this->tag2->getId()], $tagIdMapping[1]);
+ }
+
public function testGetObjectsForTags() {
$objectIds = $this->tagMapper->getObjectIdsForTags(
[$this->tag1->getId(), $this->tag2->getId(), $this->tag3->getId()],
@@ -165,7 +176,7 @@ class SystemTagObjectMapperTest extends TestCase {
], $objectIds);
}
-
+
public function testGetObjectsForTagsLimitWithMultipleTags() {
$this->expectException(\InvalidArgumentException::class);
@@ -189,7 +200,7 @@ class SystemTagObjectMapperTest extends TestCase {
], $objectIds);
}
-
+
public function testGetObjectsForNonExistingTag() {
$this->expectException(\OCP\SystemTag\TagNotFoundException::class);
@@ -227,7 +238,7 @@ class SystemTagObjectMapperTest extends TestCase {
$this->assertTrue(true, 'No error when reassigning/unassigning');
}
-
+
public function testAssignNonExistingTags() {
$this->expectException(\OCP\SystemTag\TagNotFoundException::class);
@@ -254,7 +265,7 @@ class SystemTagObjectMapperTest extends TestCase {
], $tagIdMapping, 'None of the tags got assigned');
}
-
+
public function testUnassignNonExistingTags() {
$this->expectException(\OCP\SystemTag\TagNotFoundException::class);
@@ -385,7 +396,7 @@ class SystemTagObjectMapperTest extends TestCase {
);
}
-
+
public function testHaveTagNonExisting() {
$this->expectException(\OCP\SystemTag\TagNotFoundException::class);