summaryrefslogtreecommitdiffstats
path: root/apps/files_external/tests/owncloudfunctions.php
diff options
context:
space:
mode:
authorVincent Petry <pvince81@owncloud.com>2014-10-13 17:15:58 +0200
committerVincent Petry <pvince81@owncloud.com>2014-10-13 17:15:58 +0200
commitab5149f5df332a41f88973ecdc0a9b7ba24a5423 (patch)
treea5e71ae6dc76ba0c4d2ecccd49a2045499fa4eee /apps/files_external/tests/owncloudfunctions.php
parent4b9465b937a7754d2b58a77cf8f12adeaccef993 (diff)
downloadnextcloud-server-ab5149f5df332a41f88973ecdc0a9b7ba24a5423.tar.gz
nextcloud-server-ab5149f5df332a41f88973ecdc0a9b7ba24a5423.zip
Allow specifying protocol in ext storage OC config
Allow specifying a protocol in the host field when mounting another ownCloud instance. Note that this was already possible with the WebDAV config but this bug made it inconsistent.
Diffstat (limited to 'apps/files_external/tests/owncloudfunctions.php')
-rw-r--r--apps/files_external/tests/owncloudfunctions.php83
1 files changed, 83 insertions, 0 deletions
diff --git a/apps/files_external/tests/owncloudfunctions.php b/apps/files_external/tests/owncloudfunctions.php
new file mode 100644
index 00000000000..57608fff0cf
--- /dev/null
+++ b/apps/files_external/tests/owncloudfunctions.php
@@ -0,0 +1,83 @@
+<?php
+/**
+ * Copyright (c) 2014 Vincent Petry <pvince81@owncloud.com>
+ * This file is licensed under the Affero General Public License version 3 or
+ * later.
+ * See the COPYING-README file.
+ */
+
+namespace Test\Files\Storage;
+
+class OwnCloudFunctions extends \PHPUnit_Framework_TestCase {
+
+ function configUrlProvider() {
+ return array(
+ array(
+ array(
+ 'host' => 'testhost',
+ 'root' => 'testroot',
+ 'secure' => false
+ ),
+ 'http://testhost/remote.php/webdav/testroot/',
+ ),
+ array(
+ array(
+ 'host' => 'testhost',
+ 'root' => 'testroot',
+ 'secure' => true
+ ),
+ 'https://testhost/remote.php/webdav/testroot/',
+ ),
+ array(
+ array(
+ 'host' => 'http://testhost',
+ 'root' => 'testroot',
+ 'secure' => false
+ ),
+ 'http://testhost/remote.php/webdav/testroot/',
+ ),
+ array(
+ array(
+ 'host' => 'https://testhost',
+ 'root' => 'testroot',
+ 'secure' => false
+ ),
+ 'https://testhost/remote.php/webdav/testroot/',
+ ),
+ array(
+ array(
+ 'host' => 'https://testhost/testroot',
+ 'root' => '',
+ 'secure' => false
+ ),
+ 'https://testhost/testroot/remote.php/webdav/',
+ ),
+ array(
+ array(
+ 'host' => 'https://testhost/testroot',
+ 'root' => 'subdir',
+ 'secure' => false
+ ),
+ 'https://testhost/testroot/remote.php/webdav/subdir/',
+ ),
+ array(
+ array(
+ 'host' => 'http://testhost/testroot',
+ 'root' => 'subdir',
+ 'secure' => true
+ ),
+ 'http://testhost/testroot/remote.php/webdav/subdir/',
+ ),
+ );
+ }
+
+ /**
+ * @dataProvider configUrlProvider
+ */
+ public function testConfig($config, $expectedUri) {
+ $config['user'] = 'someuser';
+ $config['password'] = 'somepassword';
+ $instance = new \OC\Files\Storage\OwnCloud($config);
+ $this->assertEquals($expectedUri, $instance->createBaseUri());
+ }
+}