aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorRobin Appelman <robin@icewind.nl>2017-07-12 15:49:36 +0200
committerRobin Appelman <robin@icewind.nl>2017-07-13 13:08:24 +0200
commit069df4c8cb39b938d77eae380f63baa45c2bc9ee (patch)
treea44b0d32bca5df6422eb5ddce0679f5430abb690 /tests
parent95e17a8245c39cda0971b747c1174581593142a5 (diff)
downloadnextcloud-server-069df4c8cb39b938d77eae380f63baa45c2bc9ee.tar.gz
nextcloud-server-069df4c8cb39b938d77eae380f63baa45c2bc9ee.zip
chunk getting invalid paths and reuse queries
Signed-off-by: Robin Appelman <robin@icewind.nl>
Diffstat (limited to 'tests')
-rw-r--r--tests/lib/Repair/RepairInvalidPathsTest.php38
1 files changed, 38 insertions, 0 deletions
diff --git a/tests/lib/Repair/RepairInvalidPathsTest.php b/tests/lib/Repair/RepairInvalidPathsTest.php
index b18758585c1..fe848b62073 100644
--- a/tests/lib/Repair/RepairInvalidPathsTest.php
+++ b/tests/lib/Repair/RepairInvalidPathsTest.php
@@ -114,4 +114,42 @@ class RepairInvalidPathsTest extends TestCase {
$this->assertEquals($this->cache->getId('foo2/bar'), $this->cache->get('foo2/bar/asd')['parent']);
$this->assertEquals($this->cache->getId('foo2/bar/asd'), $this->cache->get('foo2/bar/asd/foo')['parent']);
}
+
+ public function testRepairMultipleNonDuplicate() {
+ $this->storage->mkdir('foo/bar/asd');
+ $this->storage->mkdir('foo/bar2/asd');
+ $this->storage->mkdir('foo2');
+ $this->storage->getScanner()->scan('');
+
+ $folderId1 = $this->cache->getId('foo/bar');
+ $folderId2 = $this->cache->getId('foo/bar2');
+ $newParentFolderId = $this->cache->getId('foo2');
+ // failed rename, moved entry is updated but not it's children
+ $this->cache->update($folderId1, ['path' => 'foo2/bar', 'parent' => $newParentFolderId]);
+ $this->cache->update($folderId2, ['path' => 'foo2/bar2', 'parent' => $newParentFolderId]);
+
+ $this->assertTrue($this->cache->inCache('foo2/bar'));
+ $this->assertTrue($this->cache->inCache('foo2/bar2'));
+ $this->assertTrue($this->cache->inCache('foo/bar/asd'));
+ $this->assertTrue($this->cache->inCache('foo/bar2/asd'));
+ $this->assertFalse($this->cache->inCache('foo2/bar/asd'));
+ $this->assertFalse($this->cache->inCache('foo2/bar2/asd'));
+
+ $this->assertEquals($folderId1, $this->cache->get('foo/bar/asd')['parent']);
+ $this->assertEquals($folderId2, $this->cache->get('foo/bar2/asd')['parent']);
+
+ $this->repair->run($this->createMock(IOutput::class));
+
+ $this->assertTrue($this->cache->inCache('foo2/bar'));
+ $this->assertTrue($this->cache->inCache('foo2/bar2'));
+ $this->assertTrue($this->cache->inCache('foo2/bar/asd'));
+ $this->assertTrue($this->cache->inCache('foo2/bar2/asd'));
+ $this->assertFalse($this->cache->inCache('foo/bar/asd'));
+ $this->assertFalse($this->cache->inCache('foo/bar2/asd'));
+
+ $this->assertEquals($folderId1, $this->cache->get('foo2/bar/asd')['parent']);
+ $this->assertEquals($folderId2, $this->cache->get('foo2/bar2/asd')['parent']);
+ $this->assertEquals($folderId1, $this->cache->getId('foo2/bar'));
+ $this->assertEquals($folderId2, $this->cache->getId('foo2/bar2'));
+ }
}