summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorRobin Appelman <icewind@owncloud.com>2015-01-23 15:11:27 +0100
committerRobin Appelman <icewind@owncloud.com>2015-01-23 15:11:27 +0100
commit87a1b2bdc41b6a54665ded5b5ffdb9b57325177d (patch)
tree3d2dee78c8d8f58acf5c1f4c4ff3b66aab347f37 /tests
parent2e8c70327a7d3780ee5887b172159dc0f4c76c44 (diff)
downloadnextcloud-server-87a1b2bdc41b6a54665ded5b5ffdb9b57325177d.tar.gz
nextcloud-server-87a1b2bdc41b6a54665ded5b5ffdb9b57325177d.zip
Preserve mtime when doing cross storage move
Diffstat (limited to 'tests')
-rw-r--r--tests/lib/files/view.php29
1 files changed, 28 insertions, 1 deletions
diff --git a/tests/lib/files/view.php b/tests/lib/files/view.php
index 3ff19d7385d..158c964fd0d 100644
--- a/tests/lib/files/view.php
+++ b/tests/lib/files/view.php
@@ -613,7 +613,7 @@ class View extends \Test\TestCase {
if (\OC_Util::runningOnWindows()) {
$this->markTestSkipped('[Windows] ');
$depth = ((260 - $tmpdirLength) / 57);
- }elseif(\OC_Util::runningOnMac()){
+ } elseif (\OC_Util::runningOnMac()) {
$depth = ((1024 - $tmpdirLength) / 57);
} else {
$depth = ((4000 - $tmpdirLength) / 57);
@@ -806,4 +806,31 @@ class View extends \Test\TestCase {
array('putFileInfo', array()),
);
}
+
+ public function testRenameCrossStoragePreserveMtime() {
+ $storage1 = new Temporary(array());
+ $storage2 = new Temporary(array());
+ $scanner1 = $storage1->getScanner();
+ $scanner2 = $storage2->getScanner();
+ $storage1->mkdir('sub');
+ $storage1->mkdir('foo');
+ $storage1->file_put_contents('foo.txt', 'asd');
+ $storage1->file_put_contents('foo/bar.txt', 'asd');
+ \OC\Files\Filesystem::mount($storage1, array(), '/test/');
+ \OC\Files\Filesystem::mount($storage2, array(), '/test/sub/storage');
+
+ $view = new \OC\Files\View('');
+ $time = time() - 200;
+ $view->touch('/test/foo.txt', $time);
+ $view->touch('/test/foo', $time);
+ $view->touch('/test/foo/bar.txt', $time);
+
+ $view->rename('/test/foo.txt', '/test/sub/storage/foo.txt');
+
+ $this->assertEquals($time, $view->filemtime('/test/sub/storage/foo.txt'));
+
+ $view->rename('/test/foo', '/test/sub/storage/foo');
+
+ $this->assertEquals($time, $view->filemtime('/test/sub/storage/foo/bar.txt'));
+ }
}