Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorRobin Appelman <icewind@owncloud.com>2015-10-12 18:11:16 +0300
committerThomas Müller <thomas.mueller@tmit.eu>2015-10-16 22:41:51 +0300
commitef179331bbcb5acce487882d579753573d5bf84a (patch)
tree5f4259c18256730a89655397d0527b7ac309a6cb /tests
parenta87368acb9a2d43bc18fd03cc149e25bd6a79cdc (diff)
Add tests for double cache rename
Diffstat (limited to 'tests')
-rw-r--r--tests/lib/files/cache/updater.php18
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/lib/files/cache/updater.php b/tests/lib/files/cache/updater.php
index ea75c8dcd72..e3fa26829b4 100644
--- a/tests/lib/files/cache/updater.php
+++ b/tests/lib/files/cache/updater.php
@@ -143,6 +143,24 @@ class Updater extends \Test\TestCase {
$this->assertEquals($cached['fileid'], $cachedTarget['fileid']);
}
+ public function testMoveNonExistingOverwrite() {
+ $this->storage->file_put_contents('bar.txt', 'qwerty');
+ $this->updater->update('bar.txt');
+
+ $cached = $this->cache->get('bar.txt');
+
+ $this->updater->rename('foo.txt', 'bar.txt');
+
+ $this->assertFalse($this->cache->inCache('foo.txt'));
+ $this->assertTrue($this->cache->inCache('bar.txt'));
+
+ $cachedTarget = $this->cache->get('bar.txt');
+ $this->assertEquals($cached['etag'], $cachedTarget['etag']);
+ $this->assertEquals($cached['mtime'], $cachedTarget['mtime']);
+ $this->assertEquals($cached['size'], $cachedTarget['size']);
+ $this->assertEquals($cached['fileid'], $cachedTarget['fileid']);
+ }
+
public function testNewFileDisabled() {
$this->storage->file_put_contents('foo.txt', 'bar');
$this->assertFalse($this->cache->inCache('foo.txt'));