summaryrefslogtreecommitdiffstats
path: root/tests/lib
diff options
context:
space:
mode:
authorVincent Petry <pvince81@owncloud.com>2015-05-21 10:57:58 +0200
committerVincent Petry <pvince81@owncloud.com>2015-05-21 10:57:58 +0200
commit22968e806c9e71355875bc1e44908110c3960f79 (patch)
tree81841e5c5121e1eccc3db41c1909a252470715f4 /tests/lib
parent39d1e99228a22e232795b9800503697b866f5023 (diff)
downloadnextcloud-server-22968e806c9e71355875bc1e44908110c3960f79.tar.gz
nextcloud-server-22968e806c9e71355875bc1e44908110c3960f79.zip
Get correct mimetype when moving and changing extension
Fixes issue when restoring folders from trash cross-storage, as such folders have an extension ".d12345678". Fixes issue when moving folders between storages and at the same time changing their extension.
Diffstat (limited to 'tests/lib')
-rw-r--r--tests/lib/files/cache/updater.php26
1 files changed, 19 insertions, 7 deletions
diff --git a/tests/lib/files/cache/updater.php b/tests/lib/files/cache/updater.php
index 726ee360479..ea75c8dcd72 100644
--- a/tests/lib/files/cache/updater.php
+++ b/tests/lib/files/cache/updater.php
@@ -216,27 +216,38 @@ class Updater extends \Test\TestCase {
$this->storage->getScanner()->scan('');
+ $this->assertTrue($this->cache->inCache('foo'));
$this->assertTrue($this->cache->inCache('foo/foo.txt'));
$this->assertTrue($this->cache->inCache('foo/bar.txt'));
+ $this->assertTrue($this->cache->inCache('foo/bar'));
$this->assertTrue($this->cache->inCache('foo/bar/bar.txt'));
$cached = [];
+ $cached[] = $this->cache->get('foo');
$cached[] = $this->cache->get('foo/foo.txt');
$cached[] = $this->cache->get('foo/bar.txt');
+ $cached[] = $this->cache->get('foo/bar');
$cached[] = $this->cache->get('foo/bar/bar.txt');
- $this->view->rename('/foo', '/bar/foo');
+ // add extension to trigger the possible mimetype change
+ $this->view->rename('/foo', '/bar/foo.b');
+ $this->assertFalse($this->cache->inCache('foo'));
$this->assertFalse($this->cache->inCache('foo/foo.txt'));
$this->assertFalse($this->cache->inCache('foo/bar.txt'));
+ $this->assertFalse($this->cache->inCache('foo/bar'));
$this->assertFalse($this->cache->inCache('foo/bar/bar.txt'));
- $this->assertTrue($cache2->inCache('foo/foo.txt'));
- $this->assertTrue($cache2->inCache('foo/bar.txt'));
- $this->assertTrue($cache2->inCache('foo/bar/bar.txt'));
+ $this->assertTrue($cache2->inCache('foo.b'));
+ $this->assertTrue($cache2->inCache('foo.b/foo.txt'));
+ $this->assertTrue($cache2->inCache('foo.b/bar.txt'));
+ $this->assertTrue($cache2->inCache('foo.b/bar'));
+ $this->assertTrue($cache2->inCache('foo.b/bar/bar.txt'));
$cachedTarget = [];
- $cachedTarget[] = $cache2->get('foo/foo.txt');
- $cachedTarget[] = $cache2->get('foo/bar.txt');
- $cachedTarget[] = $cache2->get('foo/bar/bar.txt');
+ $cachedTarget[] = $cache2->get('foo.b');
+ $cachedTarget[] = $cache2->get('foo.b/foo.txt');
+ $cachedTarget[] = $cache2->get('foo.b/bar.txt');
+ $cachedTarget[] = $cache2->get('foo.b/bar');
+ $cachedTarget[] = $cache2->get('foo.b/bar/bar.txt');
foreach ($cached as $i => $old) {
$new = $cachedTarget[$i];
@@ -244,6 +255,7 @@ class Updater extends \Test\TestCase {
$this->assertEquals($old['size'], $new['size']);
$this->assertEquals($old['etag'], $new['etag']);
$this->assertEquals($old['fileid'], $new['fileid']);
+ $this->assertEquals($old['mimetype'], $new['mimetype']);
}
}
}