summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorVincent Petry <pvince81@owncloud.com>2015-06-11 18:32:15 +0200
committerVincent Petry <pvince81@owncloud.com>2015-06-16 10:48:31 +0200
commit0e3a3dd5d7fd9d57a099f3720af20b6f9a22d63f (patch)
tree8d883b4ad6572a08abeda852d3e157fe153face7 /tests
parentb6165b68655fdf957d9b63ab982a5f8724fcc3de (diff)
downloadnextcloud-server-0e3a3dd5d7fd9d57a099f3720af20b6f9a22d63f.tar.gz
nextcloud-server-0e3a3dd5d7fd9d57a099f3720af20b6f9a22d63f.zip
Rethrow LockedException with full path
Because the path is converted to md5 from the original exception, rethrow the exception with the correct full path
Diffstat (limited to 'tests')
-rw-r--r--tests/lib/files/view.php39
1 files changed, 39 insertions, 0 deletions
diff --git a/tests/lib/files/view.php b/tests/lib/files/view.php
index 1050c36d292..63d136bc7a9 100644
--- a/tests/lib/files/view.php
+++ b/tests/lib/files/view.php
@@ -1169,4 +1169,43 @@ class View extends \Test\TestCase {
['', '/testuser/{folder}'],
];
}
+
+ public function pathRelativeToFilesProvider() {
+ return [
+ ['admin/files', ''],
+ ['admin/files/x', 'x'],
+ ['/admin/files', ''],
+ ['/admin/files/sub', 'sub'],
+ ['/admin/files/sub/', 'sub'],
+ ['/admin/files/sub/sub2', 'sub/sub2'],
+ ['//admin//files/sub//sub2', 'sub/sub2'],
+ ];
+ }
+
+ /**
+ * @dataProvider pathRelativeToFilesProvider
+ */
+ public function testGetPathRelativeToFiles($path, $expectedPath) {
+ $view = new \OC\Files\View();
+ $this->assertEquals($expectedPath, $view->getPathRelativeToFiles($path));
+ }
+
+ public function pathRelativeToFilesProviderExceptionCases() {
+ return [
+ [''],
+ ['x'],
+ ['files'],
+ ['/files'],
+ ['/admin/files_versions/abc'],
+ ];
+ }
+
+ /**
+ * @dataProvider pathRelativeToFilesProviderExceptionCases
+ * @expectedException \InvalidArgumentException
+ */
+ public function testGetPathRelativeToFilesWithInvalidArgument($path) {
+ $view = new \OC\Files\View();
+ $view->getPathRelativeToFiles($path);
+ }
}