diff options
author | Thomas Müller <thomas.mueller@tmit.eu> | 2015-06-22 11:29:11 +0200 |
---|---|---|
committer | Thomas Müller <thomas.mueller@tmit.eu> | 2015-06-22 11:29:11 +0200 |
commit | ced15c44b41d3fbaf506d28c506e2db75e57b774 (patch) | |
tree | 2f63c9a4c57f5ffbc77d8419e0141cf3ef54e7b1 /tests/lib/files/view.php | |
parent | 7fe5ab4d4a43efb0384e59012fa1934acae7d6dc (diff) | |
parent | 567df226e50d372374fa15297c457c7fb2ba3306 (diff) | |
download | nextcloud-server-ced15c44b41d3fbaf506d28c506e2db75e57b774.tar.gz nextcloud-server-ced15c44b41d3fbaf506d28c506e2db75e57b774.zip |
Merge pull request #16657 from owncloud/view-emit-path
emit hooks from a view as long as the path is inside the default root
Diffstat (limited to 'tests/lib/files/view.php')
-rw-r--r-- | tests/lib/files/view.php | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/tests/lib/files/view.php b/tests/lib/files/view.php index dcdebfd9bce..9862026495f 100644 --- a/tests/lib/files/view.php +++ b/tests/lib/files/view.php @@ -1230,4 +1230,33 @@ class View extends \Test\TestCase { $this->assertFalse($this->isFileLocked($view, '/test//sub', ILockingProvider::LOCK_EXCLUSIVE)); } + + 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); + } } |