diff options
author | Joas Schilling <nickvergessen@gmx.de> | 2015-02-09 13:12:34 +0100 |
---|---|---|
committer | Joas Schilling <nickvergessen@gmx.de> | 2015-02-09 13:12:34 +0100 |
commit | c17b236c1967bbefe7b4873e8d0dcaa77bd132f2 (patch) | |
tree | 101f8e40eb041d62ccce3907548691e6be0a9299 /tests | |
parent | 31b93ac19a2ce3a957ee2f3cac03dc0590261f08 (diff) | |
download | nextcloud-server-c17b236c1967bbefe7b4873e8d0dcaa77bd132f2.tar.gz nextcloud-server-c17b236c1967bbefe7b4873e8d0dcaa77bd132f2.zip |
Add a test for the post_shared hook shareType
Diffstat (limited to 'tests')
-rw-r--r-- | tests/lib/share/share.php | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/tests/lib/share/share.php b/tests/lib/share/share.php index 6a50dd1f962..1ef62dc2b07 100644 --- a/tests/lib/share/share.php +++ b/tests/lib/share/share.php @@ -586,7 +586,10 @@ class Test_Share extends \Test\TestCase { // Attempt user specific target conflict OC_User::setUserId($this->user3); + \OCP\Util::connectHook('OCP\\Share', 'post_shared', 'DummyHookListener', 'listen'); + $this->assertTrue(OCP\Share::shareItem('test', 'share.txt', OCP\Share::SHARE_TYPE_GROUP, $this->group1, \OCP\Constants::PERMISSION_READ | \OCP\Constants::PERMISSION_SHARE)); + $this->assertEquals(OCP\Share::SHARE_TYPE_GROUP, DummyHookListener::$shareType); OC_User::setUserId($this->user2); $to_test = OCP\Share::getItemsSharedWith('test', Test_Share_Backend::FORMAT_TARGET); $this->assertEquals(2, count($to_test)); @@ -1055,3 +1058,11 @@ class DummyShareClass extends \OC\Share\Share { return parent::groupItems($items, 'test'); } } + +class DummyHookListener { + static $shareType = null; + + public static function listen($params) { + self::$shareType = $params['shareType']; + } +} |