2014-10-13 11:15:58 -04:00
|
|
|
<?php
|
2025-05-17 05:46:26 -04:00
|
|
|
|
|
|
|
|
declare(strict_types=1);
|
2014-10-13 11:15:58 -04:00
|
|
|
/**
|
2024-06-06 03:55:47 -04:00
|
|
|
* SPDX-FileCopyrightText: 2019-2024 Nextcloud GmbH and Nextcloud contributors
|
|
|
|
|
* SPDX-FileCopyrightText: 2016 ownCloud, Inc.
|
|
|
|
|
* SPDX-License-Identifier: AGPL-3.0-only
|
2014-10-13 11:15:58 -04:00
|
|
|
*/
|
2016-04-13 18:18:07 -04:00
|
|
|
namespace OCA\Files_External\Tests;
|
2014-10-13 11:15:58 -04:00
|
|
|
|
2024-10-10 06:40:31 -04:00
|
|
|
use OCA\Files_External\Lib\Storage\OwnCloud;
|
|
|
|
|
|
2015-11-25 10:58:54 -05:00
|
|
|
/**
|
|
|
|
|
* Class OwnCloudFunctions
|
|
|
|
|
*
|
|
|
|
|
* @group DB
|
|
|
|
|
*
|
2016-04-13 18:18:07 -04:00
|
|
|
* @package OCA\Files_External\Tests
|
2015-11-25 10:58:54 -05:00
|
|
|
*/
|
2016-05-13 05:56:47 -04:00
|
|
|
class OwnCloudFunctionsTest extends \Test\TestCase {
|
2025-05-17 05:46:26 -04:00
|
|
|
public static function configUrlProvider(): array {
|
2020-03-26 04:30:18 -04:00
|
|
|
return [
|
|
|
|
|
[
|
|
|
|
|
[
|
2014-10-13 11:15:58 -04:00
|
|
|
'host' => 'testhost',
|
|
|
|
|
'root' => 'testroot',
|
|
|
|
|
'secure' => false
|
2020-03-26 04:30:18 -04:00
|
|
|
],
|
2014-10-13 11:15:58 -04:00
|
|
|
'http://testhost/remote.php/webdav/testroot/',
|
2020-03-26 04:30:18 -04:00
|
|
|
],
|
|
|
|
|
[
|
|
|
|
|
[
|
2014-10-13 11:15:58 -04:00
|
|
|
'host' => 'testhost',
|
|
|
|
|
'root' => 'testroot',
|
|
|
|
|
'secure' => true
|
2020-03-26 04:30:18 -04:00
|
|
|
],
|
2014-10-13 11:15:58 -04:00
|
|
|
'https://testhost/remote.php/webdav/testroot/',
|
2020-03-26 04:30:18 -04:00
|
|
|
],
|
|
|
|
|
[
|
|
|
|
|
[
|
2014-10-13 11:15:58 -04:00
|
|
|
'host' => 'http://testhost',
|
|
|
|
|
'root' => 'testroot',
|
|
|
|
|
'secure' => false
|
2020-03-26 04:30:18 -04:00
|
|
|
],
|
2014-10-13 11:15:58 -04:00
|
|
|
'http://testhost/remote.php/webdav/testroot/',
|
2020-03-26 04:30:18 -04:00
|
|
|
],
|
|
|
|
|
[
|
|
|
|
|
[
|
2014-10-13 11:15:58 -04:00
|
|
|
'host' => 'https://testhost',
|
|
|
|
|
'root' => 'testroot',
|
|
|
|
|
'secure' => false
|
2020-03-26 04:30:18 -04:00
|
|
|
],
|
2014-10-13 11:15:58 -04:00
|
|
|
'https://testhost/remote.php/webdav/testroot/',
|
2020-03-26 04:30:18 -04:00
|
|
|
],
|
|
|
|
|
[
|
|
|
|
|
[
|
2014-10-13 11:15:58 -04:00
|
|
|
'host' => 'https://testhost/testroot',
|
|
|
|
|
'root' => '',
|
|
|
|
|
'secure' => false
|
2020-03-26 04:30:18 -04:00
|
|
|
],
|
2014-10-13 11:15:58 -04:00
|
|
|
'https://testhost/testroot/remote.php/webdav/',
|
2020-03-26 04:30:18 -04:00
|
|
|
],
|
|
|
|
|
[
|
|
|
|
|
[
|
2014-10-13 11:15:58 -04:00
|
|
|
'host' => 'https://testhost/testroot',
|
|
|
|
|
'root' => 'subdir',
|
|
|
|
|
'secure' => false
|
2020-03-26 04:30:18 -04:00
|
|
|
],
|
2014-10-13 11:15:58 -04:00
|
|
|
'https://testhost/testroot/remote.php/webdav/subdir/',
|
2020-03-26 04:30:18 -04:00
|
|
|
],
|
|
|
|
|
[
|
|
|
|
|
[
|
2014-10-13 11:15:58 -04:00
|
|
|
'host' => 'http://testhost/testroot',
|
|
|
|
|
'root' => 'subdir',
|
|
|
|
|
'secure' => true
|
2020-03-26 04:30:18 -04:00
|
|
|
],
|
2014-10-13 11:15:58 -04:00
|
|
|
'http://testhost/testroot/remote.php/webdav/subdir/',
|
2020-03-26 04:30:18 -04:00
|
|
|
],
|
|
|
|
|
[
|
|
|
|
|
[
|
2015-02-24 18:06:47 -05:00
|
|
|
'host' => 'http://testhost/testroot/',
|
|
|
|
|
'root' => '/subdir',
|
|
|
|
|
'secure' => false
|
2020-03-26 04:30:18 -04:00
|
|
|
],
|
2015-02-24 18:06:47 -05:00
|
|
|
'http://testhost/testroot/remote.php/webdav/subdir/',
|
2020-03-26 04:30:18 -04:00
|
|
|
],
|
|
|
|
|
];
|
2014-10-13 11:15:58 -04:00
|
|
|
}
|
|
|
|
|
|
2025-06-30 10:56:59 -04:00
|
|
|
#[\PHPUnit\Framework\Attributes\DataProvider('configUrlProvider')]
|
2025-05-17 05:46:26 -04:00
|
|
|
public function testConfig(array $config, string $expectedUri): void {
|
2014-10-13 11:15:58 -04:00
|
|
|
$config['user'] = 'someuser';
|
|
|
|
|
$config['password'] = 'somepassword';
|
2024-10-10 06:40:31 -04:00
|
|
|
$instance = new OwnCloud($config);
|
2014-10-13 11:15:58 -04:00
|
|
|
$this->assertEquals($expectedUri, $instance->createBaseUri());
|
|
|
|
|
}
|
|
|
|
|
}
|