Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorRobin Appelman <icewind@owncloud.com>2015-06-01 15:08:14 +0300
committerRobin Appelman <icewind@owncloud.com>2015-06-29 15:13:19 +0300
commit4e85a426a4af6f64292abf315aad8fc7a12b0cee (patch)
tree6db3640745f6f6a5a7894e3f40a047dbb624e61a /tests
parent8a1cfa4229d0d77fa863dca64d4a434c7c03f806 (diff)
emit hooks from a view as long as the path is inside the default root
Diffstat (limited to 'tests')
-rw-r--r--tests/lib/files/view.php29
1 files changed, 29 insertions, 0 deletions
diff --git a/tests/lib/files/view.php b/tests/lib/files/view.php
index f064eaaa7fd..c595afb5022 100644
--- a/tests/lib/files/view.php
+++ b/tests/lib/files/view.php
@@ -1050,4 +1050,33 @@ class View extends \Test\TestCase {
public function testNullAsRoot() {
new \OC\Files\View(null);
}
+
+ public function hookPathProvider() {
+ return [
+ ['/foo/files', '/foo', true],
+ ['/foo/files/bar', '/foo', true],
+ ['/foo', '/foo', false],
+ ['/foo', '/files/foo', true],
+ ['/foo', 'filesfoo', false]
+ ];
+ }
+
+ /**
+ * @dataProvider hookPathProvider
+ * @param $root
+ * @param $path
+ * @param $shouldEmit
+ */
+ public function testHookPaths($root, $path, $shouldEmit) {
+ $filesystemReflection = new \ReflectionClass('\OC\Files\Filesystem');
+ $defaultRootValue = $filesystemReflection->getProperty('defaultInstance');
+ $defaultRootValue->setAccessible(true);
+ $oldRoot = $defaultRootValue->getValue();
+ $defaultView = new \OC\Files\View('/foo/files');
+ $defaultRootValue->setValue($defaultView);
+ $view = new \OC\Files\View($root);
+ $result = \Test_Helper::invokePrivate($view, 'shouldEmitHooks', [$path]);
+ $defaultRootValue->setValue($oldRoot);
+ $this->assertEquals($shouldEmit, $result);
+ }
}