mirror of
https://github.com/nextcloud/server.git
synced 2026-02-03 20:41:22 -05:00
fix(psalm): Fix static analysis issues in apps/*/tests
There are still 1200 more to fix before we can enable static analysis for the tests. Signed-off-by: Carl Schwan <carlschwan@kde.org>
This commit is contained in:
parent
8f8b4411cd
commit
11cf69d8ba
323 changed files with 842 additions and 915 deletions
|
|
@ -26,7 +26,7 @@ use Test\TestCase;
|
||||||
*
|
*
|
||||||
* @package OCA\Comments\Tests\Unit\AppInfo
|
* @package OCA\Comments\Tests\Unit\AppInfo
|
||||||
*/
|
*/
|
||||||
#[\PHPUnit\Framework\Attributes\Group('DB')]
|
#[\PHPUnit\Framework\Attributes\Group(name: 'DB')]
|
||||||
class ApplicationTest extends TestCase {
|
class ApplicationTest extends TestCase {
|
||||||
protected function setUp(): void {
|
protected function setUp(): void {
|
||||||
parent::setUp();
|
parent::setUp();
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,7 @@ class CommentersSorterTest extends TestCase {
|
||||||
/**
|
/**
|
||||||
* @param $data
|
* @param $data
|
||||||
*/
|
*/
|
||||||
#[\PHPUnit\Framework\Attributes\DataProvider('sortDataProvider')]
|
#[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'sortDataProvider')]
|
||||||
public function testSort($data): void {
|
public function testSort($data): void {
|
||||||
$commentMocks = [];
|
$commentMocks = [];
|
||||||
foreach ($data['actors'] as $actorType => $actors) {
|
foreach ($data['actors'] as $actorType => $actors) {
|
||||||
|
|
|
||||||
|
|
@ -61,7 +61,7 @@ class EventHandlerTest extends TestCase {
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
#[\PHPUnit\Framework\Attributes\DataProvider('handledProvider')]
|
#[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'handledProvider')]
|
||||||
public function testHandled(string $eventType): void {
|
public function testHandled(string $eventType): void {
|
||||||
/** @var IComment|MockObject $comment */
|
/** @var IComment|MockObject $comment */
|
||||||
$comment = $this->createMock(IComment::class);
|
$comment = $this->createMock(IComment::class);
|
||||||
|
|
|
||||||
|
|
@ -51,7 +51,7 @@ class ListenerTest extends TestCase {
|
||||||
* @param string $eventType
|
* @param string $eventType
|
||||||
* @param string $notificationMethod
|
* @param string $notificationMethod
|
||||||
*/
|
*/
|
||||||
#[\PHPUnit\Framework\Attributes\DataProvider('eventProvider')]
|
#[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'eventProvider')]
|
||||||
public function testEvaluate(string $eventType, $notificationMethod): void {
|
public function testEvaluate(string $eventType, $notificationMethod): void {
|
||||||
/** @var IComment|MockObject $comment */
|
/** @var IComment|MockObject $comment */
|
||||||
$comment = $this->createMock(IComment::class);
|
$comment = $this->createMock(IComment::class);
|
||||||
|
|
@ -111,7 +111,7 @@ class ListenerTest extends TestCase {
|
||||||
$this->listener->evaluate($event);
|
$this->listener->evaluate($event);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[\PHPUnit\Framework\Attributes\DataProvider('eventProvider')]
|
#[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'eventProvider')]
|
||||||
public function testEvaluateNoMentions(string $eventType): void {
|
public function testEvaluateNoMentions(string $eventType): void {
|
||||||
/** @var IComment|MockObject $comment */
|
/** @var IComment|MockObject $comment */
|
||||||
$comment = $this->createMock(IComment::class);
|
$comment = $this->createMock(IComment::class);
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@ use Sabre\VObject\Component\VCard;
|
||||||
use Sabre\VObject\UUIDUtil;
|
use Sabre\VObject\UUIDUtil;
|
||||||
use Test\TestCase;
|
use Test\TestCase;
|
||||||
|
|
||||||
#[\PHPUnit\Framework\Attributes\Group('DB')]
|
#[\PHPUnit\Framework\Attributes\Group(name: 'DB')]
|
||||||
class RecentContactMapperTest extends TestCase {
|
class RecentContactMapperTest extends TestCase {
|
||||||
private RecentContactMapper $recentContactMapper;
|
private RecentContactMapper $recentContactMapper;
|
||||||
private ITimeFactory $time;
|
private ITimeFactory $time;
|
||||||
|
|
|
||||||
|
|
@ -28,7 +28,7 @@ use PHPUnit\Framework\MockObject\MockObject;
|
||||||
use Psr\Log\LoggerInterface;
|
use Psr\Log\LoggerInterface;
|
||||||
use Test\TestCase;
|
use Test\TestCase;
|
||||||
|
|
||||||
#[\PHPUnit\Framework\Attributes\Group('DB')]
|
#[\PHPUnit\Framework\Attributes\Group(name: 'DB')]
|
||||||
class CalDavSharingBackendTest extends TestCase {
|
class CalDavSharingBackendTest extends TestCase {
|
||||||
|
|
||||||
private IDBConnection $db;
|
private IDBConnection $db;
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@ use OCP\IDBConnection;
|
||||||
use OCP\Server;
|
use OCP\Server;
|
||||||
use Test\TestCase;
|
use Test\TestCase;
|
||||||
|
|
||||||
#[\PHPUnit\Framework\Attributes\Group('DB')]
|
#[\PHPUnit\Framework\Attributes\Group(name: 'DB')]
|
||||||
class SharingMapperTest extends TestCase {
|
class SharingMapperTest extends TestCase {
|
||||||
|
|
||||||
private SharingMapper $mapper;
|
private SharingMapper $mapper;
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,7 @@ use OCA\DAV\Db\PropertyMapper;
|
||||||
use OCP\Server;
|
use OCP\Server;
|
||||||
use Test\TestCase;
|
use Test\TestCase;
|
||||||
|
|
||||||
#[\PHPUnit\Framework\Attributes\Group('DB')]
|
#[\PHPUnit\Framework\Attributes\Group(name: 'DB')]
|
||||||
class PropertyMapperTest extends TestCase {
|
class PropertyMapperTest extends TestCase {
|
||||||
|
|
||||||
/** @var PropertyMapper */
|
/** @var PropertyMapper */
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,7 @@ use Symfony\Component\Console\Output\OutputInterface;
|
||||||
use Test\TestCase;
|
use Test\TestCase;
|
||||||
use function scandir;
|
use function scandir;
|
||||||
|
|
||||||
#[\PHPUnit\Framework\Attributes\Group('DB')]
|
#[\PHPUnit\Framework\Attributes\Group(name: 'DB')]
|
||||||
class CalendarMigratorTest extends TestCase {
|
class CalendarMigratorTest extends TestCase {
|
||||||
|
|
||||||
private IUserManager $userManager;
|
private IUserManager $userManager;
|
||||||
|
|
@ -87,7 +87,7 @@ class CalendarMigratorTest extends TestCase {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[\PHPUnit\Framework\Attributes\DataProvider('dataAssets')]
|
#[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'dataAssets')]
|
||||||
public function testImportExportAsset(string $userId, string $filename, string $initialCalendarUri, VCalendar $importCalendar): void {
|
public function testImportExportAsset(string $userId, string $filename, string $initialCalendarUri, VCalendar $importCalendar): void {
|
||||||
$user = $this->userManager->createUser($userId, 'topsecretpassword');
|
$user = $this->userManager->createUser($userId, 'topsecretpassword');
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,7 @@ use Symfony\Component\Console\Output\OutputInterface;
|
||||||
use Test\TestCase;
|
use Test\TestCase;
|
||||||
use function scandir;
|
use function scandir;
|
||||||
|
|
||||||
#[\PHPUnit\Framework\Attributes\Group('DB')]
|
#[\PHPUnit\Framework\Attributes\Group(name: 'DB')]
|
||||||
class ContactsMigratorTest extends TestCase {
|
class ContactsMigratorTest extends TestCase {
|
||||||
|
|
||||||
private IUserManager $userManager;
|
private IUserManager $userManager;
|
||||||
|
|
@ -93,7 +93,7 @@ class ContactsMigratorTest extends TestCase {
|
||||||
* @param array{displayName: string, description?: string} $importMetadata
|
* @param array{displayName: string, description?: string} $importMetadata
|
||||||
* @param VCard[] $importCards
|
* @param VCard[] $importCards
|
||||||
*/
|
*/
|
||||||
#[\PHPUnit\Framework\Attributes\DataProvider('dataAssets')]
|
#[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'dataAssets')]
|
||||||
public function testImportExportAsset(string $userId, string $filename, string $initialAddressBookUri, array $importMetadata, array $importCards): void {
|
public function testImportExportAsset(string $userId, string $filename, string $initialAddressBookUri, array $importMetadata, array $importCards): void {
|
||||||
$user = $this->userManager->createUser($userId, 'topsecretpassword');
|
$user = $this->userManager->createUser($userId, 'topsecretpassword');
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,7 @@ use Test\TestCase;
|
||||||
*
|
*
|
||||||
* @package OCA\DAV\Tests\Unit\AppInfo
|
* @package OCA\DAV\Tests\Unit\AppInfo
|
||||||
*/
|
*/
|
||||||
#[\PHPUnit\Framework\Attributes\Group('DB')]
|
#[\PHPUnit\Framework\Attributes\Group(name: 'DB')]
|
||||||
class ApplicationTest extends TestCase {
|
class ApplicationTest extends TestCase {
|
||||||
public function test(): void {
|
public function test(): void {
|
||||||
$app = new Application();
|
$app = new Application();
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,7 @@ class AvatarHomeTest extends TestCase {
|
||||||
$this->home = new AvatarHome(['uri' => 'principals/users/admin'], $this->avatarManager);
|
$this->home = new AvatarHome(['uri' => 'principals/users/admin'], $this->avatarManager);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[\PHPUnit\Framework\Attributes\DataProvider('providesForbiddenMethods')]
|
#[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'providesForbiddenMethods')]
|
||||||
public function testForbiddenMethods($method): void {
|
public function testForbiddenMethods($method): void {
|
||||||
$this->expectException(\Sabre\DAV\Exception\Forbidden::class);
|
$this->expectException(\Sabre\DAV\Exception\Forbidden::class);
|
||||||
|
|
||||||
|
|
@ -58,7 +58,7 @@ class AvatarHomeTest extends TestCase {
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
#[\PHPUnit\Framework\Attributes\DataProvider('providesTestGetChild')]
|
#[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'providesTestGetChild')]
|
||||||
public function testGetChild(?string $expectedException, bool $hasAvatar, string $path): void {
|
public function testGetChild(?string $expectedException, bool $hasAvatar, string $path): void {
|
||||||
if ($expectedException !== null) {
|
if ($expectedException !== null) {
|
||||||
$this->expectException($expectedException);
|
$this->expectException($expectedException);
|
||||||
|
|
@ -83,7 +83,7 @@ class AvatarHomeTest extends TestCase {
|
||||||
self::assertEquals(1, count($avatarNodes));
|
self::assertEquals(1, count($avatarNodes));
|
||||||
}
|
}
|
||||||
|
|
||||||
#[\PHPUnit\Framework\Attributes\DataProvider('providesTestGetChild')]
|
#[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'providesTestGetChild')]
|
||||||
public function testChildExists(?string $expectedException, bool $hasAvatar, string $path): void {
|
public function testChildExists(?string $expectedException, bool $hasAvatar, string $path): void {
|
||||||
$avatar = $this->createMock(IAvatar::class);
|
$avatar = $this->createMock(IAvatar::class);
|
||||||
$avatar->method('exists')->willReturn($hasAvatar);
|
$avatar->method('exists')->willReturn($hasAvatar);
|
||||||
|
|
|
||||||
|
|
@ -50,7 +50,7 @@ class EventReminderJobTest extends TestCase {
|
||||||
* @param bool $sendEventRemindersMode
|
* @param bool $sendEventRemindersMode
|
||||||
* @param bool $expectCall
|
* @param bool $expectCall
|
||||||
*/
|
*/
|
||||||
#[\PHPUnit\Framework\Attributes\DataProvider('data')]
|
#[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'data')]
|
||||||
public function testRun(bool $sendEventReminders, bool $sendEventRemindersMode, bool $expectCall): void {
|
public function testRun(bool $sendEventReminders, bool $sendEventRemindersMode, bool $expectCall): void {
|
||||||
$this->config->expects($this->exactly($sendEventReminders ? 2 : 1))
|
$this->config->expects($this->exactly($sendEventReminders ? 2 : 1))
|
||||||
->method('getAppValue')
|
->method('getAppValue')
|
||||||
|
|
|
||||||
|
|
@ -39,7 +39,7 @@ class PruneOutdatedSyncTokensJobTest extends TestCase {
|
||||||
$this->backgroundJob = new PruneOutdatedSyncTokensJob($this->timeFactory, $this->calDavBackend, $this->cardDavBackend, $this->config, $this->logger);
|
$this->backgroundJob = new PruneOutdatedSyncTokensJob($this->timeFactory, $this->calDavBackend, $this->cardDavBackend, $this->config, $this->logger);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[\PHPUnit\Framework\Attributes\DataProvider('dataForTestRun')]
|
#[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'dataForTestRun')]
|
||||||
public function testRun(string $configToKeep, string $configRetentionDays, int $actualLimit, int $retentionDays, int $deletedCalendarSyncTokens, int $deletedAddressBookSyncTokens): void {
|
public function testRun(string $configToKeep, string $configRetentionDays, int $actualLimit, int $retentionDays, int $deletedCalendarSyncTokens, int $deletedAddressBookSyncTokens): void {
|
||||||
$this->config->expects($this->exactly(2))
|
$this->config->expects($this->exactly(2))
|
||||||
->method('getAppValue')
|
->method('getAppValue')
|
||||||
|
|
|
||||||
|
|
@ -42,7 +42,7 @@ class RefreshWebcalJobTest extends TestCase {
|
||||||
* @param int $time
|
* @param int $time
|
||||||
* @param bool $process
|
* @param bool $process
|
||||||
*/
|
*/
|
||||||
#[\PHPUnit\Framework\Attributes\DataProvider('runDataProvider')]
|
#[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'runDataProvider')]
|
||||||
public function testRun(int $lastRun, int $time, bool $process): void {
|
public function testRun(int $lastRun, int $time, bool $process): void {
|
||||||
$backgroundJob = new RefreshWebcalJob($this->refreshWebcalService, $this->config, $this->logger, $this->timeFactory);
|
$backgroundJob = new RefreshWebcalJob($this->refreshWebcalService, $this->config, $this->logger, $this->timeFactory);
|
||||||
$backgroundJob->setId('42');
|
$backgroundJob->setId('42');
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,7 @@ use PHPUnit\Framework\MockObject\MockObject;
|
||||||
use Psr\Log\LoggerInterface;
|
use Psr\Log\LoggerInterface;
|
||||||
use Test\TestCase;
|
use Test\TestCase;
|
||||||
|
|
||||||
#[\PHPUnit\Framework\Attributes\Group('DB')]
|
#[\PHPUnit\Framework\Attributes\Group(name: 'DB')]
|
||||||
class UserStatusAutomationTest extends TestCase {
|
class UserStatusAutomationTest extends TestCase {
|
||||||
protected ITimeFactory&MockObject $time;
|
protected ITimeFactory&MockObject $time;
|
||||||
protected IJobList&MockObject $jobList;
|
protected IJobList&MockObject $jobList;
|
||||||
|
|
@ -86,7 +86,7 @@ class UserStatusAutomationTest extends TestCase {
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
#[\PHPUnit\Framework\Attributes\DataProvider('dataRun')]
|
#[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'dataRun')]
|
||||||
public function testRunNoOOO(string $ruleDay, string $currentTime, bool $isAvailable): void {
|
public function testRunNoOOO(string $ruleDay, string $currentTime, bool $isAvailable): void {
|
||||||
$user = $this->createConfiguredMock(IUser::class, [
|
$user = $this->createConfiguredMock(IUser::class, [
|
||||||
'getUID' => 'user'
|
'getUID' => 'user'
|
||||||
|
|
|
||||||
|
|
@ -42,7 +42,7 @@ use Test\TestCase;
|
||||||
*
|
*
|
||||||
* @package OCA\DAV\Tests\unit\CalDAV
|
* @package OCA\DAV\Tests\unit\CalDAV
|
||||||
*/
|
*/
|
||||||
#[\PHPUnit\Framework\Attributes\Group('DB')]
|
#[\PHPUnit\Framework\Attributes\Group(name: 'DB')]
|
||||||
abstract class AbstractCalDavBackend extends TestCase {
|
abstract class AbstractCalDavBackend extends TestCase {
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -71,7 +71,7 @@ class BackendTest extends TestCase {
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
#[\PHPUnit\Framework\Attributes\DataProvider('dataCallTriggerCalendarActivity')]
|
#[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'dataCallTriggerCalendarActivity')]
|
||||||
public function testCallTriggerCalendarActivity(string $method, array $payload, string $expectedSubject, array $expectedPayload): void {
|
public function testCallTriggerCalendarActivity(string $method, array $payload, string $expectedSubject, array $expectedPayload): void {
|
||||||
$backend = $this->getBackend(['triggerCalendarActivity']);
|
$backend = $this->getBackend(['triggerCalendarActivity']);
|
||||||
$backend->expects($this->once())
|
$backend->expects($this->once())
|
||||||
|
|
@ -166,7 +166,7 @@ class BackendTest extends TestCase {
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
#[\PHPUnit\Framework\Attributes\DataProvider('dataTriggerCalendarActivity')]
|
#[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'dataTriggerCalendarActivity')]
|
||||||
public function testTriggerCalendarActivity(string $action, array $data, array $shares, array $changedProperties, string $currentUser, string $author, ?array $shareUsers, array $users): void {
|
public function testTriggerCalendarActivity(string $action, array $data, array $shares, array $changedProperties, string $currentUser, string $author, ?array $shareUsers, array $users): void {
|
||||||
$backend = $this->getBackend(['getUsersForShares']);
|
$backend = $this->getBackend(['getUsersForShares']);
|
||||||
|
|
||||||
|
|
@ -295,7 +295,7 @@ class BackendTest extends TestCase {
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
#[\PHPUnit\Framework\Attributes\DataProvider('dataGetUsersForShares')]
|
#[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'dataGetUsersForShares')]
|
||||||
public function testGetUsersForShares(array $shares, array $groups, array $expected): void {
|
public function testGetUsersForShares(array $shares, array $groups, array $expected): void {
|
||||||
$backend = $this->getBackend();
|
$backend = $this->getBackend();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -60,7 +60,7 @@ class CalendarTest extends TestCase {
|
||||||
* @param string[] $types
|
* @param string[] $types
|
||||||
* @param string[] $expected
|
* @param string[] $expected
|
||||||
*/
|
*/
|
||||||
#[\PHPUnit\Framework\Attributes\DataProvider('dataFilterTypes')]
|
#[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'dataFilterTypes')]
|
||||||
public function testFilterTypes(array $types, array $expected): void {
|
public function testFilterTypes(array $types, array $expected): void {
|
||||||
$this->assertEquals($expected, $this->filter->filterTypes($types));
|
$this->assertEquals($expected, $this->filter->filterTypes($types));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,7 @@ use OCP\Activity\IFilter;
|
||||||
use OCP\Server;
|
use OCP\Server;
|
||||||
use Test\TestCase;
|
use Test\TestCase;
|
||||||
|
|
||||||
#[\PHPUnit\Framework\Attributes\Group('DB')]
|
#[\PHPUnit\Framework\Attributes\Group(name: 'DB')]
|
||||||
class GenericTest extends TestCase {
|
class GenericTest extends TestCase {
|
||||||
public static function dataFilters(): array {
|
public static function dataFilters(): array {
|
||||||
return [
|
return [
|
||||||
|
|
@ -22,27 +22,27 @@ class GenericTest extends TestCase {
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
#[\PHPUnit\Framework\Attributes\DataProvider('dataFilters')]
|
#[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'dataFilters')]
|
||||||
public function testImplementsInterface(string $filterClass): void {
|
public function testImplementsInterface(string $filterClass): void {
|
||||||
$filter = Server::get($filterClass);
|
$filter = Server::get($filterClass);
|
||||||
$this->assertInstanceOf(IFilter::class, $filter);
|
$this->assertInstanceOf(IFilter::class, $filter);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[\PHPUnit\Framework\Attributes\DataProvider('dataFilters')]
|
#[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'dataFilters')]
|
||||||
public function testGetIdentifier(string $filterClass): void {
|
public function testGetIdentifier(string $filterClass): void {
|
||||||
/** @var IFilter $filter */
|
/** @var IFilter $filter */
|
||||||
$filter = Server::get($filterClass);
|
$filter = Server::get($filterClass);
|
||||||
$this->assertIsString($filter->getIdentifier());
|
$this->assertIsString($filter->getIdentifier());
|
||||||
}
|
}
|
||||||
|
|
||||||
#[\PHPUnit\Framework\Attributes\DataProvider('dataFilters')]
|
#[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'dataFilters')]
|
||||||
public function testGetName(string $filterClass): void {
|
public function testGetName(string $filterClass): void {
|
||||||
/** @var IFilter $filter */
|
/** @var IFilter $filter */
|
||||||
$filter = Server::get($filterClass);
|
$filter = Server::get($filterClass);
|
||||||
$this->assertIsString($filter->getName());
|
$this->assertIsString($filter->getName());
|
||||||
}
|
}
|
||||||
|
|
||||||
#[\PHPUnit\Framework\Attributes\DataProvider('dataFilters')]
|
#[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'dataFilters')]
|
||||||
public function testGetPriority(string $filterClass): void {
|
public function testGetPriority(string $filterClass): void {
|
||||||
/** @var IFilter $filter */
|
/** @var IFilter $filter */
|
||||||
$filter = Server::get($filterClass);
|
$filter = Server::get($filterClass);
|
||||||
|
|
@ -52,7 +52,7 @@ class GenericTest extends TestCase {
|
||||||
$this->assertLessThanOrEqual(100, $priority);
|
$this->assertLessThanOrEqual(100, $priority);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[\PHPUnit\Framework\Attributes\DataProvider('dataFilters')]
|
#[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'dataFilters')]
|
||||||
public function testGetIcon(string $filterClass): void {
|
public function testGetIcon(string $filterClass): void {
|
||||||
/** @var IFilter $filter */
|
/** @var IFilter $filter */
|
||||||
$filter = Server::get($filterClass);
|
$filter = Server::get($filterClass);
|
||||||
|
|
@ -60,14 +60,14 @@ class GenericTest extends TestCase {
|
||||||
$this->assertStringStartsWith('http', $filter->getIcon());
|
$this->assertStringStartsWith('http', $filter->getIcon());
|
||||||
}
|
}
|
||||||
|
|
||||||
#[\PHPUnit\Framework\Attributes\DataProvider('dataFilters')]
|
#[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'dataFilters')]
|
||||||
public function testFilterTypes(string $filterClass): void {
|
public function testFilterTypes(string $filterClass): void {
|
||||||
/** @var IFilter $filter */
|
/** @var IFilter $filter */
|
||||||
$filter = Server::get($filterClass);
|
$filter = Server::get($filterClass);
|
||||||
$this->assertIsArray($filter->filterTypes([]));
|
$this->assertIsArray($filter->filterTypes([]));
|
||||||
}
|
}
|
||||||
|
|
||||||
#[\PHPUnit\Framework\Attributes\DataProvider('dataFilters')]
|
#[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'dataFilters')]
|
||||||
public function testAllowedApps(string $filterClass): void {
|
public function testAllowedApps(string $filterClass): void {
|
||||||
/** @var IFilter $filter */
|
/** @var IFilter $filter */
|
||||||
$filter = Server::get($filterClass);
|
$filter = Server::get($filterClass);
|
||||||
|
|
|
||||||
|
|
@ -60,7 +60,7 @@ class TodoTest extends TestCase {
|
||||||
* @param string[] $types
|
* @param string[] $types
|
||||||
* @param string[] $expected
|
* @param string[] $expected
|
||||||
*/
|
*/
|
||||||
#[\PHPUnit\Framework\Attributes\DataProvider('dataFilterTypes')]
|
#[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'dataFilterTypes')]
|
||||||
public function testFilterTypes(array $types, array $expected): void {
|
public function testFilterTypes(array $types, array $expected): void {
|
||||||
$this->assertEquals($expected, $this->filter->filterTypes($types));
|
$this->assertEquals($expected, $this->filter->filterTypes($types));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -44,7 +44,7 @@ class BaseTest extends TestCase {
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
#[\PHPUnit\Framework\Attributes\DataProvider('dataSetSubjects')]
|
#[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'dataSetSubjects')]
|
||||||
public function testSetSubjects(string $subject, array $parameters): void {
|
public function testSetSubjects(string $subject, array $parameters): void {
|
||||||
$event = $this->createMock(IEvent::class);
|
$event = $this->createMock(IEvent::class);
|
||||||
$event->expects($this->once())
|
$event->expects($this->once())
|
||||||
|
|
@ -66,7 +66,7 @@ class BaseTest extends TestCase {
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
#[\PHPUnit\Framework\Attributes\DataProvider('dataGenerateCalendarParameter')]
|
#[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'dataGenerateCalendarParameter')]
|
||||||
public function testGenerateCalendarParameter(array $data, string $name): void {
|
public function testGenerateCalendarParameter(array $data, string $name): void {
|
||||||
$l = $this->createMock(IL10N::class);
|
$l = $this->createMock(IL10N::class);
|
||||||
$l->expects($this->any())
|
$l->expects($this->any())
|
||||||
|
|
@ -89,7 +89,7 @@ class BaseTest extends TestCase {
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
#[\PHPUnit\Framework\Attributes\DataProvider('dataGenerateLegacyCalendarParameter')]
|
#[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'dataGenerateLegacyCalendarParameter')]
|
||||||
public function testGenerateLegacyCalendarParameter(int $id, string $name): void {
|
public function testGenerateLegacyCalendarParameter(int $id, string $name): void {
|
||||||
$this->assertEquals([
|
$this->assertEquals([
|
||||||
'type' => 'calendar',
|
'type' => 'calendar',
|
||||||
|
|
@ -105,7 +105,7 @@ class BaseTest extends TestCase {
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
#[\PHPUnit\Framework\Attributes\DataProvider('dataGenerateGroupParameter')]
|
#[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'dataGenerateGroupParameter')]
|
||||||
public function testGenerateGroupParameter(string $gid): void {
|
public function testGenerateGroupParameter(string $gid): void {
|
||||||
$this->assertEquals([
|
$this->assertEquals([
|
||||||
'type' => 'user-group',
|
'type' => 'user-group',
|
||||||
|
|
|
||||||
|
|
@ -67,7 +67,7 @@ class EventTest extends TestCase {
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
#[\PHPUnit\Framework\Attributes\DataProvider('dataGenerateObjectParameter')]
|
#[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'dataGenerateObjectParameter')]
|
||||||
public function testGenerateObjectParameter(int $id, string $name, ?array $link, bool $calendarAppEnabled = true): void {
|
public function testGenerateObjectParameter(int $id, string $name, ?array $link, bool $calendarAppEnabled = true): void {
|
||||||
$affectedUser = 'otheruser';
|
$affectedUser = 'otheruser';
|
||||||
if ($link) {
|
if ($link) {
|
||||||
|
|
@ -148,7 +148,7 @@ class EventTest extends TestCase {
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
#[\PHPUnit\Framework\Attributes\DataProvider('generateObjectParameterLinkEncodingDataProvider')]
|
#[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'generateObjectParameterLinkEncodingDataProvider')]
|
||||||
public function testGenerateObjectParameterLinkEncoding(array $link, string $objectId): void {
|
public function testGenerateObjectParameterLinkEncoding(array $link, string $objectId): void {
|
||||||
$generatedLink = [
|
$generatedLink = [
|
||||||
'objectId' => $objectId,
|
'objectId' => $objectId,
|
||||||
|
|
@ -181,7 +181,7 @@ class EventTest extends TestCase {
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
#[\PHPUnit\Framework\Attributes\DataProvider('dataGenerateObjectParameterThrows')]
|
#[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'dataGenerateObjectParameterThrows')]
|
||||||
public function testGenerateObjectParameterThrows(string|array $eventData, string $exception = InvalidArgumentException::class): void {
|
public function testGenerateObjectParameterThrows(string|array $eventData, string $exception = InvalidArgumentException::class): void {
|
||||||
$this->expectException($exception);
|
$this->expectException($exception);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -23,27 +23,27 @@ class GenericTest extends TestCase {
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
#[\PHPUnit\Framework\Attributes\DataProvider('dataSettings')]
|
#[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'dataSettings')]
|
||||||
public function testImplementsInterface(string $settingClass): void {
|
public function testImplementsInterface(string $settingClass): void {
|
||||||
$setting = Server::get($settingClass);
|
$setting = Server::get($settingClass);
|
||||||
$this->assertInstanceOf(ISetting::class, $setting);
|
$this->assertInstanceOf(ISetting::class, $setting);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[\PHPUnit\Framework\Attributes\DataProvider('dataSettings')]
|
#[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'dataSettings')]
|
||||||
public function testGetIdentifier(string $settingClass): void {
|
public function testGetIdentifier(string $settingClass): void {
|
||||||
/** @var ISetting $setting */
|
/** @var ISetting $setting */
|
||||||
$setting = Server::get($settingClass);
|
$setting = Server::get($settingClass);
|
||||||
$this->assertIsString($setting->getIdentifier());
|
$this->assertIsString($setting->getIdentifier());
|
||||||
}
|
}
|
||||||
|
|
||||||
#[\PHPUnit\Framework\Attributes\DataProvider('dataSettings')]
|
#[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'dataSettings')]
|
||||||
public function testGetName(string $settingClass): void {
|
public function testGetName(string $settingClass): void {
|
||||||
/** @var ISetting $setting */
|
/** @var ISetting $setting */
|
||||||
$setting = Server::get($settingClass);
|
$setting = Server::get($settingClass);
|
||||||
$this->assertIsString($setting->getName());
|
$this->assertIsString($setting->getName());
|
||||||
}
|
}
|
||||||
|
|
||||||
#[\PHPUnit\Framework\Attributes\DataProvider('dataSettings')]
|
#[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'dataSettings')]
|
||||||
public function testGetPriority(string $settingClass): void {
|
public function testGetPriority(string $settingClass): void {
|
||||||
/** @var ISetting $setting */
|
/** @var ISetting $setting */
|
||||||
$setting = Server::get($settingClass);
|
$setting = Server::get($settingClass);
|
||||||
|
|
@ -53,28 +53,28 @@ class GenericTest extends TestCase {
|
||||||
$this->assertLessThanOrEqual(100, $priority);
|
$this->assertLessThanOrEqual(100, $priority);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[\PHPUnit\Framework\Attributes\DataProvider('dataSettings')]
|
#[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'dataSettings')]
|
||||||
public function testCanChangeStream(string $settingClass): void {
|
public function testCanChangeStream(string $settingClass): void {
|
||||||
/** @var ISetting $setting */
|
/** @var ISetting $setting */
|
||||||
$setting = Server::get($settingClass);
|
$setting = Server::get($settingClass);
|
||||||
$this->assertIsBool($setting->canChangeStream());
|
$this->assertIsBool($setting->canChangeStream());
|
||||||
}
|
}
|
||||||
|
|
||||||
#[\PHPUnit\Framework\Attributes\DataProvider('dataSettings')]
|
#[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'dataSettings')]
|
||||||
public function testIsDefaultEnabledStream(string $settingClass): void {
|
public function testIsDefaultEnabledStream(string $settingClass): void {
|
||||||
/** @var ISetting $setting */
|
/** @var ISetting $setting */
|
||||||
$setting = Server::get($settingClass);
|
$setting = Server::get($settingClass);
|
||||||
$this->assertIsBool($setting->isDefaultEnabledStream());
|
$this->assertIsBool($setting->isDefaultEnabledStream());
|
||||||
}
|
}
|
||||||
|
|
||||||
#[\PHPUnit\Framework\Attributes\DataProvider('dataSettings')]
|
#[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'dataSettings')]
|
||||||
public function testCanChangeMail(string $settingClass): void {
|
public function testCanChangeMail(string $settingClass): void {
|
||||||
/** @var ISetting $setting */
|
/** @var ISetting $setting */
|
||||||
$setting = Server::get($settingClass);
|
$setting = Server::get($settingClass);
|
||||||
$this->assertIsBool($setting->canChangeMail());
|
$this->assertIsBool($setting->canChangeMail());
|
||||||
}
|
}
|
||||||
|
|
||||||
#[\PHPUnit\Framework\Attributes\DataProvider('dataSettings')]
|
#[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'dataSettings')]
|
||||||
public function testIsDefaultEnabledMail(string $settingClass): void {
|
public function testIsDefaultEnabledMail(string $settingClass): void {
|
||||||
/** @var ISetting $setting */
|
/** @var ISetting $setting */
|
||||||
$setting = Server::get($settingClass);
|
$setting = Server::get($settingClass);
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,7 @@ use function time;
|
||||||
/**
|
/**
|
||||||
* Class CalDavBackendTest
|
* Class CalDavBackendTest
|
||||||
*/
|
*/
|
||||||
#[\PHPUnit\Framework\Attributes\Group('DB')]
|
#[\PHPUnit\Framework\Attributes\Group(name: 'DB')]
|
||||||
class CalDavBackendTest extends AbstractCalDavBackend {
|
class CalDavBackendTest extends AbstractCalDavBackend {
|
||||||
public function testCalendarOperations(): void {
|
public function testCalendarOperations(): void {
|
||||||
$calendarId = $this->createTestCalendar();
|
$calendarId = $this->createTestCalendar();
|
||||||
|
|
@ -111,7 +111,7 @@ class CalDavBackendTest extends AbstractCalDavBackend {
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
#[\PHPUnit\Framework\Attributes\DataProvider('providesSharingData')]
|
#[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'providesSharingData')]
|
||||||
public function testCalendarSharing($userCanRead, $userCanWrite, $groupCanRead, $groupCanWrite, $add, $principals): void {
|
public function testCalendarSharing($userCanRead, $userCanWrite, $groupCanRead, $groupCanWrite, $add, $principals): void {
|
||||||
$logger = $this->createMock(\Psr\Log\LoggerInterface::class);
|
$logger = $this->createMock(\Psr\Log\LoggerInterface::class);
|
||||||
$config = $this->createMock(IConfig::class);
|
$config = $this->createMock(IConfig::class);
|
||||||
|
|
@ -400,7 +400,7 @@ EOD;
|
||||||
$this->assertCount(0, $calendarObjects);
|
$this->assertCount(0, $calendarObjects);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[\PHPUnit\Framework\Attributes\DataProvider('providesCalendarQueryParameters')]
|
#[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'providesCalendarQueryParameters')]
|
||||||
public function testCalendarQuery($expectedEventsInResult, $propFilters, $compFilter): void {
|
public function testCalendarQuery($expectedEventsInResult, $propFilters, $compFilter): void {
|
||||||
$calendarId = $this->createTestCalendar();
|
$calendarId = $this->createTestCalendar();
|
||||||
$events = [];
|
$events = [];
|
||||||
|
|
@ -689,7 +689,7 @@ EOS;
|
||||||
/**
|
/**
|
||||||
* @param $objectData
|
* @param $objectData
|
||||||
*/
|
*/
|
||||||
#[\PHPUnit\Framework\Attributes\DataProvider('providesSchedulingData')]
|
#[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'providesSchedulingData')]
|
||||||
public function testScheduling($objectData): void {
|
public function testScheduling($objectData): void {
|
||||||
$this->backend->createSchedulingObject(self::UNIT_TEST_USER, 'Sample Schedule', $objectData);
|
$this->backend->createSchedulingObject(self::UNIT_TEST_USER, 'Sample Schedule', $objectData);
|
||||||
|
|
||||||
|
|
@ -705,7 +705,7 @@ EOS;
|
||||||
$this->assertCount(0, $sos);
|
$this->assertCount(0, $sos);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[\PHPUnit\Framework\Attributes\DataProvider('providesCalDataForGetDenormalizedData')]
|
#[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'providesCalDataForGetDenormalizedData')]
|
||||||
public function testGetDenormalizedData($expected, $key, $calData): void {
|
public function testGetDenormalizedData($expected, $key, $calData): void {
|
||||||
try {
|
try {
|
||||||
$actual = $this->backend->getDenormalizedData($calData);
|
$actual = $this->backend->getDenormalizedData($calData);
|
||||||
|
|
@ -871,7 +871,7 @@ EOD;
|
||||||
$this->assertEquals(count($search5), 0);
|
$this->assertEquals(count($search5), 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[\PHPUnit\Framework\Attributes\DataProvider('searchDataProvider')]
|
#[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'searchDataProvider')]
|
||||||
public function testSearch(bool $isShared, array $searchOptions, int $count): void {
|
public function testSearch(bool $isShared, array $searchOptions, int $count): void {
|
||||||
$calendarId = $this->createTestCalendar();
|
$calendarId = $this->createTestCalendar();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -79,7 +79,7 @@ class CalendarObjectTest extends TestCase {
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
#[DataProvider('provideConfidentialObjectData')]
|
#[DataProvider(methodName: 'provideConfidentialObjectData')]
|
||||||
public function testGetWithConfidentialObject(
|
public function testGetWithConfidentialObject(
|
||||||
bool $expectConfidential,
|
bool $expectConfidential,
|
||||||
array $calendarInfo,
|
array $calendarInfo,
|
||||||
|
|
|
||||||
|
|
@ -144,7 +144,7 @@ class CalendarTest extends TestCase {
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
#[\PHPUnit\Framework\Attributes\DataProvider('dataPropPatch')]
|
#[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'dataPropPatch')]
|
||||||
public function testPropPatch(string $ownerPrincipal, string $principalUri, array $mutations, bool $shared): void {
|
public function testPropPatch(string $ownerPrincipal, string $principalUri, array $mutations, bool $shared): void {
|
||||||
/** @var CalDavBackend&MockObject $backend */
|
/** @var CalDavBackend&MockObject $backend */
|
||||||
$backend = $this->createMock(CalDavBackend::class);
|
$backend = $this->createMock(CalDavBackend::class);
|
||||||
|
|
@ -166,7 +166,7 @@ class CalendarTest extends TestCase {
|
||||||
$this->addToAssertionCount(1);
|
$this->addToAssertionCount(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[\PHPUnit\Framework\Attributes\DataProvider('providesReadOnlyInfo')]
|
#[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'providesReadOnlyInfo')]
|
||||||
public function testAcl($expectsWrite, $readOnlyValue, $hasOwnerSet, $uri = 'default'): void {
|
public function testAcl($expectsWrite, $readOnlyValue, $hasOwnerSet, $uri = 'default'): void {
|
||||||
/** @var CalDavBackend&MockObject $backend */
|
/** @var CalDavBackend&MockObject $backend */
|
||||||
$backend = $this->createMock(CalDavBackend::class);
|
$backend = $this->createMock(CalDavBackend::class);
|
||||||
|
|
@ -266,7 +266,7 @@ class CalendarTest extends TestCase {
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
#[\PHPUnit\Framework\Attributes\DataProvider('providesConfidentialClassificationData')]
|
#[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'providesConfidentialClassificationData')]
|
||||||
public function testPrivateClassification(int $expectedChildren, bool $isShared): void {
|
public function testPrivateClassification(int $expectedChildren, bool $isShared): void {
|
||||||
$calObject0 = ['uri' => 'event-0', 'classification' => CalDavBackend::CLASSIFICATION_PUBLIC];
|
$calObject0 = ['uri' => 'event-0', 'classification' => CalDavBackend::CLASSIFICATION_PUBLIC];
|
||||||
$calObject1 = ['uri' => 'event-1', 'classification' => CalDavBackend::CLASSIFICATION_CONFIDENTIAL];
|
$calObject1 = ['uri' => 'event-1', 'classification' => CalDavBackend::CLASSIFICATION_CONFIDENTIAL];
|
||||||
|
|
@ -304,7 +304,7 @@ class CalendarTest extends TestCase {
|
||||||
$this->assertEquals(!$isShared, $c->childExists('event-2'));
|
$this->assertEquals(!$isShared, $c->childExists('event-2'));
|
||||||
}
|
}
|
||||||
|
|
||||||
#[\PHPUnit\Framework\Attributes\DataProvider('providesConfidentialClassificationData')]
|
#[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'providesConfidentialClassificationData')]
|
||||||
public function testConfidentialClassification(int $expectedChildren, bool $isShared): void {
|
public function testConfidentialClassification(int $expectedChildren, bool $isShared): void {
|
||||||
$start = '20160609';
|
$start = '20160609';
|
||||||
$end = '20160610';
|
$end = '20160610';
|
||||||
|
|
|
||||||
|
|
@ -37,7 +37,7 @@ class CalendarFederationConfigTest extends TestCase {
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
#[DataProvider('provideIsFederationEnabledData')]
|
#[DataProvider(methodName: 'provideIsFederationEnabledData')]
|
||||||
public function testIsFederationEnabled(bool $configValue): void {
|
public function testIsFederationEnabled(bool $configValue): void {
|
||||||
$this->appConfig->expects(self::once())
|
$this->appConfig->expects(self::once())
|
||||||
->method('getAppValueBool')
|
->method('getAppValueBool')
|
||||||
|
|
|
||||||
|
|
@ -239,7 +239,7 @@ class CalendarFederationProviderTest extends TestCase {
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
#[DataProvider('provideIncompleteProtocolData')]
|
#[DataProvider(methodName: 'provideIncompleteProtocolData')]
|
||||||
public function testShareReceivedWithIncompleteProtocolData(array $protocol): void {
|
public function testShareReceivedWithIncompleteProtocolData(array $protocol): void {
|
||||||
$share = $this->createMock(ICloudFederationShare::class);
|
$share = $this->createMock(ICloudFederationShare::class);
|
||||||
$share->method('getShareType')
|
$share->method('getShareType')
|
||||||
|
|
@ -400,7 +400,7 @@ class CalendarFederationProviderTest extends TestCase {
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
#[DataProvider('provideIncompleteSyncCalendarNotificationData')]
|
#[DataProvider(methodName: 'provideIncompleteSyncCalendarNotificationData')]
|
||||||
public function testNotificationReceivedWithSyncCalendarNotificationAndIncompleteData(
|
public function testNotificationReceivedWithSyncCalendarNotificationAndIncompleteData(
|
||||||
array $notification,
|
array $notification,
|
||||||
): void {
|
): void {
|
||||||
|
|
|
||||||
|
|
@ -109,7 +109,7 @@ class FederatedCalendarAuthTest extends TestCase {
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
#[DataProvider('provideCheckData')]
|
#[DataProvider(methodName: 'provideCheckData')]
|
||||||
public function testCheck(
|
public function testCheck(
|
||||||
string $requestPath,
|
string $requestPath,
|
||||||
?string $authHeader,
|
?string $authHeader,
|
||||||
|
|
|
||||||
|
|
@ -126,7 +126,7 @@ class FederatedCalendarSyncServiceTest extends TestCase {
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
#[DataProvider('provideUnexpectedSyncTokenData')]
|
#[DataProvider(methodName: 'provideUnexpectedSyncTokenData')]
|
||||||
public function testSyncOneWithUnexpectedSyncTokenFormat(string $syncToken): void {
|
public function testSyncOneWithUnexpectedSyncTokenFormat(string $syncToken): void {
|
||||||
$calendar = new FederatedCalendarEntity();
|
$calendar = new FederatedCalendarEntity();
|
||||||
$calendar->setId(1);
|
$calendar->setId(1);
|
||||||
|
|
|
||||||
|
|
@ -390,7 +390,7 @@ class FederationSharingServiceTest extends TestCase {
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
#[DataProvider('provideInvalidRemoteUserPrincipalData')]
|
#[DataProvider(methodName: 'provideInvalidRemoteUserPrincipalData')]
|
||||||
public function testShareWithWithInvalidRemoteUserPrincipal(string $remoteUserPrincipal): void {
|
public function testShareWithWithInvalidRemoteUserPrincipal(string $remoteUserPrincipal): void {
|
||||||
$shareable = $this->createMock(Calendar::class);
|
$shareable = $this->createMock(Calendar::class);
|
||||||
$shareable->method('getOwner')
|
$shareable->method('getOwner')
|
||||||
|
|
|
||||||
|
|
@ -68,7 +68,7 @@ class ExternalCalendarTest extends TestCase {
|
||||||
$this->assertTrue(ExternalCalendar::isAppGeneratedCalendar('app-generated--example--foo--2'));
|
$this->assertTrue(ExternalCalendar::isAppGeneratedCalendar('app-generated--example--foo--2'));
|
||||||
}
|
}
|
||||||
|
|
||||||
#[\PHPUnit\Framework\Attributes\DataProvider('splitAppGeneratedCalendarUriDataProvider')]
|
#[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'splitAppGeneratedCalendarUriDataProvider')]
|
||||||
public function testSplitAppGeneratedCalendarUriInvalid(string $name):void {
|
public function testSplitAppGeneratedCalendarUriInvalid(string $name):void {
|
||||||
$this->expectException(\InvalidArgumentException::class);
|
$this->expectException(\InvalidArgumentException::class);
|
||||||
$this->expectExceptionMessage('Provided calendar uri was not app-generated');
|
$this->expectExceptionMessage('Provided calendar uri was not app-generated');
|
||||||
|
|
|
||||||
|
|
@ -36,7 +36,7 @@ class PluginTest extends TestCase {
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
#[\PHPUnit\Framework\Attributes\DataProvider('linkProvider')]
|
#[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'linkProvider')]
|
||||||
public function testGetCalendarHomeForPrincipal(string $input, string $expected): void {
|
public function testGetCalendarHomeForPrincipal(string $input, string $expected): void {
|
||||||
$this->assertSame($expected, $this->plugin->getCalendarHomeForPrincipal($input));
|
$this->assertSame($expected, $this->plugin->getCalendarHomeForPrincipal($input));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -65,7 +65,7 @@ class PublicCalendarObjectTest extends TestCase {
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
#[DataProvider('provideConfidentialObjectData')]
|
#[DataProvider(methodName: 'provideConfidentialObjectData')]
|
||||||
public function testGetWithConfidentialObject(array $calendarInfo): void {
|
public function testGetWithConfidentialObject(array $calendarInfo): void {
|
||||||
$ics = <<<EOF
|
$ics = <<<EOF
|
||||||
BEGIN:VCALENDAR
|
BEGIN:VCALENDAR
|
||||||
|
|
|
||||||
|
|
@ -32,7 +32,7 @@ use Test\TestCase;
|
||||||
*
|
*
|
||||||
* @package OCA\DAV\Tests\unit\CalDAV
|
* @package OCA\DAV\Tests\unit\CalDAV
|
||||||
*/
|
*/
|
||||||
#[\PHPUnit\Framework\Attributes\Group('DB')]
|
#[\PHPUnit\Framework\Attributes\Group(name: 'DB')]
|
||||||
class PublicCalendarRootTest extends TestCase {
|
class PublicCalendarRootTest extends TestCase {
|
||||||
public const UNIT_TEST_USER = '';
|
public const UNIT_TEST_USER = '';
|
||||||
private CalDavBackend $backend;
|
private CalDavBackend $backend;
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,7 @@ use Sabre\VObject\Reader;
|
||||||
|
|
||||||
class PublicCalendarTest extends CalendarTest {
|
class PublicCalendarTest extends CalendarTest {
|
||||||
|
|
||||||
#[\PHPUnit\Framework\Attributes\DataProvider('providesConfidentialClassificationData')]
|
#[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'providesConfidentialClassificationData')]
|
||||||
public function testPrivateClassification(int $expectedChildren, bool $isShared): void {
|
public function testPrivateClassification(int $expectedChildren, bool $isShared): void {
|
||||||
$calObject0 = ['uri' => 'event-0', 'classification' => CalDavBackend::CLASSIFICATION_PUBLIC];
|
$calObject0 = ['uri' => 'event-0', 'classification' => CalDavBackend::CLASSIFICATION_PUBLIC];
|
||||||
$calObject1 = ['uri' => 'event-1', 'classification' => CalDavBackend::CLASSIFICATION_CONFIDENTIAL];
|
$calObject1 = ['uri' => 'event-1', 'classification' => CalDavBackend::CLASSIFICATION_CONFIDENTIAL];
|
||||||
|
|
@ -55,7 +55,7 @@ class PublicCalendarTest extends CalendarTest {
|
||||||
$this->assertFalse($c->childExists('event-2'));
|
$this->assertFalse($c->childExists('event-2'));
|
||||||
}
|
}
|
||||||
|
|
||||||
#[\PHPUnit\Framework\Attributes\DataProvider('providesConfidentialClassificationData')]
|
#[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'providesConfidentialClassificationData')]
|
||||||
public function testConfidentialClassification(int $expectedChildren, bool $isShared): void {
|
public function testConfidentialClassification(int $expectedChildren, bool $isShared): void {
|
||||||
$start = '20160609';
|
$start = '20160609';
|
||||||
$end = '20160610';
|
$end = '20160610';
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@ use OCA\DAV\Capabilities;
|
||||||
use OCP\AppFramework\QueryException;
|
use OCP\AppFramework\QueryException;
|
||||||
use Test\TestCase;
|
use Test\TestCase;
|
||||||
|
|
||||||
#[\PHPUnit\Framework\Attributes\Group('DB')]
|
#[\PHPUnit\Framework\Attributes\Group(name: 'DB')]
|
||||||
class NotificationProviderManagerTest extends TestCase {
|
class NotificationProviderManagerTest extends TestCase {
|
||||||
private NotificationProviderManager $providerManager;
|
private NotificationProviderManager $providerManager;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -170,7 +170,7 @@ class NotifierTest extends TestCase {
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
#[\PHPUnit\Framework\Attributes\DataProvider('dataPrepare')]
|
#[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'dataPrepare')]
|
||||||
public function testPrepare(string $subjectType, array $subjectParams, string $subject, array $messageParams, string $message): void {
|
public function testPrepare(string $subjectType, array $subjectParams, string $subject, array $messageParams, string $message): void {
|
||||||
/** @var INotification&MockObject $notification */
|
/** @var INotification&MockObject $notification */
|
||||||
$notification = $this->createMock(INotification::class);
|
$notification = $this->createMock(INotification::class);
|
||||||
|
|
|
||||||
|
|
@ -246,7 +246,7 @@ abstract class AbstractPrincipalBackendTestCase extends TestCase {
|
||||||
$this->assertEquals(0, $actual);
|
$this->assertEquals(0, $actual);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[\PHPUnit\Framework\Attributes\DataProvider('dataSearchPrincipals')]
|
#[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'dataSearchPrincipals')]
|
||||||
public function testSearchPrincipals($expected, $test): void {
|
public function testSearchPrincipals($expected, $test): void {
|
||||||
$user = $this->createMock(IUser::class);
|
$user = $this->createMock(IUser::class);
|
||||||
$this->userSession->expects($this->once())
|
$this->userSession->expects($this->once())
|
||||||
|
|
|
||||||
|
|
@ -251,7 +251,7 @@ class PluginTest extends TestCase {
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
#[\PHPUnit\Framework\Attributes\DataProvider('propFindDefaultCalendarUrlProvider')]
|
#[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'propFindDefaultCalendarUrlProvider')]
|
||||||
public function testPropFindDefaultCalendarUrl(string $principalUri, ?string $calendarHome, bool $isResource, string $calendarUri, string $displayName, bool $exists, bool $deleted = false, bool $hasExistingCalendars = false, bool $propertiesForPath = true): void {
|
public function testPropFindDefaultCalendarUrl(string $principalUri, ?string $calendarHome, bool $isResource, string $calendarUri, string $displayName, bool $exists, bool $deleted = false, bool $hasExistingCalendars = false, bool $propertiesForPath = true): void {
|
||||||
$propFind = new PropFind(
|
$propFind = new PropFind(
|
||||||
$principalUri,
|
$principalUri,
|
||||||
|
|
|
||||||
|
|
@ -32,7 +32,7 @@ class ConnectionTest extends TestCase {
|
||||||
$this->connection = new Connection($this->clientService, $this->config, $this->logger);
|
$this->connection = new Connection($this->clientService, $this->config, $this->logger);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[\PHPUnit\Framework\Attributes\DataProvider('runLocalURLDataProvider')]
|
#[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'runLocalURLDataProvider')]
|
||||||
public function testLocalUrl($source): void {
|
public function testLocalUrl($source): void {
|
||||||
$subscription = [
|
$subscription = [
|
||||||
'id' => 42,
|
'id' => 42,
|
||||||
|
|
@ -89,7 +89,7 @@ class ConnectionTest extends TestCase {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[\PHPUnit\Framework\Attributes\DataProvider('urlDataProvider')]
|
#[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'urlDataProvider')]
|
||||||
public function testConnection(string $url, string $contentType, string $expectedFormat): void {
|
public function testConnection(string $url, string $contentType, string $expectedFormat): void {
|
||||||
$client = $this->createMock(IClient::class);
|
$client = $this->createMock(IClient::class);
|
||||||
$response = $this->createMock(IResponse::class);
|
$response = $this->createMock(IResponse::class);
|
||||||
|
|
|
||||||
|
|
@ -50,7 +50,7 @@ class RefreshWebcalServiceTest extends TestCase {
|
||||||
return $stream;
|
return $stream;
|
||||||
}
|
}
|
||||||
|
|
||||||
#[\PHPUnit\Framework\Attributes\DataProvider('runDataProvider')]
|
#[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'runDataProvider')]
|
||||||
public function testRun(string $body, string $format, string $result): void {
|
public function testRun(string $body, string $format, string $result): void {
|
||||||
$refreshWebcalService = new RefreshWebcalService(
|
$refreshWebcalService = new RefreshWebcalService(
|
||||||
$this->caldavBackend,
|
$this->caldavBackend,
|
||||||
|
|
@ -119,7 +119,7 @@ class RefreshWebcalServiceTest extends TestCase {
|
||||||
$refreshWebcalService->refreshSubscription('principals/users/testuser', 'sub123');
|
$refreshWebcalService->refreshSubscription('principals/users/testuser', 'sub123');
|
||||||
}
|
}
|
||||||
|
|
||||||
#[\PHPUnit\Framework\Attributes\DataProvider('identicalDataProvider')]
|
#[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'identicalDataProvider')]
|
||||||
public function testRunIdentical(string $uid, array $calendarObject, string $body, string $format, string $result): void {
|
public function testRunIdentical(string $uid, array $calendarObject, string $body, string $format, string $result): void {
|
||||||
$refreshWebcalService = new RefreshWebcalService(
|
$refreshWebcalService = new RefreshWebcalService(
|
||||||
$this->caldavBackend,
|
$this->caldavBackend,
|
||||||
|
|
@ -354,7 +354,7 @@ class RefreshWebcalServiceTest extends TestCase {
|
||||||
$refreshWebcalService->refreshSubscription('principals/users/testuser', 'sub123');
|
$refreshWebcalService->refreshSubscription('principals/users/testuser', 'sub123');
|
||||||
}
|
}
|
||||||
|
|
||||||
#[\PHPUnit\Framework\Attributes\DataProvider('runDataProvider')]
|
#[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'runDataProvider')]
|
||||||
public function testRunCreateCalendarNoException(string $body, string $format, string $result): void {
|
public function testRunCreateCalendarNoException(string $body, string $format, string $result): void {
|
||||||
$refreshWebcalService = $this->getMockBuilder(RefreshWebcalService::class)
|
$refreshWebcalService = $this->getMockBuilder(RefreshWebcalService::class)
|
||||||
->onlyMethods(['getSubscription'])
|
->onlyMethods(['getSubscription'])
|
||||||
|
|
@ -407,7 +407,7 @@ class RefreshWebcalServiceTest extends TestCase {
|
||||||
$refreshWebcalService->refreshSubscription('principals/users/testuser', 'sub123');
|
$refreshWebcalService->refreshSubscription('principals/users/testuser', 'sub123');
|
||||||
}
|
}
|
||||||
|
|
||||||
#[\PHPUnit\Framework\Attributes\DataProvider('runDataProvider')]
|
#[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'runDataProvider')]
|
||||||
public function testRunCreateCalendarBadRequest(string $body, string $format, string $result): void {
|
public function testRunCreateCalendarBadRequest(string $body, string $format, string $result): void {
|
||||||
$refreshWebcalService = $this->getMockBuilder(RefreshWebcalService::class)
|
$refreshWebcalService = $this->getMockBuilder(RefreshWebcalService::class)
|
||||||
->onlyMethods(['getSubscription'])
|
->onlyMethods(['getSubscription'])
|
||||||
|
|
|
||||||
|
|
@ -37,10 +37,7 @@ class BackendTest extends TestCase {
|
||||||
$this->userManager = $this->createMock(IUserManager::class);
|
$this->userManager = $this->createMock(IUserManager::class);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
protected function getBackend(array $methods = []): Backend|MockObject {
|
||||||
* @return Backend|MockObject
|
|
||||||
*/
|
|
||||||
protected function getBackend(array $methods = []): Backend {
|
|
||||||
if (empty($methods)) {
|
if (empty($methods)) {
|
||||||
return new Backend(
|
return new Backend(
|
||||||
$this->activityManager,
|
$this->activityManager,
|
||||||
|
|
@ -71,7 +68,7 @@ class BackendTest extends TestCase {
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
#[\PHPUnit\Framework\Attributes\DataProvider('dataCallTriggerAddressBookActivity')]
|
#[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'dataCallTriggerAddressBookActivity')]
|
||||||
public function testCallTriggerAddressBookActivity(string $method, array $payload, string $expectedSubject, array $expectedPayload): void {
|
public function testCallTriggerAddressBookActivity(string $method, array $payload, string $expectedSubject, array $expectedPayload): void {
|
||||||
$backend = $this->getBackend(['triggerAddressbookActivity']);
|
$backend = $this->getBackend(['triggerAddressbookActivity']);
|
||||||
$backend->expects($this->once())
|
$backend->expects($this->once())
|
||||||
|
|
@ -152,7 +149,7 @@ class BackendTest extends TestCase {
|
||||||
* @param string[]|null $shareUsers
|
* @param string[]|null $shareUsers
|
||||||
* @param string[] $users
|
* @param string[] $users
|
||||||
*/
|
*/
|
||||||
#[\PHPUnit\Framework\Attributes\DataProvider('dataTriggerAddressBookActivity')]
|
#[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'dataTriggerAddressBookActivity')]
|
||||||
public function testTriggerAddressBookActivity(string $action, array $data, array $shares, array $changedProperties, string $currentUser, string $author, ?array $shareUsers, array $users): void {
|
public function testTriggerAddressBookActivity(string $action, array $data, array $shares, array $changedProperties, string $currentUser, string $author, ?array $shareUsers, array $users): void {
|
||||||
$backend = $this->getBackend(['getUsersForShares']);
|
$backend = $this->getBackend(['getUsersForShares']);
|
||||||
|
|
||||||
|
|
@ -316,7 +313,7 @@ class BackendTest extends TestCase {
|
||||||
* @param string[]|null $shareUsers
|
* @param string[]|null $shareUsers
|
||||||
* @param string[] $users
|
* @param string[] $users
|
||||||
*/
|
*/
|
||||||
#[\PHPUnit\Framework\Attributes\DataProvider('dataTriggerCardActivity')]
|
#[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'dataTriggerCardActivity')]
|
||||||
public function testTriggerCardActivity(string $action, array $addressBookData, array $shares, array $cardData, string $currentUser, string $author, ?array $shareUsers, array $users): void {
|
public function testTriggerCardActivity(string $action, array $addressBookData, array $shares, array $cardData, string $currentUser, string $author, ?array $shareUsers, array $users): void {
|
||||||
$backend = $this->getBackend(['getUsersForShares']);
|
$backend = $this->getBackend(['getUsersForShares']);
|
||||||
|
|
||||||
|
|
@ -430,7 +427,7 @@ class BackendTest extends TestCase {
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
#[\PHPUnit\Framework\Attributes\DataProvider('dataGetUsersForShares')]
|
#[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'dataGetUsersForShares')]
|
||||||
public function testGetUsersForShares(array $shares, array $groups, array $expected): void {
|
public function testGetUsersForShares(array $shares, array $groups, array $expected): void {
|
||||||
$backend = $this->getBackend();
|
$backend = $this->getBackend();
|
||||||
|
|
||||||
|
|
@ -460,7 +457,7 @@ class BackendTest extends TestCase {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param string[] $users
|
* @param string[] $users
|
||||||
* @return IUser[]|MockObject[]
|
* @return list<IUser&MockObject>
|
||||||
*/
|
*/
|
||||||
protected function getUsers(array $users): array {
|
protected function getUsers(array $users): array {
|
||||||
$list = [];
|
$list = [];
|
||||||
|
|
@ -470,10 +467,7 @@ class BackendTest extends TestCase {
|
||||||
return $list;
|
return $list;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
protected function getUserMock(string $uid): IUser&MockObject {
|
||||||
* @return IUser|MockObject
|
|
||||||
*/
|
|
||||||
protected function getUserMock(string $uid): IUser {
|
|
||||||
$user = $this->createMock(IUser::class);
|
$user = $this->createMock(IUser::class);
|
||||||
$user->expects($this->once())
|
$user->expects($this->once())
|
||||||
->method('getUID')
|
->method('getUID')
|
||||||
|
|
|
||||||
|
|
@ -80,7 +80,7 @@ class AddressBookImplTest extends TestCase {
|
||||||
->getMock();
|
->getMock();
|
||||||
|
|
||||||
$pattern = 'pattern';
|
$pattern = 'pattern';
|
||||||
$searchProperties = 'properties';
|
$searchProperties = ['properties'];
|
||||||
|
|
||||||
$this->backend->expects($this->once())->method('search')
|
$this->backend->expects($this->once())->method('search')
|
||||||
->with($this->addressBookInfo['id'], $pattern, $searchProperties)
|
->with($this->addressBookInfo['id'], $pattern, $searchProperties)
|
||||||
|
|
@ -104,7 +104,7 @@ class AddressBookImplTest extends TestCase {
|
||||||
$this->assertSame(2, count($result));
|
$this->assertSame(2, count($result));
|
||||||
}
|
}
|
||||||
|
|
||||||
#[\PHPUnit\Framework\Attributes\DataProvider('dataTestCreate')]
|
#[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'dataTestCreate')]
|
||||||
public function testCreate(array $properties): void {
|
public function testCreate(array $properties): void {
|
||||||
$uid = 'uid';
|
$uid = 'uid';
|
||||||
|
|
||||||
|
|
@ -229,7 +229,7 @@ class AddressBookImplTest extends TestCase {
|
||||||
$addressBookImpl->createOrUpdate($properties);
|
$addressBookImpl->createOrUpdate($properties);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[\PHPUnit\Framework\Attributes\DataProvider('dataTestGetPermissions')]
|
#[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'dataTestGetPermissions')]
|
||||||
public function testGetPermissions(array $permissions, int $expected): void {
|
public function testGetPermissions(array $permissions, int $expected): void {
|
||||||
$this->addressBook->expects($this->once())->method('getACL')
|
$this->addressBook->expects($this->once())->method('getACL')
|
||||||
->willReturn($permissions);
|
->willReturn($permissions);
|
||||||
|
|
|
||||||
|
|
@ -117,7 +117,7 @@ class AddressBookTest extends TestCase {
|
||||||
$addressBook->propPatch(new PropPatch(['{DAV:}displayname' => 'Test address book']));
|
$addressBook->propPatch(new PropPatch(['{DAV:}displayname' => 'Test address book']));
|
||||||
}
|
}
|
||||||
|
|
||||||
#[\PHPUnit\Framework\Attributes\DataProvider('providesReadOnlyInfo')]
|
#[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'providesReadOnlyInfo')]
|
||||||
public function testAcl(bool $expectsWrite, ?bool $readOnlyValue, bool $hasOwnerSet): void {
|
public function testAcl(bool $expectsWrite, ?bool $readOnlyValue, bool $hasOwnerSet): void {
|
||||||
/** @var MockObject | CardDavBackend $backend */
|
/** @var MockObject | CardDavBackend $backend */
|
||||||
$backend = $this->createMock(CardDavBackend::class);
|
$backend = $this->createMock(CardDavBackend::class);
|
||||||
|
|
|
||||||
|
|
@ -50,7 +50,7 @@ class BirthdayServiceTest extends TestCase {
|
||||||
$this->dbConnection, $this->l10n);
|
$this->dbConnection, $this->l10n);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[\PHPUnit\Framework\Attributes\DataProvider('providesVCards')]
|
#[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'providesVCards')]
|
||||||
public function testBuildBirthdayFromContact(?string $expectedSummary, ?string $expectedDTStart, ?string $expectedRrule, ?string $expectedFieldType, ?string $expectedUnknownYear, ?string $expectedOriginalYear, ?string $expectedReminder, ?string $data, string $fieldType, string $prefix, bool $supports4Bytes, ?string $configuredReminder): void {
|
public function testBuildBirthdayFromContact(?string $expectedSummary, ?string $expectedDTStart, ?string $expectedRrule, ?string $expectedFieldType, ?string $expectedUnknownYear, ?string $expectedOriginalYear, ?string $expectedReminder, ?string $data, string $fieldType, string $prefix, bool $supports4Bytes, ?string $configuredReminder): void {
|
||||||
$this->dbConnection->method('supports4ByteText')->willReturn($supports4Bytes);
|
$this->dbConnection->method('supports4ByteText')->willReturn($supports4Bytes);
|
||||||
$cal = $this->service->buildDateFromContact($data, $fieldType, $prefix, $configuredReminder);
|
$cal = $this->service->buildDateFromContact($data, $fieldType, $prefix, $configuredReminder);
|
||||||
|
|
@ -198,7 +198,7 @@ class BirthdayServiceTest extends TestCase {
|
||||||
$service->onCardChanged(666, 'gump.vcf', '');
|
$service->onCardChanged(666, 'gump.vcf', '');
|
||||||
}
|
}
|
||||||
|
|
||||||
#[\PHPUnit\Framework\Attributes\DataProvider('providesCardChanges')]
|
#[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'providesCardChanges')]
|
||||||
public function testOnCardChanged(string $expectedOp): void {
|
public function testOnCardChanged(string $expectedOp): void {
|
||||||
$this->config->expects($this->once())
|
$this->config->expects($this->once())
|
||||||
->method('getAppValue')
|
->method('getAppValue')
|
||||||
|
|
@ -289,7 +289,7 @@ class BirthdayServiceTest extends TestCase {
|
||||||
$service->onCardChanged(666, 'gump.vcf', '');
|
$service->onCardChanged(666, 'gump.vcf', '');
|
||||||
}
|
}
|
||||||
|
|
||||||
#[\PHPUnit\Framework\Attributes\DataProvider('providesBirthday')]
|
#[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'providesBirthday')]
|
||||||
public function testBirthdayEvenChanged(bool $expected, string $old, string $new): void {
|
public function testBirthdayEvenChanged(bool $expected, string $old, string $new): void {
|
||||||
$new = Reader::read($new);
|
$new = Reader::read($new);
|
||||||
$this->assertEquals($expected, $this->service->birthdayEvenChanged($old, $new));
|
$this->assertEquals($expected, $this->service->birthdayEvenChanged($old, $new));
|
||||||
|
|
|
||||||
|
|
@ -46,7 +46,7 @@ use function time;
|
||||||
*
|
*
|
||||||
* @package OCA\DAV\Tests\unit\CardDAV
|
* @package OCA\DAV\Tests\unit\CardDAV
|
||||||
*/
|
*/
|
||||||
#[\PHPUnit\Framework\Attributes\Group('DB')]
|
#[\PHPUnit\Framework\Attributes\Group(name: 'DB')]
|
||||||
class CardDavBackendTest extends TestCase {
|
class CardDavBackendTest extends TestCase {
|
||||||
private Principal&MockObject $principal;
|
private Principal&MockObject $principal;
|
||||||
private IUserManager&MockObject $userManager;
|
private IUserManager&MockObject $userManager;
|
||||||
|
|
@ -656,7 +656,7 @@ class CardDavBackendTest extends TestCase {
|
||||||
$this->invokePrivate($this->backend, 'getCardId', [1, 'uri']);
|
$this->invokePrivate($this->backend, 'getCardId', [1, 'uri']);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[\PHPUnit\Framework\Attributes\DataProvider('dataTestSearch')]
|
#[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'dataTestSearch')]
|
||||||
public function testSearch(string $pattern, array $properties, array $options, array $expected): void {
|
public function testSearch(string $pattern, array $properties, array $options, array $expected): void {
|
||||||
/** @var VCard $vCards */
|
/** @var VCard $vCards */
|
||||||
$vCards = [];
|
$vCards = [];
|
||||||
|
|
|
||||||
|
|
@ -79,7 +79,7 @@ class ConverterTest extends TestCase {
|
||||||
return $accountManager;
|
return $accountManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
#[\PHPUnit\Framework\Attributes\DataProvider('providesNewUsers')]
|
#[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'providesNewUsers')]
|
||||||
public function testCreation($expectedVCard, $displayName = null, $eMailAddress = null, $cloudId = null): void {
|
public function testCreation($expectedVCard, $displayName = null, $eMailAddress = null, $cloudId = null): void {
|
||||||
$user = $this->getUserMock((string)$displayName, $eMailAddress, $cloudId);
|
$user = $this->getUserMock((string)$displayName, $eMailAddress, $cloudId);
|
||||||
$accountManager = $this->getAccountManager($user);
|
$accountManager = $this->getAccountManager($user);
|
||||||
|
|
@ -187,7 +187,7 @@ class ConverterTest extends TestCase {
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
#[\PHPUnit\Framework\Attributes\DataProvider('providesNames')]
|
#[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'providesNames')]
|
||||||
public function testNameSplitter(string $expected, string $fullName): void {
|
public function testNameSplitter(string $expected, string $fullName): void {
|
||||||
$converter = new Converter($this->accountManager, $this->userManager, $this->urlGenerator, $this->logger);
|
$converter = new Converter($this->accountManager, $this->userManager, $this->urlGenerator, $this->logger);
|
||||||
$r = $converter->splitFullName($fullName);
|
$r = $converter->splitFullName($fullName);
|
||||||
|
|
|
||||||
|
|
@ -45,7 +45,7 @@ class ImageExportPluginTest extends TestCase {
|
||||||
$this->plugin->initialize($this->server);
|
$this->plugin->initialize($this->server);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[\PHPUnit\Framework\Attributes\DataProvider('providesQueryParams')]
|
#[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'providesQueryParams')]
|
||||||
public function testQueryParams(array $param): void {
|
public function testQueryParams(array $param): void {
|
||||||
$this->request->expects($this->once())->method('getQueryParameters')->willReturn($param);
|
$this->request->expects($this->once())->method('getQueryParameters')->willReturn($param);
|
||||||
$result = $this->plugin->httpGet($this->request, $this->response);
|
$result = $this->plugin->httpGet($this->request, $this->response);
|
||||||
|
|
@ -86,7 +86,7 @@ class ImageExportPluginTest extends TestCase {
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
#[\PHPUnit\Framework\Attributes\DataProvider('dataTestCard')]
|
#[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'dataTestCard')]
|
||||||
public function testCard(?int $size, bool $photo): void {
|
public function testCard(?int $size, bool $photo): void {
|
||||||
$query = ['photo' => null];
|
$query = ['photo' => null];
|
||||||
if ($size !== null) {
|
if ($size !== null) {
|
||||||
|
|
|
||||||
|
|
@ -325,7 +325,7 @@ END:VCARD';
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
#[\PHPUnit\Framework\Attributes\DataProvider('dataActivatedUsers')]
|
#[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'dataActivatedUsers')]
|
||||||
public function testUpdateAndDeleteUser(bool $activated, int $createCalls, int $updateCalls, int $deleteCalls): void {
|
public function testUpdateAndDeleteUser(bool $activated, int $createCalls, int $updateCalls, int $deleteCalls): void {
|
||||||
/** @var CardDavBackend | MockObject $backend */
|
/** @var CardDavBackend | MockObject $backend */
|
||||||
$backend = $this->getMockBuilder(CardDavBackend::class)->disableOriginalConstructor()->getMock();
|
$backend = $this->getMockBuilder(CardDavBackend::class)->disableOriginalConstructor()->getMock();
|
||||||
|
|
@ -425,7 +425,7 @@ END:VCARD';
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[\PHPUnit\Framework\Attributes\DataProvider('providerUseAbsoluteUriReport')]
|
#[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'providerUseAbsoluteUriReport')]
|
||||||
public function testUseAbsoluteUriReport(string $host, string $expected): void {
|
public function testUseAbsoluteUriReport(string $host, string $expected): void {
|
||||||
$body = '<?xml version="1.0"?>
|
$body = '<?xml version="1.0"?>
|
||||||
<d:multistatus xmlns:d="DAV:" xmlns:s="http://sabredav.org/ns" xmlns:card="urn:ietf:params:xml:ns:carddav" xmlns:oc="http://owncloud.org/ns">
|
<d:multistatus xmlns:d="DAV:" xmlns:s="http://sabredav.org/ns" xmlns:card="urn:ietf:params:xml:ns:carddav" xmlns:oc="http://owncloud.org/ns">
|
||||||
|
|
|
||||||
|
|
@ -34,7 +34,7 @@ class SystemAddressBookTest extends TestCase {
|
||||||
private array $addressBookInfo;
|
private array $addressBookInfo;
|
||||||
private IL10N&MockObject $l10n;
|
private IL10N&MockObject $l10n;
|
||||||
private IConfig&MockObject $config;
|
private IConfig&MockObject $config;
|
||||||
private IUserSession $userSession;
|
private IUserSession&MockObject $userSession;
|
||||||
private IRequest&MockObject $request;
|
private IRequest&MockObject $request;
|
||||||
private array $server;
|
private array $server;
|
||||||
private TrustedServers&MockObject $trustedServers;
|
private TrustedServers&MockObject $trustedServers;
|
||||||
|
|
|
||||||
|
|
@ -78,7 +78,7 @@ class ListAddressbooksTest extends TestCase {
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
#[\PHPUnit\Framework\Attributes\DataProvider('dataExecute')]
|
#[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'dataExecute')]
|
||||||
public function testWithCorrectUser(bool $readOnly, string $output): void {
|
public function testWithCorrectUser(bool $readOnly, string $output): void {
|
||||||
$this->userManager->expects($this->once())
|
$this->userManager->expects($this->once())
|
||||||
->method('userExists')
|
->method('userExists')
|
||||||
|
|
|
||||||
|
|
@ -79,7 +79,7 @@ class ListCalendarsTest extends TestCase {
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
#[\PHPUnit\Framework\Attributes\DataProvider('dataExecute')]
|
#[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'dataExecute')]
|
||||||
public function testWithCorrectUser(bool $readOnly, string $output): void {
|
public function testWithCorrectUser(bool $readOnly, string $output): void {
|
||||||
$this->userManager->expects($this->once())
|
$this->userManager->expects($this->once())
|
||||||
->method('userExists')
|
->method('userExists')
|
||||||
|
|
|
||||||
|
|
@ -64,7 +64,7 @@ class MoveCalendarTest extends TestCase {
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
#[\PHPUnit\Framework\Attributes\DataProvider('dataExecute')]
|
#[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'dataExecute')]
|
||||||
public function testWithBadUserOrigin(bool $userOriginExists, bool $userDestinationExists): void {
|
public function testWithBadUserOrigin(bool $userOriginExists, bool $userDestinationExists): void {
|
||||||
$this->expectException(\InvalidArgumentException::class);
|
$this->expectException(\InvalidArgumentException::class);
|
||||||
|
|
||||||
|
|
@ -176,7 +176,7 @@ class MoveCalendarTest extends TestCase {
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
#[\PHPUnit\Framework\Attributes\DataProvider('dataTestMoveWithDestinationNotPartOfGroup')]
|
#[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'dataTestMoveWithDestinationNotPartOfGroup')]
|
||||||
public function testMoveWithDestinationNotPartOfGroup(bool $shareWithGroupMembersOnly): void {
|
public function testMoveWithDestinationNotPartOfGroup(bool $shareWithGroupMembersOnly): void {
|
||||||
$this->userManager->expects($this->exactly(2))
|
$this->userManager->expects($this->exactly(2))
|
||||||
->method('userExists')
|
->method('userExists')
|
||||||
|
|
@ -307,7 +307,7 @@ class MoveCalendarTest extends TestCase {
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
#[\PHPUnit\Framework\Attributes\DataProvider('dataTestMoveWithCalendarAlreadySharedToDestination')]
|
#[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'dataTestMoveWithCalendarAlreadySharedToDestination')]
|
||||||
public function testMoveWithCalendarAlreadySharedToDestination(bool $force): void {
|
public function testMoveWithCalendarAlreadySharedToDestination(bool $force): void {
|
||||||
$this->userManager->expects($this->exactly(2))
|
$this->userManager->expects($this->exactly(2))
|
||||||
->method('userExists')
|
->method('userExists')
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,7 @@ use Test\TestCase;
|
||||||
*
|
*
|
||||||
* @package OCA\DAV\Tests\Unit\Repair
|
* @package OCA\DAV\Tests\Unit\Repair
|
||||||
*/
|
*/
|
||||||
#[\PHPUnit\Framework\Attributes\Group('DB')]
|
#[\PHPUnit\Framework\Attributes\Group(name: 'DB')]
|
||||||
class RemoveInvalidSharesTest extends TestCase {
|
class RemoveInvalidSharesTest extends TestCase {
|
||||||
private RemoveInvalidShares $command;
|
private RemoveInvalidShares $command;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -469,7 +469,7 @@ class CommentsNodeTest extends \Test\TestCase {
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
#[\PHPUnit\Framework\Attributes\DataProvider('readCommentProvider')]
|
#[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'readCommentProvider')]
|
||||||
public function testGetPropertiesUnreadProperty(\DateTime $creationDT, ?\DateTime $readDT, string $expected): void {
|
public function testGetPropertiesUnreadProperty(\DateTime $creationDT, ?\DateTime $readDT, string $expected): void {
|
||||||
$this->comment->expects($this->any())
|
$this->comment->expects($this->any())
|
||||||
->method('getCreationDateTime')
|
->method('getCreationDateTime')
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,7 @@ use PHPUnit\Framework\MockObject\MockObject;
|
||||||
*
|
*
|
||||||
* @package OCA\DAV\Tests\unit\Connector
|
* @package OCA\DAV\Tests\unit\Connector
|
||||||
*/
|
*/
|
||||||
#[\PHPUnit\Framework\Attributes\Group('DB')]
|
#[\PHPUnit\Framework\Attributes\Group(name: 'DB')]
|
||||||
class LegacyPublicAuthTest extends \Test\TestCase {
|
class LegacyPublicAuthTest extends \Test\TestCase {
|
||||||
private ISession&MockObject $session;
|
private ISession&MockObject $session;
|
||||||
private IRequest&MockObject $request;
|
private IRequest&MockObject $request;
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,9 @@ use OCP\IUser;
|
||||||
use OCP\Security\Bruteforce\IThrottler;
|
use OCP\Security\Bruteforce\IThrottler;
|
||||||
use PHPUnit\Framework\MockObject\MockObject;
|
use PHPUnit\Framework\MockObject\MockObject;
|
||||||
use Sabre\DAV\Server;
|
use Sabre\DAV\Server;
|
||||||
|
use Sabre\HTTP\Request;
|
||||||
use Sabre\HTTP\RequestInterface;
|
use Sabre\HTTP\RequestInterface;
|
||||||
|
use Sabre\HTTP\Response;
|
||||||
use Sabre\HTTP\ResponseInterface;
|
use Sabre\HTTP\ResponseInterface;
|
||||||
use Test\TestCase;
|
use Test\TestCase;
|
||||||
|
|
||||||
|
|
@ -28,7 +30,7 @@ use Test\TestCase;
|
||||||
*
|
*
|
||||||
* @package OCA\DAV\Tests\unit\Connector\Sabre
|
* @package OCA\DAV\Tests\unit\Connector\Sabre
|
||||||
*/
|
*/
|
||||||
#[\PHPUnit\Framework\Attributes\Group('DB')]
|
#[\PHPUnit\Framework\Attributes\Group(name: 'DB')]
|
||||||
class AuthTest extends TestCase {
|
class AuthTest extends TestCase {
|
||||||
private ISession&MockObject $session;
|
private ISession&MockObject $session;
|
||||||
private Session&MockObject $userSession;
|
private Session&MockObject $userSession;
|
||||||
|
|
@ -454,8 +456,8 @@ class AuthTest extends TestCase {
|
||||||
|
|
||||||
public function testAuthenticateNoBasicAuthenticateHeadersProvided(): void {
|
public function testAuthenticateNoBasicAuthenticateHeadersProvided(): void {
|
||||||
$server = $this->createMock(Server::class);
|
$server = $this->createMock(Server::class);
|
||||||
$server->httpRequest = $this->createMock(RequestInterface::class);
|
$server->httpRequest = $this->createMock(Request::class);
|
||||||
$server->httpResponse = $this->createMock(ResponseInterface::class);
|
$server->httpResponse = $this->createMock(Response::class);
|
||||||
$response = $this->auth->check($server->httpRequest, $server->httpResponse);
|
$response = $this->auth->check($server->httpRequest, $server->httpResponse);
|
||||||
$this->assertEquals([false, 'No \'Authorization: Basic\' header found. Either the client didn\'t send one, or the server is misconfigured'], $response);
|
$this->assertEquals([false, 'No \'Authorization: Basic\' header found. Either the client didn\'t send one, or the server is misconfigured'], $response);
|
||||||
}
|
}
|
||||||
|
|
@ -525,9 +527,7 @@ class AuthTest extends TestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testAuthenticateNoBasicAuthenticateHeadersProvidedWithAjaxButUserIsStillLoggedIn(): void {
|
public function testAuthenticateNoBasicAuthenticateHeadersProvidedWithAjaxButUserIsStillLoggedIn(): void {
|
||||||
/** @var \Sabre\HTTP\RequestInterface $httpRequest */
|
|
||||||
$httpRequest = $this->createMock(RequestInterface::class);
|
$httpRequest = $this->createMock(RequestInterface::class);
|
||||||
/** @var \Sabre\HTTP\ResponseInterface $httpResponse */
|
|
||||||
$httpResponse = $this->createMock(ResponseInterface::class);
|
$httpResponse = $this->createMock(ResponseInterface::class);
|
||||||
$user = $this->createMock(IUser::class);
|
$user = $this->createMock(IUser::class);
|
||||||
$user->method('getUID')->willReturn('MyTestUser');
|
$user->method('getUID')->willReturn('MyTestUser');
|
||||||
|
|
@ -561,14 +561,14 @@ class AuthTest extends TestCase {
|
||||||
|
|
||||||
public function testAuthenticateValidCredentials(): void {
|
public function testAuthenticateValidCredentials(): void {
|
||||||
$server = $this->createMock(Server::class);
|
$server = $this->createMock(Server::class);
|
||||||
$server->httpRequest = $this->createMock(RequestInterface::class);
|
$server->httpRequest = $this->createMock(Request::class);
|
||||||
$server->httpRequest
|
$server->httpRequest
|
||||||
->expects($this->once())
|
->expects($this->once())
|
||||||
->method('getHeader')
|
->method('getHeader')
|
||||||
->with('Authorization')
|
->with('Authorization')
|
||||||
->willReturn('basic dXNlcm5hbWU6cGFzc3dvcmQ=');
|
->willReturn('basic dXNlcm5hbWU6cGFzc3dvcmQ=');
|
||||||
|
|
||||||
$server->httpResponse = $this->createMock(ResponseInterface::class);
|
$server->httpResponse = $this->createMock(Response::class);
|
||||||
$this->userSession
|
$this->userSession
|
||||||
->expects($this->once())
|
->expects($this->once())
|
||||||
->method('logClientIn')
|
->method('logClientIn')
|
||||||
|
|
@ -588,7 +588,7 @@ class AuthTest extends TestCase {
|
||||||
|
|
||||||
public function testAuthenticateInvalidCredentials(): void {
|
public function testAuthenticateInvalidCredentials(): void {
|
||||||
$server = $this->createMock(Server::class);
|
$server = $this->createMock(Server::class);
|
||||||
$server->httpRequest = $this->createMock(RequestInterface::class);
|
$server->httpRequest = $this->createMock(Request::class);
|
||||||
$server->httpRequest
|
$server->httpRequest
|
||||||
->expects($this->exactly(2))
|
->expects($this->exactly(2))
|
||||||
->method('getHeader')
|
->method('getHeader')
|
||||||
|
|
@ -596,7 +596,7 @@ class AuthTest extends TestCase {
|
||||||
['Authorization', 'basic dXNlcm5hbWU6cGFzc3dvcmQ='],
|
['Authorization', 'basic dXNlcm5hbWU6cGFzc3dvcmQ='],
|
||||||
['X-Requested-With', null],
|
['X-Requested-With', null],
|
||||||
]);
|
]);
|
||||||
$server->httpResponse = $this->createMock(ResponseInterface::class);
|
$server->httpResponse = $this->createMock(Response::class);
|
||||||
$this->userSession
|
$this->userSession
|
||||||
->expects($this->once())
|
->expects($this->once())
|
||||||
->method('logClientIn')
|
->method('logClientIn')
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,7 @@ use Sabre\HTTP\RequestInterface;
|
||||||
use Sabre\HTTP\ResponseInterface;
|
use Sabre\HTTP\ResponseInterface;
|
||||||
use Test\TestCase;
|
use Test\TestCase;
|
||||||
|
|
||||||
#[\PHPUnit\Framework\Attributes\Group('DB')]
|
#[\PHPUnit\Framework\Attributes\Group(name: 'DB')]
|
||||||
class BearerAuthTest extends TestCase {
|
class BearerAuthTest extends TestCase {
|
||||||
private IUserSession&MockObject $userSession;
|
private IUserSession&MockObject $userSession;
|
||||||
private ISession&MockObject $session;
|
private ISession&MockObject $session;
|
||||||
|
|
@ -74,7 +74,7 @@ class BearerAuthTest extends TestCase {
|
||||||
$request = $this->createMock(RequestInterface::class);
|
$request = $this->createMock(RequestInterface::class);
|
||||||
/** @var ResponseInterface&MockObject $response */
|
/** @var ResponseInterface&MockObject $response */
|
||||||
$response = $this->createMock(ResponseInterface::class);
|
$response = $this->createMock(ResponseInterface::class);
|
||||||
$result = $this->bearerAuth->challenge($request, $response);
|
$this->bearerAuth->challenge($request, $response);
|
||||||
$this->assertEmpty($result);
|
$this->assertTrue(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -55,7 +55,7 @@ class BlockLegacyClientPluginTest extends TestCase {
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
#[\PHPUnit\Framework\Attributes\DataProvider('oldDesktopClientProvider')]
|
#[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'oldDesktopClientProvider')]
|
||||||
public function testBeforeHandlerException(string $userAgent, ERROR_TYPE $errorType): void {
|
public function testBeforeHandlerException(string $userAgent, ERROR_TYPE $errorType): void {
|
||||||
$this->themingDefaults
|
$this->themingDefaults
|
||||||
->expects($this->atMost(1))
|
->expects($this->atMost(1))
|
||||||
|
|
@ -94,7 +94,7 @@ class BlockLegacyClientPluginTest extends TestCase {
|
||||||
/**
|
/**
|
||||||
* Ensure that there is no room for XSS attack through configured URL / version
|
* Ensure that there is no room for XSS attack through configured URL / version
|
||||||
*/
|
*/
|
||||||
#[\PHPUnit\Framework\Attributes\DataProvider('oldDesktopClientProvider')]
|
#[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'oldDesktopClientProvider')]
|
||||||
public function testBeforeHandlerExceptionPreventXSSAttack(string $userAgent, ERROR_TYPE $errorType): void {
|
public function testBeforeHandlerExceptionPreventXSSAttack(string $userAgent, ERROR_TYPE $errorType): void {
|
||||||
$this->expectException(\Sabre\DAV\Exception\Forbidden::class);
|
$this->expectException(\Sabre\DAV\Exception\Forbidden::class);
|
||||||
|
|
||||||
|
|
@ -140,7 +140,7 @@ class BlockLegacyClientPluginTest extends TestCase {
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
#[\PHPUnit\Framework\Attributes\DataProvider('newAndAlternateDesktopClientProvider')]
|
#[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'newAndAlternateDesktopClientProvider')]
|
||||||
public function testBeforeHandlerSuccess(string $userAgent): void {
|
public function testBeforeHandlerSuccess(string $userAgent): void {
|
||||||
/** @var RequestInterface|MockObject $request */
|
/** @var RequestInterface|MockObject $request */
|
||||||
$request = $this->createMock(RequestInterface::class);
|
$request = $this->createMock(RequestInterface::class);
|
||||||
|
|
|
||||||
|
|
@ -43,7 +43,7 @@ class CommentsPropertiesPluginTest extends \Test\TestCase {
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
#[\PHPUnit\Framework\Attributes\DataProvider('nodeProvider')]
|
#[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'nodeProvider')]
|
||||||
public function testHandleGetProperties(string $class, bool $expectedSuccessful): void {
|
public function testHandleGetProperties(string $class, bool $expectedSuccessful): void {
|
||||||
$propFind = $this->createMock(PropFind::class);
|
$propFind = $this->createMock(PropFind::class);
|
||||||
|
|
||||||
|
|
@ -67,7 +67,7 @@ class CommentsPropertiesPluginTest extends \Test\TestCase {
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
#[\PHPUnit\Framework\Attributes\DataProvider('baseUriProvider')]
|
#[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'baseUriProvider')]
|
||||||
public function testGetCommentsLink(string $baseUri, string $fid, ?string $expectedHref): void {
|
public function testGetCommentsLink(string $baseUri, string $fid, ?string $expectedHref): void {
|
||||||
$node = $this->createMock(File::class);
|
$node = $this->createMock(File::class);
|
||||||
$node->expects($this->any())
|
$node->expects($this->any())
|
||||||
|
|
@ -89,7 +89,7 @@ class CommentsPropertiesPluginTest extends \Test\TestCase {
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
#[\PHPUnit\Framework\Attributes\DataProvider('userProvider')]
|
#[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'userProvider')]
|
||||||
public function testGetUnreadCount(?string $user): void {
|
public function testGetUnreadCount(?string $user): void {
|
||||||
$node = $this->createMock(File::class);
|
$node = $this->createMock(File::class);
|
||||||
$node->expects($this->any())
|
$node->expects($this->any())
|
||||||
|
|
|
||||||
|
|
@ -13,6 +13,8 @@ use OCA\DAV\Connector\Sabre\File;
|
||||||
use Sabre\DAV\Exception\NotFound;
|
use Sabre\DAV\Exception\NotFound;
|
||||||
use Sabre\DAV\Server;
|
use Sabre\DAV\Server;
|
||||||
use Sabre\DAV\Tree;
|
use Sabre\DAV\Tree;
|
||||||
|
use Sabre\HTTP\Request;
|
||||||
|
use Sabre\HTTP\Response;
|
||||||
use Test\TestCase;
|
use Test\TestCase;
|
||||||
|
|
||||||
class CopyEtagHeaderPluginTest extends TestCase {
|
class CopyEtagHeaderPluginTest extends TestCase {
|
||||||
|
|
@ -27,8 +29,8 @@ class CopyEtagHeaderPluginTest extends TestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testCopyEtag(): void {
|
public function testCopyEtag(): void {
|
||||||
$request = new \Sabre\Http\Request('GET', 'dummy.file');
|
$request = new Request('GET', 'dummy.file');
|
||||||
$response = new \Sabre\Http\Response();
|
$response = new Response();
|
||||||
$response->setHeader('Etag', 'abcd');
|
$response->setHeader('Etag', 'abcd');
|
||||||
|
|
||||||
$this->plugin->afterMethod($request, $response);
|
$this->plugin->afterMethod($request, $response);
|
||||||
|
|
@ -37,8 +39,8 @@ class CopyEtagHeaderPluginTest extends TestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testNoopWhenEmpty(): void {
|
public function testNoopWhenEmpty(): void {
|
||||||
$request = new \Sabre\Http\Request('GET', 'dummy.file');
|
$request = new Request('GET', 'dummy.file');
|
||||||
$response = new \Sabre\Http\Response();
|
$response = new Response();
|
||||||
|
|
||||||
$this->plugin->afterMethod($request, $response);
|
$this->plugin->afterMethod($request, $response);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,7 @@ use Sabre\DAV\Tree;
|
||||||
*
|
*
|
||||||
* @package OCA\DAV\Tests\unit\Connector\Sabre
|
* @package OCA\DAV\Tests\unit\Connector\Sabre
|
||||||
*/
|
*/
|
||||||
#[\PHPUnit\Framework\Attributes\Group('DB')]
|
#[\PHPUnit\Framework\Attributes\Group(name: 'DB')]
|
||||||
class CustomPropertiesBackendTest extends \Test\TestCase {
|
class CustomPropertiesBackendTest extends \Test\TestCase {
|
||||||
private \Sabre\DAV\Server $server;
|
private \Sabre\DAV\Server $server;
|
||||||
private \Sabre\DAV\Tree&MockObject $tree;
|
private \Sabre\DAV\Tree&MockObject $tree;
|
||||||
|
|
|
||||||
|
|
@ -58,7 +58,7 @@ class TestViewDirectory extends View {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#[\PHPUnit\Framework\Attributes\Group('DB')]
|
#[\PHPUnit\Framework\Attributes\Group(name: 'DB')]
|
||||||
class DirectoryTest extends \Test\TestCase {
|
class DirectoryTest extends \Test\TestCase {
|
||||||
use UserTrait;
|
use UserTrait;
|
||||||
|
|
||||||
|
|
@ -514,20 +514,20 @@ class DirectoryTest extends \Test\TestCase {
|
||||||
$this->assertEquals([200, 800], $dir->getQuotaInfo()); //200 used, 800 free
|
$this->assertEquals([200, 800], $dir->getQuotaInfo()); //200 used, 800 free
|
||||||
}
|
}
|
||||||
|
|
||||||
#[\PHPUnit\Framework\Attributes\DataProvider('moveFailedProvider')]
|
#[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'moveFailedProvider')]
|
||||||
public function testMoveFailed(string $source, string $destination, array $updatables, array $deletables): void {
|
public function testMoveFailed(string $source, string $destination, array $updatables, array $deletables): void {
|
||||||
$this->expectException(\Sabre\DAV\Exception\Forbidden::class);
|
$this->expectException(\Sabre\DAV\Exception\Forbidden::class);
|
||||||
|
|
||||||
$this->moveTest($source, $destination, $updatables, $deletables);
|
$this->moveTest($source, $destination, $updatables, $deletables);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[\PHPUnit\Framework\Attributes\DataProvider('moveSuccessProvider')]
|
#[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'moveSuccessProvider')]
|
||||||
public function testMoveSuccess(string $source, string $destination, array $updatables, array $deletables): void {
|
public function testMoveSuccess(string $source, string $destination, array $updatables, array $deletables): void {
|
||||||
$this->moveTest($source, $destination, $updatables, $deletables);
|
$this->moveTest($source, $destination, $updatables, $deletables);
|
||||||
$this->addToAssertionCount(1);
|
$this->addToAssertionCount(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[\PHPUnit\Framework\Attributes\DataProvider('moveFailedInvalidCharsProvider')]
|
#[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'moveFailedInvalidCharsProvider')]
|
||||||
public function testMoveFailedInvalidChars(string $source, string $destination, array $updatables, array $deletables): void {
|
public function testMoveFailedInvalidChars(string $source, string $destination, array $updatables, array $deletables): void {
|
||||||
$this->expectException(InvalidPath::class);
|
$this->expectException(InvalidPath::class);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -40,9 +40,7 @@ class DummyGetResponsePluginTest extends TestCase {
|
||||||
|
|
||||||
|
|
||||||
public function testHttpGet(): void {
|
public function testHttpGet(): void {
|
||||||
/** @var \Sabre\HTTP\RequestInterface $request */
|
|
||||||
$request = $this->createMock(RequestInterface::class);
|
$request = $this->createMock(RequestInterface::class);
|
||||||
/** @var \Sabre\HTTP\ResponseInterface $response */
|
|
||||||
$response = $this->createMock(ResponseInterface::class);
|
$response = $this->createMock(ResponseInterface::class);
|
||||||
$response
|
$response
|
||||||
->expects($this->once())
|
->expects($this->once())
|
||||||
|
|
|
||||||
|
|
@ -42,7 +42,7 @@ class ExceptionLoggerPluginTest extends TestCase {
|
||||||
$this->plugin->initialize($this->server);
|
$this->plugin->initialize($this->server);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[\PHPUnit\Framework\Attributes\DataProvider('providesExceptions')]
|
#[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'providesExceptions')]
|
||||||
public function testLogging(string $expectedLogLevel, \Throwable $e): void {
|
public function testLogging(string $expectedLogLevel, \Throwable $e): void {
|
||||||
$this->init();
|
$this->init();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -119,7 +119,7 @@ class FakeLockerPluginTest extends TestCase {
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
#[\PHPUnit\Framework\Attributes\DataProvider('tokenDataProvider')]
|
#[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'tokenDataProvider')]
|
||||||
public function testValidateTokens(array $input, array $expected): void {
|
public function testValidateTokens(array $input, array $expected): void {
|
||||||
$request = $this->createMock(RequestInterface::class);
|
$request = $this->createMock(RequestInterface::class);
|
||||||
$this->fakeLockerPlugin->validateTokens($request, $input);
|
$this->fakeLockerPlugin->validateTokens($request, $input);
|
||||||
|
|
|
||||||
|
|
@ -49,7 +49,7 @@ use Test\Traits\UserTrait;
|
||||||
*
|
*
|
||||||
* @package OCA\DAV\Tests\unit\Connector\Sabre
|
* @package OCA\DAV\Tests\unit\Connector\Sabre
|
||||||
*/
|
*/
|
||||||
#[\PHPUnit\Framework\Attributes\Group('DB')]
|
#[\PHPUnit\Framework\Attributes\Group(name: 'DB')]
|
||||||
class FileTest extends TestCase {
|
class FileTest extends TestCase {
|
||||||
use MountProviderTrait;
|
use MountProviderTrait;
|
||||||
use UserTrait;
|
use UserTrait;
|
||||||
|
|
@ -150,7 +150,7 @@ class FileTest extends TestCase {
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
#[\PHPUnit\Framework\Attributes\DataProvider('fopenFailuresProvider')]
|
#[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'fopenFailuresProvider')]
|
||||||
public function testSimplePutFails(?\Throwable $thrownException, string $expectedException, bool $checkPreviousClass = true): void {
|
public function testSimplePutFails(?\Throwable $thrownException, string $expectedException, bool $checkPreviousClass = true): void {
|
||||||
// setup
|
// setup
|
||||||
$storage = $this->getMockBuilder(Local::class)
|
$storage = $this->getMockBuilder(Local::class)
|
||||||
|
|
@ -315,7 +315,7 @@ class FileTest extends TestCase {
|
||||||
/**
|
/**
|
||||||
* Test putting a file with string Mtime
|
* Test putting a file with string Mtime
|
||||||
*/
|
*/
|
||||||
#[\PHPUnit\Framework\Attributes\DataProvider('legalMtimeProvider')]
|
#[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'legalMtimeProvider')]
|
||||||
public function testPutSingleFileLegalMtime(mixed $requestMtime, ?int $resultMtime): void {
|
public function testPutSingleFileLegalMtime(mixed $requestMtime, ?int $resultMtime): void {
|
||||||
$request = new Request([
|
$request = new Request([
|
||||||
'server' => [
|
'server' => [
|
||||||
|
|
|
||||||
|
|
@ -26,16 +26,18 @@ use OCP\IPreview;
|
||||||
use OCP\IRequest;
|
use OCP\IRequest;
|
||||||
use OCP\IUserSession;
|
use OCP\IUserSession;
|
||||||
use PHPUnit\Framework\MockObject\MockObject;
|
use PHPUnit\Framework\MockObject\MockObject;
|
||||||
|
use Sabre\DAV\INode;
|
||||||
use Sabre\DAV\PropFind;
|
use Sabre\DAV\PropFind;
|
||||||
use Sabre\DAV\PropPatch;
|
use Sabre\DAV\PropPatch;
|
||||||
use Sabre\DAV\Server;
|
use Sabre\DAV\Server;
|
||||||
use Sabre\DAV\Tree;
|
use Sabre\DAV\Tree;
|
||||||
use Sabre\HTTP\RequestInterface;
|
use Sabre\HTTP\RequestInterface;
|
||||||
|
use Sabre\HTTP\Response;
|
||||||
use Sabre\HTTP\ResponseInterface;
|
use Sabre\HTTP\ResponseInterface;
|
||||||
use Sabre\Xml\Service;
|
use Sabre\Xml\Service;
|
||||||
use Test\TestCase;
|
use Test\TestCase;
|
||||||
|
|
||||||
#[\PHPUnit\Framework\Attributes\Group('DB')]
|
#[\PHPUnit\Framework\Attributes\Group(name: 'DB')]
|
||||||
class FilesPluginTest extends TestCase {
|
class FilesPluginTest extends TestCase {
|
||||||
|
|
||||||
private Tree&MockObject $tree;
|
private Tree&MockObject $tree;
|
||||||
|
|
@ -72,14 +74,17 @@ class FilesPluginTest extends TestCase {
|
||||||
$this->accountManager,
|
$this->accountManager,
|
||||||
);
|
);
|
||||||
|
|
||||||
$response = $this->createMock(ResponseInterface::class);
|
$response = $this->createMock(Response::class);
|
||||||
$this->server->httpResponse = $response;
|
$this->server->httpResponse = $response;
|
||||||
$this->server->xml = new Service();
|
$this->server->xml = new Service();
|
||||||
|
|
||||||
$this->plugin->initialize($this->server);
|
$this->plugin->initialize($this->server);
|
||||||
}
|
}
|
||||||
|
|
||||||
private function createTestNode(string $class, string $path = '/dummypath'): MockObject {
|
/**
|
||||||
|
* @param class-string<INode> $class
|
||||||
|
*/
|
||||||
|
private function createTestNode(string $class, string $path = '/dummypath'): INode&MockObject {
|
||||||
$node = $this->createMock($class);
|
$node = $this->createMock($class);
|
||||||
|
|
||||||
$node->expects($this->any())
|
$node->expects($this->any())
|
||||||
|
|
@ -650,7 +655,7 @@ class FilesPluginTest extends TestCase {
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
#[\PHPUnit\Framework\Attributes\DataProvider('downloadHeadersProvider')]
|
#[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'downloadHeadersProvider')]
|
||||||
public function testDownloadHeaders(bool $isClumsyAgent, string $contentDispositionHeader): void {
|
public function testDownloadHeaders(bool $isClumsyAgent, string $contentDispositionHeader): void {
|
||||||
$request = $this->createMock(RequestInterface::class);
|
$request = $this->createMock(RequestInterface::class);
|
||||||
$response = $this->createMock(ResponseInterface::class);
|
$response = $this->createMock(ResponseInterface::class);
|
||||||
|
|
|
||||||
|
|
@ -846,7 +846,7 @@ class FilesReportPluginTest extends \Test\TestCase {
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
#[\PHPUnit\Framework\Attributes\DataProvider('filesBaseUriProvider')]
|
#[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'filesBaseUriProvider')]
|
||||||
public function testFilesBaseUri(string $uri, string $reportPath, string $expectedUri): void {
|
public function testFilesBaseUri(string $uri, string $reportPath, string $expectedUri): void {
|
||||||
$this->assertEquals($expectedUri, self::invokePrivate($this->plugin, 'getFilesBaseUri', [$uri, $reportPath]));
|
$this->assertEquals($expectedUri, self::invokePrivate($this->plugin, 'getFilesBaseUri', [$uri, $reportPath]));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -31,7 +31,7 @@ use PHPUnit\Framework\MockObject\MockObject;
|
||||||
*
|
*
|
||||||
* @package OCA\DAV\Tests\unit\Connector\Sabre
|
* @package OCA\DAV\Tests\unit\Connector\Sabre
|
||||||
*/
|
*/
|
||||||
#[\PHPUnit\Framework\Attributes\Group('DB')]
|
#[\PHPUnit\Framework\Attributes\Group(name: 'DB')]
|
||||||
class NodeTest extends \Test\TestCase {
|
class NodeTest extends \Test\TestCase {
|
||||||
public static function davPermissionsProvider(): array {
|
public static function davPermissionsProvider(): array {
|
||||||
return [
|
return [
|
||||||
|
|
@ -51,7 +51,7 @@ class NodeTest extends \Test\TestCase {
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
#[\PHPUnit\Framework\Attributes\DataProvider('davPermissionsProvider')]
|
#[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'davPermissionsProvider')]
|
||||||
public function testDavPermissions(int $permissions, string $type, bool $shared, int $shareRootPermissions, bool $mounted, string $internalPath, string $expected): void {
|
public function testDavPermissions(int $permissions, string $type, bool $shared, int $shareRootPermissions, bool $mounted, string $internalPath, string $expected): void {
|
||||||
$info = $this->getMockBuilder(FileInfo::class)
|
$info = $this->getMockBuilder(FileInfo::class)
|
||||||
->disableOriginalConstructor()
|
->disableOriginalConstructor()
|
||||||
|
|
@ -139,7 +139,7 @@ class NodeTest extends \Test\TestCase {
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
#[\PHPUnit\Framework\Attributes\DataProvider('sharePermissionsProvider')]
|
#[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'sharePermissionsProvider')]
|
||||||
public function testSharePermissions(string $type, ?string $user, int $permissions, int $expected): void {
|
public function testSharePermissions(string $type, ?string $user, int $permissions, int $expected): void {
|
||||||
$storage = $this->createMock(IStorage::class);
|
$storage = $this->createMock(IStorage::class);
|
||||||
$storage->method('getPermissions')->willReturn($permissions);
|
$storage->method('getPermissions')->willReturn($permissions);
|
||||||
|
|
@ -238,7 +238,7 @@ class NodeTest extends \Test\TestCase {
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
#[\PHPUnit\Framework\Attributes\DataProvider('sanitizeMtimeProvider')]
|
#[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'sanitizeMtimeProvider')]
|
||||||
public function testSanitizeMtime(string|int $mtime, int $expected): void {
|
public function testSanitizeMtime(string|int $mtime, int $expected): void {
|
||||||
$view = $this->getMockBuilder(View::class)
|
$view = $this->getMockBuilder(View::class)
|
||||||
->disableOriginalConstructor()
|
->disableOriginalConstructor()
|
||||||
|
|
@ -258,7 +258,7 @@ class NodeTest extends \Test\TestCase {
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
#[\PHPUnit\Framework\Attributes\DataProvider('invalidSanitizeMtimeProvider')]
|
#[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'invalidSanitizeMtimeProvider')]
|
||||||
public function testInvalidSanitizeMtime(int|string $mtime): void {
|
public function testInvalidSanitizeMtime(int|string $mtime): void {
|
||||||
$this->expectException(\InvalidArgumentException::class);
|
$this->expectException(\InvalidArgumentException::class);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -26,7 +26,7 @@ use OCP\Files\Mount\IMountManager;
|
||||||
*
|
*
|
||||||
* @package OCA\DAV\Tests\Unit\Connector\Sabre
|
* @package OCA\DAV\Tests\Unit\Connector\Sabre
|
||||||
*/
|
*/
|
||||||
#[\PHPUnit\Framework\Attributes\Group('DB')]
|
#[\PHPUnit\Framework\Attributes\Group(name: 'DB')]
|
||||||
class ObjectTreeTest extends \Test\TestCase {
|
class ObjectTreeTest extends \Test\TestCase {
|
||||||
public static function copyDataProvider(): array {
|
public static function copyDataProvider(): array {
|
||||||
return [
|
return [
|
||||||
|
|
@ -39,7 +39,7 @@ class ObjectTreeTest extends \Test\TestCase {
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
#[\PHPUnit\Framework\Attributes\DataProvider('copyDataProvider')]
|
#[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'copyDataProvider')]
|
||||||
public function testCopy(string $sourcePath, string $targetPath, string $targetParent): void {
|
public function testCopy(string $sourcePath, string $targetPath, string $targetParent): void {
|
||||||
$view = $this->createMock(View::class);
|
$view = $this->createMock(View::class);
|
||||||
$view->expects($this->once())
|
$view->expects($this->once())
|
||||||
|
|
@ -81,7 +81,7 @@ class ObjectTreeTest extends \Test\TestCase {
|
||||||
$objectTree->copy($sourcePath, $targetPath);
|
$objectTree->copy($sourcePath, $targetPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[\PHPUnit\Framework\Attributes\DataProvider('copyDataProvider')]
|
#[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'copyDataProvider')]
|
||||||
public function testCopyFailNotCreatable($sourcePath, $targetPath, $targetParent): void {
|
public function testCopyFailNotCreatable($sourcePath, $targetPath, $targetParent): void {
|
||||||
$this->expectException(\Sabre\DAV\Exception\Forbidden::class);
|
$this->expectException(\Sabre\DAV\Exception\Forbidden::class);
|
||||||
|
|
||||||
|
|
@ -120,7 +120,7 @@ class ObjectTreeTest extends \Test\TestCase {
|
||||||
$objectTree->copy($sourcePath, $targetPath);
|
$objectTree->copy($sourcePath, $targetPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[\PHPUnit\Framework\Attributes\DataProvider('nodeForPathProvider')]
|
#[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'nodeForPathProvider')]
|
||||||
public function testGetNodeForPath(
|
public function testGetNodeForPath(
|
||||||
string $inputFileName,
|
string $inputFileName,
|
||||||
string $fileInfoQueryPath,
|
string $fileInfoQueryPath,
|
||||||
|
|
|
||||||
|
|
@ -463,7 +463,7 @@ class PrincipalTest extends TestCase {
|
||||||
['{http://sabredav.org/ns}email-address' => 'foo']));
|
['{http://sabredav.org/ns}email-address' => 'foo']));
|
||||||
}
|
}
|
||||||
|
|
||||||
#[\PHPUnit\Framework\Attributes\DataProvider('searchPrincipalsDataProvider')]
|
#[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'searchPrincipalsDataProvider')]
|
||||||
public function testSearchPrincipals(bool $sharingEnabled, bool $groupsOnly, string $test, array $result): void {
|
public function testSearchPrincipals(bool $sharingEnabled, bool $groupsOnly, string $test, array $result): void {
|
||||||
$this->shareManager->expects($this->once())
|
$this->shareManager->expects($this->once())
|
||||||
->method('shareAPIEnabled')
|
->method('shareAPIEnabled')
|
||||||
|
|
@ -824,7 +824,7 @@ class PrincipalTest extends TestCase {
|
||||||
$this->assertEquals(null, $this->connector->findByUri('mailto:user@foo.com', 'principals/users'));
|
$this->assertEquals(null, $this->connector->findByUri('mailto:user@foo.com', 'principals/users'));
|
||||||
}
|
}
|
||||||
|
|
||||||
#[\PHPUnit\Framework\Attributes\DataProvider('findByUriWithGroupRestrictionDataProvider')]
|
#[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'findByUriWithGroupRestrictionDataProvider')]
|
||||||
public function testFindByUriWithGroupRestriction(string $uri, string $email, ?string $expects): void {
|
public function testFindByUriWithGroupRestriction(string $uri, string $email, ?string $expects): void {
|
||||||
$this->shareManager->expects($this->once())
|
$this->shareManager->expects($this->once())
|
||||||
->method('shareApiEnabled')
|
->method('shareApiEnabled')
|
||||||
|
|
@ -875,7 +875,7 @@ class PrincipalTest extends TestCase {
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
#[\PHPUnit\Framework\Attributes\DataProvider('findByUriWithoutGroupRestrictionDataProvider')]
|
#[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'findByUriWithoutGroupRestrictionDataProvider')]
|
||||||
public function testFindByUriWithoutGroupRestriction(string $uri, string $email, string $expects): void {
|
public function testFindByUriWithoutGroupRestriction(string $uri, string $email, string $expects): void {
|
||||||
$this->shareManager->expects($this->once())
|
$this->shareManager->expects($this->once())
|
||||||
->method('shareApiEnabled')
|
->method('shareApiEnabled')
|
||||||
|
|
|
||||||
|
|
@ -105,7 +105,7 @@ class PropFindMonitorPluginTest extends TestCase {
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
#[\PHPUnit\Framework\Attributes\DataProvider('dataTest')]
|
#[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'dataTest')]
|
||||||
public function test(array $queries, $expectedLogCalls): void {
|
public function test(array $queries, $expectedLogCalls): void {
|
||||||
$this->plugin->initialize($this->server);
|
$this->plugin->initialize($this->server);
|
||||||
$this->server->expects($this->once())->method('getPluginQueries')
|
$this->server->expects($this->once())->method('getPluginQueries')
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,7 @@ use Psr\Log\LoggerInterface;
|
||||||
*
|
*
|
||||||
* @package OCA\DAV\Tests\unit\Connector
|
* @package OCA\DAV\Tests\unit\Connector
|
||||||
*/
|
*/
|
||||||
#[\PHPUnit\Framework\Attributes\Group('DB')]
|
#[\PHPUnit\Framework\Attributes\Group(name: 'DB')]
|
||||||
class PublicAuthTest extends \Test\TestCase {
|
class PublicAuthTest extends \Test\TestCase {
|
||||||
|
|
||||||
private ISession&MockObject $session;
|
private ISession&MockObject $session;
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,7 @@ class QuotaPluginTest extends TestCase {
|
||||||
$this->plugin->initialize($this->server);
|
$this->plugin->initialize($this->server);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[\PHPUnit\Framework\Attributes\DataProvider('lengthProvider')]
|
#[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'lengthProvider')]
|
||||||
public function testLength(?int $expected, array $headers): void {
|
public function testLength(?int $expected, array $headers): void {
|
||||||
$this->init(0);
|
$this->init(0);
|
||||||
|
|
||||||
|
|
@ -34,7 +34,7 @@ class QuotaPluginTest extends TestCase {
|
||||||
$this->assertEquals($expected, $length);
|
$this->assertEquals($expected, $length);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[\PHPUnit\Framework\Attributes\DataProvider('quotaOkayProvider')]
|
#[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'quotaOkayProvider')]
|
||||||
public function testCheckQuota(int $quota, array $headers): void {
|
public function testCheckQuota(int $quota, array $headers): void {
|
||||||
$this->init($quota);
|
$this->init($quota);
|
||||||
|
|
||||||
|
|
@ -43,7 +43,7 @@ class QuotaPluginTest extends TestCase {
|
||||||
$this->assertTrue($result);
|
$this->assertTrue($result);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[\PHPUnit\Framework\Attributes\DataProvider('quotaExceededProvider')]
|
#[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'quotaExceededProvider')]
|
||||||
public function testCheckExceededQuota(int $quota, array $headers): void {
|
public function testCheckExceededQuota(int $quota, array $headers): void {
|
||||||
$this->expectException(\Sabre\DAV\Exception\InsufficientStorage::class);
|
$this->expectException(\Sabre\DAV\Exception\InsufficientStorage::class);
|
||||||
|
|
||||||
|
|
@ -53,7 +53,7 @@ class QuotaPluginTest extends TestCase {
|
||||||
$this->plugin->checkQuota('');
|
$this->plugin->checkQuota('');
|
||||||
}
|
}
|
||||||
|
|
||||||
#[\PHPUnit\Framework\Attributes\DataProvider('quotaOkayProvider')]
|
#[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'quotaOkayProvider')]
|
||||||
public function testCheckQuotaOnPath(int $quota, array $headers): void {
|
public function testCheckQuotaOnPath(int $quota, array $headers): void {
|
||||||
$this->init($quota, 'sub/test.txt');
|
$this->init($quota, 'sub/test.txt');
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@ use OCP\Files\FileInfo;
|
||||||
*
|
*
|
||||||
* @package OCA\DAV\Tests\unit\Connector\Sabre\RequestTest
|
* @package OCA\DAV\Tests\unit\Connector\Sabre\RequestTest
|
||||||
*/
|
*/
|
||||||
#[\PHPUnit\Framework\Attributes\Group('DB')]
|
#[\PHPUnit\Framework\Attributes\Group(name: 'DB')]
|
||||||
class DeleteTest extends RequestTestCase {
|
class DeleteTest extends RequestTestCase {
|
||||||
public function testBasicUpload(): void {
|
public function testBasicUpload(): void {
|
||||||
$user = self::getUniqueID();
|
$user = self::getUniqueID();
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@ use OCP\Lock\ILockingProvider;
|
||||||
*
|
*
|
||||||
* @package OCA\DAV\Tests\unit\Connector\Sabre\RequestTest
|
* @package OCA\DAV\Tests\unit\Connector\Sabre\RequestTest
|
||||||
*/
|
*/
|
||||||
#[\PHPUnit\Framework\Attributes\Group('DB')]
|
#[\PHPUnit\Framework\Attributes\Group(name: 'DB')]
|
||||||
class DownloadTest extends RequestTestCase {
|
class DownloadTest extends RequestTestCase {
|
||||||
public function testDownload(): void {
|
public function testDownload(): void {
|
||||||
$user = self::getUniqueID();
|
$user = self::getUniqueID();
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,7 @@ use Test\Traits\EncryptionTrait;
|
||||||
*
|
*
|
||||||
* @package OCA\DAV\Tests\Unit\Connector\Sabre\RequestTest
|
* @package OCA\DAV\Tests\Unit\Connector\Sabre\RequestTest
|
||||||
*/
|
*/
|
||||||
#[\PHPUnit\Framework\Attributes\Group('DB')]
|
#[\PHPUnit\Framework\Attributes\Group(name: 'DB')]
|
||||||
class EncryptionMasterKeyUploadTest extends UploadTest {
|
class EncryptionMasterKeyUploadTest extends UploadTest {
|
||||||
use EncryptionTrait;
|
use EncryptionTrait;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,7 @@ use Test\Traits\EncryptionTrait;
|
||||||
*
|
*
|
||||||
* @package OCA\DAV\Tests\Unit\Connector\Sabre\RequestTest
|
* @package OCA\DAV\Tests\Unit\Connector\Sabre\RequestTest
|
||||||
*/
|
*/
|
||||||
#[\PHPUnit\Framework\Attributes\Group('DB')]
|
#[\PHPUnit\Framework\Attributes\Group(name: 'DB')]
|
||||||
class EncryptionUploadTest extends UploadTest {
|
class EncryptionUploadTest extends UploadTest {
|
||||||
use EncryptionTrait;
|
use EncryptionTrait;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@ use OCP\Server;
|
||||||
*
|
*
|
||||||
* @package OCA\DAV\Tests\unit\Connector\Sabre\RequestTest
|
* @package OCA\DAV\Tests\unit\Connector\Sabre\RequestTest
|
||||||
*/
|
*/
|
||||||
#[\PHPUnit\Framework\Attributes\Group('DB')]
|
#[\PHPUnit\Framework\Attributes\Group(name: 'DB')]
|
||||||
class PartFileInRootUploadTest extends UploadTest {
|
class PartFileInRootUploadTest extends UploadTest {
|
||||||
protected function setUp(): void {
|
protected function setUp(): void {
|
||||||
$config = Server::get(IConfig::class);
|
$config = Server::get(IConfig::class);
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,7 @@ use OCP\Lock\ILockingProvider;
|
||||||
*
|
*
|
||||||
* @package OCA\DAV\Tests\unit\Connector\Sabre\RequestTest
|
* @package OCA\DAV\Tests\unit\Connector\Sabre\RequestTest
|
||||||
*/
|
*/
|
||||||
#[\PHPUnit\Framework\Attributes\Group('DB')]
|
#[\PHPUnit\Framework\Attributes\Group(name: 'DB')]
|
||||||
class UploadTest extends RequestTestCase {
|
class UploadTest extends RequestTestCase {
|
||||||
public function testBasicUpload(): void {
|
public function testBasicUpload(): void {
|
||||||
$user = self::getUniqueID();
|
$user = self::getUniqueID();
|
||||||
|
|
|
||||||
|
|
@ -51,7 +51,7 @@ class SharesPluginTest extends \Test\TestCase {
|
||||||
$this->plugin->initialize($this->server);
|
$this->plugin->initialize($this->server);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[\PHPUnit\Framework\Attributes\DataProvider('sharesGetPropertiesDataProvider')]
|
#[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'sharesGetPropertiesDataProvider')]
|
||||||
public function testGetProperties(array $shareTypes): void {
|
public function testGetProperties(array $shareTypes): void {
|
||||||
$sabreNode = $this->createMock(Node::class);
|
$sabreNode = $this->createMock(Node::class);
|
||||||
$sabreNode->expects($this->any())
|
$sabreNode->expects($this->any())
|
||||||
|
|
@ -114,7 +114,7 @@ class SharesPluginTest extends \Test\TestCase {
|
||||||
$this->assertEquals($shareTypes, $result[200][self::SHARETYPES_PROPERTYNAME]->getShareTypes());
|
$this->assertEquals($shareTypes, $result[200][self::SHARETYPES_PROPERTYNAME]->getShareTypes());
|
||||||
}
|
}
|
||||||
|
|
||||||
#[\PHPUnit\Framework\Attributes\DataProvider('sharesGetPropertiesDataProvider')]
|
#[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'sharesGetPropertiesDataProvider')]
|
||||||
public function testPreloadThenGetProperties(array $shareTypes): void {
|
public function testPreloadThenGetProperties(array $shareTypes): void {
|
||||||
$sabreNode1 = $this->createMock(File::class);
|
$sabreNode1 = $this->createMock(File::class);
|
||||||
$sabreNode1->method('getId')
|
$sabreNode1->method('getId')
|
||||||
|
|
|
||||||
|
|
@ -58,7 +58,7 @@ class TagsPluginTest extends \Test\TestCase {
|
||||||
$this->plugin->initialize($this->server);
|
$this->plugin->initialize($this->server);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[\PHPUnit\Framework\Attributes\DataProvider('tagsGetPropertiesDataProvider')]
|
#[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'tagsGetPropertiesDataProvider')]
|
||||||
public function testGetProperties(array $tags, array $requestedProperties, array $expectedProperties): void {
|
public function testGetProperties(array $tags, array $requestedProperties, array $expectedProperties): void {
|
||||||
$node = $this->createMock(Node::class);
|
$node = $this->createMock(Node::class);
|
||||||
$node->expects($this->any())
|
$node->expects($this->any())
|
||||||
|
|
@ -93,7 +93,7 @@ class TagsPluginTest extends \Test\TestCase {
|
||||||
$this->assertEquals($expectedProperties, $result);
|
$this->assertEquals($expectedProperties, $result);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[\PHPUnit\Framework\Attributes\DataProvider('tagsGetPropertiesDataProvider')]
|
#[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'tagsGetPropertiesDataProvider')]
|
||||||
public function testPreloadThenGetProperties(array $tags, array $requestedProperties, array $expectedProperties): void {
|
public function testPreloadThenGetProperties(array $tags, array $requestedProperties, array $expectedProperties): void {
|
||||||
$node1 = $this->createMock(File::class);
|
$node1 = $this->createMock(File::class);
|
||||||
$node1->expects($this->any())
|
$node1->expects($this->any())
|
||||||
|
|
|
||||||
|
|
@ -45,7 +45,7 @@ class ServerTest extends TestCase {
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
#[DataProvider('removeAllListenersData')]
|
#[DataProvider(methodName: 'removeAllListenersData')]
|
||||||
public function testRemoveAllListeners(?string $removeEventName): void {
|
public function testRemoveAllListeners(?string $removeEventName): void {
|
||||||
$listener = static function () {
|
$listener = static function () {
|
||||||
return false;
|
return false;
|
||||||
|
|
|
||||||
|
|
@ -53,7 +53,7 @@ class InvitationResponseControllerTest extends TestCase {
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
#[\PHPUnit\Framework\Attributes\DataProvider('attendeeProvider')]
|
#[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'attendeeProvider')]
|
||||||
public function testAccept(bool $isExternalAttendee): void {
|
public function testAccept(bool $isExternalAttendee): void {
|
||||||
$this->buildQueryExpects('TOKEN123', [
|
$this->buildQueryExpects('TOKEN123', [
|
||||||
'id' => 0,
|
'id' => 0,
|
||||||
|
|
@ -115,7 +115,7 @@ EOF;
|
||||||
$this->assertTrue($called);
|
$this->assertTrue($called);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[\PHPUnit\Framework\Attributes\DataProvider('attendeeProvider')]
|
#[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'attendeeProvider')]
|
||||||
public function testAcceptSequence(bool $isExternalAttendee): void {
|
public function testAcceptSequence(bool $isExternalAttendee): void {
|
||||||
$this->buildQueryExpects('TOKEN123', [
|
$this->buildQueryExpects('TOKEN123', [
|
||||||
'id' => 0,
|
'id' => 0,
|
||||||
|
|
@ -177,7 +177,7 @@ EOF;
|
||||||
$this->assertTrue($called);
|
$this->assertTrue($called);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[\PHPUnit\Framework\Attributes\DataProvider('attendeeProvider')]
|
#[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'attendeeProvider')]
|
||||||
public function testAcceptRecurrenceId(bool $isExternalAttendee): void {
|
public function testAcceptRecurrenceId(bool $isExternalAttendee): void {
|
||||||
$this->buildQueryExpects('TOKEN123', [
|
$this->buildQueryExpects('TOKEN123', [
|
||||||
'id' => 0,
|
'id' => 0,
|
||||||
|
|
@ -267,7 +267,7 @@ EOF;
|
||||||
$this->assertEquals([], $response->getParams());
|
$this->assertEquals([], $response->getParams());
|
||||||
}
|
}
|
||||||
|
|
||||||
#[\PHPUnit\Framework\Attributes\DataProvider('attendeeProvider')]
|
#[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'attendeeProvider')]
|
||||||
public function testDecline(bool $isExternalAttendee): void {
|
public function testDecline(bool $isExternalAttendee): void {
|
||||||
$this->buildQueryExpects('TOKEN123', [
|
$this->buildQueryExpects('TOKEN123', [
|
||||||
'id' => 0,
|
'id' => 0,
|
||||||
|
|
@ -336,7 +336,7 @@ EOF;
|
||||||
$this->assertEquals(['token' => 'TOKEN123'], $response->getParams());
|
$this->assertEquals(['token' => 'TOKEN123'], $response->getParams());
|
||||||
}
|
}
|
||||||
|
|
||||||
#[\PHPUnit\Framework\Attributes\DataProvider('attendeeProvider')]
|
#[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'attendeeProvider')]
|
||||||
public function testProcessMoreOptionsResult(bool $isExternalAttendee): void {
|
public function testProcessMoreOptionsResult(bool $isExternalAttendee): void {
|
||||||
$this->request->expects($this->once())
|
$this->request->expects($this->once())
|
||||||
->method('getParam')
|
->method('getParam')
|
||||||
|
|
@ -430,7 +430,7 @@ EOF;
|
||||||
$expr->expects($this->once())
|
$expr->expects($this->once())
|
||||||
->method('eq')
|
->method('eq')
|
||||||
->with('token', 'namedParameterToken')
|
->with('token', 'namedParameterToken')
|
||||||
->willReturn((string)$function);
|
->willReturn($function);
|
||||||
|
|
||||||
$this->dbConnection->expects($this->once())
|
$this->dbConnection->expects($this->once())
|
||||||
->method('getQueryBuilder')
|
->method('getQueryBuilder')
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@ use Sabre\HTTP\Response;
|
||||||
|
|
||||||
class BrowserErrorPagePluginTest extends \Test\TestCase {
|
class BrowserErrorPagePluginTest extends \Test\TestCase {
|
||||||
|
|
||||||
#[\PHPUnit\Framework\Attributes\DataProvider('providesExceptions')]
|
#[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'providesExceptions')]
|
||||||
public function test(int $expectedCode, \Throwable $exception): void {
|
public function test(int $expectedCode, \Throwable $exception): void {
|
||||||
/** @var BrowserErrorPagePlugin&MockObject $plugin */
|
/** @var BrowserErrorPagePlugin&MockObject $plugin */
|
||||||
$plugin = $this->getMockBuilder(BrowserErrorPagePlugin::class)->onlyMethods(['sendResponse', 'generateBody'])->getMock();
|
$plugin = $this->getMockBuilder(BrowserErrorPagePlugin::class)->onlyMethods(['sendResponse', 'generateBody'])->getMock();
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,7 @@ use Sabre\DAVACL\IACL;
|
||||||
use Sabre\DAVACL\IPrincipal;
|
use Sabre\DAVACL\IPrincipal;
|
||||||
use Test\TestCase;
|
use Test\TestCase;
|
||||||
|
|
||||||
#[\PHPUnit\Framework\Attributes\Group('DB')]
|
#[\PHPUnit\Framework\Attributes\Group(name: 'DB')]
|
||||||
class CustomPropertiesBackendTest extends TestCase {
|
class CustomPropertiesBackendTest extends TestCase {
|
||||||
private const BASE_URI = '/remote.php/dav/';
|
private const BASE_URI = '/remote.php/dav/';
|
||||||
|
|
||||||
|
|
@ -274,7 +274,7 @@ class CustomPropertiesBackendTest extends TestCase {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[\PHPUnit\Framework\Attributes\DataProvider('propFindPrincipalScheduleDefaultCalendarProviderUrlProvider')]
|
#[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'propFindPrincipalScheduleDefaultCalendarProviderUrlProvider')]
|
||||||
public function testPropFindPrincipalScheduleDefaultCalendarUrl(
|
public function testPropFindPrincipalScheduleDefaultCalendarUrl(
|
||||||
string $user,
|
string $user,
|
||||||
array $nodes,
|
array $nodes,
|
||||||
|
|
@ -336,7 +336,7 @@ class CustomPropertiesBackendTest extends TestCase {
|
||||||
$this->assertEquals($returnedProps, $setProps);
|
$this->assertEquals($returnedProps, $setProps);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[\PHPUnit\Framework\Attributes\DataProvider('propPatchProvider')]
|
#[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'propPatchProvider')]
|
||||||
public function testPropPatch(string $path, array $existing, array $props, array $result): void {
|
public function testPropPatch(string $path, array $existing, array $props, array $result): void {
|
||||||
$this->server->method('calculateUri')
|
$this->server->method('calculateUri')
|
||||||
->willReturnCallback(function ($uri) {
|
->willReturnCallback(function ($uri) {
|
||||||
|
|
@ -417,7 +417,7 @@ class CustomPropertiesBackendTest extends TestCase {
|
||||||
$this->assertEquals([], $storedProps);
|
$this->assertEquals([], $storedProps);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[\PHPUnit\Framework\Attributes\DataProvider('deleteProvider')]
|
#[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'deleteProvider')]
|
||||||
public function testDelete(string $path): void {
|
public function testDelete(string $path): void {
|
||||||
$this->insertProps('dummy_user_42', $path, ['foo' => 'bar']);
|
$this->insertProps('dummy_user_42', $path, ['foo' => 'bar']);
|
||||||
$this->backend->delete($path);
|
$this->backend->delete($path);
|
||||||
|
|
@ -431,7 +431,7 @@ class CustomPropertiesBackendTest extends TestCase {
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
#[\PHPUnit\Framework\Attributes\DataProvider('moveProvider')]
|
#[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'moveProvider')]
|
||||||
public function testMove(string $source, string $target): void {
|
public function testMove(string $source, string $target): void {
|
||||||
$this->insertProps('dummy_user_42', $source, ['foo' => 'bar']);
|
$this->insertProps('dummy_user_42', $source, ['foo' => 'bar']);
|
||||||
$this->backend->move($source, $target);
|
$this->backend->move($source, $target);
|
||||||
|
|
|
||||||
|
|
@ -192,7 +192,7 @@ class GroupPrincipalTest extends \Test\TestCase {
|
||||||
['{DAV:}displayname' => 'Foo']));
|
['{DAV:}displayname' => 'Foo']));
|
||||||
}
|
}
|
||||||
|
|
||||||
#[\PHPUnit\Framework\Attributes\DataProvider('searchPrincipalsDataProvider')]
|
#[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'searchPrincipalsDataProvider')]
|
||||||
public function testSearchPrincipals(bool $sharingEnabled, bool $groupSharingEnabled, bool $groupsOnly, string $test, array $result): void {
|
public function testSearchPrincipals(bool $sharingEnabled, bool $groupSharingEnabled, bool $groupsOnly, string $test, array $result): void {
|
||||||
$this->shareManager->expects($this->once())
|
$this->shareManager->expects($this->once())
|
||||||
->method('shareAPIEnabled')
|
->method('shareAPIEnabled')
|
||||||
|
|
@ -263,7 +263,7 @@ class GroupPrincipalTest extends \Test\TestCase {
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
#[\PHPUnit\Framework\Attributes\DataProvider('findByUriDataProvider')]
|
#[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'findByUriDataProvider')]
|
||||||
public function testFindByUri(bool $sharingEnabled, bool $groupSharingEnabled, bool $groupsOnly, string $findUri, ?string $result): void {
|
public function testFindByUri(bool $sharingEnabled, bool $groupSharingEnabled, bool $groupsOnly, string $findUri, ?string $result): void {
|
||||||
$this->shareManager->expects($this->once())
|
$this->shareManager->expects($this->once())
|
||||||
->method('shareAPIEnabled')
|
->method('shareAPIEnabled')
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@ use Test\TestCase;
|
||||||
|
|
||||||
class SystemPrincipalBackendTest extends TestCase {
|
class SystemPrincipalBackendTest extends TestCase {
|
||||||
|
|
||||||
#[\PHPUnit\Framework\Attributes\DataProvider('providesPrefix')]
|
#[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'providesPrefix')]
|
||||||
public function testGetPrincipalsByPrefix(array $expected, string $prefix): void {
|
public function testGetPrincipalsByPrefix(array $expected, string $prefix): void {
|
||||||
$backend = new SystemPrincipalBackend();
|
$backend = new SystemPrincipalBackend();
|
||||||
$result = $backend->getPrincipalsByPrefix($prefix);
|
$result = $backend->getPrincipalsByPrefix($prefix);
|
||||||
|
|
@ -36,7 +36,7 @@ class SystemPrincipalBackendTest extends TestCase {
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
#[\PHPUnit\Framework\Attributes\DataProvider('providesPath')]
|
#[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'providesPath')]
|
||||||
public function testGetPrincipalByPath(?array $expected, string $path): void {
|
public function testGetPrincipalByPath(?array $expected, string $path): void {
|
||||||
$backend = new SystemPrincipalBackend();
|
$backend = new SystemPrincipalBackend();
|
||||||
$result = $backend->getPrincipalByPath($path);
|
$result = $backend->getPrincipalByPath($path);
|
||||||
|
|
@ -55,7 +55,7 @@ class SystemPrincipalBackendTest extends TestCase {
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
#[\PHPUnit\Framework\Attributes\DataProvider('providesPrincipalForGetGroupMemberSet')]
|
#[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'providesPrincipalForGetGroupMemberSet')]
|
||||||
public function testGetGroupMemberSetExceptional(?string $principal): void {
|
public function testGetGroupMemberSetExceptional(?string $principal): void {
|
||||||
$this->expectException(Exception::class);
|
$this->expectException(Exception::class);
|
||||||
$this->expectExceptionMessage('Principal not found');
|
$this->expectExceptionMessage('Principal not found');
|
||||||
|
|
@ -77,7 +77,7 @@ class SystemPrincipalBackendTest extends TestCase {
|
||||||
$this->assertEquals(['principals/system/system'], $result);
|
$this->assertEquals(['principals/system/system'], $result);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[\PHPUnit\Framework\Attributes\DataProvider('providesPrincipalForGetGroupMembership')]
|
#[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'providesPrincipalForGetGroupMembership')]
|
||||||
public function testGetGroupMembershipExceptional(string $principal): void {
|
public function testGetGroupMembershipExceptional(string $principal): void {
|
||||||
$this->expectException(Exception::class);
|
$this->expectException(Exception::class);
|
||||||
$this->expectExceptionMessage('Principal not found');
|
$this->expectExceptionMessage('Principal not found');
|
||||||
|
|
|
||||||
|
|
@ -94,7 +94,7 @@ class ViewOnlyPluginTest extends TestCase {
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
#[\PHPUnit\Framework\Attributes\DataProvider('providesDataForCanGet')]
|
#[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'providesDataForCanGet')]
|
||||||
public function testCanGet(bool $isVersion, ?bool $attrEnabled, bool $expectCanDownloadFile, bool $allowViewWithoutDownload): void {
|
public function testCanGet(bool $isVersion, ?bool $attrEnabled, bool $expectCanDownloadFile, bool $allowViewWithoutDownload): void {
|
||||||
$nodeInfo = $this->createMock(File::class);
|
$nodeInfo = $this->createMock(File::class);
|
||||||
if ($isVersion) {
|
if ($isVersion) {
|
||||||
|
|
|
||||||
|
|
@ -36,7 +36,7 @@ class ActivityUpdaterListenerTest extends TestCase {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[\PHPUnit\Framework\Attributes\DataProvider('dataForTestHandleCalendarObjectDeletedEvent')]
|
#[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'dataForTestHandleCalendarObjectDeletedEvent')]
|
||||||
public function testHandleCalendarObjectDeletedEvent(int $calendarId, array $calendarData, array $shares, array $objectData, bool $createsActivity): void {
|
public function testHandleCalendarObjectDeletedEvent(int $calendarId, array $calendarData, array $shares, array $objectData, bool $createsActivity): void {
|
||||||
$event = new CalendarObjectDeletedEvent($calendarId, $calendarData, $shares, $objectData);
|
$event = new CalendarObjectDeletedEvent($calendarId, $calendarData, $shares, $objectData);
|
||||||
$this->logger->expects($this->once())->method('debug')->with(
|
$this->logger->expects($this->once())->method('debug')->with(
|
||||||
|
|
@ -58,7 +58,7 @@ class ActivityUpdaterListenerTest extends TestCase {
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
#[\PHPUnit\Framework\Attributes\DataProvider('dataForTestHandleCalendarDeletedEvent')]
|
#[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'dataForTestHandleCalendarDeletedEvent')]
|
||||||
public function testHandleCalendarDeletedEvent(int $calendarId, array $calendarData, array $shares, bool $createsActivity): void {
|
public function testHandleCalendarDeletedEvent(int $calendarId, array $calendarData, array $shares, bool $createsActivity): void {
|
||||||
$event = new CalendarDeletedEvent($calendarId, $calendarData, $shares);
|
$event = new CalendarDeletedEvent($calendarId, $calendarData, $shares);
|
||||||
$this->logger->expects($this->once())->method('debug')->with(
|
$this->logger->expects($this->once())->method('debug')->with(
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,7 @@ use Test\TestCase;
|
||||||
*
|
*
|
||||||
* @package OCA\DAV\Tests\Unit\DAV\Migration
|
* @package OCA\DAV\Tests\Unit\DAV\Migration
|
||||||
*/
|
*/
|
||||||
#[\PHPUnit\Framework\Attributes\Group('DB')]
|
#[\PHPUnit\Framework\Attributes\Group(name: 'DB')]
|
||||||
class CalDAVRemoveEmptyValueTest extends TestCase {
|
class CalDAVRemoveEmptyValueTest extends TestCase {
|
||||||
private LoggerInterface&MockObject $logger;
|
private LoggerInterface&MockObject $logger;
|
||||||
private CalDavBackend&MockObject $backend;
|
private CalDavBackend&MockObject $backend;
|
||||||
|
|
|
||||||
|
|
@ -45,7 +45,7 @@ class RemoveDeletedUsersCalendarSubscriptionsTest extends TestCase {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[\PHPUnit\Framework\Attributes\DataProvider('dataTestRun')]
|
#[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'dataTestRun')]
|
||||||
public function testRun(array $subscriptions, array $userExists, int $deletions): void {
|
public function testRun(array $subscriptions, array $userExists, int $deletions): void {
|
||||||
$qb = $this->createMock(IQueryBuilder::class);
|
$qb = $this->createMock(IQueryBuilder::class);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -408,7 +408,7 @@ class EventsSearchProviderTest extends TestCase {
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
#[DataProvider('provideDeepLinkData')]
|
#[DataProvider(methodName: 'provideDeepLinkData')]
|
||||||
public function testGetDeepLinkToCalendarApp(
|
public function testGetDeepLinkToCalendarApp(
|
||||||
string $principalUri,
|
string $principalUri,
|
||||||
string $expectedBase64DavUrl,
|
string $expectedBase64DavUrl,
|
||||||
|
|
@ -435,7 +435,7 @@ class EventsSearchProviderTest extends TestCase {
|
||||||
$this->assertEquals('absolute-url-to-route', $actual);
|
$this->assertEquals('absolute-url-to-route', $actual);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[\PHPUnit\Framework\Attributes\DataProvider('generateSublineDataProvider')]
|
#[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'generateSublineDataProvider')]
|
||||||
public function testGenerateSubline(string $ics, string $expectedSubline): void {
|
public function testGenerateSubline(string $ics, string $expectedSubline): void {
|
||||||
$vCalendar = Reader::read($ics, Reader::OPTION_FORGIVING);
|
$vCalendar = Reader::read($ics, Reader::OPTION_FORGIVING);
|
||||||
$eventComponent = $vCalendar->VEVENT;
|
$eventComponent = $vCalendar->VEVENT;
|
||||||
|
|
|
||||||
|
|
@ -289,7 +289,7 @@ class TasksSearchProviderTest extends TestCase {
|
||||||
$this->assertEquals('absolute-url-link-to-route-tasks.indexcalendars/uri-john.doe/tasks/task-uri.ics', $actual);
|
$this->assertEquals('absolute-url-link-to-route-tasks.indexcalendars/uri-john.doe/tasks/task-uri.ics', $actual);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[\PHPUnit\Framework\Attributes\DataProvider('generateSublineDataProvider')]
|
#[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'generateSublineDataProvider')]
|
||||||
public function testGenerateSubline(string $ics, string $expectedSubline): void {
|
public function testGenerateSubline(string $ics, string $expectedSubline): void {
|
||||||
$vCalendar = Reader::read($ics, Reader::OPTION_FORGIVING);
|
$vCalendar = Reader::read($ics, Reader::OPTION_FORGIVING);
|
||||||
$taskComponent = $vCalendar->VTODO;
|
$taskComponent = $vCalendar->VTODO;
|
||||||
|
|
|
||||||
|
|
@ -17,10 +17,10 @@ use OCP\IRequest;
|
||||||
*
|
*
|
||||||
* @package OCA\DAV\Tests\Unit
|
* @package OCA\DAV\Tests\Unit
|
||||||
*/
|
*/
|
||||||
#[\PHPUnit\Framework\Attributes\Group('DB')]
|
#[\PHPUnit\Framework\Attributes\Group(name: 'DB')]
|
||||||
class ServerTest extends \Test\TestCase {
|
class ServerTest extends \Test\TestCase {
|
||||||
|
|
||||||
#[\PHPUnit\Framework\Attributes\DataProvider('providesUris')]
|
#[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'providesUris')]
|
||||||
public function test(string $uri, array $plugins): void {
|
public function test(string $uri, array $plugins): void {
|
||||||
/** @var IRequest | \PHPUnit\Framework\MockObject\MockObject $r */
|
/** @var IRequest | \PHPUnit\Framework\MockObject\MockObject $r */
|
||||||
$r = $this->createMock(IRequest::class);
|
$r = $this->createMock(IRequest::class);
|
||||||
|
|
|
||||||
|
|
@ -173,7 +173,7 @@ class ExampleContactServiceTest extends TestCase {
|
||||||
return [[true], [false]];
|
return [[true], [false]];
|
||||||
}
|
}
|
||||||
|
|
||||||
#[\PHPUnit\Framework\Attributes\DataProvider('provideDefaultContactEnableData')]
|
#[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'provideDefaultContactEnableData')]
|
||||||
public function testIsDefaultContactEnabled(bool $enabled): void {
|
public function testIsDefaultContactEnabled(bool $enabled): void {
|
||||||
$this->appConfig->expects(self::once())
|
$this->appConfig->expects(self::once())
|
||||||
->method('getAppValueBool')
|
->method('getAppValueBool')
|
||||||
|
|
@ -183,7 +183,7 @@ class ExampleContactServiceTest extends TestCase {
|
||||||
$this->assertEquals($enabled, $this->service->isDefaultContactEnabled());
|
$this->assertEquals($enabled, $this->service->isDefaultContactEnabled());
|
||||||
}
|
}
|
||||||
|
|
||||||
#[\PHPUnit\Framework\Attributes\DataProvider('provideDefaultContactEnableData')]
|
#[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'provideDefaultContactEnableData')]
|
||||||
public function testSetDefaultContactEnabled(bool $enabled): void {
|
public function testSetDefaultContactEnabled(bool $enabled): void {
|
||||||
$this->appConfig->expects(self::once())
|
$this->appConfig->expects(self::once())
|
||||||
->method('setAppValueBool')
|
->method('setAppValueBool')
|
||||||
|
|
|
||||||
|
|
@ -62,7 +62,7 @@ class ExampleEventServiceTest extends TestCase {
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
#[\PHPUnit\Framework\Attributes\DataProvider('provideCustomEventData')]
|
#[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'provideCustomEventData')]
|
||||||
public function testCreateExampleEventWithCustomEvent($customEventIcs): void {
|
public function testCreateExampleEventWithCustomEvent($customEventIcs): void {
|
||||||
$this->appConfig->expects(self::once())
|
$this->appConfig->expects(self::once())
|
||||||
->method('getValueBool')
|
->method('getValueBool')
|
||||||
|
|
@ -142,7 +142,7 @@ class ExampleEventServiceTest extends TestCase {
|
||||||
$this->service->createExampleEvent(1000);
|
$this->service->createExampleEvent(1000);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[\PHPUnit\Framework\Attributes\DataProvider('provideCustomEventData')]
|
#[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'provideCustomEventData')]
|
||||||
public function testGetExampleEventWithCustomEvent($customEventIcs): void {
|
public function testGetExampleEventWithCustomEvent($customEventIcs): void {
|
||||||
$exampleEventFolder = $this->createMock(ISimpleFolder::class);
|
$exampleEventFolder = $this->createMock(ISimpleFolder::class);
|
||||||
$this->appData->expects(self::once())
|
$this->appData->expects(self::once())
|
||||||
|
|
|
||||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue