diff options
author | Robin Appelman <icewind@owncloud.com> | 2015-10-12 17:11:16 +0200 |
---|---|---|
committer | Thomas Müller <thomas.mueller@tmit.eu> | 2015-10-16 21:41:51 +0200 |
commit | ef179331bbcb5acce487882d579753573d5bf84a (patch) | |
tree | 5f4259c18256730a89655397d0527b7ac309a6cb /tests/lib | |
parent | a87368acb9a2d43bc18fd03cc149e25bd6a79cdc (diff) | |
download | nextcloud-server-ef179331bbcb5acce487882d579753573d5bf84a.tar.gz nextcloud-server-ef179331bbcb5acce487882d579753573d5bf84a.zip |
Add tests for double cache rename
Diffstat (limited to 'tests/lib')
-rw-r--r-- | tests/lib/files/cache/updater.php | 18 |
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')); |