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:
Carl Schwan 2026-01-07 14:21:48 +01:00
parent 8f8b4411cd
commit 11cf69d8ba
No known key found for this signature in database
GPG key ID: 02325448204E452A
323 changed files with 842 additions and 915 deletions

View file

@ -26,7 +26,7 @@ use Test\TestCase;
*
* @package OCA\Comments\Tests\Unit\AppInfo
*/
#[\PHPUnit\Framework\Attributes\Group('DB')]
#[\PHPUnit\Framework\Attributes\Group(name: 'DB')]
class ApplicationTest extends TestCase {
protected function setUp(): void {
parent::setUp();

View file

@ -27,7 +27,7 @@ class CommentersSorterTest extends TestCase {
/**
* @param $data
*/
#[\PHPUnit\Framework\Attributes\DataProvider('sortDataProvider')]
#[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'sortDataProvider')]
public function testSort($data): void {
$commentMocks = [];
foreach ($data['actors'] as $actorType => $actors) {

View file

@ -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 {
/** @var IComment|MockObject $comment */
$comment = $this->createMock(IComment::class);

View file

@ -51,7 +51,7 @@ class ListenerTest extends TestCase {
* @param string $eventType
* @param string $notificationMethod
*/
#[\PHPUnit\Framework\Attributes\DataProvider('eventProvider')]
#[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'eventProvider')]
public function testEvaluate(string $eventType, $notificationMethod): void {
/** @var IComment|MockObject $comment */
$comment = $this->createMock(IComment::class);
@ -111,7 +111,7 @@ class ListenerTest extends TestCase {
$this->listener->evaluate($event);
}
#[\PHPUnit\Framework\Attributes\DataProvider('eventProvider')]
#[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'eventProvider')]
public function testEvaluateNoMentions(string $eventType): void {
/** @var IComment|MockObject $comment */
$comment = $this->createMock(IComment::class);

View file

@ -17,7 +17,7 @@ use Sabre\VObject\Component\VCard;
use Sabre\VObject\UUIDUtil;
use Test\TestCase;
#[\PHPUnit\Framework\Attributes\Group('DB')]
#[\PHPUnit\Framework\Attributes\Group(name: 'DB')]
class RecentContactMapperTest extends TestCase {
private RecentContactMapper $recentContactMapper;
private ITimeFactory $time;

View file

@ -28,7 +28,7 @@ use PHPUnit\Framework\MockObject\MockObject;
use Psr\Log\LoggerInterface;
use Test\TestCase;
#[\PHPUnit\Framework\Attributes\Group('DB')]
#[\PHPUnit\Framework\Attributes\Group(name: 'DB')]
class CalDavSharingBackendTest extends TestCase {
private IDBConnection $db;

View file

@ -14,7 +14,7 @@ use OCP\IDBConnection;
use OCP\Server;
use Test\TestCase;
#[\PHPUnit\Framework\Attributes\Group('DB')]
#[\PHPUnit\Framework\Attributes\Group(name: 'DB')]
class SharingMapperTest extends TestCase {
private SharingMapper $mapper;

View file

@ -13,7 +13,7 @@ use OCA\DAV\Db\PropertyMapper;
use OCP\Server;
use Test\TestCase;
#[\PHPUnit\Framework\Attributes\Group('DB')]
#[\PHPUnit\Framework\Attributes\Group(name: 'DB')]
class PropertyMapperTest extends TestCase {
/** @var PropertyMapper */

View file

@ -22,7 +22,7 @@ use Symfony\Component\Console\Output\OutputInterface;
use Test\TestCase;
use function scandir;
#[\PHPUnit\Framework\Attributes\Group('DB')]
#[\PHPUnit\Framework\Attributes\Group(name: 'DB')]
class CalendarMigratorTest extends TestCase {
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 {
$user = $this->userManager->createUser($userId, 'topsecretpassword');

View file

@ -22,7 +22,7 @@ use Symfony\Component\Console\Output\OutputInterface;
use Test\TestCase;
use function scandir;
#[\PHPUnit\Framework\Attributes\Group('DB')]
#[\PHPUnit\Framework\Attributes\Group(name: 'DB')]
class ContactsMigratorTest extends TestCase {
private IUserManager $userManager;
@ -93,7 +93,7 @@ class ContactsMigratorTest extends TestCase {
* @param array{displayName: string, description?: string} $importMetadata
* @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 {
$user = $this->userManager->createUser($userId, 'topsecretpassword');

View file

@ -19,7 +19,7 @@ use Test\TestCase;
*
* @package OCA\DAV\Tests\Unit\AppInfo
*/
#[\PHPUnit\Framework\Attributes\Group('DB')]
#[\PHPUnit\Framework\Attributes\Group(name: 'DB')]
class ApplicationTest extends TestCase {
public function test(): void {
$app = new Application();

View file

@ -27,7 +27,7 @@ class AvatarHomeTest extends TestCase {
$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 {
$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 {
if ($expectedException !== null) {
$this->expectException($expectedException);
@ -83,7 +83,7 @@ class AvatarHomeTest extends TestCase {
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 {
$avatar = $this->createMock(IAvatar::class);
$avatar->method('exists')->willReturn($hasAvatar);

View file

@ -50,7 +50,7 @@ class EventReminderJobTest extends TestCase {
* @param bool $sendEventRemindersMode
* @param bool $expectCall
*/
#[\PHPUnit\Framework\Attributes\DataProvider('data')]
#[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'data')]
public function testRun(bool $sendEventReminders, bool $sendEventRemindersMode, bool $expectCall): void {
$this->config->expects($this->exactly($sendEventReminders ? 2 : 1))
->method('getAppValue')

View file

@ -39,7 +39,7 @@ class PruneOutdatedSyncTokensJobTest extends TestCase {
$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 {
$this->config->expects($this->exactly(2))
->method('getAppValue')

View file

@ -42,7 +42,7 @@ class RefreshWebcalJobTest extends TestCase {
* @param int $time
* @param bool $process
*/
#[\PHPUnit\Framework\Attributes\DataProvider('runDataProvider')]
#[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'runDataProvider')]
public function testRun(int $lastRun, int $time, bool $process): void {
$backgroundJob = new RefreshWebcalJob($this->refreshWebcalService, $this->config, $this->logger, $this->timeFactory);
$backgroundJob->setId('42');

View file

@ -25,7 +25,7 @@ use PHPUnit\Framework\MockObject\MockObject;
use Psr\Log\LoggerInterface;
use Test\TestCase;
#[\PHPUnit\Framework\Attributes\Group('DB')]
#[\PHPUnit\Framework\Attributes\Group(name: 'DB')]
class UserStatusAutomationTest extends TestCase {
protected ITimeFactory&MockObject $time;
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 {
$user = $this->createConfiguredMock(IUser::class, [
'getUID' => 'user'

View file

@ -42,7 +42,7 @@ use Test\TestCase;
*
* @package OCA\DAV\Tests\unit\CalDAV
*/
#[\PHPUnit\Framework\Attributes\Group('DB')]
#[\PHPUnit\Framework\Attributes\Group(name: 'DB')]
abstract class AbstractCalDavBackend extends TestCase {

View file

@ -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 {
$backend = $this->getBackend(['triggerCalendarActivity']);
$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 {
$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 {
$backend = $this->getBackend();

View file

@ -60,7 +60,7 @@ class CalendarTest extends TestCase {
* @param string[] $types
* @param string[] $expected
*/
#[\PHPUnit\Framework\Attributes\DataProvider('dataFilterTypes')]
#[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'dataFilterTypes')]
public function testFilterTypes(array $types, array $expected): void {
$this->assertEquals($expected, $this->filter->filterTypes($types));
}

View file

@ -13,7 +13,7 @@ use OCP\Activity\IFilter;
use OCP\Server;
use Test\TestCase;
#[\PHPUnit\Framework\Attributes\Group('DB')]
#[\PHPUnit\Framework\Attributes\Group(name: 'DB')]
class GenericTest extends TestCase {
public static function dataFilters(): array {
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 {
$filter = Server::get($filterClass);
$this->assertInstanceOf(IFilter::class, $filter);
}
#[\PHPUnit\Framework\Attributes\DataProvider('dataFilters')]
#[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'dataFilters')]
public function testGetIdentifier(string $filterClass): void {
/** @var IFilter $filter */
$filter = Server::get($filterClass);
$this->assertIsString($filter->getIdentifier());
}
#[\PHPUnit\Framework\Attributes\DataProvider('dataFilters')]
#[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'dataFilters')]
public function testGetName(string $filterClass): void {
/** @var IFilter $filter */
$filter = Server::get($filterClass);
$this->assertIsString($filter->getName());
}
#[\PHPUnit\Framework\Attributes\DataProvider('dataFilters')]
#[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'dataFilters')]
public function testGetPriority(string $filterClass): void {
/** @var IFilter $filter */
$filter = Server::get($filterClass);
@ -52,7 +52,7 @@ class GenericTest extends TestCase {
$this->assertLessThanOrEqual(100, $priority);
}
#[\PHPUnit\Framework\Attributes\DataProvider('dataFilters')]
#[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'dataFilters')]
public function testGetIcon(string $filterClass): void {
/** @var IFilter $filter */
$filter = Server::get($filterClass);
@ -60,14 +60,14 @@ class GenericTest extends TestCase {
$this->assertStringStartsWith('http', $filter->getIcon());
}
#[\PHPUnit\Framework\Attributes\DataProvider('dataFilters')]
#[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'dataFilters')]
public function testFilterTypes(string $filterClass): void {
/** @var IFilter $filter */
$filter = Server::get($filterClass);
$this->assertIsArray($filter->filterTypes([]));
}
#[\PHPUnit\Framework\Attributes\DataProvider('dataFilters')]
#[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'dataFilters')]
public function testAllowedApps(string $filterClass): void {
/** @var IFilter $filter */
$filter = Server::get($filterClass);

View file

@ -60,7 +60,7 @@ class TodoTest extends TestCase {
* @param string[] $types
* @param string[] $expected
*/
#[\PHPUnit\Framework\Attributes\DataProvider('dataFilterTypes')]
#[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'dataFilterTypes')]
public function testFilterTypes(array $types, array $expected): void {
$this->assertEquals($expected, $this->filter->filterTypes($types));
}

View file

@ -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 {
$event = $this->createMock(IEvent::class);
$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 {
$l = $this->createMock(IL10N::class);
$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 {
$this->assertEquals([
'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 {
$this->assertEquals([
'type' => 'user-group',

View file

@ -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 {
$affectedUser = 'otheruser';
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 {
$generatedLink = [
'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 {
$this->expectException($exception);

View file

@ -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 {
$setting = Server::get($settingClass);
$this->assertInstanceOf(ISetting::class, $setting);
}
#[\PHPUnit\Framework\Attributes\DataProvider('dataSettings')]
#[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'dataSettings')]
public function testGetIdentifier(string $settingClass): void {
/** @var ISetting $setting */
$setting = Server::get($settingClass);
$this->assertIsString($setting->getIdentifier());
}
#[\PHPUnit\Framework\Attributes\DataProvider('dataSettings')]
#[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'dataSettings')]
public function testGetName(string $settingClass): void {
/** @var ISetting $setting */
$setting = Server::get($settingClass);
$this->assertIsString($setting->getName());
}
#[\PHPUnit\Framework\Attributes\DataProvider('dataSettings')]
#[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'dataSettings')]
public function testGetPriority(string $settingClass): void {
/** @var ISetting $setting */
$setting = Server::get($settingClass);
@ -53,28 +53,28 @@ class GenericTest extends TestCase {
$this->assertLessThanOrEqual(100, $priority);
}
#[\PHPUnit\Framework\Attributes\DataProvider('dataSettings')]
#[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'dataSettings')]
public function testCanChangeStream(string $settingClass): void {
/** @var ISetting $setting */
$setting = Server::get($settingClass);
$this->assertIsBool($setting->canChangeStream());
}
#[\PHPUnit\Framework\Attributes\DataProvider('dataSettings')]
#[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'dataSettings')]
public function testIsDefaultEnabledStream(string $settingClass): void {
/** @var ISetting $setting */
$setting = Server::get($settingClass);
$this->assertIsBool($setting->isDefaultEnabledStream());
}
#[\PHPUnit\Framework\Attributes\DataProvider('dataSettings')]
#[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'dataSettings')]
public function testCanChangeMail(string $settingClass): void {
/** @var ISetting $setting */
$setting = Server::get($settingClass);
$this->assertIsBool($setting->canChangeMail());
}
#[\PHPUnit\Framework\Attributes\DataProvider('dataSettings')]
#[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'dataSettings')]
public function testIsDefaultEnabledMail(string $settingClass): void {
/** @var ISetting $setting */
$setting = Server::get($settingClass);

View file

@ -29,7 +29,7 @@ use function time;
/**
* Class CalDavBackendTest
*/
#[\PHPUnit\Framework\Attributes\Group('DB')]
#[\PHPUnit\Framework\Attributes\Group(name: 'DB')]
class CalDavBackendTest extends AbstractCalDavBackend {
public function testCalendarOperations(): void {
$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 {
$logger = $this->createMock(\Psr\Log\LoggerInterface::class);
$config = $this->createMock(IConfig::class);
@ -400,7 +400,7 @@ EOD;
$this->assertCount(0, $calendarObjects);
}
#[\PHPUnit\Framework\Attributes\DataProvider('providesCalendarQueryParameters')]
#[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'providesCalendarQueryParameters')]
public function testCalendarQuery($expectedEventsInResult, $propFilters, $compFilter): void {
$calendarId = $this->createTestCalendar();
$events = [];
@ -689,7 +689,7 @@ EOS;
/**
* @param $objectData
*/
#[\PHPUnit\Framework\Attributes\DataProvider('providesSchedulingData')]
#[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'providesSchedulingData')]
public function testScheduling($objectData): void {
$this->backend->createSchedulingObject(self::UNIT_TEST_USER, 'Sample Schedule', $objectData);
@ -705,7 +705,7 @@ EOS;
$this->assertCount(0, $sos);
}
#[\PHPUnit\Framework\Attributes\DataProvider('providesCalDataForGetDenormalizedData')]
#[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'providesCalDataForGetDenormalizedData')]
public function testGetDenormalizedData($expected, $key, $calData): void {
try {
$actual = $this->backend->getDenormalizedData($calData);
@ -871,7 +871,7 @@ EOD;
$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 {
$calendarId = $this->createTestCalendar();

View file

@ -79,7 +79,7 @@ class CalendarObjectTest extends TestCase {
];
}
#[DataProvider('provideConfidentialObjectData')]
#[DataProvider(methodName: 'provideConfidentialObjectData')]
public function testGetWithConfidentialObject(
bool $expectConfidential,
array $calendarInfo,

View file

@ -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 {
/** @var CalDavBackend&MockObject $backend */
$backend = $this->createMock(CalDavBackend::class);
@ -166,7 +166,7 @@ class CalendarTest extends TestCase {
$this->addToAssertionCount(1);
}
#[\PHPUnit\Framework\Attributes\DataProvider('providesReadOnlyInfo')]
#[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'providesReadOnlyInfo')]
public function testAcl($expectsWrite, $readOnlyValue, $hasOwnerSet, $uri = 'default'): void {
/** @var CalDavBackend&MockObject $backend */
$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 {
$calObject0 = ['uri' => 'event-0', 'classification' => CalDavBackend::CLASSIFICATION_PUBLIC];
$calObject1 = ['uri' => 'event-1', 'classification' => CalDavBackend::CLASSIFICATION_CONFIDENTIAL];
@ -304,7 +304,7 @@ class CalendarTest extends TestCase {
$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 {
$start = '20160609';
$end = '20160610';

View file

@ -37,7 +37,7 @@ class CalendarFederationConfigTest extends TestCase {
];
}
#[DataProvider('provideIsFederationEnabledData')]
#[DataProvider(methodName: 'provideIsFederationEnabledData')]
public function testIsFederationEnabled(bool $configValue): void {
$this->appConfig->expects(self::once())
->method('getAppValueBool')

View file

@ -239,7 +239,7 @@ class CalendarFederationProviderTest extends TestCase {
];
}
#[DataProvider('provideIncompleteProtocolData')]
#[DataProvider(methodName: 'provideIncompleteProtocolData')]
public function testShareReceivedWithIncompleteProtocolData(array $protocol): void {
$share = $this->createMock(ICloudFederationShare::class);
$share->method('getShareType')
@ -400,7 +400,7 @@ class CalendarFederationProviderTest extends TestCase {
];
}
#[DataProvider('provideIncompleteSyncCalendarNotificationData')]
#[DataProvider(methodName: 'provideIncompleteSyncCalendarNotificationData')]
public function testNotificationReceivedWithSyncCalendarNotificationAndIncompleteData(
array $notification,
): void {

View file

@ -109,7 +109,7 @@ class FederatedCalendarAuthTest extends TestCase {
];
}
#[DataProvider('provideCheckData')]
#[DataProvider(methodName: 'provideCheckData')]
public function testCheck(
string $requestPath,
?string $authHeader,

View file

@ -126,7 +126,7 @@ class FederatedCalendarSyncServiceTest extends TestCase {
];
}
#[DataProvider('provideUnexpectedSyncTokenData')]
#[DataProvider(methodName: 'provideUnexpectedSyncTokenData')]
public function testSyncOneWithUnexpectedSyncTokenFormat(string $syncToken): void {
$calendar = new FederatedCalendarEntity();
$calendar->setId(1);

View file

@ -390,7 +390,7 @@ class FederationSharingServiceTest extends TestCase {
];
}
#[DataProvider('provideInvalidRemoteUserPrincipalData')]
#[DataProvider(methodName: 'provideInvalidRemoteUserPrincipalData')]
public function testShareWithWithInvalidRemoteUserPrincipal(string $remoteUserPrincipal): void {
$shareable = $this->createMock(Calendar::class);
$shareable->method('getOwner')

View file

@ -68,7 +68,7 @@ class ExternalCalendarTest extends TestCase {
$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 {
$this->expectException(\InvalidArgumentException::class);
$this->expectExceptionMessage('Provided calendar uri was not app-generated');

View file

@ -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 {
$this->assertSame($expected, $this->plugin->getCalendarHomeForPrincipal($input));
}

View file

@ -65,7 +65,7 @@ class PublicCalendarObjectTest extends TestCase {
];
}
#[DataProvider('provideConfidentialObjectData')]
#[DataProvider(methodName: 'provideConfidentialObjectData')]
public function testGetWithConfidentialObject(array $calendarInfo): void {
$ics = <<<EOF
BEGIN:VCALENDAR

View file

@ -32,7 +32,7 @@ use Test\TestCase;
*
* @package OCA\DAV\Tests\unit\CalDAV
*/
#[\PHPUnit\Framework\Attributes\Group('DB')]
#[\PHPUnit\Framework\Attributes\Group(name: 'DB')]
class PublicCalendarRootTest extends TestCase {
public const UNIT_TEST_USER = '';
private CalDavBackend $backend;

View file

@ -16,7 +16,7 @@ use Sabre\VObject\Reader;
class PublicCalendarTest extends CalendarTest {
#[\PHPUnit\Framework\Attributes\DataProvider('providesConfidentialClassificationData')]
#[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'providesConfidentialClassificationData')]
public function testPrivateClassification(int $expectedChildren, bool $isShared): void {
$calObject0 = ['uri' => 'event-0', 'classification' => CalDavBackend::CLASSIFICATION_PUBLIC];
$calObject1 = ['uri' => 'event-1', 'classification' => CalDavBackend::CLASSIFICATION_CONFIDENTIAL];
@ -55,7 +55,7 @@ class PublicCalendarTest extends CalendarTest {
$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 {
$start = '20160609';
$end = '20160610';

View file

@ -17,7 +17,7 @@ use OCA\DAV\Capabilities;
use OCP\AppFramework\QueryException;
use Test\TestCase;
#[\PHPUnit\Framework\Attributes\Group('DB')]
#[\PHPUnit\Framework\Attributes\Group(name: 'DB')]
class NotificationProviderManagerTest extends TestCase {
private NotificationProviderManager $providerManager;

View file

@ -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 {
/** @var INotification&MockObject $notification */
$notification = $this->createMock(INotification::class);

View file

@ -246,7 +246,7 @@ abstract class AbstractPrincipalBackendTestCase extends TestCase {
$this->assertEquals(0, $actual);
}
#[\PHPUnit\Framework\Attributes\DataProvider('dataSearchPrincipals')]
#[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'dataSearchPrincipals')]
public function testSearchPrincipals($expected, $test): void {
$user = $this->createMock(IUser::class);
$this->userSession->expects($this->once())

View file

@ -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 {
$propFind = new PropFind(
$principalUri,

View file

@ -32,7 +32,7 @@ class ConnectionTest extends TestCase {
$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 {
$subscription = [
'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 {
$client = $this->createMock(IClient::class);
$response = $this->createMock(IResponse::class);

View file

@ -50,7 +50,7 @@ class RefreshWebcalServiceTest extends TestCase {
return $stream;
}
#[\PHPUnit\Framework\Attributes\DataProvider('runDataProvider')]
#[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'runDataProvider')]
public function testRun(string $body, string $format, string $result): void {
$refreshWebcalService = new RefreshWebcalService(
$this->caldavBackend,
@ -119,7 +119,7 @@ class RefreshWebcalServiceTest extends TestCase {
$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 {
$refreshWebcalService = new RefreshWebcalService(
$this->caldavBackend,
@ -354,7 +354,7 @@ class RefreshWebcalServiceTest extends TestCase {
$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 {
$refreshWebcalService = $this->getMockBuilder(RefreshWebcalService::class)
->onlyMethods(['getSubscription'])
@ -407,7 +407,7 @@ class RefreshWebcalServiceTest extends TestCase {
$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 {
$refreshWebcalService = $this->getMockBuilder(RefreshWebcalService::class)
->onlyMethods(['getSubscription'])

View file

@ -37,10 +37,7 @@ class BackendTest extends TestCase {
$this->userManager = $this->createMock(IUserManager::class);
}
/**
* @return Backend|MockObject
*/
protected function getBackend(array $methods = []): Backend {
protected function getBackend(array $methods = []): Backend|MockObject {
if (empty($methods)) {
return new Backend(
$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 {
$backend = $this->getBackend(['triggerAddressbookActivity']);
$backend->expects($this->once())
@ -152,7 +149,7 @@ class BackendTest extends TestCase {
* @param string[]|null $shareUsers
* @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 {
$backend = $this->getBackend(['getUsersForShares']);
@ -316,7 +313,7 @@ class BackendTest extends TestCase {
* @param string[]|null $shareUsers
* @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 {
$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 {
$backend = $this->getBackend();
@ -460,7 +457,7 @@ class BackendTest extends TestCase {
/**
* @param string[] $users
* @return IUser[]|MockObject[]
* @return list<IUser&MockObject>
*/
protected function getUsers(array $users): array {
$list = [];
@ -470,10 +467,7 @@ class BackendTest extends TestCase {
return $list;
}
/**
* @return IUser|MockObject
*/
protected function getUserMock(string $uid): IUser {
protected function getUserMock(string $uid): IUser&MockObject {
$user = $this->createMock(IUser::class);
$user->expects($this->once())
->method('getUID')

View file

@ -80,7 +80,7 @@ class AddressBookImplTest extends TestCase {
->getMock();
$pattern = 'pattern';
$searchProperties = 'properties';
$searchProperties = ['properties'];
$this->backend->expects($this->once())->method('search')
->with($this->addressBookInfo['id'], $pattern, $searchProperties)
@ -104,7 +104,7 @@ class AddressBookImplTest extends TestCase {
$this->assertSame(2, count($result));
}
#[\PHPUnit\Framework\Attributes\DataProvider('dataTestCreate')]
#[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'dataTestCreate')]
public function testCreate(array $properties): void {
$uid = 'uid';
@ -229,7 +229,7 @@ class AddressBookImplTest extends TestCase {
$addressBookImpl->createOrUpdate($properties);
}
#[\PHPUnit\Framework\Attributes\DataProvider('dataTestGetPermissions')]
#[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'dataTestGetPermissions')]
public function testGetPermissions(array $permissions, int $expected): void {
$this->addressBook->expects($this->once())->method('getACL')
->willReturn($permissions);

View file

@ -117,7 +117,7 @@ class AddressBookTest extends TestCase {
$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 {
/** @var MockObject | CardDavBackend $backend */
$backend = $this->createMock(CardDavBackend::class);

View file

@ -50,7 +50,7 @@ class BirthdayServiceTest extends TestCase {
$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 {
$this->dbConnection->method('supports4ByteText')->willReturn($supports4Bytes);
$cal = $this->service->buildDateFromContact($data, $fieldType, $prefix, $configuredReminder);
@ -198,7 +198,7 @@ class BirthdayServiceTest extends TestCase {
$service->onCardChanged(666, 'gump.vcf', '');
}
#[\PHPUnit\Framework\Attributes\DataProvider('providesCardChanges')]
#[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'providesCardChanges')]
public function testOnCardChanged(string $expectedOp): void {
$this->config->expects($this->once())
->method('getAppValue')
@ -289,7 +289,7 @@ class BirthdayServiceTest extends TestCase {
$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 {
$new = Reader::read($new);
$this->assertEquals($expected, $this->service->birthdayEvenChanged($old, $new));

View file

@ -46,7 +46,7 @@ use function time;
*
* @package OCA\DAV\Tests\unit\CardDAV
*/
#[\PHPUnit\Framework\Attributes\Group('DB')]
#[\PHPUnit\Framework\Attributes\Group(name: 'DB')]
class CardDavBackendTest extends TestCase {
private Principal&MockObject $principal;
private IUserManager&MockObject $userManager;
@ -656,7 +656,7 @@ class CardDavBackendTest extends TestCase {
$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 {
/** @var VCard $vCards */
$vCards = [];

View file

@ -79,7 +79,7 @@ class ConverterTest extends TestCase {
return $accountManager;
}
#[\PHPUnit\Framework\Attributes\DataProvider('providesNewUsers')]
#[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'providesNewUsers')]
public function testCreation($expectedVCard, $displayName = null, $eMailAddress = null, $cloudId = null): void {
$user = $this->getUserMock((string)$displayName, $eMailAddress, $cloudId);
$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 {
$converter = new Converter($this->accountManager, $this->userManager, $this->urlGenerator, $this->logger);
$r = $converter->splitFullName($fullName);

View file

@ -45,7 +45,7 @@ class ImageExportPluginTest extends TestCase {
$this->plugin->initialize($this->server);
}
#[\PHPUnit\Framework\Attributes\DataProvider('providesQueryParams')]
#[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'providesQueryParams')]
public function testQueryParams(array $param): void {
$this->request->expects($this->once())->method('getQueryParameters')->willReturn($param);
$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 {
$query = ['photo' => null];
if ($size !== null) {

View file

@ -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 {
/** @var CardDavBackend | MockObject $backend */
$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 {
$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">

View file

@ -34,7 +34,7 @@ class SystemAddressBookTest extends TestCase {
private array $addressBookInfo;
private IL10N&MockObject $l10n;
private IConfig&MockObject $config;
private IUserSession $userSession;
private IUserSession&MockObject $userSession;
private IRequest&MockObject $request;
private array $server;
private TrustedServers&MockObject $trustedServers;

View file

@ -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 {
$this->userManager->expects($this->once())
->method('userExists')

View file

@ -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 {
$this->userManager->expects($this->once())
->method('userExists')

View file

@ -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 {
$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 {
$this->userManager->expects($this->exactly(2))
->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 {
$this->userManager->expects($this->exactly(2))
->method('userExists')

View file

@ -24,7 +24,7 @@ use Test\TestCase;
*
* @package OCA\DAV\Tests\Unit\Repair
*/
#[\PHPUnit\Framework\Attributes\Group('DB')]
#[\PHPUnit\Framework\Attributes\Group(name: 'DB')]
class RemoveInvalidSharesTest extends TestCase {
private RemoveInvalidShares $command;

View file

@ -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 {
$this->comment->expects($this->any())
->method('getCreationDateTime')

View file

@ -23,7 +23,7 @@ use PHPUnit\Framework\MockObject\MockObject;
*
* @package OCA\DAV\Tests\unit\Connector
*/
#[\PHPUnit\Framework\Attributes\Group('DB')]
#[\PHPUnit\Framework\Attributes\Group(name: 'DB')]
class LegacyPublicAuthTest extends \Test\TestCase {
private ISession&MockObject $session;
private IRequest&MockObject $request;

View file

@ -19,7 +19,9 @@ use OCP\IUser;
use OCP\Security\Bruteforce\IThrottler;
use PHPUnit\Framework\MockObject\MockObject;
use Sabre\DAV\Server;
use Sabre\HTTP\Request;
use Sabre\HTTP\RequestInterface;
use Sabre\HTTP\Response;
use Sabre\HTTP\ResponseInterface;
use Test\TestCase;
@ -28,7 +30,7 @@ use Test\TestCase;
*
* @package OCA\DAV\Tests\unit\Connector\Sabre
*/
#[\PHPUnit\Framework\Attributes\Group('DB')]
#[\PHPUnit\Framework\Attributes\Group(name: 'DB')]
class AuthTest extends TestCase {
private ISession&MockObject $session;
private Session&MockObject $userSession;
@ -454,8 +456,8 @@ class AuthTest extends TestCase {
public function testAuthenticateNoBasicAuthenticateHeadersProvided(): void {
$server = $this->createMock(Server::class);
$server->httpRequest = $this->createMock(RequestInterface::class);
$server->httpResponse = $this->createMock(ResponseInterface::class);
$server->httpRequest = $this->createMock(Request::class);
$server->httpResponse = $this->createMock(Response::class);
$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);
}
@ -525,9 +527,7 @@ class AuthTest extends TestCase {
}
public function testAuthenticateNoBasicAuthenticateHeadersProvidedWithAjaxButUserIsStillLoggedIn(): void {
/** @var \Sabre\HTTP\RequestInterface $httpRequest */
$httpRequest = $this->createMock(RequestInterface::class);
/** @var \Sabre\HTTP\ResponseInterface $httpResponse */
$httpResponse = $this->createMock(ResponseInterface::class);
$user = $this->createMock(IUser::class);
$user->method('getUID')->willReturn('MyTestUser');
@ -561,14 +561,14 @@ class AuthTest extends TestCase {
public function testAuthenticateValidCredentials(): void {
$server = $this->createMock(Server::class);
$server->httpRequest = $this->createMock(RequestInterface::class);
$server->httpRequest = $this->createMock(Request::class);
$server->httpRequest
->expects($this->once())
->method('getHeader')
->with('Authorization')
->willReturn('basic dXNlcm5hbWU6cGFzc3dvcmQ=');
$server->httpResponse = $this->createMock(ResponseInterface::class);
$server->httpResponse = $this->createMock(Response::class);
$this->userSession
->expects($this->once())
->method('logClientIn')
@ -588,7 +588,7 @@ class AuthTest extends TestCase {
public function testAuthenticateInvalidCredentials(): void {
$server = $this->createMock(Server::class);
$server->httpRequest = $this->createMock(RequestInterface::class);
$server->httpRequest = $this->createMock(Request::class);
$server->httpRequest
->expects($this->exactly(2))
->method('getHeader')
@ -596,7 +596,7 @@ class AuthTest extends TestCase {
['Authorization', 'basic dXNlcm5hbWU6cGFzc3dvcmQ='],
['X-Requested-With', null],
]);
$server->httpResponse = $this->createMock(ResponseInterface::class);
$server->httpResponse = $this->createMock(Response::class);
$this->userSession
->expects($this->once())
->method('logClientIn')

View file

@ -19,7 +19,7 @@ use Sabre\HTTP\RequestInterface;
use Sabre\HTTP\ResponseInterface;
use Test\TestCase;
#[\PHPUnit\Framework\Attributes\Group('DB')]
#[\PHPUnit\Framework\Attributes\Group(name: 'DB')]
class BearerAuthTest extends TestCase {
private IUserSession&MockObject $userSession;
private ISession&MockObject $session;
@ -74,7 +74,7 @@ class BearerAuthTest extends TestCase {
$request = $this->createMock(RequestInterface::class);
/** @var ResponseInterface&MockObject $response */
$response = $this->createMock(ResponseInterface::class);
$result = $this->bearerAuth->challenge($request, $response);
$this->assertEmpty($result);
$this->bearerAuth->challenge($request, $response);
$this->assertTrue(true);
}
}

View file

@ -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 {
$this->themingDefaults
->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
*/
#[\PHPUnit\Framework\Attributes\DataProvider('oldDesktopClientProvider')]
#[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'oldDesktopClientProvider')]
public function testBeforeHandlerExceptionPreventXSSAttack(string $userAgent, ERROR_TYPE $errorType): void {
$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 {
/** @var RequestInterface|MockObject $request */
$request = $this->createMock(RequestInterface::class);

View file

@ -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 {
$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 {
$node = $this->createMock(File::class);
$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 {
$node = $this->createMock(File::class);
$node->expects($this->any())

View file

@ -13,6 +13,8 @@ use OCA\DAV\Connector\Sabre\File;
use Sabre\DAV\Exception\NotFound;
use Sabre\DAV\Server;
use Sabre\DAV\Tree;
use Sabre\HTTP\Request;
use Sabre\HTTP\Response;
use Test\TestCase;
class CopyEtagHeaderPluginTest extends TestCase {
@ -27,8 +29,8 @@ class CopyEtagHeaderPluginTest extends TestCase {
}
public function testCopyEtag(): void {
$request = new \Sabre\Http\Request('GET', 'dummy.file');
$response = new \Sabre\Http\Response();
$request = new Request('GET', 'dummy.file');
$response = new Response();
$response->setHeader('Etag', 'abcd');
$this->plugin->afterMethod($request, $response);
@ -37,8 +39,8 @@ class CopyEtagHeaderPluginTest extends TestCase {
}
public function testNoopWhenEmpty(): void {
$request = new \Sabre\Http\Request('GET', 'dummy.file');
$response = new \Sabre\Http\Response();
$request = new Request('GET', 'dummy.file');
$response = new Response();
$this->plugin->afterMethod($request, $response);

View file

@ -25,7 +25,7 @@ use Sabre\DAV\Tree;
*
* @package OCA\DAV\Tests\unit\Connector\Sabre
*/
#[\PHPUnit\Framework\Attributes\Group('DB')]
#[\PHPUnit\Framework\Attributes\Group(name: 'DB')]
class CustomPropertiesBackendTest extends \Test\TestCase {
private \Sabre\DAV\Server $server;
private \Sabre\DAV\Tree&MockObject $tree;

View file

@ -58,7 +58,7 @@ class TestViewDirectory extends View {
}
#[\PHPUnit\Framework\Attributes\Group('DB')]
#[\PHPUnit\Framework\Attributes\Group(name: 'DB')]
class DirectoryTest extends \Test\TestCase {
use UserTrait;
@ -514,20 +514,20 @@ class DirectoryTest extends \Test\TestCase {
$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 {
$this->expectException(\Sabre\DAV\Exception\Forbidden::class);
$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 {
$this->moveTest($source, $destination, $updatables, $deletables);
$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 {
$this->expectException(InvalidPath::class);

View file

@ -40,9 +40,7 @@ class DummyGetResponsePluginTest extends TestCase {
public function testHttpGet(): void {
/** @var \Sabre\HTTP\RequestInterface $request */
$request = $this->createMock(RequestInterface::class);
/** @var \Sabre\HTTP\ResponseInterface $response */
$response = $this->createMock(ResponseInterface::class);
$response
->expects($this->once())

View file

@ -42,7 +42,7 @@ class ExceptionLoggerPluginTest extends TestCase {
$this->plugin->initialize($this->server);
}
#[\PHPUnit\Framework\Attributes\DataProvider('providesExceptions')]
#[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'providesExceptions')]
public function testLogging(string $expectedLogLevel, \Throwable $e): void {
$this->init();

View file

@ -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 {
$request = $this->createMock(RequestInterface::class);
$this->fakeLockerPlugin->validateTokens($request, $input);

View file

@ -49,7 +49,7 @@ use Test\Traits\UserTrait;
*
* @package OCA\DAV\Tests\unit\Connector\Sabre
*/
#[\PHPUnit\Framework\Attributes\Group('DB')]
#[\PHPUnit\Framework\Attributes\Group(name: 'DB')]
class FileTest extends TestCase {
use MountProviderTrait;
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 {
// setup
$storage = $this->getMockBuilder(Local::class)
@ -315,7 +315,7 @@ class FileTest extends TestCase {
/**
* 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 {
$request = new Request([
'server' => [

View file

@ -26,16 +26,18 @@ use OCP\IPreview;
use OCP\IRequest;
use OCP\IUserSession;
use PHPUnit\Framework\MockObject\MockObject;
use Sabre\DAV\INode;
use Sabre\DAV\PropFind;
use Sabre\DAV\PropPatch;
use Sabre\DAV\Server;
use Sabre\DAV\Tree;
use Sabre\HTTP\RequestInterface;
use Sabre\HTTP\Response;
use Sabre\HTTP\ResponseInterface;
use Sabre\Xml\Service;
use Test\TestCase;
#[\PHPUnit\Framework\Attributes\Group('DB')]
#[\PHPUnit\Framework\Attributes\Group(name: 'DB')]
class FilesPluginTest extends TestCase {
private Tree&MockObject $tree;
@ -72,14 +74,17 @@ class FilesPluginTest extends TestCase {
$this->accountManager,
);
$response = $this->createMock(ResponseInterface::class);
$response = $this->createMock(Response::class);
$this->server->httpResponse = $response;
$this->server->xml = new Service();
$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->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 {
$request = $this->createMock(RequestInterface::class);
$response = $this->createMock(ResponseInterface::class);

View file

@ -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 {
$this->assertEquals($expectedUri, self::invokePrivate($this->plugin, 'getFilesBaseUri', [$uri, $reportPath]));
}

View file

@ -31,7 +31,7 @@ use PHPUnit\Framework\MockObject\MockObject;
*
* @package OCA\DAV\Tests\unit\Connector\Sabre
*/
#[\PHPUnit\Framework\Attributes\Group('DB')]
#[\PHPUnit\Framework\Attributes\Group(name: 'DB')]
class NodeTest extends \Test\TestCase {
public static function davPermissionsProvider(): array {
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 {
$info = $this->getMockBuilder(FileInfo::class)
->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 {
$storage = $this->createMock(IStorage::class);
$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 {
$view = $this->getMockBuilder(View::class)
->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 {
$this->expectException(\InvalidArgumentException::class);

View file

@ -26,7 +26,7 @@ use OCP\Files\Mount\IMountManager;
*
* @package OCA\DAV\Tests\Unit\Connector\Sabre
*/
#[\PHPUnit\Framework\Attributes\Group('DB')]
#[\PHPUnit\Framework\Attributes\Group(name: 'DB')]
class ObjectTreeTest extends \Test\TestCase {
public static function copyDataProvider(): array {
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 {
$view = $this->createMock(View::class);
$view->expects($this->once())
@ -81,7 +81,7 @@ class ObjectTreeTest extends \Test\TestCase {
$objectTree->copy($sourcePath, $targetPath);
}
#[\PHPUnit\Framework\Attributes\DataProvider('copyDataProvider')]
#[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'copyDataProvider')]
public function testCopyFailNotCreatable($sourcePath, $targetPath, $targetParent): void {
$this->expectException(\Sabre\DAV\Exception\Forbidden::class);
@ -120,7 +120,7 @@ class ObjectTreeTest extends \Test\TestCase {
$objectTree->copy($sourcePath, $targetPath);
}
#[\PHPUnit\Framework\Attributes\DataProvider('nodeForPathProvider')]
#[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'nodeForPathProvider')]
public function testGetNodeForPath(
string $inputFileName,
string $fileInfoQueryPath,

View file

@ -463,7 +463,7 @@ class PrincipalTest extends TestCase {
['{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 {
$this->shareManager->expects($this->once())
->method('shareAPIEnabled')
@ -824,7 +824,7 @@ class PrincipalTest extends TestCase {
$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 {
$this->shareManager->expects($this->once())
->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 {
$this->shareManager->expects($this->once())
->method('shareApiEnabled')

View file

@ -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 {
$this->plugin->initialize($this->server);
$this->server->expects($this->once())->method('getPluginQueries')

View file

@ -25,7 +25,7 @@ use Psr\Log\LoggerInterface;
*
* @package OCA\DAV\Tests\unit\Connector
*/
#[\PHPUnit\Framework\Attributes\Group('DB')]
#[\PHPUnit\Framework\Attributes\Group(name: 'DB')]
class PublicAuthTest extends \Test\TestCase {
private ISession&MockObject $session;

View file

@ -25,7 +25,7 @@ class QuotaPluginTest extends TestCase {
$this->plugin->initialize($this->server);
}
#[\PHPUnit\Framework\Attributes\DataProvider('lengthProvider')]
#[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'lengthProvider')]
public function testLength(?int $expected, array $headers): void {
$this->init(0);
@ -34,7 +34,7 @@ class QuotaPluginTest extends TestCase {
$this->assertEquals($expected, $length);
}
#[\PHPUnit\Framework\Attributes\DataProvider('quotaOkayProvider')]
#[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'quotaOkayProvider')]
public function testCheckQuota(int $quota, array $headers): void {
$this->init($quota);
@ -43,7 +43,7 @@ class QuotaPluginTest extends TestCase {
$this->assertTrue($result);
}
#[\PHPUnit\Framework\Attributes\DataProvider('quotaExceededProvider')]
#[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'quotaExceededProvider')]
public function testCheckExceededQuota(int $quota, array $headers): void {
$this->expectException(\Sabre\DAV\Exception\InsufficientStorage::class);
@ -53,7 +53,7 @@ class QuotaPluginTest extends TestCase {
$this->plugin->checkQuota('');
}
#[\PHPUnit\Framework\Attributes\DataProvider('quotaOkayProvider')]
#[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'quotaOkayProvider')]
public function testCheckQuotaOnPath(int $quota, array $headers): void {
$this->init($quota, 'sub/test.txt');

View file

@ -17,7 +17,7 @@ use OCP\Files\FileInfo;
*
* @package OCA\DAV\Tests\unit\Connector\Sabre\RequestTest
*/
#[\PHPUnit\Framework\Attributes\Group('DB')]
#[\PHPUnit\Framework\Attributes\Group(name: 'DB')]
class DeleteTest extends RequestTestCase {
public function testBasicUpload(): void {
$user = self::getUniqueID();

View file

@ -17,7 +17,7 @@ use OCP\Lock\ILockingProvider;
*
* @package OCA\DAV\Tests\unit\Connector\Sabre\RequestTest
*/
#[\PHPUnit\Framework\Attributes\Group('DB')]
#[\PHPUnit\Framework\Attributes\Group(name: 'DB')]
class DownloadTest extends RequestTestCase {
public function testDownload(): void {
$user = self::getUniqueID();

View file

@ -20,7 +20,7 @@ use Test\Traits\EncryptionTrait;
*
* @package OCA\DAV\Tests\Unit\Connector\Sabre\RequestTest
*/
#[\PHPUnit\Framework\Attributes\Group('DB')]
#[\PHPUnit\Framework\Attributes\Group(name: 'DB')]
class EncryptionMasterKeyUploadTest extends UploadTest {
use EncryptionTrait;

View file

@ -20,7 +20,7 @@ use Test\Traits\EncryptionTrait;
*
* @package OCA\DAV\Tests\Unit\Connector\Sabre\RequestTest
*/
#[\PHPUnit\Framework\Attributes\Group('DB')]
#[\PHPUnit\Framework\Attributes\Group(name: 'DB')]
class EncryptionUploadTest extends UploadTest {
use EncryptionTrait;

View file

@ -17,7 +17,7 @@ use OCP\Server;
*
* @package OCA\DAV\Tests\unit\Connector\Sabre\RequestTest
*/
#[\PHPUnit\Framework\Attributes\Group('DB')]
#[\PHPUnit\Framework\Attributes\Group(name: 'DB')]
class PartFileInRootUploadTest extends UploadTest {
protected function setUp(): void {
$config = Server::get(IConfig::class);

View file

@ -19,7 +19,7 @@ use OCP\Lock\ILockingProvider;
*
* @package OCA\DAV\Tests\unit\Connector\Sabre\RequestTest
*/
#[\PHPUnit\Framework\Attributes\Group('DB')]
#[\PHPUnit\Framework\Attributes\Group(name: 'DB')]
class UploadTest extends RequestTestCase {
public function testBasicUpload(): void {
$user = self::getUniqueID();

View file

@ -51,7 +51,7 @@ class SharesPluginTest extends \Test\TestCase {
$this->plugin->initialize($this->server);
}
#[\PHPUnit\Framework\Attributes\DataProvider('sharesGetPropertiesDataProvider')]
#[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'sharesGetPropertiesDataProvider')]
public function testGetProperties(array $shareTypes): void {
$sabreNode = $this->createMock(Node::class);
$sabreNode->expects($this->any())
@ -114,7 +114,7 @@ class SharesPluginTest extends \Test\TestCase {
$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 {
$sabreNode1 = $this->createMock(File::class);
$sabreNode1->method('getId')

View file

@ -58,7 +58,7 @@ class TagsPluginTest extends \Test\TestCase {
$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 {
$node = $this->createMock(Node::class);
$node->expects($this->any())
@ -93,7 +93,7 @@ class TagsPluginTest extends \Test\TestCase {
$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 {
$node1 = $this->createMock(File::class);
$node1->expects($this->any())

View file

@ -45,7 +45,7 @@ class ServerTest extends TestCase {
];
}
#[DataProvider('removeAllListenersData')]
#[DataProvider(methodName: 'removeAllListenersData')]
public function testRemoveAllListeners(?string $removeEventName): void {
$listener = static function () {
return false;

View file

@ -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 {
$this->buildQueryExpects('TOKEN123', [
'id' => 0,
@ -115,7 +115,7 @@ EOF;
$this->assertTrue($called);
}
#[\PHPUnit\Framework\Attributes\DataProvider('attendeeProvider')]
#[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'attendeeProvider')]
public function testAcceptSequence(bool $isExternalAttendee): void {
$this->buildQueryExpects('TOKEN123', [
'id' => 0,
@ -177,7 +177,7 @@ EOF;
$this->assertTrue($called);
}
#[\PHPUnit\Framework\Attributes\DataProvider('attendeeProvider')]
#[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'attendeeProvider')]
public function testAcceptRecurrenceId(bool $isExternalAttendee): void {
$this->buildQueryExpects('TOKEN123', [
'id' => 0,
@ -267,7 +267,7 @@ EOF;
$this->assertEquals([], $response->getParams());
}
#[\PHPUnit\Framework\Attributes\DataProvider('attendeeProvider')]
#[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'attendeeProvider')]
public function testDecline(bool $isExternalAttendee): void {
$this->buildQueryExpects('TOKEN123', [
'id' => 0,
@ -336,7 +336,7 @@ EOF;
$this->assertEquals(['token' => 'TOKEN123'], $response->getParams());
}
#[\PHPUnit\Framework\Attributes\DataProvider('attendeeProvider')]
#[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'attendeeProvider')]
public function testProcessMoreOptionsResult(bool $isExternalAttendee): void {
$this->request->expects($this->once())
->method('getParam')
@ -430,7 +430,7 @@ EOF;
$expr->expects($this->once())
->method('eq')
->with('token', 'namedParameterToken')
->willReturn((string)$function);
->willReturn($function);
$this->dbConnection->expects($this->once())
->method('getQueryBuilder')

View file

@ -15,7 +15,7 @@ use Sabre\HTTP\Response;
class BrowserErrorPagePluginTest extends \Test\TestCase {
#[\PHPUnit\Framework\Attributes\DataProvider('providesExceptions')]
#[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'providesExceptions')]
public function test(int $expectedCode, \Throwable $exception): void {
/** @var BrowserErrorPagePlugin&MockObject $plugin */
$plugin = $this->getMockBuilder(BrowserErrorPagePlugin::class)->onlyMethods(['sendResponse', 'generateBody'])->getMock();

View file

@ -25,7 +25,7 @@ use Sabre\DAVACL\IACL;
use Sabre\DAVACL\IPrincipal;
use Test\TestCase;
#[\PHPUnit\Framework\Attributes\Group('DB')]
#[\PHPUnit\Framework\Attributes\Group(name: 'DB')]
class CustomPropertiesBackendTest extends TestCase {
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(
string $user,
array $nodes,
@ -336,7 +336,7 @@ class CustomPropertiesBackendTest extends TestCase {
$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 {
$this->server->method('calculateUri')
->willReturnCallback(function ($uri) {
@ -417,7 +417,7 @@ class CustomPropertiesBackendTest extends TestCase {
$this->assertEquals([], $storedProps);
}
#[\PHPUnit\Framework\Attributes\DataProvider('deleteProvider')]
#[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'deleteProvider')]
public function testDelete(string $path): void {
$this->insertProps('dummy_user_42', $path, ['foo' => 'bar']);
$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 {
$this->insertProps('dummy_user_42', $source, ['foo' => 'bar']);
$this->backend->move($source, $target);

View file

@ -192,7 +192,7 @@ class GroupPrincipalTest extends \Test\TestCase {
['{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 {
$this->shareManager->expects($this->once())
->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 {
$this->shareManager->expects($this->once())
->method('shareAPIEnabled')

View file

@ -14,7 +14,7 @@ use Test\TestCase;
class SystemPrincipalBackendTest extends TestCase {
#[\PHPUnit\Framework\Attributes\DataProvider('providesPrefix')]
#[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'providesPrefix')]
public function testGetPrincipalsByPrefix(array $expected, string $prefix): void {
$backend = new SystemPrincipalBackend();
$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 {
$backend = new SystemPrincipalBackend();
$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 {
$this->expectException(Exception::class);
$this->expectExceptionMessage('Principal not found');
@ -77,7 +77,7 @@ class SystemPrincipalBackendTest extends TestCase {
$this->assertEquals(['principals/system/system'], $result);
}
#[\PHPUnit\Framework\Attributes\DataProvider('providesPrincipalForGetGroupMembership')]
#[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'providesPrincipalForGetGroupMembership')]
public function testGetGroupMembershipExceptional(string $principal): void {
$this->expectException(Exception::class);
$this->expectExceptionMessage('Principal not found');

View file

@ -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 {
$nodeInfo = $this->createMock(File::class);
if ($isVersion) {

View file

@ -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 {
$event = new CalendarObjectDeletedEvent($calendarId, $calendarData, $shares, $objectData);
$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 {
$event = new CalendarDeletedEvent($calendarId, $calendarData, $shares);
$this->logger->expects($this->once())->method('debug')->with(

View file

@ -22,7 +22,7 @@ use Test\TestCase;
*
* @package OCA\DAV\Tests\Unit\DAV\Migration
*/
#[\PHPUnit\Framework\Attributes\Group('DB')]
#[\PHPUnit\Framework\Attributes\Group(name: 'DB')]
class CalDAVRemoveEmptyValueTest extends TestCase {
private LoggerInterface&MockObject $logger;
private CalDavBackend&MockObject $backend;

View file

@ -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 {
$qb = $this->createMock(IQueryBuilder::class);

View file

@ -408,7 +408,7 @@ class EventsSearchProviderTest extends TestCase {
];
}
#[DataProvider('provideDeepLinkData')]
#[DataProvider(methodName: 'provideDeepLinkData')]
public function testGetDeepLinkToCalendarApp(
string $principalUri,
string $expectedBase64DavUrl,
@ -435,7 +435,7 @@ class EventsSearchProviderTest extends TestCase {
$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 {
$vCalendar = Reader::read($ics, Reader::OPTION_FORGIVING);
$eventComponent = $vCalendar->VEVENT;

View file

@ -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);
}
#[\PHPUnit\Framework\Attributes\DataProvider('generateSublineDataProvider')]
#[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'generateSublineDataProvider')]
public function testGenerateSubline(string $ics, string $expectedSubline): void {
$vCalendar = Reader::read($ics, Reader::OPTION_FORGIVING);
$taskComponent = $vCalendar->VTODO;

View file

@ -17,10 +17,10 @@ use OCP\IRequest;
*
* @package OCA\DAV\Tests\Unit
*/
#[\PHPUnit\Framework\Attributes\Group('DB')]
#[\PHPUnit\Framework\Attributes\Group(name: 'DB')]
class ServerTest extends \Test\TestCase {
#[\PHPUnit\Framework\Attributes\DataProvider('providesUris')]
#[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'providesUris')]
public function test(string $uri, array $plugins): void {
/** @var IRequest | \PHPUnit\Framework\MockObject\MockObject $r */
$r = $this->createMock(IRequest::class);

View file

@ -173,7 +173,7 @@ class ExampleContactServiceTest extends TestCase {
return [[true], [false]];
}
#[\PHPUnit\Framework\Attributes\DataProvider('provideDefaultContactEnableData')]
#[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'provideDefaultContactEnableData')]
public function testIsDefaultContactEnabled(bool $enabled): void {
$this->appConfig->expects(self::once())
->method('getAppValueBool')
@ -183,7 +183,7 @@ class ExampleContactServiceTest extends TestCase {
$this->assertEquals($enabled, $this->service->isDefaultContactEnabled());
}
#[\PHPUnit\Framework\Attributes\DataProvider('provideDefaultContactEnableData')]
#[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'provideDefaultContactEnableData')]
public function testSetDefaultContactEnabled(bool $enabled): void {
$this->appConfig->expects(self::once())
->method('setAppValueBool')

View file

@ -62,7 +62,7 @@ class ExampleEventServiceTest extends TestCase {
];
}
#[\PHPUnit\Framework\Attributes\DataProvider('provideCustomEventData')]
#[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'provideCustomEventData')]
public function testCreateExampleEventWithCustomEvent($customEventIcs): void {
$this->appConfig->expects(self::once())
->method('getValueBool')
@ -142,7 +142,7 @@ class ExampleEventServiceTest extends TestCase {
$this->service->createExampleEvent(1000);
}
#[\PHPUnit\Framework\Attributes\DataProvider('provideCustomEventData')]
#[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'provideCustomEventData')]
public function testGetExampleEventWithCustomEvent($customEventIcs): void {
$exampleEventFolder = $this->createMock(ISimpleFolder::class);
$this->appData->expects(self::once())

Some files were not shown because too many files have changed in this diff Show more