summaryrefslogtreecommitdiffstats
path: root/tests/lib/share
diff options
context:
space:
mode:
authorJoas Schilling <nickvergessen@owncloud.com>2015-06-18 12:46:52 +0200
committerJoas Schilling <nickvergessen@owncloud.com>2015-06-22 15:34:06 +0200
commit738b78f1b0eec61f4a55dd356d6b6a541ff56246 (patch)
treecba20da65582db0e389c2b7017c4ffd0a49ff7f5 /tests/lib/share
parent2b7e5f841a016e8682d560643dce4797758a44c3 (diff)
downloadnextcloud-server-738b78f1b0eec61f4a55dd356d6b6a541ff56246.tar.gz
nextcloud-server-738b78f1b0eec61f4a55dd356d6b6a541ff56246.zip
Use \OC\HintException and translate the hint
Diffstat (limited to 'tests/lib/share')
-rw-r--r--tests/lib/share/helper.php2
-rw-r--r--tests/lib/share/share.php29
2 files changed, 30 insertions, 1 deletions
diff --git a/tests/lib/share/helper.php b/tests/lib/share/helper.php
index c91d0bdde30..e37a3db8bf0 100644
--- a/tests/lib/share/helper.php
+++ b/tests/lib/share/helper.php
@@ -116,7 +116,7 @@ class Test_Share_Helper extends \Test\TestCase {
* @dataProvider dataTestSplitUserRemoteError
*
* @param string $id
- * @expectedException \OC\Share\Exceptions\InvalidFederatedCloudIdException
+ * @expectedException \OC\HintException
*/
public function testSplitUserRemoteError($id) {
\OC\Share\Helper::splitUserRemote($id);
diff --git a/tests/lib/share/share.php b/tests/lib/share/share.php
index f03ed43e7fc..92f6b612688 100644
--- a/tests/lib/share/share.php
+++ b/tests/lib/share/share.php
@@ -968,6 +968,35 @@ class Test_Share extends \Test\TestCase {
}
+ public function dataShareWithRemoteUserAndRemoteIsInvalid() {
+ return [
+ // Invalid path
+ array('user@'),
+
+ // Invalid user
+ array('@server'),
+ array('us/er@server'),
+ array('us:er@server'),
+
+ // Invalid splitting
+ array('user'),
+ array(''),
+ array('us/erserver'),
+ array('us:erserver'),
+ ];
+ }
+
+ /**
+ * @dataProvider dataShareWithRemoteUserAndRemoteIsInvalid
+ *
+ * @param string $remoteId
+ * @expectedException \OC\HintException
+ */
+ public function testShareWithRemoteUserAndRemoteIsInvalid($remoteId) {
+ OC_User::setUserId($this->user1);
+ OCP\Share::shareItem('test', 'test.txt', OCP\Share::SHARE_TYPE_REMOTE, $remoteId, \OCP\Constants::PERMISSION_ALL);
+ }
+
public function testUnshareAll() {
$this->shareUserTestFileWithUser($this->user1, $this->user2);
$this->shareUserTestFileWithUser($this->user2, $this->user3);