diff options
author | Björn Schießle <bjoern@schiessle.org> | 2015-12-09 12:00:00 +0100 |
---|---|---|
committer | Björn Schießle <bjoern@schiessle.org> | 2015-12-14 17:30:50 +0100 |
commit | 171062fed37ada28c257371af2ebfc8647250652 (patch) | |
tree | 4c4d11d00c97284f679db48a9ecad463133aa519 /tests | |
parent | 486fdcb34f351576adb279028414097bdf498ebe (diff) | |
download | nextcloud-server-171062fed37ada28c257371af2ebfc8647250652.tar.gz nextcloud-server-171062fed37ada28c257371af2ebfc8647250652.zip |
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], + ]; + } } |