You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

OwnCloudFunctionsTest.php 2.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. <?php
  2. /**
  3. * @copyright Copyright (c) 2016, ownCloud, Inc.
  4. *
  5. * @author Christoph Wurst <christoph@winzerhof-wurst.at>
  6. * @author Joas Schilling <coding@schilljs.com>
  7. * @author Morris Jobke <hey@morrisjobke.de>
  8. * @author Robin McCorkell <robin@mccorkell.me.uk>
  9. * @author Thomas Müller <thomas.mueller@tmit.eu>
  10. * @author Vincent Petry <pvince81@owncloud.com>
  11. *
  12. * @license AGPL-3.0
  13. *
  14. * This code is free software: you can redistribute it and/or modify
  15. * it under the terms of the GNU Affero General Public License, version 3,
  16. * as published by the Free Software Foundation.
  17. *
  18. * This program is distributed in the hope that it will be useful,
  19. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  20. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  21. * GNU Affero General Public License for more details.
  22. *
  23. * You should have received a copy of the GNU Affero General Public License, version 3,
  24. * along with this program. If not, see <http://www.gnu.org/licenses/>
  25. *
  26. */
  27. namespace OCA\Files_External\Tests;
  28. /**
  29. * Class OwnCloudFunctions
  30. *
  31. * @group DB
  32. *
  33. * @package OCA\Files_External\Tests
  34. */
  35. class OwnCloudFunctionsTest extends \Test\TestCase {
  36. public function configUrlProvider() {
  37. return [
  38. [
  39. [
  40. 'host' => 'testhost',
  41. 'root' => 'testroot',
  42. 'secure' => false
  43. ],
  44. 'http://testhost/remote.php/webdav/testroot/',
  45. ],
  46. [
  47. [
  48. 'host' => 'testhost',
  49. 'root' => 'testroot',
  50. 'secure' => true
  51. ],
  52. 'https://testhost/remote.php/webdav/testroot/',
  53. ],
  54. [
  55. [
  56. 'host' => 'http://testhost',
  57. 'root' => 'testroot',
  58. 'secure' => false
  59. ],
  60. 'http://testhost/remote.php/webdav/testroot/',
  61. ],
  62. [
  63. [
  64. 'host' => 'https://testhost',
  65. 'root' => 'testroot',
  66. 'secure' => false
  67. ],
  68. 'https://testhost/remote.php/webdav/testroot/',
  69. ],
  70. [
  71. [
  72. 'host' => 'https://testhost/testroot',
  73. 'root' => '',
  74. 'secure' => false
  75. ],
  76. 'https://testhost/testroot/remote.php/webdav/',
  77. ],
  78. [
  79. [
  80. 'host' => 'https://testhost/testroot',
  81. 'root' => 'subdir',
  82. 'secure' => false
  83. ],
  84. 'https://testhost/testroot/remote.php/webdav/subdir/',
  85. ],
  86. [
  87. [
  88. 'host' => 'http://testhost/testroot',
  89. 'root' => 'subdir',
  90. 'secure' => true
  91. ],
  92. 'http://testhost/testroot/remote.php/webdav/subdir/',
  93. ],
  94. [
  95. [
  96. 'host' => 'http://testhost/testroot/',
  97. 'root' => '/subdir',
  98. 'secure' => false
  99. ],
  100. 'http://testhost/testroot/remote.php/webdav/subdir/',
  101. ],
  102. ];
  103. }
  104. /**
  105. * @dataProvider configUrlProvider
  106. */
  107. public function testConfig($config, $expectedUri) {
  108. $config['user'] = 'someuser';
  109. $config['password'] = 'somepassword';
  110. $instance = new \OCA\Files_External\Lib\Storage\OwnCloud($config);
  111. $this->assertEquals($expectedUri, $instance->createBaseUri());
  112. }
  113. }