summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorRobin Appelman <icewind@owncloud.com>2013-10-09 20:34:18 +0200
committerRobin Appelman <icewind@owncloud.com>2013-10-09 20:34:18 +0200
commit38c563dcdcfc46742a55be3b9b84a37512e203d3 (patch)
tree46a0caa7dd62da1ddbc8baedd5121090fd7a723b /tests
parent3a3819b30392547d6d4250830275cec64f7a08d4 (diff)
downloadnextcloud-server-38c563dcdcfc46742a55be3b9b84a37512e203d3.tar.gz
nextcloud-server-38c563dcdcfc46742a55be3b9b84a37512e203d3.zip
don't trigger the create hooks when if the file already exists for file_put_contents
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 3043f132b73..a5107c351f4 100644
--- a/tests/lib/files/view.php
+++ b/tests/lib/files/view.php
@@ -391,4 +391,29 @@ class View extends \PHPUnit_Framework_TestCase {
$this->storages[] = $storage;
return $storage;
}
+
+ private $createHookPath;
+
+ function dummyCreateHook($params) {
+ $this->createHookPath = $params['path'];
+ }
+
+ 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);
+ }
}