diff options
Diffstat (limited to 'tests')
-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()); + } } |