From 0e3a3dd5d7fd9d57a099f3720af20b6f9a22d63f Mon Sep 17 00:00:00 2001 From: Vincent Petry Date: Thu, 11 Jun 2015 18:32:15 +0200 Subject: Rethrow LockedException with full path Because the path is converted to md5 from the original exception, rethrow the exception with the correct full path --- tests/lib/files/view.php | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) (limited to 'tests') 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); + } } -- cgit v1.2.3