diff options
author | Robin Appelman <icewind@owncloud.com> | 2015-12-02 13:19:19 +0100 |
---|---|---|
committer | Robin Appelman <icewind@owncloud.com> | 2015-12-02 13:51:26 +0100 |
commit | 0062888aafcad14d574787d985cf6780356137cc (patch) | |
tree | 560886b8d02928334dcaa349684f757da73ee4b6 /tests/lib/files | |
parent | 8d218bf3ef842d76c2b97a175b28e13054497952 (diff) | |
download | nextcloud-server-0062888aafcad14d574787d985cf6780356137cc.tar.gz nextcloud-server-0062888aafcad14d574787d985cf6780356137cc.zip |
Also add metadata for postDelete hooks triggered from the view
Diffstat (limited to 'tests/lib/files')
-rw-r--r-- | tests/lib/files/node/hookconnector.php | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/tests/lib/files/node/hookconnector.php b/tests/lib/files/node/hookconnector.php index 646e3952a38..e2a5e190687 100644 --- a/tests/lib/files/node/hookconnector.php +++ b/tests/lib/files/node/hookconnector.php @@ -21,7 +21,7 @@ use Test\Traits\UserTrait; * Class HookConnector * * @group DB - * + * * @package Test\Files\Node */ class HookConnector extends TestCase { @@ -180,4 +180,24 @@ class HookConnector extends TestCase { $this->assertEquals('/' . $this->userId . '/files/source', $hookSourceNode->getPath()); $this->assertEquals('/' . $this->userId . '/files/target', $hookTargetNode->getPath()); } + + public function testPostDeleteMeta() { + $connector = new \OC\Files\Node\HookConnector($this->root, $this->view); + $connector->viewToNode(); + $hookCalled = false; + /** @var Node $hookNode */ + $hookNode = null; + + $this->root->listen('\OC\Files', 'postDelete', function ($node) use (&$hookNode, &$hookCalled) { + $hookCalled = true; + $hookNode = $node; + }); + + Filesystem::file_put_contents('test.txt', 'asd'); + $info = Filesystem::getFileInfo('test.txt'); + Filesystem::unlink('test.txt'); + + $this->assertTrue($hookCalled); + $this->assertEquals($hookNode->getId(), $info->getId()); + } } |