diff options
Diffstat (limited to 'tests/lib')
-rw-r--r-- | tests/lib/share/helper.php | 2 | ||||
-rw-r--r-- | tests/lib/share/share.php | 29 |
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); |