owncloudfunctions.php 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. <?php
  2. /**
  3. * Copyright (c) 2014 Vincent Petry <pvince81@owncloud.com>
  4. * This file is licensed under the Affero General Public License version 3 or
  5. * later.
  6. * See the COPYING-README file.
  7. */
  8. namespace Test\Files\Storage;
  9. class OwnCloudFunctions extends \Test\TestCase {
  10. function configUrlProvider() {
  11. return array(
  12. array(
  13. array(
  14. 'host' => 'testhost',
  15. 'root' => 'testroot',
  16. 'secure' => false
  17. ),
  18. 'http://testhost/remote.php/webdav/testroot/',
  19. ),
  20. array(
  21. array(
  22. 'host' => 'testhost',
  23. 'root' => 'testroot',
  24. 'secure' => true
  25. ),
  26. 'https://testhost/remote.php/webdav/testroot/',
  27. ),
  28. array(
  29. array(
  30. 'host' => 'http://testhost',
  31. 'root' => 'testroot',
  32. 'secure' => false
  33. ),
  34. 'http://testhost/remote.php/webdav/testroot/',
  35. ),
  36. array(
  37. array(
  38. 'host' => 'https://testhost',
  39. 'root' => 'testroot',
  40. 'secure' => false
  41. ),
  42. 'https://testhost/remote.php/webdav/testroot/',
  43. ),
  44. array(
  45. array(
  46. 'host' => 'https://testhost/testroot',
  47. 'root' => '',
  48. 'secure' => false
  49. ),
  50. 'https://testhost/testroot/remote.php/webdav/',
  51. ),
  52. array(
  53. array(
  54. 'host' => 'https://testhost/testroot',
  55. 'root' => 'subdir',
  56. 'secure' => false
  57. ),
  58. 'https://testhost/testroot/remote.php/webdav/subdir/',
  59. ),
  60. array(
  61. array(
  62. 'host' => 'http://testhost/testroot',
  63. 'root' => 'subdir',
  64. 'secure' => true
  65. ),
  66. 'http://testhost/testroot/remote.php/webdav/subdir/',
  67. ),
  68. );
  69. }
  70. /**
  71. * @dataProvider configUrlProvider
  72. */
  73. public function testConfig($config, $expectedUri) {
  74. $config['user'] = 'someuser';
  75. $config['password'] = 'somepassword';
  76. $instance = new \OC\Files\Storage\OwnCloud($config);
  77. $this->assertEquals($expectedUri, $instance->createBaseUri());
  78. }
  79. }