summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorVincent Petry <pvince81@owncloud.com>2015-01-27 17:05:38 +0100
committerVincent Petry <pvince81@owncloud.com>2015-01-27 17:05:38 +0100
commitacec40fe5aea032b9ee81116c721848d1d37355f (patch)
tree26fb4e56ec10fff43df1eef23f27881ce9a543da /tests
parent3478634df1ce2b7717bfe211425f59c4107688f8 (diff)
parent12867b9c788487aa67ebfb4f8ee1e9997877ee69 (diff)
downloadnextcloud-server-acec40fe5aea032b9ee81116c721848d1d37355f.tar.gz
nextcloud-server-acec40fe5aea032b9ee81116c721848d1d37355f.zip
Merge pull request #13561 from owncloud/trash-finaldeletewhencrossstoragefix
Call final unlink in trash wrapper's storage
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'));
+ }
}