diff options
author | Björn Schießle <bjoern@schiessle.org> | 2015-12-09 14:00:00 +0300 |
---|---|---|
committer | Björn Schießle <bjoern@schiessle.org> | 2015-12-14 19:16:14 +0300 |
commit | efc030aa25b047a7c9f720cf781f26cbe1d274e0 (patch) | |
tree | c5fb0f9eb12ec53a9f9e20a3a6ede8841e64b25c /tests | |
parent | db41c4f4b5f27757838ba17c03f6f263b91af527 (diff) |
don't allow to create a federated share if source and target server are the same
Diffstat (limited to 'tests')
-rw-r--r-- | tests/lib/share/helper.php | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/tests/lib/share/helper.php b/tests/lib/share/helper.php index e37a3db8bf0..eaa29c8cb90 100644 --- a/tests/lib/share/helper.php +++ b/tests/lib/share/helper.php @@ -19,6 +19,10 @@ * License along with this library. If not, see <http://www.gnu.org/licenses/>. */ +/** + * @group DB + * Class Test_Share_Helper + */ class Test_Share_Helper extends \Test\TestCase { public function expireDateProvider() { @@ -121,4 +125,37 @@ class Test_Share_Helper extends \Test\TestCase { public function testSplitUserRemoteError($id) { \OC\Share\Helper::splitUserRemote($id); } + + /** + * @dataProvider dataTestCompareServerAddresses + * + * @param string $server1 + * @param string $server2 + * @param bool $expected + */ + public function testIsSameUserOnSameServer($user1, $server1, $user2, $server2, $expected) { + $this->assertSame($expected, + \OC\Share\Helper::isSameUserOnSameServer($user1, $server1, $user2, $server2) + ); + } + + public function dataTestCompareServerAddresses() { + return [ + ['user1', 'http://server1', 'user1', 'http://server1', true], + ['user1', 'https://server1', 'user1', 'http://server1', true], + ['user1', 'http://serVer1', 'user1', 'http://server1', true], + ['user1', 'http://server1/', 'user1', 'http://server1', true], + ['user1', 'server1', 'user1', 'http://server1', true], + ['user1', 'http://server1', 'user1', 'http://server2', false], + ['user1', 'https://server1', 'user1', 'http://server2', false], + ['user1', 'http://serVer1', 'user1', 'http://serer2', false], + ['user1', 'http://server1/', 'user1', 'http://server2', false], + ['user1', 'server1', 'user1', 'http://server2', false], + ['user1', 'http://server1', 'user2', 'http://server1', false], + ['user1', 'https://server1', 'user2', 'http://server1', false], + ['user1', 'http://serVer1', 'user2', 'http://server1', false], + ['user1', 'http://server1/', 'user2', 'http://server1', false], + ['user1', 'server1', 'user2', 'http://server1', false], + ]; + } } |