0
0
Fork 0
mirror of https://github.com/nextcloud/server.git synced 2025-01-31 06:43:12 +00:00
nextcloud_server/apps/files_external/tests/OwnCloudFunctionsTest.php
Andy Scherzinger c1555fc33e
chore: Add SPDX header
Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
2024-06-06 18:05:37 +02:00

95 lines
2 KiB
PHP

<?php
/**
* SPDX-FileCopyrightText: 2019-2024 Nextcloud GmbH and Nextcloud contributors
* SPDX-FileCopyrightText: 2016 ownCloud, Inc.
* SPDX-License-Identifier: AGPL-3.0-only
*/
namespace OCA\Files_External\Tests;
/**
* Class OwnCloudFunctions
*
* @group DB
*
* @package OCA\Files_External\Tests
*/
class OwnCloudFunctionsTest extends \Test\TestCase {
public function configUrlProvider() {
return [
[
[
'host' => 'testhost',
'root' => 'testroot',
'secure' => false
],
'http://testhost/remote.php/webdav/testroot/',
],
[
[
'host' => 'testhost',
'root' => 'testroot',
'secure' => true
],
'https://testhost/remote.php/webdav/testroot/',
],
[
[
'host' => 'http://testhost',
'root' => 'testroot',
'secure' => false
],
'http://testhost/remote.php/webdav/testroot/',
],
[
[
'host' => 'https://testhost',
'root' => 'testroot',
'secure' => false
],
'https://testhost/remote.php/webdav/testroot/',
],
[
[
'host' => 'https://testhost/testroot',
'root' => '',
'secure' => false
],
'https://testhost/testroot/remote.php/webdav/',
],
[
[
'host' => 'https://testhost/testroot',
'root' => 'subdir',
'secure' => false
],
'https://testhost/testroot/remote.php/webdav/subdir/',
],
[
[
'host' => 'http://testhost/testroot',
'root' => 'subdir',
'secure' => true
],
'http://testhost/testroot/remote.php/webdav/subdir/',
],
[
[
'host' => 'http://testhost/testroot/',
'root' => '/subdir',
'secure' => false
],
'http://testhost/testroot/remote.php/webdav/subdir/',
],
];
}
/**
* @dataProvider configUrlProvider
*/
public function testConfig($config, $expectedUri) {
$config['user'] = 'someuser';
$config['password'] = 'somepassword';
$instance = new \OCA\Files_External\Lib\Storage\OwnCloud($config);
$this->assertEquals($expectedUri, $instance->createBaseUri());
}
}