diff options
author | Joas Schilling <nickvergessen@gmx.de> | 2015-02-09 15:12:34 +0300 |
---|---|---|
committer | Joas Schilling <nickvergessen@gmx.de> | 2015-02-09 18:27:44 +0300 |
commit | 63e5282c414882edcbb2e55e701d4e4c9e0ea6e5 (patch) | |
tree | ada4adea502f18a0499de0d25c670e4bbb0c2bb1 | |
parent | 0c3204c7a6d699f5135fb793686cd0495d729669 (diff) |
Add a test for the post_shared hook shareType
Conflicts:
tests/lib/share/share.php
-rw-r--r-- | tests/lib/share/share.php | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/tests/lib/share/share.php b/tests/lib/share/share.php index d2825f320ca..3d61de4e4a1 100644 --- a/tests/lib/share/share.php +++ b/tests/lib/share/share.php @@ -562,7 +562,9 @@ 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\PERMISSION_READ | OCP\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)); @@ -951,3 +953,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']; + } +} |