summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorRobin Appelman <icewind@owncloud.com>2013-10-10 11:34:30 +0200
committerRobin Appelman <icewind@owncloud.com>2013-10-10 11:34:30 +0200
commit1378af838ced159f1070f869394dccbde8c21219 (patch)
tree7c6b43f7900000a2400a6ad2368f3f54d7075cc7 /tests
parent7f8eeb04747e88770a9eb49dffa028a36ab6cadc (diff)
parent1cb47bf777bea9f46a9554ea1b570bfc9ec69845 (diff)
downloadnextcloud-server-1378af838ced159f1070f869394dccbde8c21219.tar.gz
nextcloud-server-1378af838ced159f1070f869394dccbde8c21219.zip
merge master into hooks-view-same-start
Diffstat (limited to 'tests')
-rw-r--r--tests/lib/files/view.php25
1 files changed, 25 insertions, 0 deletions
diff --git a/tests/lib/files/view.php b/tests/lib/files/view.php
index e2107a03614..b2dd3963f1c 100644
--- a/tests/lib/files/view.php
+++ b/tests/lib/files/view.php
@@ -392,6 +392,12 @@ class View extends \PHPUnit_Framework_TestCase {
return $storage;
}
+ private $createHookPath;
+
+ function dummyCreateHook($params) {
+ $this->createHookPath = $params['path'];
+ }
+
/**
* @medium
*/
@@ -409,4 +415,23 @@ class View extends \PHPUnit_Framework_TestCase {
$subView->file_put_contents('/foo.txt', 'asd');
$this->assertNull($this->hookPath);
}
+
+ public function testEditNoCreateHook() {
+ $storage1 = $this->getTestStorage();
+ $storage2 = $this->getTestStorage();
+ $defaultRoot = \OC\Files\Filesystem::getRoot();
+ \OC\Files\Filesystem::mount($storage1, array(), '/');
+ \OC\Files\Filesystem::mount($storage2, array(), $defaultRoot);
+ \OC_Hook::connect('OC_Filesystem', 'post_create', $this, 'dummyCreateHook');
+
+ $view = new \OC\Files\View($defaultRoot);
+ $this->hookPath = null;
+
+ $view->file_put_contents('/asd.txt', 'foo');
+ $this->assertEquals('/asd.txt', $this->createHookPath);
+ $this->createHookPath = null;
+
+ $view->file_put_contents('/asd.txt', 'foo');
+ $this->assertNull($this->createHookPath);
+ }
}