diff options
author | Vincent Petry <pvince81@owncloud.com> | 2015-06-16 16:47:10 +0200 |
---|---|---|
committer | Vincent Petry <pvince81@owncloud.com> | 2015-06-16 16:47:10 +0200 |
commit | e5d34a273353e651c6609fffe9804a4755d3e80d (patch) | |
tree | 01f08b3a8152c56a85163cfaa1a869f359b296e6 /tests/lib | |
parent | 829f6474ff4cd4e39647bcb5b68b5e5c0fb1b483 (diff) | |
parent | 0e3a3dd5d7fd9d57a099f3720af20b6f9a22d63f (diff) | |
download | nextcloud-server-e5d34a273353e651c6609fffe9804a4755d3e80d.tar.gz nextcloud-server-e5d34a273353e651c6609fffe9804a4755d3e80d.zip |
Merge pull request #16892 from owncloud/lock-returnfullpath
Rethrow LockedException with full path
Diffstat (limited to 'tests/lib')
-rw-r--r-- | tests/lib/files/view.php | 39 |
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); + } } |