[Pkg-owncloud-commits] [owncloud] 04/95: Add a test for the post_shared hook shareType

David Prévot taffit at moszumanska.debian.org
Wed Mar 11 15:49:43 UTC 2015


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to annotated tag v8.0.1
in repository owncloud.

commit 46186dc896a315379b32612efeae456b049a4339
Author: Joas Schilling <nickvergessen at gmx.de>
Date:   Mon Feb 9 13:12:34 2015 +0100

    Add a test for the post_shared hook shareType
---
 tests/lib/share/share.php | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/tests/lib/share/share.php b/tests/lib/share/share.php
index 6a50dd1..1ef62dc 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'];
+	}
+}

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/owncloud.git



More information about the Pkg-owncloud-commits mailing list