2016-01-25 14:23:11 -05:00
|
|
|
<?php
|
2024-05-28 06:34:11 -04:00
|
|
|
|
2025-05-26 16:02:22 -04:00
|
|
|
declare(strict_types=1);
|
2016-03-01 11:25:15 -05:00
|
|
|
/**
|
2024-05-28 06:34:11 -04:00
|
|
|
* SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors
|
|
|
|
|
* SPDX-FileCopyrightText: 2016 ownCloud, Inc.
|
|
|
|
|
* SPDX-License-Identifier: AGPL-3.0-only
|
2016-03-01 11:25:15 -05:00
|
|
|
*/
|
2016-05-25 10:04:15 -04:00
|
|
|
namespace OCA\DAV\Tests\unit;
|
2016-01-25 14:23:11 -05:00
|
|
|
|
|
|
|
|
use OCA\DAV\Server;
|
|
|
|
|
use OCP\IRequest;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Class ServerTest
|
|
|
|
|
*
|
|
|
|
|
*
|
|
|
|
|
* @package OCA\DAV\Tests\Unit
|
|
|
|
|
*/
|
2026-01-07 08:21:48 -05:00
|
|
|
#[\PHPUnit\Framework\Attributes\Group(name: 'DB')]
|
2016-01-25 14:23:11 -05:00
|
|
|
class ServerTest extends \Test\TestCase {
|
|
|
|
|
|
2026-01-07 08:21:48 -05:00
|
|
|
#[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'providesUris')]
|
2025-05-26 16:02:22 -04:00
|
|
|
public function test(string $uri, array $plugins): void {
|
2020-08-11 15:32:18 -04:00
|
|
|
/** @var IRequest | \PHPUnit\Framework\MockObject\MockObject $r */
|
2016-12-06 18:19:14 -05:00
|
|
|
$r = $this->createMock(IRequest::class);
|
2018-04-23 07:54:58 -04:00
|
|
|
$r->expects($this->any())->method('getRequestUri')->willReturn($uri);
|
2024-02-13 08:46:04 -05:00
|
|
|
$this->loginAsUser('admin');
|
2016-01-25 14:23:11 -05:00
|
|
|
$s = new Server($r, '/');
|
2018-04-23 07:54:58 -04:00
|
|
|
$this->assertNotNull($s->server);
|
|
|
|
|
foreach ($plugins as $plugin) {
|
|
|
|
|
$this->assertNotNull($s->server->getPlugin($plugin));
|
|
|
|
|
}
|
|
|
|
|
}
|
2025-05-26 16:02:22 -04:00
|
|
|
public static function providesUris(): array {
|
2018-04-23 07:54:58 -04:00
|
|
|
return [
|
|
|
|
|
'principals' => ['principals/users/admin', ['caldav', 'oc-resource-sharing', 'carddav']],
|
|
|
|
|
'calendars' => ['calendars/admin', ['caldav', 'oc-resource-sharing']],
|
|
|
|
|
'addressbooks' => ['addressbooks/admin', ['carddav', 'oc-resource-sharing']],
|
|
|
|
|
];
|
2016-01-25 14:23:11 -05:00
|
|
|
}
|
2016-05-25 10:04:15 -04:00
|
|
|
}
|