From 069df4c8cb39b938d77eae380f63baa45c2bc9ee Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Wed, 12 Jul 2017 15:49:36 +0200 Subject: chunk getting invalid paths and reuse queries Signed-off-by: Robin Appelman --- tests/lib/Repair/RepairInvalidPathsTest.php | 38 +++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) (limited to 'tests') 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')); + } } -- cgit v1.2.3