summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorRobin Appelman <icewind@owncloud.com>2015-01-26 17:48:09 +0100
committerRobin Appelman <icewind@owncloud.com>2015-01-29 12:47:11 +0100
commitddee63fa00e13e1830aa4b6113d30f24b3b34535 (patch)
treede267f32a116155e42836aaa889b8911a849d60a /tests
parent099d43b1f9300f508c1899d376ae5aef459894bb (diff)
downloadnextcloud-server-ddee63fa00e13e1830aa4b6113d30f24b3b34535.tar.gz
nextcloud-server-ddee63fa00e13e1830aa4b6113d30f24b3b34535.zip
Fix resolving paths for views rooted in a file
Diffstat (limited to 'tests')
-rw-r--r--tests/lib/files/view.php16
1 files changed, 16 insertions, 0 deletions
diff --git a/tests/lib/files/view.php b/tests/lib/files/view.php
index 158c964fd0d..5e42e5ffd0f 100644
--- a/tests/lib/files/view.php
+++ b/tests/lib/files/view.php
@@ -729,6 +729,22 @@ class View extends \Test\TestCase {
);
}
+ public function testFileView() {
+ $storage = new Temporary(array());
+ $scanner = $storage->getScanner();
+ $storage->file_put_contents('foo.txt', 'bar');
+ \OC\Files\Filesystem::mount($storage, array(), '/test/');
+ $scanner->scan('');
+ $view = new \OC\Files\View('/test/foo.txt');
+
+ $this->assertEquals('bar', $view->file_get_contents(''));
+ $fh = tmpfile();
+ fwrite($fh, 'foo');
+ rewind($fh);
+ $view->file_put_contents('', $fh);
+ $this->assertEquals('foo', $view->file_get_contents(''));
+ }
+
/**
* @dataProvider tooLongPathDataProvider
* @expectedException \OCP\Files\InvalidPathException