diff options
author | Robin Appelman <robin@icewind.nl> | 2017-07-12 15:49:36 +0200 |
---|---|---|
committer | Morris Jobke <hey@morrisjobke.de> | 2017-07-13 16:37:38 +0200 |
commit | 350e036c56d1ddd60e8a8d6d8822dbf8979f8719 (patch) | |
tree | 6b6a9180d6cc0a639b3f0a73a8619b4b0206c25d /tests | |
parent | 4a727a578ca1a75bfb85167d6a1b3fa3bbdf3a3e (diff) | |
download | nextcloud-server-350e036c56d1ddd60e8a8d6d8822dbf8979f8719.tar.gz nextcloud-server-350e036c56d1ddd60e8a8d6d8822dbf8979f8719.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.php | 38 |
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')); + } } |