owncloudfunctions.php 2.8 KB

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