diff --git a/apps/comments/tests/Unit/AppInfo/ApplicationTest.php b/apps/comments/tests/Unit/AppInfo/ApplicationTest.php index ac34c97778c03..696057681acd9 100644 --- a/apps/comments/tests/Unit/AppInfo/ApplicationTest.php +++ b/apps/comments/tests/Unit/AppInfo/ApplicationTest.php @@ -26,7 +26,7 @@ * * @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(); diff --git a/apps/comments/tests/Unit/Collaboration/CommentersSorterTest.php b/apps/comments/tests/Unit/Collaboration/CommentersSorterTest.php index 4d3392a562dbc..0abc7f88c6a1c 100644 --- a/apps/comments/tests/Unit/Collaboration/CommentersSorterTest.php +++ b/apps/comments/tests/Unit/Collaboration/CommentersSorterTest.php @@ -27,7 +27,7 @@ protected function setUp(): void { /** * @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) { diff --git a/apps/comments/tests/Unit/EventHandlerTest.php b/apps/comments/tests/Unit/EventHandlerTest.php index 3e6ddf5eed683..666b1623d97e4 100644 --- a/apps/comments/tests/Unit/EventHandlerTest.php +++ b/apps/comments/tests/Unit/EventHandlerTest.php @@ -61,7 +61,7 @@ public static function handledProvider(): array { ]; } - #[\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); diff --git a/apps/comments/tests/Unit/Notification/ListenerTest.php b/apps/comments/tests/Unit/Notification/ListenerTest.php index f2114d0b15b1c..a84e86ef528a3 100644 --- a/apps/comments/tests/Unit/Notification/ListenerTest.php +++ b/apps/comments/tests/Unit/Notification/ListenerTest.php @@ -51,7 +51,7 @@ public static function eventProvider(): array { * @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 @@ public function testEvaluate(string $eventType, $notificationMethod): void { $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); diff --git a/apps/contactsinteraction/tests/Db/RecentContactMapperTest.php b/apps/contactsinteraction/tests/Db/RecentContactMapperTest.php index e3b844e663819..4876f5b84f0c0 100644 --- a/apps/contactsinteraction/tests/Db/RecentContactMapperTest.php +++ b/apps/contactsinteraction/tests/Db/RecentContactMapperTest.php @@ -17,7 +17,7 @@ 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; diff --git a/apps/dav/tests/integration/DAV/Sharing/CalDavSharingBackendTest.php b/apps/dav/tests/integration/DAV/Sharing/CalDavSharingBackendTest.php index c8d0b041fcdc8..40ce65baf1e09 100644 --- a/apps/dav/tests/integration/DAV/Sharing/CalDavSharingBackendTest.php +++ b/apps/dav/tests/integration/DAV/Sharing/CalDavSharingBackendTest.php @@ -28,7 +28,7 @@ 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; diff --git a/apps/dav/tests/integration/DAV/Sharing/SharingMapperTest.php b/apps/dav/tests/integration/DAV/Sharing/SharingMapperTest.php index 68dec89aa3e07..284d6fec4cdf5 100644 --- a/apps/dav/tests/integration/DAV/Sharing/SharingMapperTest.php +++ b/apps/dav/tests/integration/DAV/Sharing/SharingMapperTest.php @@ -14,7 +14,7 @@ use OCP\Server; use Test\TestCase; -#[\PHPUnit\Framework\Attributes\Group('DB')] +#[\PHPUnit\Framework\Attributes\Group(name: 'DB')] class SharingMapperTest extends TestCase { private SharingMapper $mapper; diff --git a/apps/dav/tests/integration/Db/PropertyMapperTest.php b/apps/dav/tests/integration/Db/PropertyMapperTest.php index 22ddbdf3bb401..346c5661f1601 100644 --- a/apps/dav/tests/integration/Db/PropertyMapperTest.php +++ b/apps/dav/tests/integration/Db/PropertyMapperTest.php @@ -13,7 +13,7 @@ use OCP\Server; use Test\TestCase; -#[\PHPUnit\Framework\Attributes\Group('DB')] +#[\PHPUnit\Framework\Attributes\Group(name: 'DB')] class PropertyMapperTest extends TestCase { /** @var PropertyMapper */ diff --git a/apps/dav/tests/integration/UserMigration/CalendarMigratorTest.php b/apps/dav/tests/integration/UserMigration/CalendarMigratorTest.php index ac28793303783..e32f9979822ed 100644 --- a/apps/dav/tests/integration/UserMigration/CalendarMigratorTest.php +++ b/apps/dav/tests/integration/UserMigration/CalendarMigratorTest.php @@ -22,7 +22,7 @@ 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 @@ private function getSanitizedComponents(VCalendar $vCalendar): array { ); } - #[\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'); diff --git a/apps/dav/tests/integration/UserMigration/ContactsMigratorTest.php b/apps/dav/tests/integration/UserMigration/ContactsMigratorTest.php index bc7d42d10707a..6c19d1b5468e8 100644 --- a/apps/dav/tests/integration/UserMigration/ContactsMigratorTest.php +++ b/apps/dav/tests/integration/UserMigration/ContactsMigratorTest.php @@ -22,7 +22,7 @@ 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 @@ private function getProperties(VCard $vCard): array { * @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'); diff --git a/apps/dav/tests/unit/AppInfo/ApplicationTest.php b/apps/dav/tests/unit/AppInfo/ApplicationTest.php index 5af3836741e3d..59e7a74640ded 100644 --- a/apps/dav/tests/unit/AppInfo/ApplicationTest.php +++ b/apps/dav/tests/unit/AppInfo/ApplicationTest.php @@ -19,7 +19,7 @@ * * @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(); diff --git a/apps/dav/tests/unit/Avatars/AvatarHomeTest.php b/apps/dav/tests/unit/Avatars/AvatarHomeTest.php index 7117637a00029..5b613091ed4ff 100644 --- a/apps/dav/tests/unit/Avatars/AvatarHomeTest.php +++ b/apps/dav/tests/unit/Avatars/AvatarHomeTest.php @@ -27,7 +27,7 @@ protected function setUp(): void { $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 @@ public static function providesTestGetChild(): array { ]; } - #[\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 @@ public function testGetChildren(): void { 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); diff --git a/apps/dav/tests/unit/BackgroundJob/EventReminderJobTest.php b/apps/dav/tests/unit/BackgroundJob/EventReminderJobTest.php index a46a1e5e5b04c..6cb4f220e07ee 100644 --- a/apps/dav/tests/unit/BackgroundJob/EventReminderJobTest.php +++ b/apps/dav/tests/unit/BackgroundJob/EventReminderJobTest.php @@ -50,7 +50,7 @@ public static function data(): array { * @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') diff --git a/apps/dav/tests/unit/BackgroundJob/PruneOutdatedSyncTokensJobTest.php b/apps/dav/tests/unit/BackgroundJob/PruneOutdatedSyncTokensJobTest.php index 1838fb2537d0b..32b24377d06a1 100644 --- a/apps/dav/tests/unit/BackgroundJob/PruneOutdatedSyncTokensJobTest.php +++ b/apps/dav/tests/unit/BackgroundJob/PruneOutdatedSyncTokensJobTest.php @@ -39,7 +39,7 @@ protected function setUp(): void { $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') diff --git a/apps/dav/tests/unit/BackgroundJob/RefreshWebcalJobTest.php b/apps/dav/tests/unit/BackgroundJob/RefreshWebcalJobTest.php index 46c73c69290df..14cc1bce72c56 100644 --- a/apps/dav/tests/unit/BackgroundJob/RefreshWebcalJobTest.php +++ b/apps/dav/tests/unit/BackgroundJob/RefreshWebcalJobTest.php @@ -42,7 +42,7 @@ protected function setUp(): void { * @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'); diff --git a/apps/dav/tests/unit/BackgroundJob/UserStatusAutomationTest.php b/apps/dav/tests/unit/BackgroundJob/UserStatusAutomationTest.php index 41e13df975bc7..3a824c26b4a0f 100644 --- a/apps/dav/tests/unit/BackgroundJob/UserStatusAutomationTest.php +++ b/apps/dav/tests/unit/BackgroundJob/UserStatusAutomationTest.php @@ -25,7 +25,7 @@ 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 @@ public static function dataRun(): array { ]; } - #[\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' diff --git a/apps/dav/tests/unit/CalDAV/AbstractCalDavBackend.php b/apps/dav/tests/unit/CalDAV/AbstractCalDavBackend.php index 3e419e086acb0..f8d29fdd418d4 100644 --- a/apps/dav/tests/unit/CalDAV/AbstractCalDavBackend.php +++ b/apps/dav/tests/unit/CalDAV/AbstractCalDavBackend.php @@ -42,7 +42,7 @@ * * @package OCA\DAV\Tests\unit\CalDAV */ -#[\PHPUnit\Framework\Attributes\Group('DB')] +#[\PHPUnit\Framework\Attributes\Group(name: 'DB')] abstract class AbstractCalDavBackend extends TestCase { diff --git a/apps/dav/tests/unit/CalDAV/Activity/BackendTest.php b/apps/dav/tests/unit/CalDAV/Activity/BackendTest.php index 4848a01f6b905..037aa19f9171a 100644 --- a/apps/dav/tests/unit/CalDAV/Activity/BackendTest.php +++ b/apps/dav/tests/unit/CalDAV/Activity/BackendTest.php @@ -71,7 +71,7 @@ public static function dataCallTriggerCalendarActivity(): array { ]; } - #[\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 @@ public static function dataTriggerCalendarActivity(): array { ]; } - #[\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 @@ public static function dataGetUsersForShares(): array { ]; } - #[\PHPUnit\Framework\Attributes\DataProvider('dataGetUsersForShares')] + #[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'dataGetUsersForShares')] public function testGetUsersForShares(array $shares, array $groups, array $expected): void { $backend = $this->getBackend(); diff --git a/apps/dav/tests/unit/CalDAV/Activity/Filter/CalendarTest.php b/apps/dav/tests/unit/CalDAV/Activity/Filter/CalendarTest.php index b4c4e14fe7d87..10f089fd9893d 100644 --- a/apps/dav/tests/unit/CalDAV/Activity/Filter/CalendarTest.php +++ b/apps/dav/tests/unit/CalDAV/Activity/Filter/CalendarTest.php @@ -60,7 +60,7 @@ public static function dataFilterTypes(): array { * @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)); } diff --git a/apps/dav/tests/unit/CalDAV/Activity/Filter/GenericTest.php b/apps/dav/tests/unit/CalDAV/Activity/Filter/GenericTest.php index ca8f5d5669f0c..ea47c64048c66 100644 --- a/apps/dav/tests/unit/CalDAV/Activity/Filter/GenericTest.php +++ b/apps/dav/tests/unit/CalDAV/Activity/Filter/GenericTest.php @@ -13,7 +13,7 @@ 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 @@ public static function dataFilters(): array { ]; } - #[\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 @@ public function testGetPriority(string $filterClass): void { $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 @@ public function testGetIcon(string $filterClass): void { $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); diff --git a/apps/dav/tests/unit/CalDAV/Activity/Filter/TodoTest.php b/apps/dav/tests/unit/CalDAV/Activity/Filter/TodoTest.php index f18d66b977460..7236e7c11b14e 100644 --- a/apps/dav/tests/unit/CalDAV/Activity/Filter/TodoTest.php +++ b/apps/dav/tests/unit/CalDAV/Activity/Filter/TodoTest.php @@ -60,7 +60,7 @@ public static function dataFilterTypes(): array { * @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)); } diff --git a/apps/dav/tests/unit/CalDAV/Activity/Provider/BaseTest.php b/apps/dav/tests/unit/CalDAV/Activity/Provider/BaseTest.php index 3e6219beef8a4..0abe0915ac0fc 100644 --- a/apps/dav/tests/unit/CalDAV/Activity/Provider/BaseTest.php +++ b/apps/dav/tests/unit/CalDAV/Activity/Provider/BaseTest.php @@ -44,7 +44,7 @@ public static function dataSetSubjects(): array { ]; } - #[\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 @@ public static function dataGenerateCalendarParameter(): array { ]; } - #[\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 @@ public static function dataGenerateLegacyCalendarParameter(): array { ]; } - #[\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 @@ public static function dataGenerateGroupParameter(): array { ]; } - #[\PHPUnit\Framework\Attributes\DataProvider('dataGenerateGroupParameter')] + #[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'dataGenerateGroupParameter')] public function testGenerateGroupParameter(string $gid): void { $this->assertEquals([ 'type' => 'user-group', diff --git a/apps/dav/tests/unit/CalDAV/Activity/Provider/EventTest.php b/apps/dav/tests/unit/CalDAV/Activity/Provider/EventTest.php index 4fd38c1aed2f2..f0e75e0a17058 100644 --- a/apps/dav/tests/unit/CalDAV/Activity/Provider/EventTest.php +++ b/apps/dav/tests/unit/CalDAV/Activity/Provider/EventTest.php @@ -67,7 +67,7 @@ public static function dataGenerateObjectParameter(): array { ]; } - #[\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 @@ public static function generateObjectParameterLinkEncodingDataProvider(): array ]; } - #[\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 @@ public static function dataGenerateObjectParameterThrows(): array { ]; } - #[\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); diff --git a/apps/dav/tests/unit/CalDAV/Activity/Setting/GenericTest.php b/apps/dav/tests/unit/CalDAV/Activity/Setting/GenericTest.php index 23126b6bbcf31..14d44a3352828 100644 --- a/apps/dav/tests/unit/CalDAV/Activity/Setting/GenericTest.php +++ b/apps/dav/tests/unit/CalDAV/Activity/Setting/GenericTest.php @@ -23,27 +23,27 @@ public static function dataSettings(): array { ]; } - #[\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 @@ public function testGetPriority(string $settingClass): void { $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); diff --git a/apps/dav/tests/unit/CalDAV/CalDavBackendTest.php b/apps/dav/tests/unit/CalDAV/CalDavBackendTest.php index abb0155103764..802e73208b0e6 100644 --- a/apps/dav/tests/unit/CalDAV/CalDavBackendTest.php +++ b/apps/dav/tests/unit/CalDAV/CalDavBackendTest.php @@ -29,7 +29,7 @@ /** * 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 @@ public static function providesSharingData(): array { ]; } - #[\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 @@ public function testMultiCalendarObjects(): void { $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 @@ public static function providesSchedulingData(): array { /** * @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 @@ public function testScheduling($objectData): void { $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 @@ public function testCalendarSearch(): void { $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(); diff --git a/apps/dav/tests/unit/CalDAV/CalendarObjectTest.php b/apps/dav/tests/unit/CalDAV/CalendarObjectTest.php index 4a7404d3e790d..19b143fab6764 100644 --- a/apps/dav/tests/unit/CalDAV/CalendarObjectTest.php +++ b/apps/dav/tests/unit/CalDAV/CalendarObjectTest.php @@ -79,7 +79,7 @@ public static function provideConfidentialObjectData(): array { ]; } - #[DataProvider('provideConfidentialObjectData')] + #[DataProvider(methodName: 'provideConfidentialObjectData')] public function testGetWithConfidentialObject( bool $expectConfidential, array $calendarInfo, diff --git a/apps/dav/tests/unit/CalDAV/CalendarTest.php b/apps/dav/tests/unit/CalDAV/CalendarTest.php index eb211b9fedfe4..5f5552dd0f0df 100644 --- a/apps/dav/tests/unit/CalDAV/CalendarTest.php +++ b/apps/dav/tests/unit/CalDAV/CalendarTest.php @@ -144,7 +144,7 @@ public static function dataPropPatch(): array { ]; } - #[\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 @@ public function testPropPatch(string $ownerPrincipal, string $principalUri, arra $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 @@ public static function providesReadOnlyInfo(): array { ]; } - #[\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 @@ public function testPrivateClassification(int $expectedChildren, bool $isShared) $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'; diff --git a/apps/dav/tests/unit/CalDAV/Federation/CalendarFederationConfigTest.php b/apps/dav/tests/unit/CalDAV/Federation/CalendarFederationConfigTest.php index ad0e442ad4f47..b8b37eea16748 100644 --- a/apps/dav/tests/unit/CalDAV/Federation/CalendarFederationConfigTest.php +++ b/apps/dav/tests/unit/CalDAV/Federation/CalendarFederationConfigTest.php @@ -37,7 +37,7 @@ public static function provideIsFederationEnabledData(): array { ]; } - #[DataProvider('provideIsFederationEnabledData')] + #[DataProvider(methodName: 'provideIsFederationEnabledData')] public function testIsFederationEnabled(bool $configValue): void { $this->appConfig->expects(self::once()) ->method('getAppValueBool') diff --git a/apps/dav/tests/unit/CalDAV/Federation/CalendarFederationProviderTest.php b/apps/dav/tests/unit/CalDAV/Federation/CalendarFederationProviderTest.php index 8e43689778985..64188322f65a1 100644 --- a/apps/dav/tests/unit/CalDAV/Federation/CalendarFederationProviderTest.php +++ b/apps/dav/tests/unit/CalDAV/Federation/CalendarFederationProviderTest.php @@ -239,7 +239,7 @@ public static function provideIncompleteProtocolData(): array { ]; } - #[DataProvider('provideIncompleteProtocolData')] + #[DataProvider(methodName: 'provideIncompleteProtocolData')] public function testShareReceivedWithIncompleteProtocolData(array $protocol): void { $share = $this->createMock(ICloudFederationShare::class); $share->method('getShareType') @@ -400,7 +400,7 @@ public static function provideIncompleteSyncCalendarNotificationData(): array { ]; } - #[DataProvider('provideIncompleteSyncCalendarNotificationData')] + #[DataProvider(methodName: 'provideIncompleteSyncCalendarNotificationData')] public function testNotificationReceivedWithSyncCalendarNotificationAndIncompleteData( array $notification, ): void { diff --git a/apps/dav/tests/unit/CalDAV/Federation/FederatedCalendarAuthTest.php b/apps/dav/tests/unit/CalDAV/Federation/FederatedCalendarAuthTest.php index d4bd4201f0402..aa6822257500a 100644 --- a/apps/dav/tests/unit/CalDAV/Federation/FederatedCalendarAuthTest.php +++ b/apps/dav/tests/unit/CalDAV/Federation/FederatedCalendarAuthTest.php @@ -109,7 +109,7 @@ public static function provideCheckData(): array { ]; } - #[DataProvider('provideCheckData')] + #[DataProvider(methodName: 'provideCheckData')] public function testCheck( string $requestPath, ?string $authHeader, diff --git a/apps/dav/tests/unit/CalDAV/Federation/FederatedCalendarSyncServiceTest.php b/apps/dav/tests/unit/CalDAV/Federation/FederatedCalendarSyncServiceTest.php index 64dda266af063..03a83348d081b 100644 --- a/apps/dav/tests/unit/CalDAV/Federation/FederatedCalendarSyncServiceTest.php +++ b/apps/dav/tests/unit/CalDAV/Federation/FederatedCalendarSyncServiceTest.php @@ -126,7 +126,7 @@ public static function provideUnexpectedSyncTokenData(): array { ]; } - #[DataProvider('provideUnexpectedSyncTokenData')] + #[DataProvider(methodName: 'provideUnexpectedSyncTokenData')] public function testSyncOneWithUnexpectedSyncTokenFormat(string $syncToken): void { $calendar = new FederatedCalendarEntity(); $calendar->setId(1); diff --git a/apps/dav/tests/unit/CalDAV/Federation/FederationSharingServiceTest.php b/apps/dav/tests/unit/CalDAV/Federation/FederationSharingServiceTest.php index 1bb03e387baf5..6df0a565c938b 100644 --- a/apps/dav/tests/unit/CalDAV/Federation/FederationSharingServiceTest.php +++ b/apps/dav/tests/unit/CalDAV/Federation/FederationSharingServiceTest.php @@ -390,7 +390,7 @@ public static function provideInvalidRemoteUserPrincipalData(): array { ]; } - #[DataProvider('provideInvalidRemoteUserPrincipalData')] + #[DataProvider(methodName: 'provideInvalidRemoteUserPrincipalData')] public function testShareWithWithInvalidRemoteUserPrincipal(string $remoteUserPrincipal): void { $shareable = $this->createMock(Calendar::class); $shareable->method('getOwner') diff --git a/apps/dav/tests/unit/CalDAV/Integration/ExternalCalendarTest.php b/apps/dav/tests/unit/CalDAV/Integration/ExternalCalendarTest.php index b2f479ac0e371..3faf95d37531c 100644 --- a/apps/dav/tests/unit/CalDAV/Integration/ExternalCalendarTest.php +++ b/apps/dav/tests/unit/CalDAV/Integration/ExternalCalendarTest.php @@ -66,7 +66,7 @@ public function testIsAppGeneratedCalendar():void { $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'); diff --git a/apps/dav/tests/unit/CalDAV/PluginTest.php b/apps/dav/tests/unit/CalDAV/PluginTest.php index c5725a1fa813a..a9e868c688f4a 100644 --- a/apps/dav/tests/unit/CalDAV/PluginTest.php +++ b/apps/dav/tests/unit/CalDAV/PluginTest.php @@ -36,7 +36,7 @@ public static function linkProvider(): array { ]; } - #[\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)); } diff --git a/apps/dav/tests/unit/CalDAV/PublicCalendarObjectTest.php b/apps/dav/tests/unit/CalDAV/PublicCalendarObjectTest.php index 8f5044dbd5755..e274339891880 100644 --- a/apps/dav/tests/unit/CalDAV/PublicCalendarObjectTest.php +++ b/apps/dav/tests/unit/CalDAV/PublicCalendarObjectTest.php @@ -65,7 +65,7 @@ public static function provideConfidentialObjectData(): array { ]; } - #[DataProvider('provideConfidentialObjectData')] + #[DataProvider(methodName: 'provideConfidentialObjectData')] public function testGetWithConfidentialObject(array $calendarInfo): void { $ics = << 'event-0', 'classification' => CalDavBackend::CLASSIFICATION_PUBLIC]; $calObject1 = ['uri' => 'event-1', 'classification' => CalDavBackend::CLASSIFICATION_CONFIDENTIAL]; @@ -55,7 +55,7 @@ public function testPrivateClassification(int $expectedChildren, bool $isShared) $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'; diff --git a/apps/dav/tests/unit/CalDAV/Reminder/NotificationProviderManagerTest.php b/apps/dav/tests/unit/CalDAV/Reminder/NotificationProviderManagerTest.php index 4bea30dbfc975..90bd1e1565622 100644 --- a/apps/dav/tests/unit/CalDAV/Reminder/NotificationProviderManagerTest.php +++ b/apps/dav/tests/unit/CalDAV/Reminder/NotificationProviderManagerTest.php @@ -17,7 +17,7 @@ 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; diff --git a/apps/dav/tests/unit/CalDAV/Reminder/NotifierTest.php b/apps/dav/tests/unit/CalDAV/Reminder/NotifierTest.php index c091f5907114e..078f892121a14 100644 --- a/apps/dav/tests/unit/CalDAV/Reminder/NotifierTest.php +++ b/apps/dav/tests/unit/CalDAV/Reminder/NotifierTest.php @@ -170,7 +170,7 @@ public static function dataPrepare(): array { ]; } - #[\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); diff --git a/apps/dav/tests/unit/CalDAV/ResourceBooking/AbstractPrincipalBackendTestCase.php b/apps/dav/tests/unit/CalDAV/ResourceBooking/AbstractPrincipalBackendTestCase.php index 03007d622dfa5..80a5a90ad2309 100644 --- a/apps/dav/tests/unit/CalDAV/ResourceBooking/AbstractPrincipalBackendTestCase.php +++ b/apps/dav/tests/unit/CalDAV/ResourceBooking/AbstractPrincipalBackendTestCase.php @@ -246,7 +246,7 @@ public function testUpdatePrincipal(): void { $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()) diff --git a/apps/dav/tests/unit/CalDAV/Schedule/PluginTest.php b/apps/dav/tests/unit/CalDAV/Schedule/PluginTest.php index 524ac556e19a4..bb0b3070f9ead 100644 --- a/apps/dav/tests/unit/CalDAV/Schedule/PluginTest.php +++ b/apps/dav/tests/unit/CalDAV/Schedule/PluginTest.php @@ -251,7 +251,7 @@ public static function propFindDefaultCalendarUrlProvider(): array { ]; } - #[\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, diff --git a/apps/dav/tests/unit/CalDAV/WebcalCaching/ConnectionTest.php b/apps/dav/tests/unit/CalDAV/WebcalCaching/ConnectionTest.php index 0c3f4f88fc542..1a0eade56f7c8 100644 --- a/apps/dav/tests/unit/CalDAV/WebcalCaching/ConnectionTest.php +++ b/apps/dav/tests/unit/CalDAV/WebcalCaching/ConnectionTest.php @@ -32,7 +32,7 @@ public function setUp(): void { $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 @@ public function testInvalidUrl(): void { } - #[\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); diff --git a/apps/dav/tests/unit/CalDAV/WebcalCaching/RefreshWebcalServiceTest.php b/apps/dav/tests/unit/CalDAV/WebcalCaching/RefreshWebcalServiceTest.php index 3039b8be0877b..06f04019d8e1d 100644 --- a/apps/dav/tests/unit/CalDAV/WebcalCaching/RefreshWebcalServiceTest.php +++ b/apps/dav/tests/unit/CalDAV/WebcalCaching/RefreshWebcalServiceTest.php @@ -50,7 +50,7 @@ private function createStreamFromString(string $content) { 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 @@ public function testRun(string $body, string $format, string $result): void { $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 @@ public function testLongUidIsSkipped(): void { $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 @@ public function testRunCreateCalendarNoException(string $body, string $format, s $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']) diff --git a/apps/dav/tests/unit/CardDAV/Activity/BackendTest.php b/apps/dav/tests/unit/CardDAV/Activity/BackendTest.php index a070a3d7131ae..b5b5e9799ec7d 100644 --- a/apps/dav/tests/unit/CardDAV/Activity/BackendTest.php +++ b/apps/dav/tests/unit/CardDAV/Activity/BackendTest.php @@ -37,10 +37,7 @@ protected function setUp(): void { $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 @@ public static function dataCallTriggerAddressBookActivity(): array { ]; } - #[\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 @@ public static function dataTriggerAddressBookActivity(): array { * @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 @@ public static function dataTriggerCardActivity(): array { * @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 @@ public static function dataGetUsersForShares(): array { ]; } - #[\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 @@ public function testGetUsersForShares(array $shares, array $groups, array $expec /** * @param string[] $users - * @return IUser[]|MockObject[] + * @return list */ protected function getUsers(array $users): array { $list = []; @@ -470,10 +467,7 @@ protected function getUsers(array $users): array { 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') diff --git a/apps/dav/tests/unit/CardDAV/AddressBookImplTest.php b/apps/dav/tests/unit/CardDAV/AddressBookImplTest.php index 77b5db309dffa..1c346bf984658 100644 --- a/apps/dav/tests/unit/CardDAV/AddressBookImplTest.php +++ b/apps/dav/tests/unit/CardDAV/AddressBookImplTest.php @@ -80,7 +80,7 @@ public function testSearch(): void { ->getMock(); $pattern = 'pattern'; - $searchProperties = 'properties'; + $searchProperties = ['properties']; $this->backend->expects($this->once())->method('search') ->with($this->addressBookInfo['id'], $pattern, $searchProperties) @@ -104,7 +104,7 @@ public function testSearch(): void { $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 @@ public function testUpdateWithTypes(): void { $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); diff --git a/apps/dav/tests/unit/CardDAV/AddressBookTest.php b/apps/dav/tests/unit/CardDAV/AddressBookTest.php index cf28b7b8a8eb9..e89232297d349 100644 --- a/apps/dav/tests/unit/CardDAV/AddressBookTest.php +++ b/apps/dav/tests/unit/CardDAV/AddressBookTest.php @@ -117,7 +117,7 @@ public function testPropPatchNotShared(): void { $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); diff --git a/apps/dav/tests/unit/CardDAV/BirthdayServiceTest.php b/apps/dav/tests/unit/CardDAV/BirthdayServiceTest.php index bb3ea04f969b0..14a21dd7a770c 100644 --- a/apps/dav/tests/unit/CardDAV/BirthdayServiceTest.php +++ b/apps/dav/tests/unit/CardDAV/BirthdayServiceTest.php @@ -50,7 +50,7 @@ protected function setUp(): void { $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 @@ public function testOnCardChangedUserDisabled(): void { $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 @@ public function testOnCardChanged(string $expectedOp): void { $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)); diff --git a/apps/dav/tests/unit/CardDAV/CardDavBackendTest.php b/apps/dav/tests/unit/CardDAV/CardDavBackendTest.php index 2c5c4789fca09..195eb75545770 100644 --- a/apps/dav/tests/unit/CardDAV/CardDavBackendTest.php +++ b/apps/dav/tests/unit/CardDAV/CardDavBackendTest.php @@ -46,7 +46,7 @@ * * @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 @@ public function testGetCardIdFailed(): void { $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 = []; diff --git a/apps/dav/tests/unit/CardDAV/ConverterTest.php b/apps/dav/tests/unit/CardDAV/ConverterTest.php index 00519b82766d0..96cf8993de646 100644 --- a/apps/dav/tests/unit/CardDAV/ConverterTest.php +++ b/apps/dav/tests/unit/CardDAV/ConverterTest.php @@ -79,7 +79,7 @@ public function getAccountManager(IUser $user) { 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 @@ public static function providesNewUsers(): array { ]; } - #[\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); diff --git a/apps/dav/tests/unit/CardDAV/ImageExportPluginTest.php b/apps/dav/tests/unit/CardDAV/ImageExportPluginTest.php index d47f53bddcd07..2a766f1327b51 100644 --- a/apps/dav/tests/unit/CardDAV/ImageExportPluginTest.php +++ b/apps/dav/tests/unit/CardDAV/ImageExportPluginTest.php @@ -45,7 +45,7 @@ protected function setUp(): void { $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 @@ public static function dataTestCard(): array { ]; } - #[\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) { diff --git a/apps/dav/tests/unit/CardDAV/SyncServiceTest.php b/apps/dav/tests/unit/CardDAV/SyncServiceTest.php index 716db41c49a00..9411bb20e4ae2 100644 --- a/apps/dav/tests/unit/CardDAV/SyncServiceTest.php +++ b/apps/dav/tests/unit/CardDAV/SyncServiceTest.php @@ -325,7 +325,7 @@ public static function dataActivatedUsers(): array { ]; } - #[\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 @@ public function testDeleteAddressbookWhenAccessRevoked(): void { ); } - #[\PHPUnit\Framework\Attributes\DataProvider('providerUseAbsoluteUriReport')] + #[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'providerUseAbsoluteUriReport')] public function testUseAbsoluteUriReport(string $host, string $expected): void { $body = ' diff --git a/apps/dav/tests/unit/CardDAV/SystemAddressBookTest.php b/apps/dav/tests/unit/CardDAV/SystemAddressBookTest.php index 4a218fa461641..1c163f4ea83b8 100644 --- a/apps/dav/tests/unit/CardDAV/SystemAddressBookTest.php +++ b/apps/dav/tests/unit/CardDAV/SystemAddressBookTest.php @@ -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; diff --git a/apps/dav/tests/unit/Command/ListAddressbooksTest.php b/apps/dav/tests/unit/Command/ListAddressbooksTest.php index 2768ed576c348..d78e020aa03d2 100644 --- a/apps/dav/tests/unit/Command/ListAddressbooksTest.php +++ b/apps/dav/tests/unit/Command/ListAddressbooksTest.php @@ -78,7 +78,7 @@ public static function dataExecute(): array { ]; } - #[\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') diff --git a/apps/dav/tests/unit/Command/ListCalendarsTest.php b/apps/dav/tests/unit/Command/ListCalendarsTest.php index d398a7c772fef..fde5e8b4103ca 100644 --- a/apps/dav/tests/unit/Command/ListCalendarsTest.php +++ b/apps/dav/tests/unit/Command/ListCalendarsTest.php @@ -79,7 +79,7 @@ public static function dataExecute(): array { ]; } - #[\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') diff --git a/apps/dav/tests/unit/Command/MoveCalendarTest.php b/apps/dav/tests/unit/Command/MoveCalendarTest.php index e9f016961f298..391624ae1cae7 100644 --- a/apps/dav/tests/unit/Command/MoveCalendarTest.php +++ b/apps/dav/tests/unit/Command/MoveCalendarTest.php @@ -64,7 +64,7 @@ public static function dataExecute(): array { ]; } - #[\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 @@ public static function dataTestMoveWithDestinationNotPartOfGroup(): array { ]; } - #[\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 @@ public static function dataTestMoveWithCalendarAlreadySharedToDestination(): arr ]; } - #[\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') diff --git a/apps/dav/tests/unit/Command/RemoveInvalidSharesTest.php b/apps/dav/tests/unit/Command/RemoveInvalidSharesTest.php index 50ca649b431ff..57462535438bb 100644 --- a/apps/dav/tests/unit/Command/RemoveInvalidSharesTest.php +++ b/apps/dav/tests/unit/Command/RemoveInvalidSharesTest.php @@ -24,7 +24,7 @@ * * @package OCA\DAV\Tests\Unit\Repair */ -#[\PHPUnit\Framework\Attributes\Group('DB')] +#[\PHPUnit\Framework\Attributes\Group(name: 'DB')] class RemoveInvalidSharesTest extends TestCase { private RemoveInvalidShares $command; diff --git a/apps/dav/tests/unit/Comments/CommentsNodeTest.php b/apps/dav/tests/unit/Comments/CommentsNodeTest.php index 9e108b4cf63ab..a1bbfe816f61e 100644 --- a/apps/dav/tests/unit/Comments/CommentsNodeTest.php +++ b/apps/dav/tests/unit/Comments/CommentsNodeTest.php @@ -469,7 +469,7 @@ public static function readCommentProvider(): array { ]; } - #[\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') diff --git a/apps/dav/tests/unit/Connector/LegacyPublicAuthTest.php b/apps/dav/tests/unit/Connector/LegacyPublicAuthTest.php index 2c25b32fa0291..01b67d7d543c8 100644 --- a/apps/dav/tests/unit/Connector/LegacyPublicAuthTest.php +++ b/apps/dav/tests/unit/Connector/LegacyPublicAuthTest.php @@ -23,7 +23,7 @@ * * @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; diff --git a/apps/dav/tests/unit/Connector/Sabre/AuthTest.php b/apps/dav/tests/unit/Connector/Sabre/AuthTest.php index cf6efea0c5b8b..e05c46705652c 100644 --- a/apps/dav/tests/unit/Connector/Sabre/AuthTest.php +++ b/apps/dav/tests/unit/Connector/Sabre/AuthTest.php @@ -19,7 +19,9 @@ 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 @@ * * @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 @@ public function testAuthenticateAlreadyLoggedInWithCsrfTokenForGet(): void { 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 @@ public function testAuthenticateWithBasicAuthenticateHeadersProvidedWithAjax(): } 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 @@ public function testAuthenticateNoBasicAuthenticateHeadersProvidedWithAjaxButUse 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 @@ public function testAuthenticateValidCredentials(): void { 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 @@ public function testAuthenticateInvalidCredentials(): void { ['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') diff --git a/apps/dav/tests/unit/Connector/Sabre/BearerAuthTest.php b/apps/dav/tests/unit/Connector/Sabre/BearerAuthTest.php index 01038747bde24..e85158db083b2 100644 --- a/apps/dav/tests/unit/Connector/Sabre/BearerAuthTest.php +++ b/apps/dav/tests/unit/Connector/Sabre/BearerAuthTest.php @@ -19,7 +19,7 @@ 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 @@ public function testChallenge(): void { $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); } } diff --git a/apps/dav/tests/unit/Connector/Sabre/BlockLegacyClientPluginTest.php b/apps/dav/tests/unit/Connector/Sabre/BlockLegacyClientPluginTest.php index 366c9475b1bb3..fc177034c0314 100644 --- a/apps/dav/tests/unit/Connector/Sabre/BlockLegacyClientPluginTest.php +++ b/apps/dav/tests/unit/Connector/Sabre/BlockLegacyClientPluginTest.php @@ -55,7 +55,7 @@ public static function oldDesktopClientProvider(): array { ]; } - #[\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 @@ public function testBeforeHandlerException(string $userAgent, ERROR_TYPE $errorT /** * 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 @@ public static function newAndAlternateDesktopClientProvider(): array { ]; } - #[\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); diff --git a/apps/dav/tests/unit/Connector/Sabre/CommentsPropertiesPluginTest.php b/apps/dav/tests/unit/Connector/Sabre/CommentsPropertiesPluginTest.php index 9bec46019b99a..f89e8e065425c 100644 --- a/apps/dav/tests/unit/Connector/Sabre/CommentsPropertiesPluginTest.php +++ b/apps/dav/tests/unit/Connector/Sabre/CommentsPropertiesPluginTest.php @@ -43,7 +43,7 @@ public static function nodeProvider(): array { ]; } - #[\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 @@ public static function baseUriProvider(): array { ]; } - #[\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 @@ public static function userProvider(): array { ]; } - #[\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()) diff --git a/apps/dav/tests/unit/Connector/Sabre/CopyEtagHeaderPluginTest.php b/apps/dav/tests/unit/Connector/Sabre/CopyEtagHeaderPluginTest.php index 7067cf335ede4..907825e4237bd 100644 --- a/apps/dav/tests/unit/Connector/Sabre/CopyEtagHeaderPluginTest.php +++ b/apps/dav/tests/unit/Connector/Sabre/CopyEtagHeaderPluginTest.php @@ -13,6 +13,8 @@ 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 @@ protected function setUp(): void { } 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 @@ public function testCopyEtag(): void { } 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); diff --git a/apps/dav/tests/unit/Connector/Sabre/CustomPropertiesBackendTest.php b/apps/dav/tests/unit/Connector/Sabre/CustomPropertiesBackendTest.php index 1ffe47f70d800..af72d1cfc4cba 100644 --- a/apps/dav/tests/unit/Connector/Sabre/CustomPropertiesBackendTest.php +++ b/apps/dav/tests/unit/Connector/Sabre/CustomPropertiesBackendTest.php @@ -25,7 +25,7 @@ * * @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; diff --git a/apps/dav/tests/unit/Connector/Sabre/DirectoryTest.php b/apps/dav/tests/unit/Connector/Sabre/DirectoryTest.php index e2567af602d6a..4144c79821ef5 100644 --- a/apps/dav/tests/unit/Connector/Sabre/DirectoryTest.php +++ b/apps/dav/tests/unit/Connector/Sabre/DirectoryTest.php @@ -58,7 +58,7 @@ public function getRelativePath($path): ?string { } -#[\PHPUnit\Framework\Attributes\Group('DB')] +#[\PHPUnit\Framework\Attributes\Group(name: 'DB')] class DirectoryTest extends \Test\TestCase { use UserTrait; @@ -514,20 +514,20 @@ public function testGetQuotaInfoSpecific(): void { $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); diff --git a/apps/dav/tests/unit/Connector/Sabre/DummyGetResponsePluginTest.php b/apps/dav/tests/unit/Connector/Sabre/DummyGetResponsePluginTest.php index 2d688d6460063..4dd8dc9409f4a 100644 --- a/apps/dav/tests/unit/Connector/Sabre/DummyGetResponsePluginTest.php +++ b/apps/dav/tests/unit/Connector/Sabre/DummyGetResponsePluginTest.php @@ -40,9 +40,7 @@ public function testInitialize(): void { 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()) diff --git a/apps/dav/tests/unit/Connector/Sabre/ExceptionLoggerPluginTest.php b/apps/dav/tests/unit/Connector/Sabre/ExceptionLoggerPluginTest.php index 416ac8a75c990..4539dd998d2a0 100644 --- a/apps/dav/tests/unit/Connector/Sabre/ExceptionLoggerPluginTest.php +++ b/apps/dav/tests/unit/Connector/Sabre/ExceptionLoggerPluginTest.php @@ -42,7 +42,7 @@ private function init(): void { $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(); diff --git a/apps/dav/tests/unit/Connector/Sabre/FakeLockerPluginTest.php b/apps/dav/tests/unit/Connector/Sabre/FakeLockerPluginTest.php index 366932137f45e..4de8642e41ab6 100644 --- a/apps/dav/tests/unit/Connector/Sabre/FakeLockerPluginTest.php +++ b/apps/dav/tests/unit/Connector/Sabre/FakeLockerPluginTest.php @@ -119,7 +119,7 @@ public static function tokenDataProvider(): array { ]; } - #[\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); diff --git a/apps/dav/tests/unit/Connector/Sabre/FileTest.php b/apps/dav/tests/unit/Connector/Sabre/FileTest.php index 64ee2df025379..8c5b04486ddb4 100644 --- a/apps/dav/tests/unit/Connector/Sabre/FileTest.php +++ b/apps/dav/tests/unit/Connector/Sabre/FileTest.php @@ -49,7 +49,7 @@ * * @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 @@ public static function fopenFailuresProvider(): array { ]; } - #[\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 @@ public static function legalMtimeProvider(): array { /** * 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' => [ diff --git a/apps/dav/tests/unit/Connector/Sabre/FilesPluginTest.php b/apps/dav/tests/unit/Connector/Sabre/FilesPluginTest.php index 8d27bc337e4af..6e2d555762653 100644 --- a/apps/dav/tests/unit/Connector/Sabre/FilesPluginTest.php +++ b/apps/dav/tests/unit/Connector/Sabre/FilesPluginTest.php @@ -26,16 +26,18 @@ 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 @@ protected function setUp(): void { $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 $class + */ + private function createTestNode(string $class, string $path = '/dummypath'): INode&MockObject { $node = $this->createMock($class); $node->expects($this->any()) @@ -650,7 +655,7 @@ public static function downloadHeadersProvider(): array { ]; } - #[\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); diff --git a/apps/dav/tests/unit/Connector/Sabre/FilesReportPluginTest.php b/apps/dav/tests/unit/Connector/Sabre/FilesReportPluginTest.php index 176949f999c78..9c408c55e28e5 100644 --- a/apps/dav/tests/unit/Connector/Sabre/FilesReportPluginTest.php +++ b/apps/dav/tests/unit/Connector/Sabre/FilesReportPluginTest.php @@ -846,7 +846,7 @@ public static function filesBaseUriProvider(): array { ]; } - #[\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])); } diff --git a/apps/dav/tests/unit/Connector/Sabre/NodeTest.php b/apps/dav/tests/unit/Connector/Sabre/NodeTest.php index ddea281ea1d49..896f36f12536d 100644 --- a/apps/dav/tests/unit/Connector/Sabre/NodeTest.php +++ b/apps/dav/tests/unit/Connector/Sabre/NodeTest.php @@ -31,7 +31,7 @@ * * @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 @@ public static function davPermissionsProvider(): array { ]; } - #[\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 @@ public static function sharePermissionsProvider(): array { ]; } - #[\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 @@ public static function sanitizeMtimeProvider(): array { ]; } - #[\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 @@ public static function invalidSanitizeMtimeProvider(): array { ]; } - #[\PHPUnit\Framework\Attributes\DataProvider('invalidSanitizeMtimeProvider')] + #[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'invalidSanitizeMtimeProvider')] public function testInvalidSanitizeMtime(int|string $mtime): void { $this->expectException(\InvalidArgumentException::class); diff --git a/apps/dav/tests/unit/Connector/Sabre/ObjectTreeTest.php b/apps/dav/tests/unit/Connector/Sabre/ObjectTreeTest.php index 592d6c958d0f3..fbbda7deffbd5 100644 --- a/apps/dav/tests/unit/Connector/Sabre/ObjectTreeTest.php +++ b/apps/dav/tests/unit/Connector/Sabre/ObjectTreeTest.php @@ -26,7 +26,7 @@ * * @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 @@ public static function copyDataProvider(): array { ]; } - #[\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 @@ public function testCopy(string $sourcePath, string $targetPath, string $targetP $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 @@ public function testCopyFailNotCreatable($sourcePath, $targetPath, $targetParent $objectTree->copy($sourcePath, $targetPath); } - #[\PHPUnit\Framework\Attributes\DataProvider('nodeForPathProvider')] + #[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'nodeForPathProvider')] public function testGetNodeForPath( string $inputFileName, string $fileInfoQueryPath, diff --git a/apps/dav/tests/unit/Connector/Sabre/PrincipalTest.php b/apps/dav/tests/unit/Connector/Sabre/PrincipalTest.php index e32d267106383..eb5176902431a 100644 --- a/apps/dav/tests/unit/Connector/Sabre/PrincipalTest.php +++ b/apps/dav/tests/unit/Connector/Sabre/PrincipalTest.php @@ -463,7 +463,7 @@ public function testSearchPrincipalsWithWrongPrefixPath(): void { ['{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 @@ public function testFindByUriSharingApiDisabled(): void { $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 @@ public static function findByUriWithGroupRestrictionDataProvider(): array { ]; } - #[\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') diff --git a/apps/dav/tests/unit/Connector/Sabre/PropFindMonitorPluginTest.php b/apps/dav/tests/unit/Connector/Sabre/PropFindMonitorPluginTest.php index 60b162116cdcb..261f916badf69 100644 --- a/apps/dav/tests/unit/Connector/Sabre/PropFindMonitorPluginTest.php +++ b/apps/dav/tests/unit/Connector/Sabre/PropFindMonitorPluginTest.php @@ -105,7 +105,7 @@ public static function dataTest(): array { ]; } - #[\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') diff --git a/apps/dav/tests/unit/Connector/Sabre/PublicAuthTest.php b/apps/dav/tests/unit/Connector/Sabre/PublicAuthTest.php index 7fb2339c6f426..2f18b4305087e 100644 --- a/apps/dav/tests/unit/Connector/Sabre/PublicAuthTest.php +++ b/apps/dav/tests/unit/Connector/Sabre/PublicAuthTest.php @@ -25,7 +25,7 @@ * * @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; diff --git a/apps/dav/tests/unit/Connector/Sabre/QuotaPluginTest.php b/apps/dav/tests/unit/Connector/Sabre/QuotaPluginTest.php index 6fe2d6ccabe03..afddea2e7ee7c 100644 --- a/apps/dav/tests/unit/Connector/Sabre/QuotaPluginTest.php +++ b/apps/dav/tests/unit/Connector/Sabre/QuotaPluginTest.php @@ -25,7 +25,7 @@ private function init(int $quota, string $checkedPath = ''): void { $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 @@ public function testLength(?int $expected, array $headers): void { $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 @@ public function testCheckQuota(int $quota, array $headers): void { $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 @@ public function testCheckExceededQuota(int $quota, array $headers): void { $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'); diff --git a/apps/dav/tests/unit/Connector/Sabre/RequestTest/DeleteTest.php b/apps/dav/tests/unit/Connector/Sabre/RequestTest/DeleteTest.php index 34cc0cd5fb3ce..1cc0ec711cb8b 100644 --- a/apps/dav/tests/unit/Connector/Sabre/RequestTest/DeleteTest.php +++ b/apps/dav/tests/unit/Connector/Sabre/RequestTest/DeleteTest.php @@ -17,7 +17,7 @@ * * @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(); diff --git a/apps/dav/tests/unit/Connector/Sabre/RequestTest/DownloadTest.php b/apps/dav/tests/unit/Connector/Sabre/RequestTest/DownloadTest.php index 490833b911d5d..70bff8c04300e 100644 --- a/apps/dav/tests/unit/Connector/Sabre/RequestTest/DownloadTest.php +++ b/apps/dav/tests/unit/Connector/Sabre/RequestTest/DownloadTest.php @@ -17,7 +17,7 @@ * * @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(); diff --git a/apps/dav/tests/unit/Connector/Sabre/RequestTest/EncryptionMasterKeyUploadTest.php b/apps/dav/tests/unit/Connector/Sabre/RequestTest/EncryptionMasterKeyUploadTest.php index cf552e4d4c8fb..abdabb1cb7acc 100644 --- a/apps/dav/tests/unit/Connector/Sabre/RequestTest/EncryptionMasterKeyUploadTest.php +++ b/apps/dav/tests/unit/Connector/Sabre/RequestTest/EncryptionMasterKeyUploadTest.php @@ -20,7 +20,7 @@ * * @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; diff --git a/apps/dav/tests/unit/Connector/Sabre/RequestTest/EncryptionUploadTest.php b/apps/dav/tests/unit/Connector/Sabre/RequestTest/EncryptionUploadTest.php index 19b2b170a9df4..c1ae71ac28f74 100644 --- a/apps/dav/tests/unit/Connector/Sabre/RequestTest/EncryptionUploadTest.php +++ b/apps/dav/tests/unit/Connector/Sabre/RequestTest/EncryptionUploadTest.php @@ -20,7 +20,7 @@ * * @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; diff --git a/apps/dav/tests/unit/Connector/Sabre/RequestTest/PartFileInRootUploadTest.php b/apps/dav/tests/unit/Connector/Sabre/RequestTest/PartFileInRootUploadTest.php index bd22f37185807..0962c9516fb40 100644 --- a/apps/dav/tests/unit/Connector/Sabre/RequestTest/PartFileInRootUploadTest.php +++ b/apps/dav/tests/unit/Connector/Sabre/RequestTest/PartFileInRootUploadTest.php @@ -17,7 +17,7 @@ * * @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); diff --git a/apps/dav/tests/unit/Connector/Sabre/RequestTest/UploadTest.php b/apps/dav/tests/unit/Connector/Sabre/RequestTest/UploadTest.php index 1bb1b1e42c45d..7432add82a85d 100644 --- a/apps/dav/tests/unit/Connector/Sabre/RequestTest/UploadTest.php +++ b/apps/dav/tests/unit/Connector/Sabre/RequestTest/UploadTest.php @@ -19,7 +19,7 @@ * * @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(); diff --git a/apps/dav/tests/unit/Connector/Sabre/SharesPluginTest.php b/apps/dav/tests/unit/Connector/Sabre/SharesPluginTest.php index 66c9054a6fe95..4e2ddd4d4d161 100644 --- a/apps/dav/tests/unit/Connector/Sabre/SharesPluginTest.php +++ b/apps/dav/tests/unit/Connector/Sabre/SharesPluginTest.php @@ -54,7 +54,7 @@ protected function setUp(): void { $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()) @@ -117,7 +117,7 @@ public function testGetProperties(array $shareTypes): void { $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') diff --git a/apps/dav/tests/unit/Connector/Sabre/TagsPluginTest.php b/apps/dav/tests/unit/Connector/Sabre/TagsPluginTest.php index 7ca11c32a0205..4c4f10463e582 100644 --- a/apps/dav/tests/unit/Connector/Sabre/TagsPluginTest.php +++ b/apps/dav/tests/unit/Connector/Sabre/TagsPluginTest.php @@ -58,7 +58,7 @@ protected function setUp(): void { $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 @@ public function testGetProperties(array $tags, array $requestedProperties, array $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()) diff --git a/apps/dav/tests/unit/Connector/ServerTest.php b/apps/dav/tests/unit/Connector/ServerTest.php index 24664f9c88ca6..768db1a85cbeb 100644 --- a/apps/dav/tests/unit/Connector/ServerTest.php +++ b/apps/dav/tests/unit/Connector/ServerTest.php @@ -45,7 +45,7 @@ public static function removeAllListenersData(): array { ]; } - #[DataProvider('removeAllListenersData')] + #[DataProvider(methodName: 'removeAllListenersData')] public function testRemoveAllListeners(?string $removeEventName): void { $listener = static function () { return false; diff --git a/apps/dav/tests/unit/Controller/InvitationResponseControllerTest.php b/apps/dav/tests/unit/Controller/InvitationResponseControllerTest.php index a12f40beaf54c..3b535ceed22fc 100644 --- a/apps/dav/tests/unit/Controller/InvitationResponseControllerTest.php +++ b/apps/dav/tests/unit/Controller/InvitationResponseControllerTest.php @@ -53,7 +53,7 @@ public static function attendeeProvider(): array { ]; } - #[\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 @@ public function testAccept(bool $isExternalAttendee): void { $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 @@ public function testAcceptSequence(bool $isExternalAttendee): void { $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 @@ public function testAcceptExpiredToken(): void { $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 @@ public function testOptions(): void { $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 @@ private function buildQueryExpects(string $token, ?array $return, int $time): vo $expr->expects($this->once()) ->method('eq') ->with('token', 'namedParameterToken') - ->willReturn((string)$function); + ->willReturn($function); $this->dbConnection->expects($this->once()) ->method('getQueryBuilder') diff --git a/apps/dav/tests/unit/DAV/BrowserErrorPagePluginTest.php b/apps/dav/tests/unit/DAV/BrowserErrorPagePluginTest.php index 0e82ef0a3aec8..cb8d8f0169e2b 100644 --- a/apps/dav/tests/unit/DAV/BrowserErrorPagePluginTest.php +++ b/apps/dav/tests/unit/DAV/BrowserErrorPagePluginTest.php @@ -15,7 +15,7 @@ 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(); diff --git a/apps/dav/tests/unit/DAV/CustomPropertiesBackendTest.php b/apps/dav/tests/unit/DAV/CustomPropertiesBackendTest.php index a7ef373c98929..4d48e70af57a6 100644 --- a/apps/dav/tests/unit/DAV/CustomPropertiesBackendTest.php +++ b/apps/dav/tests/unit/DAV/CustomPropertiesBackendTest.php @@ -25,7 +25,7 @@ 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 @@ public static function propFindPrincipalScheduleDefaultCalendarProviderUrlProvid } - #[\PHPUnit\Framework\Attributes\DataProvider('propFindPrincipalScheduleDefaultCalendarProviderUrlProvider')] + #[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'propFindPrincipalScheduleDefaultCalendarProviderUrlProvider')] public function testPropFindPrincipalScheduleDefaultCalendarUrl( string $user, array $nodes, @@ -336,7 +336,7 @@ public function testPropFindPrincipalScheduleDefaultCalendarUrl( $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 @@ public function testPropPatchWithUnsuitableCalendar(): void { $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 @@ public static function deleteProvider(): array { ]; } - #[\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); diff --git a/apps/dav/tests/unit/DAV/GroupPrincipalTest.php b/apps/dav/tests/unit/DAV/GroupPrincipalTest.php index 2756152a6e263..068dd28eafb9f 100644 --- a/apps/dav/tests/unit/DAV/GroupPrincipalTest.php +++ b/apps/dav/tests/unit/DAV/GroupPrincipalTest.php @@ -192,7 +192,7 @@ public function testSearchPrincipalsWithWrongPrefixPath(): void { ['{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 @@ public static function searchPrincipalsDataProvider(): array { ]; } - #[\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') diff --git a/apps/dav/tests/unit/DAV/SystemPrincipalBackendTest.php b/apps/dav/tests/unit/DAV/SystemPrincipalBackendTest.php index 3df861accf2d2..275aa1782f743 100644 --- a/apps/dav/tests/unit/DAV/SystemPrincipalBackendTest.php +++ b/apps/dav/tests/unit/DAV/SystemPrincipalBackendTest.php @@ -14,7 +14,7 @@ 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 @@ public static function providesPrefix(): array { ]; } - #[\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 @@ public static function providesPath(): array { ]; } - #[\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 @@ public function testGetGroupMemberSet(): void { $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'); diff --git a/apps/dav/tests/unit/DAV/ViewOnlyPluginTest.php b/apps/dav/tests/unit/DAV/ViewOnlyPluginTest.php index eefbc53fd22cb..fbb28bb34d1b8 100644 --- a/apps/dav/tests/unit/DAV/ViewOnlyPluginTest.php +++ b/apps/dav/tests/unit/DAV/ViewOnlyPluginTest.php @@ -94,7 +94,7 @@ public static function providesDataForCanGet(): array { ]; } - #[\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) { diff --git a/apps/dav/tests/unit/Listener/ActivityUpdaterListenerTest.php b/apps/dav/tests/unit/Listener/ActivityUpdaterListenerTest.php index 8519dca7126d7..5b2b8c66ac0ea 100644 --- a/apps/dav/tests/unit/Listener/ActivityUpdaterListenerTest.php +++ b/apps/dav/tests/unit/Listener/ActivityUpdaterListenerTest.php @@ -36,7 +36,7 @@ protected function setUp(): void { ); } - #[\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 @@ public static function dataForTestHandleCalendarObjectDeletedEvent(): array { ]; } - #[\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( diff --git a/apps/dav/tests/unit/Migration/CalDAVRemoveEmptyValueTest.php b/apps/dav/tests/unit/Migration/CalDAVRemoveEmptyValueTest.php index 18c4ebb020e3d..86535af18da66 100644 --- a/apps/dav/tests/unit/Migration/CalDAVRemoveEmptyValueTest.php +++ b/apps/dav/tests/unit/Migration/CalDAVRemoveEmptyValueTest.php @@ -22,7 +22,7 @@ * * @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; diff --git a/apps/dav/tests/unit/Migration/RemoveDeletedUsersCalendarSubscriptionsTest.php b/apps/dav/tests/unit/Migration/RemoveDeletedUsersCalendarSubscriptionsTest.php index c7843c8f57ac4..619549a6c3408 100644 --- a/apps/dav/tests/unit/Migration/RemoveDeletedUsersCalendarSubscriptionsTest.php +++ b/apps/dav/tests/unit/Migration/RemoveDeletedUsersCalendarSubscriptionsTest.php @@ -45,7 +45,7 @@ public function testGetName(): void { ); } - #[\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); diff --git a/apps/dav/tests/unit/Search/EventsSearchProviderTest.php b/apps/dav/tests/unit/Search/EventsSearchProviderTest.php index e4ca8fdab2628..463f8c4efc0ed 100644 --- a/apps/dav/tests/unit/Search/EventsSearchProviderTest.php +++ b/apps/dav/tests/unit/Search/EventsSearchProviderTest.php @@ -408,7 +408,7 @@ public static function provideDeepLinkData(): array { ]; } - #[DataProvider('provideDeepLinkData')] + #[DataProvider(methodName: 'provideDeepLinkData')] public function testGetDeepLinkToCalendarApp( string $principalUri, string $expectedBase64DavUrl, @@ -435,7 +435,7 @@ public function testGetDeepLinkToCalendarApp( $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; diff --git a/apps/dav/tests/unit/Search/TasksSearchProviderTest.php b/apps/dav/tests/unit/Search/TasksSearchProviderTest.php index 7f9a2842de99f..dcb35c624d408 100644 --- a/apps/dav/tests/unit/Search/TasksSearchProviderTest.php +++ b/apps/dav/tests/unit/Search/TasksSearchProviderTest.php @@ -289,7 +289,7 @@ public function testGetDeepLinkToTasksApp(): void { $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; diff --git a/apps/dav/tests/unit/ServerTest.php b/apps/dav/tests/unit/ServerTest.php index 96574643a8d81..2233feb398838 100644 --- a/apps/dav/tests/unit/ServerTest.php +++ b/apps/dav/tests/unit/ServerTest.php @@ -17,10 +17,10 @@ * * @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); diff --git a/apps/dav/tests/unit/Service/ExampleContactServiceTest.php b/apps/dav/tests/unit/Service/ExampleContactServiceTest.php index 027b66a6fb255..89e32a1ad1990 100644 --- a/apps/dav/tests/unit/Service/ExampleContactServiceTest.php +++ b/apps/dav/tests/unit/Service/ExampleContactServiceTest.php @@ -173,7 +173,7 @@ public static function provideDefaultContactEnableData(): array { 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 @@ public function testIsDefaultContactEnabled(bool $enabled): void { $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') diff --git a/apps/dav/tests/unit/Service/ExampleEventServiceTest.php b/apps/dav/tests/unit/Service/ExampleEventServiceTest.php index 0f423624fb808..a6e080217eb7e 100644 --- a/apps/dav/tests/unit/Service/ExampleEventServiceTest.php +++ b/apps/dav/tests/unit/Service/ExampleEventServiceTest.php @@ -62,7 +62,7 @@ public static function provideCustomEventData(): array { ]; } - #[\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 @@ public function testCreateExampleWhenDisabled(): void { $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()) diff --git a/apps/dav/tests/unit/SystemTag/SystemTagMappingNodeTest.php b/apps/dav/tests/unit/SystemTag/SystemTagMappingNodeTest.php index 393428113777d..b626c2474d2d8 100644 --- a/apps/dav/tests/unit/SystemTag/SystemTagMappingNodeTest.php +++ b/apps/dav/tests/unit/SystemTag/SystemTagMappingNodeTest.php @@ -107,7 +107,7 @@ public static function tagNodeDeleteProviderPermissionException(): array { ]; } - #[\PHPUnit\Framework\Attributes\DataProvider('tagNodeDeleteProviderPermissionException')] + #[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'tagNodeDeleteProviderPermissionException')] public function testDeleteTagExpectedException(ISystemTag $tag, $expectedException): void { $this->tagManager->expects($this->any()) ->method('canUserSeeTag') diff --git a/apps/dav/tests/unit/SystemTag/SystemTagNodeTest.php b/apps/dav/tests/unit/SystemTag/SystemTagNodeTest.php index 594b5e15db6cf..9c476ec735e0e 100644 --- a/apps/dav/tests/unit/SystemTag/SystemTagNodeTest.php +++ b/apps/dav/tests/unit/SystemTag/SystemTagNodeTest.php @@ -49,7 +49,7 @@ public static function adminFlagProvider(): array { return [[true], [false]]; } - #[\PHPUnit\Framework\Attributes\DataProvider('adminFlagProvider')] + #[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'adminFlagProvider')] public function testGetters(bool $isAdmin): void { $tag = new SystemTag('1', 'Test', true, true); $node = $this->getTagNode($isAdmin, $tag); @@ -87,7 +87,7 @@ public static function tagNodeProvider(): array { ]; } - #[\PHPUnit\Framework\Attributes\DataProvider('tagNodeProvider')] + #[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'tagNodeProvider')] public function testUpdateTag(bool $isAdmin, ISystemTag $originalTag, array $changedArgs): void { $this->tagManager->expects($this->once()) ->method('canUserSeeTag') @@ -145,7 +145,7 @@ public static function tagNodeProviderPermissionException(): array { ]; } - #[\PHPUnit\Framework\Attributes\DataProvider('tagNodeProviderPermissionException')] + #[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'tagNodeProviderPermissionException')] public function testUpdateTagPermissionException(ISystemTag $originalTag, array $changedArgs, string $expectedException): void { $this->tagManager->expects($this->any()) ->method('canUserSeeTag') @@ -210,7 +210,7 @@ public function testUpdateTagNotFound(): void { $this->getTagNode(false, $tag)->update('Renamed', true, true, null); } - #[\PHPUnit\Framework\Attributes\DataProvider('adminFlagProvider')] + #[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'adminFlagProvider')] public function testDeleteTag(bool $isAdmin): void { $tag = new SystemTag('1', 'tag1', true, true); $this->tagManager->expects($isAdmin ? $this->once() : $this->never()) @@ -241,7 +241,7 @@ public static function tagNodeDeleteProviderPermissionException(): array { ]; } - #[\PHPUnit\Framework\Attributes\DataProvider('tagNodeDeleteProviderPermissionException')] + #[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'tagNodeDeleteProviderPermissionException')] public function testDeleteTagPermissionException(ISystemTag $tag, string $expectedException): void { $this->tagManager->expects($this->any()) ->method('canUserSeeTag') diff --git a/apps/dav/tests/unit/SystemTag/SystemTagPluginTest.php b/apps/dav/tests/unit/SystemTag/SystemTagPluginTest.php index e0c4685c1fb01..f46450cf045be 100644 --- a/apps/dav/tests/unit/SystemTag/SystemTagPluginTest.php +++ b/apps/dav/tests/unit/SystemTag/SystemTagPluginTest.php @@ -142,7 +142,7 @@ public static function getPropertiesDataProvider(): array { ]; } - #[\PHPUnit\Framework\Attributes\DataProvider('getPropertiesDataProvider')] + #[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'getPropertiesDataProvider')] public function testGetProperties(ISystemTag $systemTag, array $groups, array $requestedProperties, array $expectedProperties): void { $this->user->expects($this->any()) ->method('getUID') @@ -339,7 +339,7 @@ public static function createTagInsufficientPermissionsProvider(): array { [true, true, 'group1|group2'], ]; } - #[\PHPUnit\Framework\Attributes\DataProvider('createTagInsufficientPermissionsProvider')] + #[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'createTagInsufficientPermissionsProvider')] public function testCreateNotAssignableTagAsRegularUser(bool $userVisible, bool $userAssignable, string $groups): void { $this->expectException(\Sabre\DAV\Exception\BadRequest::class); $this->expectExceptionMessage('Not sufficient permissions'); @@ -448,7 +448,7 @@ public static function createTagProvider(): array { ]; } - #[\PHPUnit\Framework\Attributes\DataProvider('createTagProvider')] + #[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'createTagProvider')] public function testCreateTagInByIdCollection(bool $userVisible, bool $userAssignable, string $groups): void { $this->user->expects($this->once()) ->method('getUID') @@ -613,7 +613,7 @@ public function testCreateTagToUnknownNode(): void { $this->plugin->httpPost($request, $response); } - #[\PHPUnit\Framework\Attributes\DataProvider('nodeClassProvider')] + #[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'nodeClassProvider')] public function testCreateTagConflict(string $nodeClass): void { $this->expectException(\Sabre\DAV\Exception\Conflict::class); diff --git a/apps/dav/tests/unit/SystemTag/SystemTagsByIdCollectionTest.php b/apps/dav/tests/unit/SystemTag/SystemTagsByIdCollectionTest.php index 8f7848452feb9..53173c66d6ed8 100644 --- a/apps/dav/tests/unit/SystemTag/SystemTagsByIdCollectionTest.php +++ b/apps/dav/tests/unit/SystemTag/SystemTagsByIdCollectionTest.php @@ -185,7 +185,7 @@ public static function childExistsProvider(): array { ]; } - #[\PHPUnit\Framework\Attributes\DataProvider('childExistsProvider')] + #[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'childExistsProvider')] public function testChildExists(bool $userVisible, bool $expectedResult): void { $tag = new SystemTag('123', 'One', $userVisible, false); $this->tagManager->expects($this->once()) diff --git a/apps/dav/tests/unit/SystemTag/SystemTagsObjectMappingCollectionTest.php b/apps/dav/tests/unit/SystemTag/SystemTagsObjectMappingCollectionTest.php index 5aea1242e2a14..84674ee57c5e6 100644 --- a/apps/dav/tests/unit/SystemTag/SystemTagsObjectMappingCollectionTest.php +++ b/apps/dav/tests/unit/SystemTag/SystemTagsObjectMappingCollectionTest.php @@ -93,7 +93,7 @@ public static function permissionsProvider(): array { ]; } - #[\PHPUnit\Framework\Attributes\DataProvider('permissionsProvider')] + #[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'permissionsProvider')] public function testAssignTagNoPermission(bool $userVisible, bool $userAssignable, string $expectedException): void { $tag = new SystemTag('1', 'Test', $userVisible, $userAssignable); $this->tagManager->expects($this->once()) diff --git a/apps/dav/tests/unit/Upload/AssemblyStreamTest.php b/apps/dav/tests/unit/Upload/AssemblyStreamTest.php index ec5d0a9ab5bf9..ee4d0b605bb3c 100644 --- a/apps/dav/tests/unit/Upload/AssemblyStreamTest.php +++ b/apps/dav/tests/unit/Upload/AssemblyStreamTest.php @@ -12,7 +12,7 @@ class AssemblyStreamTest extends \Test\TestCase { - #[\PHPUnit\Framework\Attributes\DataProvider('providesNodes')] + #[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'providesNodes')] public function testGetContents(string $expected, array $nodeData): void { $nodes = []; foreach ($nodeData as $data) { @@ -24,7 +24,7 @@ public function testGetContents(string $expected, array $nodeData): void { $this->assertEquals($expected, $content); } - #[\PHPUnit\Framework\Attributes\DataProvider('providesNodes')] + #[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'providesNodes')] public function testGetContentsFread(string $expected, array $nodeData, int $chunkLength = 3): void { $nodes = []; foreach ($nodeData as $data) { @@ -44,7 +44,7 @@ public function testGetContentsFread(string $expected, array $nodeData, int $chu $this->assertEquals($expected, $content); } - #[\PHPUnit\Framework\Attributes\DataProvider('providesNodes')] + #[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'providesNodes')] public function testSeek(string $expected, array $nodeData): void { $nodes = []; foreach ($nodeData as $data) { diff --git a/apps/dav/tests/unit/Upload/UploadAutoMkcolPluginTest.php b/apps/dav/tests/unit/Upload/UploadAutoMkcolPluginTest.php index 3ee352ade2253..1cef4f0e47039 100644 --- a/apps/dav/tests/unit/Upload/UploadAutoMkcolPluginTest.php +++ b/apps/dav/tests/unit/Upload/UploadAutoMkcolPluginTest.php @@ -68,7 +68,7 @@ public function testBeforeMethodWithRootNodeNotAnICollectionShouldReturnTrue(): $this->assertTrue($return); } - #[\PHPUnit\Framework\Attributes\DataProvider('dataMissingHeaderShouldReturnTrue')] + #[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'dataMissingHeaderShouldReturnTrue')] public function testBeforeMethodWithMissingHeaderShouldReturnTrue(?string $header): void { $this->request->expects(self::once()) ->method('getHeader') diff --git a/apps/encryption/tests/Command/FixEncryptedVersionTest.php b/apps/encryption/tests/Command/FixEncryptedVersionTest.php index b94d4400d5ded..d2d9feed6ffca 100644 --- a/apps/encryption/tests/Command/FixEncryptedVersionTest.php +++ b/apps/encryption/tests/Command/FixEncryptedVersionTest.php @@ -33,7 +33,7 @@ * * @package OCA\Encryption\Tests\Command */ -#[\PHPUnit\Framework\Attributes\Group('DB')] +#[\PHPUnit\Framework\Attributes\Group(name: 'DB')] class FixEncryptedVersionTest extends TestCase { use MountProviderTrait; use EncryptionTrait; diff --git a/apps/encryption/tests/Command/TestEnableMasterKey.php b/apps/encryption/tests/Command/TestEnableMasterKey.php index aec1b1de71931..460e3c59aeb73 100644 --- a/apps/encryption/tests/Command/TestEnableMasterKey.php +++ b/apps/encryption/tests/Command/TestEnableMasterKey.php @@ -46,7 +46,7 @@ protected function setUp(): void { $this->enableMasterKey = new EnableMasterKey($this->util, $this->config, $this->questionHelper); } - #[\PHPUnit\Framework\Attributes\DataProvider('dataTestExecute')] + #[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'dataTestExecute')] public function testExecute(bool $isAlreadyEnabled, string $answer): void { $this->util->expects($this->once())->method('isMasterKeyEnabled') ->willReturn($isAlreadyEnabled); diff --git a/apps/encryption/tests/Controller/RecoveryControllerTest.php b/apps/encryption/tests/Controller/RecoveryControllerTest.php index 717e31cf53bb1..e7c7282ffe46b 100644 --- a/apps/encryption/tests/Controller/RecoveryControllerTest.php +++ b/apps/encryption/tests/Controller/RecoveryControllerTest.php @@ -43,7 +43,7 @@ public static function adminRecoveryProvider(): array { * @param $expectedMessage * @param $expectedStatus */ - #[\PHPUnit\Framework\Attributes\DataProvider('adminRecoveryProvider')] + #[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'adminRecoveryProvider')] public function testAdminRecovery($recoveryPassword, $passConfirm, $enableRecovery, $expectedMessage, $expectedStatus): void { $this->recoveryMock->expects($this->any()) ->method('enableAdminRecovery') @@ -79,7 +79,7 @@ public static function changeRecoveryPasswordProvider(): array { * @param $expectedMessage * @param $expectedStatus */ - #[\PHPUnit\Framework\Attributes\DataProvider('changeRecoveryPasswordProvider')] + #[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'changeRecoveryPasswordProvider')] public function testChangeRecoveryPassword($password, $confirmPassword, $oldPassword, $expectedMessage, $expectedStatus): void { $this->recoveryMock->expects($this->any()) ->method('changeRecoveryKeyPassword') @@ -109,7 +109,7 @@ public static function userSetRecoveryProvider(): array { * @param $expectedMessage * @param $expectedStatus */ - #[\PHPUnit\Framework\Attributes\DataProvider('userSetRecoveryProvider')] + #[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'userSetRecoveryProvider')] public function testUserSetRecovery($enableRecovery, $expectedMessage, $expectedStatus): void { $this->recoveryMock->expects($this->any()) ->method('setRecoveryForUser') diff --git a/apps/encryption/tests/Controller/StatusControllerTest.php b/apps/encryption/tests/Controller/StatusControllerTest.php index 1bbcad7741178..bb9f1dd83e8ab 100644 --- a/apps/encryption/tests/Controller/StatusControllerTest.php +++ b/apps/encryption/tests/Controller/StatusControllerTest.php @@ -54,7 +54,7 @@ protected function setUp(): void { * @param string $status * @param string $expectedStatus */ - #[\PHPUnit\Framework\Attributes\DataProvider('dataTestGetStatus')] + #[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'dataTestGetStatus')] public function testGetStatus($status, $expectedStatus): void { $this->sessionMock->expects($this->once()) ->method('getStatus')->willReturn($status); diff --git a/apps/encryption/tests/Crypto/CryptTest.php b/apps/encryption/tests/Crypto/CryptTest.php index cb817687b88c3..3221fcb4ed3ea 100644 --- a/apps/encryption/tests/Crypto/CryptTest.php +++ b/apps/encryption/tests/Crypto/CryptTest.php @@ -81,7 +81,7 @@ public function testGetOpenSSLConfig(): void { /** * test generateHeader with valid key formats */ - #[\PHPUnit\Framework\Attributes\DataProvider('dataTestGenerateHeader')] + #[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'dataTestGenerateHeader')] public function testGenerateHeader($keyFormat, $expected): void { $this->config->expects($this->once()) ->method('getSystemValueString') @@ -132,7 +132,7 @@ public function testGetCipherWithInvalidCipher(): void { * @param string $configValue * @param string $expected */ - #[\PHPUnit\Framework\Attributes\DataProvider('dataProviderGetCipher')] + #[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'dataProviderGetCipher')] public function testGetCipher($configValue, $expected): void { $this->config->expects($this->once()) ->method('getSystemValueString') @@ -172,7 +172,7 @@ public function testConcatIV(): void { ); } - #[\PHPUnit\Framework\Attributes\DataProvider('dataTestSplitMetaData')] + #[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'dataTestSplitMetaData')] public function testSplitMetaData($data, $expected): void { $this->config->method('getSystemValueBool') ->with('encryption_skip_signature_check', false) @@ -197,7 +197,7 @@ public static function dataTestSplitMetaData(): array { ]; } - #[\PHPUnit\Framework\Attributes\DataProvider('dataTestHasSignature')] + #[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'dataTestHasSignature')] public function testHasSignature($data, $expected): void { $this->config->method('getSystemValueBool') ->with('encryption_skip_signature_check', false) @@ -214,7 +214,7 @@ public static function dataTestHasSignature(): array { ]; } - #[\PHPUnit\Framework\Attributes\DataProvider('dataTestHasSignatureFail')] + #[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'dataTestHasSignatureFail')] public function testHasSignatureFail($cipher): void { $this->expectException(GenericEncryptionException::class); @@ -245,7 +245,7 @@ public function testAddPadding(): void { * @param $data * @param $expected */ - #[\PHPUnit\Framework\Attributes\DataProvider('dataProviderRemovePadding')] + #[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'dataProviderRemovePadding')] public function testRemovePadding($data, $expected): void { $result = self::invokePrivate($this->crypt, 'removePadding', [$data]); $this->assertSame($expected, $result); @@ -320,7 +320,7 @@ public function testDecrypt($data): void { /** * test return values of valid ciphers */ - #[\PHPUnit\Framework\Attributes\DataProvider('dataTestGetKeySize')] + #[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'dataTestGetKeySize')] public function testGetKeySize($cipher, $expected): void { $result = $this->invokePrivate($this->crypt, 'getKeySize', [$cipher]); $this->assertSame($expected, $result); @@ -345,7 +345,7 @@ public static function dataTestGetKeySize(): array { ]; } - #[\PHPUnit\Framework\Attributes\DataProvider('dataTestDecryptPrivateKey')] + #[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'dataTestDecryptPrivateKey')] public function testDecryptPrivateKey($header, $privateKey, $expectedCipher, $isValidKey, $expected): void { $this->config->method('getSystemValueBool') ->willReturnMap([ diff --git a/apps/encryption/tests/Crypto/DecryptAllTest.php b/apps/encryption/tests/Crypto/DecryptAllTest.php index 82e6100bce58e..f2a56bc2fbc2c 100644 --- a/apps/encryption/tests/Crypto/DecryptAllTest.php +++ b/apps/encryption/tests/Crypto/DecryptAllTest.php @@ -63,7 +63,7 @@ public function testUpdateSession(): void { * @param string $user * @param string $recoveryKeyId */ - #[\PHPUnit\Framework\Attributes\DataProvider('dataTestGetPrivateKey')] + #[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'dataTestGetPrivateKey')] public function testGetPrivateKey($user, $recoveryKeyId, $masterKeyId): void { $password = 'passwd'; $recoveryKey = 'recoveryKey'; diff --git a/apps/encryption/tests/Crypto/EncryptAllTest.php b/apps/encryption/tests/Crypto/EncryptAllTest.php index 17af5dc52b4b1..733e899d1624d 100644 --- a/apps/encryption/tests/Crypto/EncryptAllTest.php +++ b/apps/encryption/tests/Crypto/EncryptAllTest.php @@ -383,7 +383,7 @@ public function testGenerateOneTimePassword(): void { /** * @param $isEncrypted */ - #[\PHPUnit\Framework\Attributes\DataProvider('dataTestEncryptFile')] + #[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'dataTestEncryptFile')] public function testEncryptFile($isEncrypted): void { $fileInfo = $this->createMock(FileInfo::class); $fileInfo->expects($this->any())->method('isEncrypted') diff --git a/apps/encryption/tests/Crypto/EncryptionTest.php b/apps/encryption/tests/Crypto/EncryptionTest.php index df9655cd2eb08..bea53f9efa813 100644 --- a/apps/encryption/tests/Crypto/EncryptionTest.php +++ b/apps/encryption/tests/Crypto/EncryptionTest.php @@ -152,7 +152,7 @@ public function addSystemKeysCallback($accessList, $publicKeys) { return $publicKeys; } - #[\PHPUnit\Framework\Attributes\DataProvider('dataProviderForTestGetPathToRealFile')] + #[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'dataProviderForTestGetPathToRealFile')] public function testGetPathToRealFile($path, $expected): void { $this->assertSame($expected, self::invokePrivate($this->instance, 'getPathToRealFile', [$path]) @@ -168,7 +168,7 @@ public static function dataProviderForTestGetPathToRealFile(): array { ]; } - #[\PHPUnit\Framework\Attributes\DataProvider('dataTestBegin')] + #[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'dataTestBegin')] public function testBegin($mode, $header, $legacyCipher, $defaultCipher, $fileKey, $expected): void { $this->sessionMock->expects($this->once()) ->method('decryptAllModeActivated') @@ -265,7 +265,7 @@ public function testBeginInitMasterKey(): void { * @param string $fileKey * @param boolean $expected */ - #[\PHPUnit\Framework\Attributes\DataProvider('dataTestUpdate')] + #[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'dataTestUpdate')] public function testUpdate($fileKey, $expected): void { $this->keyManagerMock->expects($this->once()) ->method('getFileKey')->willReturn($fileKey); @@ -351,7 +351,7 @@ function ($fileKey, $publicKeys) { * by default the encryption module should encrypt regular files, files in * files_versions and files in files_trashbin */ - #[\PHPUnit\Framework\Attributes\DataProvider('dataTestShouldEncrypt')] + #[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'dataTestShouldEncrypt')] public function testShouldEncrypt($path, $shouldEncryptHomeStorage, $isHomeStorage, $expected): void { $this->utilMock->expects($this->once())->method('shouldEncryptHomeStorage') ->willReturn($shouldEncryptHomeStorage); diff --git a/apps/encryption/tests/EncryptedStorageTest.php b/apps/encryption/tests/EncryptedStorageTest.php index a47a71370eb60..eb1463fcf0d15 100644 --- a/apps/encryption/tests/EncryptedStorageTest.php +++ b/apps/encryption/tests/EncryptedStorageTest.php @@ -23,7 +23,7 @@ class TemporaryNoEncrypted extends Temporary implements IDisableEncryptionStorag } -#[\PHPUnit\Framework\Attributes\Group('DB')] +#[\PHPUnit\Framework\Attributes\Group(name: 'DB')] class EncryptedStorageTest extends TestCase { use MountProviderTrait; use EncryptionTrait; diff --git a/apps/encryption/tests/KeyManagerTest.php b/apps/encryption/tests/KeyManagerTest.php index 85e8ef0da32db..ac8238ddd0000 100644 --- a/apps/encryption/tests/KeyManagerTest.php +++ b/apps/encryption/tests/KeyManagerTest.php @@ -167,7 +167,7 @@ public function testSetPrivateKey(): void { ); } - #[\PHPUnit\Framework\Attributes\DataProvider('dataTestUserHasKeys')] + #[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'dataTestUserHasKeys')] public function testUserHasKeys($key, $expected): void { $this->keyStorageMock->expects($this->exactly(2)) ->method('getUserKey') @@ -222,7 +222,7 @@ public function testUserHasKeysMissingPublicKey(): void { /** * @param bool $useMasterKey */ - #[\PHPUnit\Framework\Attributes\DataProvider('dataTestInit')] + #[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'dataTestInit')] public function testInit($useMasterKey): void { /** @var KeyManager&MockObject $instance */ $instance = $this->getMockBuilder(KeyManager::class) @@ -353,7 +353,7 @@ public static function dataTestGetFileKey(): array { ]; } - #[\PHPUnit\Framework\Attributes\DataProvider('dataTestGetFileKey')] + #[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'dataTestGetFileKey')] public function testGetFileKey(?string $uid, bool $isMasterKeyEnabled, string $privateKey, string $encryptedFileKey, string $expected): void { $path = '/foo.txt'; @@ -459,7 +459,7 @@ public function testDeleteAllFileKeys(): void { * @param string $uid * @param array $expectedKeys */ - #[\PHPUnit\Framework\Attributes\DataProvider('dataTestAddSystemKeys')] + #[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'dataTestAddSystemKeys')] public function testAddSystemKeys($accessList, $publicKeys, $uid, $expectedKeys): void { $publicShareKeyId = 'publicShareKey'; $recoveryKeyId = 'recoveryKey'; @@ -542,7 +542,7 @@ public function testGetMasterKeyPasswordException(): void { /** * @param $masterKey */ - #[\PHPUnit\Framework\Attributes\DataProvider('dataTestValidateMasterKey')] + #[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'dataTestValidateMasterKey')] public function testValidateMasterKey($masterKey): void { /** @var KeyManager&MockObject $instance */ $instance = $this->getMockBuilder(KeyManager::class) diff --git a/apps/encryption/tests/Listeners/UserEventsListenersTest.php b/apps/encryption/tests/Listeners/UserEventsListenersTest.php index 15b99c2e2067c..83a57af184aa5 100644 --- a/apps/encryption/tests/Listeners/UserEventsListenersTest.php +++ b/apps/encryption/tests/Listeners/UserEventsListenersTest.php @@ -30,7 +30,7 @@ use PHPUnit\Framework\MockObject\MockObject; use Test\TestCase; -#[\PHPUnit\Framework\Attributes\Group('DB')] +#[\PHPUnit\Framework\Attributes\Group(name: 'DB')] class UserEventsListenersTest extends TestCase { protected Util&MockObject $util; diff --git a/apps/encryption/tests/PassphraseServiceTest.php b/apps/encryption/tests/PassphraseServiceTest.php index c275b6aadea08..29a800f3a8a09 100644 --- a/apps/encryption/tests/PassphraseServiceTest.php +++ b/apps/encryption/tests/PassphraseServiceTest.php @@ -21,7 +21,7 @@ use Psr\Log\LoggerInterface; use Test\TestCase; -#[\PHPUnit\Framework\Attributes\Group('DB')] +#[\PHPUnit\Framework\Attributes\Group(name: 'DB')] class PassphraseServiceTest extends TestCase { protected Util&MockObject $util; diff --git a/apps/encryption/tests/SessionTest.php b/apps/encryption/tests/SessionTest.php index b12ff495bff3b..7769b1949d8e9 100644 --- a/apps/encryption/tests/SessionTest.php +++ b/apps/encryption/tests/SessionTest.php @@ -115,7 +115,7 @@ public function testSetAndGetStatusWillSetAndReturn(): void { * @param int $status * @param bool $expected */ - #[\PHPUnit\Framework\Attributes\DataProvider('dataTestIsReady')] + #[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'dataTestIsReady')] public function testIsReady($status, $expected): void { /** @var Session&MockObject $instance */ $instance = $this->getMockBuilder(Session::class) diff --git a/apps/encryption/tests/Users/SetupTest.php b/apps/encryption/tests/Users/SetupTest.php index 6b2b8b4cad5d1..2d8974aa5d450 100644 --- a/apps/encryption/tests/Users/SetupTest.php +++ b/apps/encryption/tests/Users/SetupTest.php @@ -50,7 +50,7 @@ public function testSetupSystem(): void { * @param bool $hasKeys * @param bool $expected */ - #[\PHPUnit\Framework\Attributes\DataProvider('dataTestSetupUser')] + #[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'dataTestSetupUser')] public function testSetupUser($hasKeys, $expected): void { $this->keyManagerMock->expects($this->once())->method('userHasKeys') ->with('uid')->willReturn($hasKeys); diff --git a/apps/encryption/tests/UtilTest.php b/apps/encryption/tests/UtilTest.php index 41860a44ffb33..ed274f74ab5ca 100644 --- a/apps/encryption/tests/UtilTest.php +++ b/apps/encryption/tests/UtilTest.php @@ -119,7 +119,7 @@ public function getValueTester($userId, $app, $key, $default) { * @param string $value * @param bool $expect */ - #[\PHPUnit\Framework\Attributes\DataProvider('dataTestIsMasterKeyEnabled')] + #[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'dataTestIsMasterKeyEnabled')] public function testIsMasterKeyEnabled($value, $expect): void { $this->configMock->expects($this->once())->method('getAppValue') ->with('encryption', 'useMasterKey', '1')->willReturn($value); @@ -139,7 +139,7 @@ public static function dataTestIsMasterKeyEnabled(): array { * @param string $returnValue return value from getAppValue() * @param bool $expected */ - #[\PHPUnit\Framework\Attributes\DataProvider('dataTestShouldEncryptHomeStorage')] + #[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'dataTestShouldEncryptHomeStorage')] public function testShouldEncryptHomeStorage($returnValue, $expected): void { $this->configMock->expects($this->once())->method('getAppValue') ->with('encryption', 'encryptHomeStorage', '1') @@ -160,7 +160,7 @@ public static function dataTestShouldEncryptHomeStorage(): array { * @param $value * @param $expected */ - #[\PHPUnit\Framework\Attributes\DataProvider('dataTestSetEncryptHomeStorage')] + #[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'dataTestSetEncryptHomeStorage')] public function testSetEncryptHomeStorage($value, $expected): void { $this->configMock->expects($this->once())->method('setAppValue') ->with('encryption', 'encryptHomeStorage', $expected); diff --git a/apps/federatedfilesharing/tests/AddressHandlerTest.php b/apps/federatedfilesharing/tests/AddressHandlerTest.php index 279bf48514580..40557eeb07db5 100644 --- a/apps/federatedfilesharing/tests/AddressHandlerTest.php +++ b/apps/federatedfilesharing/tests/AddressHandlerTest.php @@ -80,7 +80,7 @@ public static function dataTestSplitUserRemote(): array { return $testCases; } - #[\PHPUnit\Framework\Attributes\DataProvider('dataTestSplitUserRemote')] + #[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'dataTestSplitUserRemote')] public function testSplitUserRemote(string $remote, string $expectedUser, string $expectedUrl): void { $this->contactsManager->expects($this->any()) ->method('search') @@ -109,14 +109,14 @@ public static function dataTestSplitUserRemoteError(): array { ]; } - #[\PHPUnit\Framework\Attributes\DataProvider('dataTestSplitUserRemoteError')] + #[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'dataTestSplitUserRemoteError')] public function testSplitUserRemoteError(string $id): void { $this->expectException(HintException::class); $this->addressHandler->splitUserRemote($id); } - #[\PHPUnit\Framework\Attributes\DataProvider('dataTestCompareAddresses')] + #[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'dataTestCompareAddresses')] public function testCompareAddresses(string $user1, string $server1, string $user2, string $server2, bool $expected): void { $this->assertSame($expected, $this->addressHandler->compareAddresses($user1, $server1, $user2, $server2) @@ -143,7 +143,7 @@ public static function dataTestCompareAddresses(): array { ]; } - #[\PHPUnit\Framework\Attributes\DataProvider('dataTestRemoveProtocolFromUrl')] + #[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'dataTestRemoveProtocolFromUrl')] public function testRemoveProtocolFromUrl(string $url, string $expectedResult): void { $result = $this->addressHandler->removeProtocolFromUrl($url); $this->assertSame($expectedResult, $result); @@ -157,7 +157,7 @@ public static function dataTestRemoveProtocolFromUrl(): array { ]; } - #[\PHPUnit\Framework\Attributes\DataProvider('dataTestUrlContainProtocol')] + #[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'dataTestUrlContainProtocol')] public function testUrlContainProtocol(string $url, bool $expectedResult): void { $result = $this->addressHandler->urlContainProtocol($url); $this->assertSame($expectedResult, $result); diff --git a/apps/federatedfilesharing/tests/Controller/MountPublicLinkControllerTest.php b/apps/federatedfilesharing/tests/Controller/MountPublicLinkControllerTest.php index e99b59e82b85f..e0cbb976b17c7 100644 --- a/apps/federatedfilesharing/tests/Controller/MountPublicLinkControllerTest.php +++ b/apps/federatedfilesharing/tests/Controller/MountPublicLinkControllerTest.php @@ -85,7 +85,7 @@ protected function setUp(): void { ); } - #[\PHPUnit\Framework\Attributes\DataProvider('dataTestCreateFederatedShare')] + #[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'dataTestCreateFederatedShare')] public function testCreateFederatedShare( string $shareWith, bool $outgoingSharesAllowed, diff --git a/apps/federatedfilesharing/tests/Controller/RequestHandlerControllerTest.php b/apps/federatedfilesharing/tests/Controller/RequestHandlerControllerTest.php index ca09587cbe897..0e4e75a331664 100644 --- a/apps/federatedfilesharing/tests/Controller/RequestHandlerControllerTest.php +++ b/apps/federatedfilesharing/tests/Controller/RequestHandlerControllerTest.php @@ -28,7 +28,7 @@ * * @package OCA\FederatedFileSharing\Tests */ -#[\PHPUnit\Framework\Attributes\Group('DB')] +#[\PHPUnit\Framework\Attributes\Group(name: 'DB')] class RequestHandlerControllerTest extends \Test\TestCase { private string $owner = 'owner'; private string $user1 = 'user1'; diff --git a/apps/federatedfilesharing/tests/FederatedShareProviderTest.php b/apps/federatedfilesharing/tests/FederatedShareProviderTest.php index 4acf7d12e0b57..fd732ca58d55d 100644 --- a/apps/federatedfilesharing/tests/FederatedShareProviderTest.php +++ b/apps/federatedfilesharing/tests/FederatedShareProviderTest.php @@ -37,7 +37,7 @@ * * @package OCA\FederatedFileSharing\Tests */ -#[\PHPUnit\Framework\Attributes\Group('DB')] +#[\PHPUnit\Framework\Attributes\Group(name: 'DB')] class FederatedShareProviderTest extends \Test\TestCase { protected IDBConnection $connection; protected AddressHandler&MockObject $addressHandler; @@ -117,7 +117,7 @@ public static function dataTestCreate(): array { ]; } - #[\PHPUnit\Framework\Attributes\DataProvider('dataTestCreate')] + #[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'dataTestCreate')] public function testCreate(?\DateTime $expirationDate, ?string $expectedDataDate): void { $share = $this->shareManager->newShare(); @@ -417,7 +417,7 @@ public function testCreateAlreadyShared(): void { } } - #[\PHPUnit\Framework\Attributes\DataProvider('dataTestUpdate')] + #[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'dataTestUpdate')] public function testUpdate(string $owner, string $sharedBy, ?\DateTime $expirationDate): void { $this->provider = $this->getMockBuilder(FederatedShareProvider::class) ->setConstructorArgs( @@ -708,7 +708,7 @@ public static function dataDeleteUser(): array { * @param string $deletedUser The user that is deleted * @param bool $rowDeleted Is the row deleted in this setup */ - #[\PHPUnit\Framework\Attributes\DataProvider('dataDeleteUser')] + #[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'dataDeleteUser')] public function testDeleteUser(string $owner, string $initiator, string $recipient, string $deletedUser, bool $rowDeleted): void { $qb = $this->connection->getQueryBuilder(); $qb->insert('share') @@ -738,7 +738,7 @@ public function testDeleteUser(string $owner, string $initiator, string $recipie $this->assertCount($rowDeleted ? 0 : 1, $data); } - #[\PHPUnit\Framework\Attributes\DataProvider('dataTestIsOutgoingServer2serverShareEnabled')] + #[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'dataTestIsOutgoingServer2serverShareEnabled')] public function testIsOutgoingServer2serverShareEnabled(bool $internalOnly, string $isEnabled, bool $expected): void { $this->gsConfig->expects($this->once())->method('onlyInternalFederation') ->willReturn($internalOnly); @@ -760,7 +760,7 @@ public static function dataTestIsOutgoingServer2serverShareEnabled(): array { ]; } - #[\PHPUnit\Framework\Attributes\DataProvider('dataTestIsIncomingServer2serverShareEnabled')] + #[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'dataTestIsIncomingServer2serverShareEnabled')] public function testIsIncomingServer2serverShareEnabled(bool $onlyInternal, string $isEnabled, bool $expected): void { $this->gsConfig->expects($this->once())->method('onlyInternalFederation') ->willReturn($onlyInternal); @@ -782,7 +782,7 @@ public static function dataTestIsIncomingServer2serverShareEnabled(): array { ]; } - #[\PHPUnit\Framework\Attributes\DataProvider('dataTestIsLookupServerQueriesEnabled')] + #[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'dataTestIsLookupServerQueriesEnabled')] public function testIsLookupServerQueriesEnabled(bool $gsEnabled, string $isEnabled, bool $expected): void { $this->gsConfig->expects($this->once())->method('isGlobalScaleEnabled') ->willReturn($gsEnabled); @@ -808,7 +808,7 @@ public static function dataTestIsLookupServerQueriesEnabled(): array { ]; } - #[\PHPUnit\Framework\Attributes\DataProvider('dataTestIsLookupServerUploadEnabled')] + #[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'dataTestIsLookupServerUploadEnabled')] public function testIsLookupServerUploadEnabled(bool $gsEnabled, string $isEnabled, bool $expected): void { $this->gsConfig->expects($this->once())->method('isGlobalScaleEnabled') ->willReturn($gsEnabled); diff --git a/apps/federatedfilesharing/tests/NotificationsTest.php b/apps/federatedfilesharing/tests/NotificationsTest.php index da5defd8e55e5..761dbcce3bf9f 100644 --- a/apps/federatedfilesharing/tests/NotificationsTest.php +++ b/apps/federatedfilesharing/tests/NotificationsTest.php @@ -78,7 +78,7 @@ private function getInstance(array $mockedMethods = []) { } - #[\PHPUnit\Framework\Attributes\DataProvider('dataTestSendUpdateToRemote')] + #[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'dataTestSendUpdateToRemote')] public function testSendUpdateToRemote(int $try, array $httpRequestResult, bool $expected): void { $remote = 'http://remote'; $id = 42; diff --git a/apps/federatedfilesharing/tests/Settings/AdminTest.php b/apps/federatedfilesharing/tests/Settings/AdminTest.php index 1eee362c11f47..54b36f1dea2b8 100644 --- a/apps/federatedfilesharing/tests/Settings/AdminTest.php +++ b/apps/federatedfilesharing/tests/Settings/AdminTest.php @@ -53,7 +53,7 @@ public static function sharingStateProvider(): array { ]; } - #[\PHPUnit\Framework\Attributes\DataProvider('sharingStateProvider')] + #[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'sharingStateProvider')] public function testGetForm(bool $state): void { $this->federatedShareProvider ->expects($this->once()) diff --git a/apps/federatedfilesharing/tests/TestCase.php b/apps/federatedfilesharing/tests/TestCase.php index 1cb1c064b9463..5132a2c8fd0d6 100644 --- a/apps/federatedfilesharing/tests/TestCase.php +++ b/apps/federatedfilesharing/tests/TestCase.php @@ -19,7 +19,7 @@ /** * Base class for sharing tests. */ -#[\PHPUnit\Framework\Attributes\Group('DB')] +#[\PHPUnit\Framework\Attributes\Group(name: 'DB')] abstract class TestCase extends \Test\TestCase { public const TEST_FILES_SHARING_API_USER1 = 'test-share-user1'; public const TEST_FILES_SHARING_API_USER2 = 'test-share-user2'; diff --git a/apps/federation/tests/BackgroundJob/GetSharedSecretTest.php b/apps/federation/tests/BackgroundJob/GetSharedSecretTest.php index b847a4cfcf61a..21dbf61a5bb64 100644 --- a/apps/federation/tests/BackgroundJob/GetSharedSecretTest.php +++ b/apps/federation/tests/BackgroundJob/GetSharedSecretTest.php @@ -30,7 +30,7 @@ * * @package OCA\Federation\Tests\BackgroundJob */ -#[\PHPUnit\Framework\Attributes\Group('DB')] +#[\PHPUnit\Framework\Attributes\Group(name: 'DB')] class GetSharedSecretTest extends TestCase { private MockObject&IClient $httpClient; @@ -76,7 +76,7 @@ protected function setUp(): void { ); } - #[\PHPUnit\Framework\Attributes\DataProvider('dataTestExecute')] + #[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'dataTestExecute')] public function testExecute(bool $isTrustedServer, bool $retainBackgroundJob): void { /** @var GetSharedSecret&MockObject $getSharedSecret */ $getSharedSecret = $this->getMockBuilder(GetSharedSecret::class) @@ -134,7 +134,7 @@ public static function dataTestExecute(): array { ]; } - #[\PHPUnit\Framework\Attributes\DataProvider('dataTestRun')] + #[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'dataTestRun')] public function testRun(int $statusCode): void { $target = 'targetURL'; $source = 'sourceURL'; diff --git a/apps/federation/tests/BackgroundJob/RequestSharedSecretTest.php b/apps/federation/tests/BackgroundJob/RequestSharedSecretTest.php index 6ef579c7483eb..c1108731625cd 100644 --- a/apps/federation/tests/BackgroundJob/RequestSharedSecretTest.php +++ b/apps/federation/tests/BackgroundJob/RequestSharedSecretTest.php @@ -66,7 +66,7 @@ protected function setUp(): void { ); } - #[\PHPUnit\Framework\Attributes\DataProvider('dataTestStart')] + #[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'dataTestStart')] public function testStart(bool $isTrustedServer, bool $retainBackgroundJob): void { /** @var RequestSharedSecret&MockObject $requestSharedSecret */ $requestSharedSecret = $this->getMockBuilder(RequestSharedSecret::class) @@ -125,7 +125,7 @@ public static function dataTestStart(): array { ]; } - #[\PHPUnit\Framework\Attributes\DataProvider('dataTestRun')] + #[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'dataTestRun')] public function testRun(int $statusCode, int $attempt = 0): void { $target = 'targetURL'; $source = 'sourceURL'; diff --git a/apps/federation/tests/Controller/OCSAuthAPIControllerTest.php b/apps/federation/tests/Controller/OCSAuthAPIControllerTest.php index a054277c5cd2d..9ccbcf0898bec 100644 --- a/apps/federation/tests/Controller/OCSAuthAPIControllerTest.php +++ b/apps/federation/tests/Controller/OCSAuthAPIControllerTest.php @@ -64,7 +64,7 @@ protected function setUp(): void { ->willReturn($this->currentTime); } - #[\PHPUnit\Framework\Attributes\DataProvider('dataTestRequestSharedSecret')] + #[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'dataTestRequestSharedSecret')] public function testRequestSharedSecret(string $token, string $localToken, bool $isTrustedServer, bool $ok): void { $url = 'url'; @@ -104,7 +104,7 @@ public static function dataTestRequestSharedSecret(): array { ]; } - #[\PHPUnit\Framework\Attributes\DataProvider('dataTestGetSharedSecret')] + #[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'dataTestGetSharedSecret')] public function testGetSharedSecret(bool $isTrustedServer, bool $isValidToken, bool $ok): void { $url = 'url'; $token = 'token'; diff --git a/apps/federation/tests/Controller/SettingsControllerTest.php b/apps/federation/tests/Controller/SettingsControllerTest.php index b0a7a5e30c94f..aa46559431687 100644 --- a/apps/federation/tests/Controller/SettingsControllerTest.php +++ b/apps/federation/tests/Controller/SettingsControllerTest.php @@ -65,7 +65,7 @@ public function testAddServer(): void { $this->assertArrayHasKey('id', $data); } - #[\PHPUnit\Framework\Attributes\DataProvider('checkServerFails')] + #[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'checkServerFails')] public function testAddServerFail(bool $isTrustedServer, bool $isNextcloud): void { $this->trustedServers ->expects($this->any()) @@ -113,7 +113,7 @@ public function testCheckServer(): void { ); } - #[\PHPUnit\Framework\Attributes\DataProvider('checkServerFails')] + #[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'checkServerFails')] public function testCheckServerFail(bool $isTrustedServer, bool $isNextcloud): void { $this->trustedServers ->expects($this->any()) diff --git a/apps/federation/tests/DAV/FedAuthTest.php b/apps/federation/tests/DAV/FedAuthTest.php index c95d3852b484d..f68bfe9297ea8 100644 --- a/apps/federation/tests/DAV/FedAuthTest.php +++ b/apps/federation/tests/DAV/FedAuthTest.php @@ -15,7 +15,7 @@ class FedAuthTest extends TestCase { - #[\PHPUnit\Framework\Attributes\DataProvider('providesUser')] + #[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'providesUser')] public function testFedAuth(bool $expected, string $user, string $password): void { /** @var DbHandler&MockObject $db */ $db = $this->createMock(DbHandler::class); diff --git a/apps/federation/tests/DbHandlerTest.php b/apps/federation/tests/DbHandlerTest.php index def093f3685a4..a812c28b6344d 100644 --- a/apps/federation/tests/DbHandlerTest.php +++ b/apps/federation/tests/DbHandlerTest.php @@ -16,7 +16,7 @@ use PHPUnit\Framework\MockObject\MockObject; use Test\TestCase; -#[\PHPUnit\Framework\Attributes\Group('DB')] +#[\PHPUnit\Framework\Attributes\Group(name: 'DB')] class DbHandlerTest extends TestCase { private DbHandler $dbHandler; private IL10N&MockObject $il10n; @@ -55,7 +55,7 @@ protected function tearDown(): void { * @param string $expectedUrl the url we expect to be written to the db * @param string $expectedHash the hash value we expect to be written to the db */ - #[\PHPUnit\Framework\Attributes\DataProvider('dataTestAddServer')] + #[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'dataTestAddServer')] public function testAddServer(string $url, string $expectedUrl, string $expectedHash): void { $id = $this->dbHandler->addServer($url); @@ -126,7 +126,7 @@ public function testGetAll(): void { $this->assertSame($id2, (int)$result[1]['id']); } - #[\PHPUnit\Framework\Attributes\DataProvider('dataTestServerExists')] + #[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'dataTestServerExists')] public function testServerExists(string $serverInTable, string $checkForServer, bool $expected): void { $this->dbHandler->addServer($serverInTable); $this->assertSame($expected, @@ -231,7 +231,7 @@ public function testGetServerStatus(): void { /** * hash should always be computed with the normalized URL */ - #[\PHPUnit\Framework\Attributes\DataProvider('dataTestHash')] + #[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'dataTestHash')] public function testHash(string $url, string $expected): void { $this->assertSame($expected, $this->invokePrivate($this->dbHandler, 'hash', [$url]) @@ -247,7 +247,7 @@ public static function dataTestHash(): array { ]; } - #[\PHPUnit\Framework\Attributes\DataProvider('dataTestNormalizeUrl')] + #[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'dataTestNormalizeUrl')] public function testNormalizeUrl(string $url, string $expected): void { $this->assertSame($expected, $this->invokePrivate($this->dbHandler, 'normalizeUrl', [$url]) @@ -264,7 +264,7 @@ public static function dataTestNormalizeUrl(): array { ]; } - #[\PHPUnit\Framework\Attributes\DataProvider('providesAuth')] + #[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'providesAuth')] public function testAuth(bool $expectedResult, string $user, string $password): void { if ($expectedResult) { $this->dbHandler->addServer('url1'); diff --git a/apps/federation/tests/TrustedServersTest.php b/apps/federation/tests/TrustedServersTest.php index 0b8eed426729e..e08736a26d5c0 100644 --- a/apps/federation/tests/TrustedServersTest.php +++ b/apps/federation/tests/TrustedServersTest.php @@ -174,7 +174,7 @@ public static function dataTestGetServer() { ]; } - #[\PHPUnit\Framework\Attributes\DataProvider('dataTestGetServer')] + #[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'dataTestGetServer')] public function testGetServer(int $id, ?array $expectedServer): void { $servers = [ [ @@ -228,7 +228,7 @@ public function testGetServerStatus(): void { ); } - #[\PHPUnit\Framework\Attributes\DataProvider('dataTestIsNextcloudServer')] + #[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'dataTestIsNextcloudServer')] public function testIsNextcloudServer(int $statusCode, bool $isValidNextcloudVersion, bool $expected): void { $server = 'server1'; @@ -295,7 +295,7 @@ public function testIsNextcloudServerFail(): void { $this->assertFalse($this->trustedServers->isNextcloudServer($server)); } - #[\PHPUnit\Framework\Attributes\DataProvider('dataTestCheckNextcloudVersion')] + #[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'dataTestCheckNextcloudVersion')] public function testCheckNextcloudVersion(string $status): void { $this->assertTrue(self::invokePrivate($this->trustedServers, 'checkNextcloudVersion', [$status])); } @@ -307,7 +307,7 @@ public static function dataTestCheckNextcloudVersion(): array { ]; } - #[\PHPUnit\Framework\Attributes\DataProvider('dataTestCheckNextcloudVersionTooLow')] + #[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'dataTestCheckNextcloudVersionTooLow')] public function testCheckNextcloudVersionTooLow(string $status): void { $this->expectException(HintException::class); $this->expectExceptionMessage('Remote server version is too low. 9.0 is required.'); @@ -321,7 +321,7 @@ public static function dataTestCheckNextcloudVersionTooLow(): array { ]; } - #[\PHPUnit\Framework\Attributes\DataProvider('dataTestUpdateProtocol')] + #[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'dataTestUpdateProtocol')] public function testUpdateProtocol(string $url, string $expected): void { $this->assertSame($expected, self::invokePrivate($this->trustedServers, 'updateProtocol', [$url]) diff --git a/apps/files/tests/Activity/Filter/GenericTest.php b/apps/files/tests/Activity/Filter/GenericTest.php index 8d8a00ededa95..af3419c8c674f 100644 --- a/apps/files/tests/Activity/Filter/GenericTest.php +++ b/apps/files/tests/Activity/Filter/GenericTest.php @@ -18,7 +18,7 @@ * * @package OCA\Files\Tests\Activity\Filter */ -#[\PHPUnit\Framework\Attributes\Group('DB')] +#[\PHPUnit\Framework\Attributes\Group(name: 'DB')] class GenericTest extends TestCase { public static function dataFilters(): array { return [ @@ -27,27 +27,27 @@ public static function dataFilters(): array { ]; } - #[\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); @@ -57,7 +57,7 @@ public function testGetPriority(string $filterClass): void { $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); @@ -65,14 +65,14 @@ public function testGetIcon(string $filterClass): void { $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); diff --git a/apps/files/tests/Activity/ProviderTest.php b/apps/files/tests/Activity/ProviderTest.php index b6ba095ecfec4..1a7f25609a930 100644 --- a/apps/files/tests/Activity/ProviderTest.php +++ b/apps/files/tests/Activity/ProviderTest.php @@ -90,7 +90,7 @@ public static function dataGetFile(): array { ]; } - #[\PHPUnit\Framework\Attributes\DataProvider('dataGetFile')] + #[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'dataGetFile')] public function testGetFile(array|string $parameter, ?int $eventId, string $id, string $name, string $path): void { $provider = $this->getProvider(); @@ -134,7 +134,7 @@ public static function dataGetUser(): array { ]; } - #[\PHPUnit\Framework\Attributes\DataProvider('dataGetUser')] + #[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'dataGetUser')] public function testGetUser(string $uid, ?string $userDisplayName, ?array $cloudIdData, array $expected): void { $provider = $this->getProvider(); diff --git a/apps/files/tests/Activity/Setting/GenericTest.php b/apps/files/tests/Activity/Setting/GenericTest.php index df6b1e0f6d4a4..3b4584a8f1b1a 100644 --- a/apps/files/tests/Activity/Setting/GenericTest.php +++ b/apps/files/tests/Activity/Setting/GenericTest.php @@ -22,27 +22,27 @@ public static function dataSettings(): array { ]; } - #[\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); @@ -52,28 +52,28 @@ public function testGetPriority(string $settingClass): void { $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); diff --git a/apps/files/tests/AdvancedCapabilitiesTest.php b/apps/files/tests/AdvancedCapabilitiesTest.php index f39ac1c873f13..921f7a6b353f1 100644 --- a/apps/files/tests/AdvancedCapabilitiesTest.php +++ b/apps/files/tests/AdvancedCapabilitiesTest.php @@ -23,7 +23,7 @@ protected function setUp(): void { $this->capabilities = new AdvancedCapabilities($this->service); } - #[\PHPUnit\Framework\Attributes\DataProvider('dataGetCapabilities')] + #[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'dataGetCapabilities')] public function testGetCapabilities(bool $wcf): void { $this->service ->expects(self::once()) diff --git a/apps/files/tests/BackgroundJob/DeleteOrphanedItemsJobTest.php b/apps/files/tests/BackgroundJob/DeleteOrphanedItemsJobTest.php index 5202037b6a1cc..a0aaeafc4dc3f 100644 --- a/apps/files/tests/BackgroundJob/DeleteOrphanedItemsJobTest.php +++ b/apps/files/tests/BackgroundJob/DeleteOrphanedItemsJobTest.php @@ -21,7 +21,7 @@ * * @package Test\BackgroundJob */ -#[\PHPUnit\Framework\Attributes\Group('DB')] +#[\PHPUnit\Framework\Attributes\Group(name: 'DB')] class DeleteOrphanedItemsJobTest extends \Test\TestCase { protected IDBConnection $connection; protected LoggerInterface $logger; diff --git a/apps/files/tests/BackgroundJob/ScanFilesTest.php b/apps/files/tests/BackgroundJob/ScanFilesTest.php index 22ec049741b2b..ed9e0b7767b86 100644 --- a/apps/files/tests/BackgroundJob/ScanFilesTest.php +++ b/apps/files/tests/BackgroundJob/ScanFilesTest.php @@ -28,7 +28,7 @@ * * @package OCA\Files\Tests\BackgroundJob */ -#[\PHPUnit\Framework\Attributes\Group('DB')] +#[\PHPUnit\Framework\Attributes\Group(name: 'DB')] class ScanFilesTest extends TestCase { use UserTrait; use MountProviderTrait; diff --git a/apps/files/tests/Command/DeleteOrphanedFilesTest.php b/apps/files/tests/Command/DeleteOrphanedFilesTest.php index 4c0a487ace60b..13c7a36785ae6 100644 --- a/apps/files/tests/Command/DeleteOrphanedFilesTest.php +++ b/apps/files/tests/Command/DeleteOrphanedFilesTest.php @@ -25,7 +25,7 @@ * * @package OCA\Files\Tests\Command */ -#[\PHPUnit\Framework\Attributes\Group('DB')] +#[\PHPUnit\Framework\Attributes\Group(name: 'DB')] class DeleteOrphanedFilesTest extends TestCase { private DeleteOrphanedFiles $command; @@ -93,7 +93,7 @@ public function testClearFiles(): void { $fileInfo = $view->getFileInfo('files/test'); $storageId = $fileInfo->getStorage()->getId(); - $numericStorageId = $fileInfo->getStorage()->getStorageCache()->getNumericId(); + $numericStorageId = $fileInfo->getStorage()->getCache()->getNumericStorageId(); $this->assertCount(1, $this->getFile($fileInfo->getId()), 'Asserts that file is available'); $this->assertEquals(1, $this->getMountsCount($numericStorageId), 'Asserts that mount is available'); diff --git a/apps/files/tests/Controller/ApiControllerTest.php b/apps/files/tests/Controller/ApiControllerTest.php index e74989eb2f5d3..12b584fc56d9a 100644 --- a/apps/files/tests/Controller/ApiControllerTest.php +++ b/apps/files/tests/Controller/ApiControllerTest.php @@ -44,11 +44,11 @@ class ApiControllerTest extends TestCase { private string $appName = 'files'; private IUser $user; private IRequest $request; - private TagService $tagService; + private TagService&MockObject $tagService; private IPreview&MockObject $preview; private ApiController $apiController; private IManager $shareManager; - private IConfig $config; + private IConfig&MockObject $config; private Folder&MockObject $userFolder; private UserConfig&MockObject $userConfig; private ViewConfig&MockObject $viewConfig; diff --git a/apps/files/tests/Controller/ViewControllerTest.php b/apps/files/tests/Controller/ViewControllerTest.php index cd466b3e97ea9..631097cbc6019 100644 --- a/apps/files/tests/Controller/ViewControllerTest.php +++ b/apps/files/tests/Controller/ViewControllerTest.php @@ -214,7 +214,7 @@ public static function dataTestShortRedirect(): array { ]; } - #[\PHPUnit\Framework\Attributes\DataProvider('dataTestShortRedirect')] + #[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'dataTestShortRedirect')] public function testShortRedirect(?string $openfile, ?string $opendetails, string $result): void { $this->appManager->expects($this->any()) ->method('isEnabledForUser') diff --git a/apps/files/tests/HelperTest.php b/apps/files/tests/HelperTest.php index ba93fa0efdf26..776e72a729b07 100644 --- a/apps/files/tests/HelperTest.php +++ b/apps/files/tests/HelperTest.php @@ -76,7 +76,7 @@ public static function sortDataProvider(): array { ]; } - #[\PHPUnit\Framework\Attributes\DataProvider('sortDataProvider')] + #[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'sortDataProvider')] public function testSortByName(string $sort, bool $sortDescending, array $expectedOrder): void { if (($sort === 'mtime') && (PHP_INT_SIZE < 8)) { $this->markTestSkipped('Skip mtime sorting on 32bit'); diff --git a/apps/files/tests/Service/TagServiceTest.php b/apps/files/tests/Service/TagServiceTest.php index 05a6518022512..1b3e0898b334a 100644 --- a/apps/files/tests/Service/TagServiceTest.php +++ b/apps/files/tests/Service/TagServiceTest.php @@ -27,7 +27,7 @@ * * @package OCA\Files */ -#[\PHPUnit\Framework\Attributes\Group('DB')] +#[\PHPUnit\Framework\Attributes\Group(name: 'DB')] class TagServiceTest extends \Test\TestCase { private string $user; private IUserSession&MockObject $userSession; @@ -44,9 +44,6 @@ protected function setUp(): void { \OC_User::setUserId($this->user); \OC_Util::setupFS($this->user); $user = $this->createMock(IUser::class); - /** - * @var IUserSession - */ $this->userSession = $this->createMock(IUserSession::class); $this->userSession->expects($this->any()) ->method('getUser') diff --git a/apps/files_external/lib/Controller/GlobalStoragesController.php b/apps/files_external/lib/Controller/GlobalStoragesController.php index 0f9326ef464ed..38455a154fc7b 100644 --- a/apps/files_external/lib/Controller/GlobalStoragesController.php +++ b/apps/files_external/lib/Controller/GlobalStoragesController.php @@ -25,15 +25,6 @@ class GlobalStoragesController extends StoragesController { /** * Creates a new global storages controller. - * - * @param string $AppName application name - * @param IRequest $request request object - * @param IL10N $l10n l10n service - * @param GlobalStoragesService $globalStoragesService storage service - * @param LoggerInterface $logger - * @param IUserSession $userSession - * @param IGroupManager $groupManager - * @param IConfig $config */ public function __construct( $appName, @@ -64,24 +55,22 @@ public function __construct( * @param string $backend backend identifier * @param string $authMechanism authentication mechanism identifier * @param array $backendOptions backend-specific options - * @param array $mountOptions mount-specific options - * @param array $applicableUsers users for which to mount the storage - * @param array $applicableGroups groups for which to mount the storage - * @param int $priority priority - * - * @return DataResponse + * @param ?array $mountOptions mount-specific options + * @param ?array $applicableUsers users for which to mount the storage + * @param ?array $applicableGroups groups for which to mount the storage + * @param ?int $priority priority */ #[PasswordConfirmationRequired(strict: true)] public function create( - $mountPoint, - $backend, - $authMechanism, - $backendOptions, - $mountOptions, - $applicableUsers, - $applicableGroups, - $priority, - ) { + string $mountPoint, + string $backend, + string $authMechanism, + array $backendOptions, + ?array $mountOptions, + ?array $applicableUsers, + ?array $applicableGroups, + ?int $priority, + ): DataResponse { $canCreateNewLocalStorage = $this->config->getSystemValue('files_external_allow_create_new_local', true); if (!$canCreateNewLocalStorage && $backend === 'local') { return new DataResponse( @@ -129,25 +118,23 @@ public function create( * @param string $backend backend identifier * @param string $authMechanism authentication mechanism identifier * @param array $backendOptions backend-specific options - * @param array $mountOptions mount-specific options - * @param array $applicableUsers users for which to mount the storage - * @param array $applicableGroups groups for which to mount the storage - * @param int $priority priority - * - * @return DataResponse + * @param ?array $mountOptions mount-specific options + * @param ?array $applicableUsers users for which to mount the storage + * @param ?array $applicableGroups groups for which to mount the storage + * @param ?int $priority priority */ #[PasswordConfirmationRequired(strict: true)] public function update( - $id, - $mountPoint, - $backend, - $authMechanism, - $backendOptions, - $mountOptions, - $applicableUsers, - $applicableGroups, - $priority, - ) { + int $id, + string $mountPoint, + string $backend, + string $authMechanism, + array $backendOptions, + ?array $mountOptions, + ?array $applicableUsers, + ?array $applicableGroups, + ?int $priority, + ): DataResponse { $storage = $this->createStorage( $mountPoint, $backend, diff --git a/apps/files_external/lib/Controller/StoragesController.php b/apps/files_external/lib/Controller/StoragesController.php index cf3fbc2d24fd1..cecf8f2861b87 100644 --- a/apps/files_external/lib/Controller/StoragesController.php +++ b/apps/files_external/lib/Controller/StoragesController.php @@ -67,14 +67,14 @@ public function __construct( * @return StorageConfig|DataResponse */ protected function createStorage( - $mountPoint, - $backend, - $authMechanism, - $backendOptions, - $mountOptions = null, - $applicableUsers = null, - $applicableGroups = null, - $priority = null, + string $mountPoint, + string $backend, + string $authMechanism, + array $backendOptions, + ?array $mountOptions = null, + ?array $applicableUsers = null, + ?array $applicableGroups = null, + ?int $priority = null, ) { $canCreateNewLocalStorage = $this->config->getSystemValue('files_external_allow_create_new_local', true); if (!$canCreateNewLocalStorage && $backend === 'local') { diff --git a/apps/files_external/lib/Controller/UserStoragesController.php b/apps/files_external/lib/Controller/UserStoragesController.php index f724718aaa585..95d212f91888c 100644 --- a/apps/files_external/lib/Controller/UserStoragesController.php +++ b/apps/files_external/lib/Controller/UserStoragesController.php @@ -21,6 +21,7 @@ use OCP\IL10N; use OCP\IRequest; use OCP\IUserSession; +use Override; use Psr\Log\LoggerInterface; /** @@ -29,17 +30,9 @@ class UserStoragesController extends StoragesController { /** * Creates a new user storages controller. - * - * @param string $AppName application name - * @param IRequest $request request object - * @param IL10N $l10n l10n service - * @param UserStoragesService $userStoragesService storage service - * @param LoggerInterface $logger - * @param IUserSession $userSession - * @param IGroupManager $groupManager */ public function __construct( - $appName, + string $appName, IRequest $request, IL10N $l10n, UserStoragesService $userStoragesService, @@ -60,7 +53,7 @@ public function __construct( ); } - protected function manipulateStorageConfig(StorageConfig $storage) { + protected function manipulateStorageConfig(StorageConfig $storage): void { /** @var AuthMechanism */ $authMechanism = $storage->getAuthMechanism(); $authMechanism->manipulateStorageConfig($storage, $this->userSession->getUser()); @@ -71,21 +64,19 @@ protected function manipulateStorageConfig(StorageConfig $storage) { /** * Get all storage entries - * - * @return DataResponse */ + #[Override] #[NoAdminRequired] - public function index() { + public function index(): DataResponse { return parent::index(); } /** * Return storage - * - * {@inheritdoc} */ + #[Override] #[NoAdminRequired] - public function show(int $id) { + public function show(int $id): DataResponse { return parent::show($id); } @@ -97,18 +88,16 @@ public function show(int $id) { * @param string $authMechanism authentication mechanism identifier * @param array $backendOptions backend-specific options * @param array $mountOptions backend-specific mount options - * - * @return DataResponse */ #[NoAdminRequired] #[PasswordConfirmationRequired(strict: true)] public function create( - $mountPoint, - $backend, - $authMechanism, - $backendOptions, - $mountOptions, - ) { + string $mountPoint, + string $backend, + string $authMechanism, + array $backendOptions, + ?array $mountOptions, + ): DataResponse { $canCreateNewLocalStorage = $this->config->getSystemValue('files_external_allow_create_new_local', true); if (!$canCreateNewLocalStorage && $backend === 'local') { return new DataResponse( @@ -151,20 +140,18 @@ public function create( * @param string $backend backend identifier * @param string $authMechanism authentication mechanism identifier * @param array $backendOptions backend-specific options - * @param array $mountOptions backend-specific mount options - * - * @return DataResponse + * @param ?array $mountOptions backend-specific mount options */ #[NoAdminRequired] #[PasswordConfirmationRequired(strict: true)] public function update( - $id, - $mountPoint, - $backend, - $authMechanism, - $backendOptions, - $mountOptions, - ) { + int $id, + string $mountPoint, + string $backend, + string $authMechanism, + array $backendOptions, + ?array $mountOptions, + ): DataResponse { $storage = $this->createStorage( $mountPoint, $backend, @@ -203,12 +190,11 @@ public function update( /** * Delete storage - * - * {@inheritdoc} */ + #[Override] #[NoAdminRequired] #[PasswordConfirmationRequired(strict: true)] - public function destroy(int $id) { + public function destroy(int $id): DataResponse { return parent::destroy($id); } } diff --git a/apps/files_external/lib/Service/StoragesService.php b/apps/files_external/lib/Service/StoragesService.php index 7b1b7ba2dc1ff..a119359b8b487 100644 --- a/apps/files_external/lib/Service/StoragesService.php +++ b/apps/files_external/lib/Service/StoragesService.php @@ -268,14 +268,14 @@ public function addStorage(StorageConfig $newStorage) { * @return StorageConfig */ public function createStorage( - $mountPoint, - $backendIdentifier, - $authMechanismIdentifier, - $backendOptions, - $mountOptions = null, - $applicableUsers = null, - $applicableGroups = null, - $priority = null, + string $mountPoint, + string $backendIdentifier, + string $authMechanismIdentifier, + array $backendOptions, + ?array $mountOptions = null, + ?array $applicableUsers = null, + ?array $applicableGroups = null, + ?int $priority = null, ) { $backend = $this->backendService->getBackend($backendIdentifier); if (!$backend) { diff --git a/apps/files_external/tests/Auth/AuthMechanismTest.php b/apps/files_external/tests/Auth/AuthMechanismTest.php index e999cecf181e2..5d859a66868f2 100644 --- a/apps/files_external/tests/Auth/AuthMechanismTest.php +++ b/apps/files_external/tests/Auth/AuthMechanismTest.php @@ -37,7 +37,7 @@ public static function validateStorageProvider(): array { ]; } - #[\PHPUnit\Framework\Attributes\DataProvider('validateStorageProvider')] + #[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'validateStorageProvider')] public function testValidateStorage(bool $expectedSuccess, string $scheme, bool $definitionSuccess): void { $mechanism = $this->getMockBuilder(AuthMechanism::class) ->onlyMethods(['validateStorageDefinition']) diff --git a/apps/files_external/tests/Backend/BackendTest.php b/apps/files_external/tests/Backend/BackendTest.php index 1653c354e16cd..0fe119567ab53 100644 --- a/apps/files_external/tests/Backend/BackendTest.php +++ b/apps/files_external/tests/Backend/BackendTest.php @@ -41,7 +41,7 @@ public static function validateStorageProvider(): array { ]; } - #[\PHPUnit\Framework\Attributes\DataProvider('validateStorageProvider')] + #[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'validateStorageProvider')] public function testValidateStorage(bool $expectedSuccess, bool $definitionSuccess): void { $backend = $this->getMockBuilder(Backend::class) ->onlyMethods(['validateStorageDefinition']) diff --git a/apps/files_external/tests/Config/UserPlaceholderHandlerTest.php b/apps/files_external/tests/Config/UserPlaceholderHandlerTest.php index 0e4805e86dcf5..22d49cafe911e 100644 --- a/apps/files_external/tests/Config/UserPlaceholderHandlerTest.php +++ b/apps/files_external/tests/Config/UserPlaceholderHandlerTest.php @@ -58,13 +58,13 @@ public static function optionProvider(): array { ]; } - #[DataProvider('optionProvider')] + #[DataProvider(methodName: 'optionProvider')] public function testHandle(string|array $option, string|array $expected): void { $this->setUser(); $this->assertSame($expected, $this->handler->handle($option)); } - #[DataProvider('optionProvider')] + #[DataProvider(methodName: 'optionProvider')] public function testHandleNoUser(string|array $option): void { $this->shareManager->expects($this->once()) ->method('getShareByToken') diff --git a/apps/files_external/tests/Controller/StoragesControllerTestCase.php b/apps/files_external/tests/Controller/StoragesControllerTestCase.php index 1eb52f9b459c3..12e3e13f943c2 100644 --- a/apps/files_external/tests/Controller/StoragesControllerTestCase.php +++ b/apps/files_external/tests/Controller/StoragesControllerTestCase.php @@ -186,7 +186,7 @@ public static function mountPointNamesProvider(): array { ]; } - #[\PHPUnit\Framework\Attributes\DataProvider('mountPointNamesProvider')] + #[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'mountPointNamesProvider')] public function testAddOrUpdateStorageInvalidMountPoint($mountPoint): void { $storageConfig = new StorageConfig(1); $storageConfig->setMountPoint($mountPoint); @@ -355,7 +355,7 @@ public static function validateStorageProvider(): array { ]; } - #[\PHPUnit\Framework\Attributes\DataProvider('validateStorageProvider')] + #[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'validateStorageProvider')] public function testValidateStorage(bool $backendValidate, bool $authMechValidate, bool $expectSuccess): void { $backend = $this->getBackendMock(); $backend->method('validateStorage') diff --git a/apps/files_external/tests/DefinitionParameterTest.php b/apps/files_external/tests/DefinitionParameterTest.php index c535481bf66a7..7ccd3a6406c01 100644 --- a/apps/files_external/tests/DefinitionParameterTest.php +++ b/apps/files_external/tests/DefinitionParameterTest.php @@ -68,7 +68,7 @@ public static function validateValueProvider(): array { ]; } - #[\PHPUnit\Framework\Attributes\DataProvider('validateValueProvider')] + #[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'validateValueProvider')] public function testValidateValue($type, $flags, $value, $success, $expectedValue = null): void { $param = new Param('foo', 'bar'); $param->setType($type); diff --git a/apps/files_external/tests/FrontendDefinitionTraitTest.php b/apps/files_external/tests/FrontendDefinitionTraitTest.php index e0bf066e70a17..c22598749534e 100644 --- a/apps/files_external/tests/FrontendDefinitionTraitTest.php +++ b/apps/files_external/tests/FrontendDefinitionTraitTest.php @@ -18,6 +18,7 @@ public function testJsonSerialization(): void { ->getMock(); $param->method('getName')->willReturn('foo'); + /** @var FrontendDefinitionTrait $trait */ $trait = $this->getMockForTrait(FrontendDefinitionTrait::class); $trait->setText('test'); $trait->addParameters([$param]); @@ -41,7 +42,7 @@ public static function validateStorageProvider(): array { ]; } - #[\PHPUnit\Framework\Attributes\DataProvider('validateStorageProvider')] + #[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'validateStorageProvider')] public function testValidateStorage(bool $expectedSuccess, array $params): void { $backendParams = []; foreach ($params as $name => $valid) { @@ -67,6 +68,7 @@ public function testValidateStorage(bool $expectedSuccess, array $params): void $storageConfig->expects($this->any()) ->method('setBackendOption'); + /** @var FrontendDefinitionTrait $trait */ $trait = $this->getMockForTrait(FrontendDefinitionTrait::class); $trait->setText('test'); $trait->addParameters($backendParams); @@ -98,6 +100,7 @@ public function testValidateStorageSet(): void { ->method('setBackendOption') ->with('param', 'foobar'); + /** @var FrontendDefinitionTrait $trait */ $trait = $this->getMockForTrait(FrontendDefinitionTrait::class); $trait->setText('test'); $trait->addParameter($param); diff --git a/apps/files_external/tests/Listener/StorePasswordListenerTest.php b/apps/files_external/tests/Listener/StorePasswordListenerTest.php index 848d8a35dac9b..3aeb1bdf6416d 100644 --- a/apps/files_external/tests/Listener/StorePasswordListenerTest.php +++ b/apps/files_external/tests/Listener/StorePasswordListenerTest.php @@ -18,7 +18,7 @@ use PHPUnit\Framework\MockObject\MockObject; use Test\TestCase; -#[\PHPUnit\Framework\Attributes\Group('DB')] +#[\PHPUnit\Framework\Attributes\Group(name: 'DB')] class StorePasswordListenerTest extends TestCase { protected IUser&MockObject $mockedUser; diff --git a/apps/files_external/tests/OwnCloudFunctionsTest.php b/apps/files_external/tests/OwnCloudFunctionsTest.php index 298fb7461218f..f6ad0f5c91c74 100644 --- a/apps/files_external/tests/OwnCloudFunctionsTest.php +++ b/apps/files_external/tests/OwnCloudFunctionsTest.php @@ -16,7 +16,7 @@ * * @package OCA\Files_External\Tests */ -#[\PHPUnit\Framework\Attributes\Group('DB')] +#[\PHPUnit\Framework\Attributes\Group(name: 'DB')] class OwnCloudFunctionsTest extends \Test\TestCase { public static function configUrlProvider(): array { return [ @@ -87,7 +87,7 @@ public static function configUrlProvider(): array { ]; } - #[\PHPUnit\Framework\Attributes\DataProvider('configUrlProvider')] + #[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'configUrlProvider')] public function testConfig(array $config, string $expectedUri): void { $config['user'] = 'someuser'; $config['password'] = 'somepassword'; diff --git a/apps/files_external/tests/Service/BackendServiceTest.php b/apps/files_external/tests/Service/BackendServiceTest.php index ef545688040bd..081447b26f585 100644 --- a/apps/files_external/tests/Service/BackendServiceTest.php +++ b/apps/files_external/tests/Service/BackendServiceTest.php @@ -208,7 +208,7 @@ public static function invalidConfigPlaceholderProvider(): array { ]; } - #[\PHPUnit\Framework\Attributes\DataProvider('invalidConfigPlaceholderProvider')] + #[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'invalidConfigPlaceholderProvider')] public function testRegisterConfigHandlerInvalid(array $placeholders): void { $this->expectException(\RuntimeException::class); diff --git a/apps/files_external/tests/Service/DBConfigServiceTest.php b/apps/files_external/tests/Service/DBConfigServiceTest.php index 87c01dcc85f9d..b1730eb10fef3 100644 --- a/apps/files_external/tests/Service/DBConfigServiceTest.php +++ b/apps/files_external/tests/Service/DBConfigServiceTest.php @@ -14,7 +14,7 @@ use OCP\Server; use Test\TestCase; -#[\PHPUnit\Framework\Attributes\Group('DB')] +#[\PHPUnit\Framework\Attributes\Group(name: 'DB')] class DBConfigServiceTest extends TestCase { private IDBConnection $connection; private DBConfigService $dbConfig; diff --git a/apps/files_external/tests/Service/GlobalStoragesServiceTest.php b/apps/files_external/tests/Service/GlobalStoragesServiceTest.php index a76005718d37a..994da6a537e5b 100644 --- a/apps/files_external/tests/Service/GlobalStoragesServiceTest.php +++ b/apps/files_external/tests/Service/GlobalStoragesServiceTest.php @@ -13,7 +13,7 @@ use OCA\Files_External\Service\GlobalStoragesService; -#[\PHPUnit\Framework\Attributes\Group('DB')] +#[\PHPUnit\Framework\Attributes\Group(name: 'DB')] class GlobalStoragesServiceTest extends StoragesServiceTestCase { protected function setUp(): void { parent::setUp(); @@ -113,7 +113,7 @@ public static function storageDataProvider(): array { ]; } - #[\PHPUnit\Framework\Attributes\DataProvider('storageDataProvider')] + #[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'storageDataProvider')] public function testAddStorage($storageParams): void { $storage = $this->makeStorageConfig($storageParams); $newStorage = $this->service->addStorage($storage); @@ -135,7 +135,7 @@ public function testAddStorage($storageParams): void { $this->assertEquals($baseId + 1, $nextStorage->getId()); } - #[\PHPUnit\Framework\Attributes\DataProvider('storageDataProvider')] + #[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'storageDataProvider')] public function testUpdateStorage($updatedStorageParams): void { $updatedStorage = $this->makeStorageConfig($updatedStorageParams); $storage = $this->makeStorageConfig([ @@ -275,7 +275,7 @@ public static function hooksAddStorageDataProvider(): array { ]; } - #[\PHPUnit\Framework\Attributes\DataProvider('hooksAddStorageDataProvider')] + #[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'hooksAddStorageDataProvider')] public function testHooksAddStorage($applicableUsers, $applicableGroups, $expectedCalls): void { $storage = $this->makeTestStorageData(); $storage->setApplicableUsers($applicableUsers); @@ -411,7 +411,7 @@ public static function hooksUpdateStorageDataProvider(): array { ]; } - #[\PHPUnit\Framework\Attributes\DataProvider('hooksUpdateStorageDataProvider')] + #[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'hooksUpdateStorageDataProvider')] public function testHooksUpdateStorage( array $sourceApplicableUsers, array $sourceApplicableGroups, @@ -569,7 +569,7 @@ public static function hooksDeleteStorageDataProvider(): array { ]; } - #[\PHPUnit\Framework\Attributes\DataProvider('hooksDeleteStorageDataProvider')] + #[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'hooksDeleteStorageDataProvider')] public function testHooksDeleteStorage( array $sourceApplicableUsers, array $sourceApplicableGroups, diff --git a/apps/files_external/tests/Service/StoragesServiceTestCase.php b/apps/files_external/tests/Service/StoragesServiceTestCase.php index fdc086751af7d..bc538094544ea 100644 --- a/apps/files_external/tests/Service/StoragesServiceTestCase.php +++ b/apps/files_external/tests/Service/StoragesServiceTestCase.php @@ -53,7 +53,7 @@ public function clean() { } } -#[\PHPUnit\Framework\Attributes\Group('DB')] +#[\PHPUnit\Framework\Attributes\Group(name: 'DB')] abstract class StoragesServiceTestCase extends \Test\TestCase { protected StoragesService $service; protected BackendService&MockObject $backendService; @@ -251,7 +251,7 @@ public static function deleteStorageDataProvider(): array { ]; } - #[\PHPUnit\Framework\Attributes\DataProvider('deleteStorageDataProvider')] + #[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'deleteStorageDataProvider')] public function testDeleteStorage(array $backendOptions, string $rustyStorageId): void { $backend = $this->backendService->getBackend('identifier:\OCA\Files_External\Lib\Backend\DAV'); $authMechanism = $this->backendService->getAuthMechanism('identifier:\Auth\Mechanism'); @@ -384,11 +384,13 @@ public function testCreateStorageInvalidAuthMechanismClass(): void { } public function testGetStoragesBackendNotVisible(): void { + /** @var Backend&MockObject $backend */ $backend = $this->backendService->getBackend('identifier:\OCA\Files_External\Lib\Backend\SMB'); $backend->expects($this->once()) ->method('isVisibleFor') ->with($this->service->getVisibilityType()) ->willReturn(false); + /** @var AuthMechanism&MockObject $authMechanism */ $authMechanism = $this->backendService->getAuthMechanism('identifier:\Auth\Mechanism'); $authMechanism->method('isVisibleFor') ->with($this->service->getVisibilityType()) @@ -407,10 +409,12 @@ public function testGetStoragesBackendNotVisible(): void { } public function testGetStoragesAuthMechanismNotVisible(): void { + /** @var Backend&MockObject $backend */ $backend = $this->backendService->getBackend('identifier:\OCA\Files_External\Lib\Backend\SMB'); $backend->method('isVisibleFor') ->with($this->service->getVisibilityType()) ->willReturn(true); + /** @var AuthMechanism&MockObject $authMechanism */ $authMechanism = $this->backendService->getAuthMechanism('identifier:\Auth\Mechanism'); $authMechanism->expects($this->once()) ->method('isVisibleFor') diff --git a/apps/files_external/tests/Service/UserGlobalStoragesServiceTest.php b/apps/files_external/tests/Service/UserGlobalStoragesServiceTest.php index e38835f2077a1..2ca61d641a8ed 100644 --- a/apps/files_external/tests/Service/UserGlobalStoragesServiceTest.php +++ b/apps/files_external/tests/Service/UserGlobalStoragesServiceTest.php @@ -20,7 +20,7 @@ use PHPUnit\Framework\MockObject\MockObject; use Test\Traits\UserTrait; -#[\PHPUnit\Framework\Attributes\Group('DB')] +#[\PHPUnit\Framework\Attributes\Group(name: 'DB')] class UserGlobalStoragesServiceTest extends GlobalStoragesServiceTest { use UserTrait; @@ -97,7 +97,7 @@ public static function applicableStorageProvider(): array { ]; } - #[\PHPUnit\Framework\Attributes\DataProvider('applicableStorageProvider')] + #[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'applicableStorageProvider')] public function testGetStorageWithApplicable($applicableUsers, $applicableGroups, $isVisible): void { $backend = $this->backendService->getBackend('identifier:\OCA\Files_External\Lib\Backend\SMB'); $authMechanism = $this->backendService->getAuthMechanism('identifier:\Auth\Mechanism'); @@ -171,7 +171,7 @@ public function testNonExistingStorage(): void { $this->ActualNonExistingStorageTest(); } - #[\PHPUnit\Framework\Attributes\DataProvider('deleteStorageDataProvider')] + #[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'deleteStorageDataProvider')] public function testDeleteStorage($backendOptions, $rustyStorageId): void { $this->expectException(\DomainException::class); @@ -225,7 +225,7 @@ public static function getUniqueStoragesProvider(): array { ]; } - #[\PHPUnit\Framework\Attributes\DataProvider('getUniqueStoragesProvider')] + #[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'getUniqueStoragesProvider')] public function testGetUniqueStorages( $priority1, $applicableUsers1, $applicableGroups1, $priority2, $applicableUsers2, $applicableGroups2, diff --git a/apps/files_external/tests/Service/UserStoragesServiceTest.php b/apps/files_external/tests/Service/UserStoragesServiceTest.php index 99482a9cbbeb1..17b76957b9c51 100644 --- a/apps/files_external/tests/Service/UserStoragesServiceTest.php +++ b/apps/files_external/tests/Service/UserStoragesServiceTest.php @@ -22,7 +22,7 @@ use PHPUnit\Framework\MockObject\MockObject; use Test\Traits\UserTrait; -#[\PHPUnit\Framework\Attributes\Group('DB')] +#[\PHPUnit\Framework\Attributes\Group(name: 'DB')] class UserStoragesServiceTest extends StoragesServiceTestCase { use UserTrait; @@ -126,7 +126,7 @@ public function testUpdateStorage(): void { $this->assertEmpty(self::$hookCalls); } - #[\PHPUnit\Framework\Attributes\DataProvider('deleteStorageDataProvider')] + #[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'deleteStorageDataProvider')] public function testDeleteStorage($backendOptions, $rustyStorageId): void { parent::testDeleteStorage($backendOptions, $rustyStorageId); diff --git a/apps/files_external/tests/Storage/Amazons3MultiPartTest.php b/apps/files_external/tests/Storage/Amazons3MultiPartTest.php index 2ba180dbbcff3..9829ba81a0a17 100644 --- a/apps/files_external/tests/Storage/Amazons3MultiPartTest.php +++ b/apps/files_external/tests/Storage/Amazons3MultiPartTest.php @@ -15,8 +15,8 @@ * * @package OCA\Files_External\Tests\Storage */ -#[\PHPUnit\Framework\Attributes\Group('DB')] -#[\PHPUnit\Framework\Attributes\Group('S3')] +#[\PHPUnit\Framework\Attributes\Group(name: 'DB')] +#[\PHPUnit\Framework\Attributes\Group(name: 'S3')] class Amazons3MultiPartTest extends \Test\Files\Storage\Storage { use ConfigurableStorageTrait; /** @var AmazonS3 */ diff --git a/apps/files_external/tests/Storage/Amazons3Test.php b/apps/files_external/tests/Storage/Amazons3Test.php index 864d6be03a828..7f686f34ad960 100644 --- a/apps/files_external/tests/Storage/Amazons3Test.php +++ b/apps/files_external/tests/Storage/Amazons3Test.php @@ -16,7 +16,7 @@ * * @package OCA\Files_External\Tests\Storage */ -#[\PHPUnit\Framework\Attributes\Group('DB')] +#[\PHPUnit\Framework\Attributes\Group(name: 'DB')] #[\PHPUnit\Framework\Attributes\Group('S3')] class Amazons3Test extends \Test\Files\Storage\Storage { use ConfigurableStorageTrait; diff --git a/apps/files_external/tests/Storage/FtpTest.php b/apps/files_external/tests/Storage/FtpTest.php index 34a1393053a85..a16cd7f79a6e6 100644 --- a/apps/files_external/tests/Storage/FtpTest.php +++ b/apps/files_external/tests/Storage/FtpTest.php @@ -16,7 +16,7 @@ * * @package OCA\Files_External\Tests\Storage */ -#[\PHPUnit\Framework\Attributes\Group('DB')] +#[\PHPUnit\Framework\Attributes\Group(name: 'DB')] class FtpTest extends \Test\Files\Storage\Storage { use ConfigurableStorageTrait; diff --git a/apps/files_external/tests/Storage/OwncloudTest.php b/apps/files_external/tests/Storage/OwncloudTest.php index 0ab66713454c2..e6f36033edcb1 100644 --- a/apps/files_external/tests/Storage/OwncloudTest.php +++ b/apps/files_external/tests/Storage/OwncloudTest.php @@ -16,7 +16,7 @@ * * @package OCA\Files_External\Tests\Storage */ -#[\PHPUnit\Framework\Attributes\Group('DB')] +#[\PHPUnit\Framework\Attributes\Group(name: 'DB')] class OwncloudTest extends \Test\Files\Storage\Storage { use ConfigurableStorageTrait; diff --git a/apps/files_external/tests/Storage/SFTP_KeyTest.php b/apps/files_external/tests/Storage/SFTP_KeyTest.php index 57ffea340fad4..71d577df2f905 100644 --- a/apps/files_external/tests/Storage/SFTP_KeyTest.php +++ b/apps/files_external/tests/Storage/SFTP_KeyTest.php @@ -16,7 +16,7 @@ * * @package OCA\Files_External\Tests\Storage */ -#[\PHPUnit\Framework\Attributes\Group('DB')] +#[\PHPUnit\Framework\Attributes\Group(name: 'DB')] class SFTP_KeyTest extends \Test\Files\Storage\Storage { use ConfigurableStorageTrait; diff --git a/apps/files_external/tests/Storage/SftpTest.php b/apps/files_external/tests/Storage/SftpTest.php index 2842618965539..21c66ad06fe31 100644 --- a/apps/files_external/tests/Storage/SftpTest.php +++ b/apps/files_external/tests/Storage/SftpTest.php @@ -16,7 +16,7 @@ * * @package OCA\Files_External\Tests\Storage */ -#[\PHPUnit\Framework\Attributes\Group('DB')] +#[\PHPUnit\Framework\Attributes\Group(name: 'DB')] class SftpTest extends \Test\Files\Storage\Storage { use ConfigurableStorageTrait; /** @@ -42,7 +42,7 @@ protected function tearDown(): void { parent::tearDown(); } - #[\PHPUnit\Framework\Attributes\DataProvider('configProvider')] + #[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'configProvider')] public function testStorageId($config, $expectedStorageId): void { $instance = new SFTP($config); $this->assertEquals($expectedStorageId, $instance->getId()); diff --git a/apps/files_external/tests/Storage/SmbTest.php b/apps/files_external/tests/Storage/SmbTest.php index dae402a150912..6eda927c9fb57 100644 --- a/apps/files_external/tests/Storage/SmbTest.php +++ b/apps/files_external/tests/Storage/SmbTest.php @@ -20,7 +20,7 @@ * * @package OCA\Files_External\Tests\Storage */ -#[\PHPUnit\Framework\Attributes\Group('DB')] +#[\PHPUnit\Framework\Attributes\Group(name: 'DB')] class SmbTest extends \Test\Files\Storage\Storage { use ConfigurableStorageTrait; /** diff --git a/apps/files_external/tests/Storage/SwiftTest.php b/apps/files_external/tests/Storage/SwiftTest.php index 5f8ef462dc25d..5381a894b2a95 100644 --- a/apps/files_external/tests/Storage/SwiftTest.php +++ b/apps/files_external/tests/Storage/SwiftTest.php @@ -17,7 +17,7 @@ * * @package OCA\Files_External\Tests\Storage */ -#[\PHPUnit\Framework\Attributes\Group('DB')] +#[\PHPUnit\Framework\Attributes\Group(name: 'DB')] class SwiftTest extends \Test\Files\Storage\Storage { use ConfigurableStorageTrait; diff --git a/apps/files_external/tests/Storage/VersionedAmazonS3Test.php b/apps/files_external/tests/Storage/VersionedAmazonS3Test.php index 4a195e2ea5b64..33d6126a7fd1c 100644 --- a/apps/files_external/tests/Storage/VersionedAmazonS3Test.php +++ b/apps/files_external/tests/Storage/VersionedAmazonS3Test.php @@ -8,7 +8,7 @@ namespace OCA\Files_External\Tests\Storage; -#[\PHPUnit\Framework\Attributes\Group('DB')] +#[\PHPUnit\Framework\Attributes\Group(name: 'DB')] #[\PHPUnit\Framework\Attributes\Group('S3')] class VersionedAmazonS3Test extends Amazons3Test { protected function setUp(): void { diff --git a/apps/files_external/tests/Storage/WebdavTest.php b/apps/files_external/tests/Storage/WebdavTest.php index e7abe92afab45..56202b81d4220 100644 --- a/apps/files_external/tests/Storage/WebdavTest.php +++ b/apps/files_external/tests/Storage/WebdavTest.php @@ -19,7 +19,7 @@ * * @package OCA\Files_External\Tests\Storage */ -#[\PHPUnit\Framework\Attributes\Group('DB')] +#[\PHPUnit\Framework\Attributes\Group(name: 'DB')] class WebdavTest extends \Test\Files\Storage\Storage { use ConfigurableStorageTrait; diff --git a/apps/files_sharing/tests/ApiTest.php b/apps/files_sharing/tests/ApiTest.php index 4a4d04be5c44f..0eb8a5816058f 100644 --- a/apps/files_sharing/tests/ApiTest.php +++ b/apps/files_sharing/tests/ApiTest.php @@ -48,7 +48,7 @@ * Class ApiTest */ #[\PHPUnit\Framework\Attributes\Medium] -#[\PHPUnit\Framework\Attributes\Group('DB')] +#[\PHPUnit\Framework\Attributes\Group(name: 'DB')] class ApiTest extends TestCase { use EmailValidatorTrait; @@ -216,7 +216,7 @@ public function testCreateShareGroupFolder(): void { $ocs->cleanup(); } - #[\PHPUnit\Framework\Attributes\Group('RoutingWeirdness')] + #[\PHPUnit\Framework\Attributes\Group(name: 'RoutingWeirdness')] public function testCreateShareLink(): void { $ocs = $this->createOCS(self::TEST_FILES_SHARING_API_USER1); $result = $ocs->createShare($this->folder, Constants::PERMISSION_ALL, IShare::TYPE_LINK); @@ -239,8 +239,8 @@ public function testCreateShareLink(): void { $ocs->cleanup(); } - #[\PHPUnit\Framework\Attributes\DataProvider('dataAllowFederationOnPublicShares')] - #[\PHPUnit\Framework\Attributes\Group('RoutingWeirdness')] + #[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'dataAllowFederationOnPublicShares')] + #[\PHPUnit\Framework\Attributes\Group(name: 'RoutingWeirdness')] public function testCreateShareLinkPublicUpload(array $appConfig, int $permissions): void { $this->appConfig->method('getValueBool') ->willReturnMap([$appConfig]); @@ -472,8 +472,8 @@ public function testPublicLinkUrl(): void { $ocs->cleanup(); } - #[\PHPUnit\Framework\Attributes\Depends('testCreateShareUserFile')] - #[\PHPUnit\Framework\Attributes\Depends('testCreateShareLink')] + #[\PHPUnit\Framework\Attributes\Depends(methodName: 'testCreateShareUserFile')] + #[\PHPUnit\Framework\Attributes\Depends(methodName: 'testCreateShareLink')] public function testGetShareFromSource(): void { $node = $this->userFolder->get($this->filename); $share = $this->shareManager->newShare(); @@ -502,8 +502,8 @@ public function testGetShareFromSource(): void { $this->shareManager->deleteShare($share2); } - #[\PHPUnit\Framework\Attributes\Depends('testCreateShareUserFile')] - #[\PHPUnit\Framework\Attributes\Depends('testCreateShareLink')] + #[\PHPUnit\Framework\Attributes\Depends(methodName: 'testCreateShareUserFile')] + #[\PHPUnit\Framework\Attributes\Depends(methodName: 'testCreateShareLink')] public function testGetShareFromSourceWithReshares(): void { $node = $this->userFolder->get($this->filename); $share1 = $this->shareManager->newShare(); @@ -541,7 +541,7 @@ public function testGetShareFromSourceWithReshares(): void { $this->shareManager->deleteShare($share2); } - #[\PHPUnit\Framework\Attributes\Depends('testCreateShareUserFile')] + #[\PHPUnit\Framework\Attributes\Depends(methodName: 'testCreateShareUserFile')] public function testGetShareFromId(): void { $node = $this->userFolder->get($this->filename); $share1 = $this->shareManager->newShare(); @@ -920,8 +920,8 @@ public function testGetShareFromUnknownId(): void { $ocs->cleanup(); } - #[\PHPUnit\Framework\Attributes\Depends('testCreateShareUserFile')] - #[\PHPUnit\Framework\Attributes\Depends('testCreateShareLink')] + #[\PHPUnit\Framework\Attributes\Depends(methodName: 'testCreateShareUserFile')] + #[\PHPUnit\Framework\Attributes\Depends(methodName: 'testCreateShareLink')] public function testUpdateShare(): void { $password = md5(time()); @@ -979,7 +979,7 @@ public function testUpdateShare(): void { $this->shareManager->deleteShare($share2); } - #[\PHPUnit\Framework\Attributes\DataProvider('dataAllowFederationOnPublicShares')] + #[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'dataAllowFederationOnPublicShares')] public function testUpdateShareUpload(array $appConfig, int $permissions): void { $this->appConfig->method('getValueBool')->willReturnMap([ $appConfig, @@ -1275,7 +1275,7 @@ public static function datesProvider() { /** * Make sure only ISO 8601 dates are accepted */ - #[\PHPUnit\Framework\Attributes\DataProvider('datesProvider')] + #[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'datesProvider')] #[\PHPUnit\Framework\Attributes\Group('RoutingWeirdness')] public function testPublicLinkExpireDate($date, $valid): void { $ocs = $this->createOCS(self::TEST_FILES_SHARING_API_USER1); diff --git a/apps/files_sharing/tests/ApplicationTest.php b/apps/files_sharing/tests/ApplicationTest.php index 0be9fd9d50d70..a6ff620722a5d 100644 --- a/apps/files_sharing/tests/ApplicationTest.php +++ b/apps/files_sharing/tests/ApplicationTest.php @@ -56,7 +56,7 @@ public static function providesDataForCanGet(): array { ]; } - #[DataProvider('providesDataForCanGet')] + #[DataProvider(methodName: 'providesDataForCanGet')] public function testCheckDirectCanBeDownloaded( string $path, string $storageClass, @@ -115,7 +115,7 @@ public static function providesDataForCanZip(): array { ]; } - #[DataProvider('providesDataForCanZip')] + #[DataProvider(methodName: 'providesDataForCanZip')] public function testCheckZipCanBeDownloaded( string $dir, array $files, diff --git a/apps/files_sharing/tests/CacheTest.php b/apps/files_sharing/tests/CacheTest.php index d451a9c20619e..db6a67e952f8f 100644 --- a/apps/files_sharing/tests/CacheTest.php +++ b/apps/files_sharing/tests/CacheTest.php @@ -16,6 +16,7 @@ use OCA\Files_Sharing\SharedStorage; use OCP\Constants; use OCP\Files\Cache\IWatcher; +use OCP\Files\Node; use OCP\IUserManager; use OCP\Server; use OCP\Share\IShare; @@ -23,7 +24,7 @@ /** * Class CacheTest */ -#[\PHPUnit\Framework\Attributes\Group('DB')] +#[\PHPUnit\Framework\Attributes\Group(name: 'DB')] class CacheTest extends TestCase { /** @@ -319,9 +320,7 @@ public function testShareRenameOriginalFileInRecentResults(): void { self::assertEquals([ 'welcome.txt', 'simplefile.txt' - ], array_map(function ($node) { - return $node->getFileInfo()['name']; - }, $recents)); + ], array_map(static fn (Node $node): string => $node->getName(), $recents)); } public function testGetFolderContentsWhenSubSubdirShared(): void { diff --git a/apps/files_sharing/tests/CapabilitiesTest.php b/apps/files_sharing/tests/CapabilitiesTest.php index adc1909cf7c5d..252459eaaae75 100644 --- a/apps/files_sharing/tests/CapabilitiesTest.php +++ b/apps/files_sharing/tests/CapabilitiesTest.php @@ -30,17 +30,16 @@ /** * Class CapabilitiesTest */ -#[\PHPUnit\Framework\Attributes\Group('DB')] +#[\PHPUnit\Framework\Attributes\Group(name: 'DB')] class CapabilitiesTest extends \Test\TestCase { /** * Test for the general part in each return statement and assert. * Strip of the general part on the way. * - * @param string[] $data Capabilities - * @return string[] + * @param array $data Capabilities */ - private function getFilesSharingPart(array $data) { + private function getFilesSharingPart(array $data): array { $this->assertArrayHasKey('files_sharing', $data); return $data['files_sharing']; } @@ -51,9 +50,8 @@ private function getFilesSharingPart(array $data) { * levels in the array * * @param (string[])[] $map Map of arguments to return types for the getAppValue function in the mock - * @return string[] */ - private function getResults(array $map, array $typedMap = [], bool $federationEnabled = true) { + private function getResults(array $map, array $typedMap = [], bool $federationEnabled = true): array { $config = $this->getMockBuilder(IConfig::class)->disableOriginalConstructor()->getMock(); $appManager = $this->getMockBuilder(IAppManager::class)->disableOriginalConstructor()->getMock(); $config->method('getAppValue')->willReturnMap($map); @@ -97,8 +95,7 @@ private function getResults(array $map, array $typedMap = [], bool $federationEn ); $cap = new Capabilities($config, $appConfig, $shareManager, $appManager); - $result = $this->getFilesSharingPart($cap->getCapabilities()); - return $result; + return $this->getFilesSharingPart($cap->getCapabilities()); } public function testEnabledSharingAPI(): void { diff --git a/apps/files_sharing/tests/Collaboration/ShareRecipientSorterTest.php b/apps/files_sharing/tests/Collaboration/ShareRecipientSorterTest.php index 572463a9ebc4a..2a2e1c2909667 100644 --- a/apps/files_sharing/tests/Collaboration/ShareRecipientSorterTest.php +++ b/apps/files_sharing/tests/Collaboration/ShareRecipientSorterTest.php @@ -38,7 +38,7 @@ protected function setUp(): void { /** * @param $data */ - #[\PHPUnit\Framework\Attributes\DataProvider('sortDataProvider')] + #[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'sortDataProvider')] public function testSort($data): void { $node = $this->createMock(Node::class); diff --git a/apps/files_sharing/tests/Command/CleanupRemoteStoragesTest.php b/apps/files_sharing/tests/Command/CleanupRemoteStoragesTest.php index e0a18245538ca..3650b812a3c05 100644 --- a/apps/files_sharing/tests/Command/CleanupRemoteStoragesTest.php +++ b/apps/files_sharing/tests/Command/CleanupRemoteStoragesTest.php @@ -20,7 +20,7 @@ use Symfony\Component\Console\Output\OutputInterface; use Test\TestCase; -#[Group('DB')] +#[Group(name: 'DB')] class CleanupRemoteStoragesTest extends TestCase { protected IDBConnection $connection; diff --git a/apps/files_sharing/tests/Controller/ExternalShareControllerTest.php b/apps/files_sharing/tests/Controller/ExternalShareControllerTest.php index 74978984fd5f1..620b770511eeb 100644 --- a/apps/files_sharing/tests/Controller/ExternalShareControllerTest.php +++ b/apps/files_sharing/tests/Controller/ExternalShareControllerTest.php @@ -21,7 +21,7 @@ */ class ExternalShareControllerTest extends \Test\TestCase { private IRequest&MockObject $request; - private Manager $externalManager; + private Manager&MockObject $externalManager; protected function setUp(): void { parent::setUp(); @@ -29,10 +29,7 @@ protected function setUp(): void { $this->externalManager = $this->createMock(Manager::class); } - /** - * @return ExternalSharesController - */ - public function getExternalShareController() { + public function getExternalShareController(): ExternalSharesController { return new ExternalSharesController( 'files_sharing', $this->request, diff --git a/apps/files_sharing/tests/Controller/PublicPreviewControllerTest.php b/apps/files_sharing/tests/Controller/PublicPreviewControllerTest.php index f49d839e8d47b..94ecd0bc23e43 100644 --- a/apps/files_sharing/tests/Controller/PublicPreviewControllerTest.php +++ b/apps/files_sharing/tests/Controller/PublicPreviewControllerTest.php @@ -59,7 +59,7 @@ protected function setUp(): void { } public function testInvalidToken(): void { - $res = $this->controller->getPreview('', 'file', 10, 10, ''); + $res = $this->controller->getPreview('', 'file', 10, 10); $expected = new DataResponse([], Http::STATUS_BAD_REQUEST); $this->assertEquals($expected, $res); diff --git a/apps/files_sharing/tests/Controller/ShareAPIControllerTest.php b/apps/files_sharing/tests/Controller/ShareAPIControllerTest.php index 6f79420b11338..662ff8452d098 100644 --- a/apps/files_sharing/tests/Controller/ShareAPIControllerTest.php +++ b/apps/files_sharing/tests/Controller/ShareAPIControllerTest.php @@ -64,7 +64,7 @@ * * @package OCA\Files_Sharing\Tests\Controller */ -#[\PHPUnit\Framework\Attributes\Group('DB')] +#[\PHPUnit\Framework\Attributes\Group(name: 'DB')] class ShareAPIControllerTest extends TestCase { use EmailValidatorTrait; @@ -838,7 +838,7 @@ public static function dataGetShare(): array { return $data; } - #[DataProvider('dataGetShare')] + #[DataProvider(methodName: 'dataGetShare')] public function testGetShare(array $shareParams, array $result, bool $attributes): void { $cache = $this->createMock(ICache::class); @@ -1529,7 +1529,7 @@ private function mockSimpleNode(string $class, array $methods): MockObject { return $node; } - #[DataProvider('dataGetShares')] + #[DataProvider(methodName: 'dataGetShares')] public function testGetShares(array $getSharesParameters, array $shares, array $extraShareTypes, array $expected): void { $shares = array_map( fn ($sharesByType) => array_map( @@ -1706,7 +1706,7 @@ public function testCannotAccessLinkShare(): void { $this->assertFalse($this->invokePrivate($this->ocs, 'canAccessShare', [$share])); } - #[DataProvider('dataCanAccessShareWithPermissions')] + #[DataProvider(methodName: 'dataCanAccessShareWithPermissions')] public function testCanAccessShareWithPermissions(int $permissions, bool $expected): void { $share = $this->createMock(IShare::class); $share->method('getShareType')->willReturn(IShare::TYPE_USER); @@ -1744,7 +1744,7 @@ public static function dataCanAccessShareWithPermissions(): array { ]; } - #[DataProvider('dataCanAccessShareAsGroupMember')] + #[DataProvider(methodName: 'dataCanAccessShareAsGroupMember')] public function testCanAccessShareAsGroupMember(string $group, bool $expected): void { $share = $this->createMock(IShare::class); $share->method('getShareType')->willReturn(IShare::TYPE_GROUP); @@ -1804,7 +1804,7 @@ public static function dataCanAccessRoomShare(): array { ]; } - #[DataProvider('dataCanAccessRoomShare')] + #[DataProvider(methodName: 'dataCanAccessRoomShare')] public function testCanAccessRoomShare( bool $expected, bool $helperAvailable, @@ -3061,7 +3061,7 @@ public function testUpdateLinkShareSet(): void { $this->assertEquals($expected->getData(), $result->getData()); } - #[DataProvider('publicUploadParamsProvider')] + #[DataProvider(methodName: 'publicUploadParamsProvider')] public function testUpdateLinkShareEnablePublicUpload($permissions, $publicUpload, $expireDate, $password): void { $ocs = $this->mockFormatShare(); @@ -3120,7 +3120,7 @@ public static function publicLinkValidPermissionsProvider() { ]; } - #[DataProvider('publicLinkValidPermissionsProvider')] + #[DataProvider(methodName: 'publicLinkValidPermissionsProvider')] public function testUpdateLinkShareSetCRUDPermissions($permissions): void { $ocs = $this->mockFormatShare(); @@ -3173,7 +3173,7 @@ public static function publicLinkInvalidPermissionsProvider1() { ]; } - #[DataProvider('publicLinkInvalidPermissionsProvider1')] + #[DataProvider(methodName: 'publicLinkInvalidPermissionsProvider1')] public function testUpdateLinkShareSetInvalidCRUDPermissions1($permissions): void { $this->expectException(OCSBadRequestException::class); $this->expectExceptionMessage('Share must at least have READ or CREATE permissions'); @@ -3188,7 +3188,7 @@ public static function publicLinkInvalidPermissionsProvider2() { ]; } - #[DataProvider('publicLinkInvalidPermissionsProvider2')] + #[DataProvider(methodName: 'publicLinkInvalidPermissionsProvider2')] public function testUpdateLinkShareSetInvalidCRUDPermissions2($permissions): void { $this->expectException(OCSBadRequestException::class); $this->expectExceptionMessage('Share must have READ permission if UPDATE or DELETE permission is set'); @@ -3240,7 +3240,7 @@ public static function publicUploadParamsProvider() { ]; } - #[DataProvider('publicUploadParamsProvider')] + #[DataProvider(methodName: 'publicUploadParamsProvider')] public function testUpdateLinkSharePublicUploadNotAllowed($permissions, $publicUpload, $expireDate, $password): void { $this->expectException(OCSForbiddenException::class); $this->expectExceptionMessage('Public upload disabled by the administrator'); @@ -4898,7 +4898,7 @@ public static function dataFormatShare(): array { return $result; } - #[DataProvider('dataFormatShare')] + #[DataProvider(methodName: 'dataFormatShare')] public function testFormatShare( array $expects, array $shareParams, @@ -5155,7 +5155,7 @@ public static function dataFormatRoomShare(): array { * @param bool $helperAvailable * @param array $formatShareByHelper */ - #[DataProvider('dataFormatRoomShare')] + #[DataProvider(methodName: 'dataFormatRoomShare')] public function testFormatRoomShare(array $expects, bool $helperAvailable, array $formatShareByHelper): void { $file = $this->createMock(File::class); @@ -5309,7 +5309,7 @@ public static function trustedServerProvider(): array { ]; } - #[DataProvider('trustedServerProvider')] + #[DataProvider(methodName: 'trustedServerProvider')] public function testFormatShareWithFederatedShare(bool $isKnownServer, bool $isTrusted): void { $nodeId = 12; $nodePath = '/test.txt'; diff --git a/apps/files_sharing/tests/Controller/ShareControllerTest.php b/apps/files_sharing/tests/Controller/ShareControllerTest.php index a8381e70fd7ab..a81fa6aedfe44 100644 --- a/apps/files_sharing/tests/Controller/ShareControllerTest.php +++ b/apps/files_sharing/tests/Controller/ShareControllerTest.php @@ -52,7 +52,7 @@ /** * @package OCA\Files_Sharing\Controllers */ -#[\PHPUnit\Framework\Attributes\Group('DB')] +#[\PHPUnit\Framework\Attributes\Group(name: 'DB')] class ShareControllerTest extends \Test\TestCase { private string $user; @@ -245,7 +245,7 @@ public function testShowShare(): void { /** @var Manager */ $manager = Server::get(Manager::class); $share = $manager->newShare(); - $share->setId(42) + $share->setId('42') ->setPermissions(Constants::PERMISSION_READ | Constants::PERMISSION_UPDATE) ->setPassword('password') ->setShareOwner('ownerUID') @@ -401,7 +401,7 @@ public function testShowFileDropShare(): void { /** @var Manager */ $manager = Server::get(Manager::class); $share = $manager->newShare(); - $share->setId(42) + $share->setId('42') ->setPermissions(Constants::PERMISSION_CREATE) ->setPassword('password') ->setShareOwner('ownerUID') @@ -549,7 +549,7 @@ public function testShowShareWithPrivateName(): void { /** @var IShare */ $share = Server::get(Manager::class)->newShare(); - $share->setId(42); + $share->setId('42'); $share->setPassword('password') ->setShareOwner('ownerUID') ->setSharedBy('initiatorUID') @@ -656,7 +656,7 @@ public function testShowShareInvalid(): void { $owner->method('getDisplayName')->willReturn('ownerDisplay'); $owner->method('getUID')->willReturn('ownerUID'); - $file = $this->getMockBuilder('OCP\Files\File')->getMock(); + $file = $this->getMockBuilder(File::class)->getMock(); $file->method('getName')->willReturn($filename); $file->method('getMimetype')->willReturn('text/plain'); $file->method('getSize')->willReturn(33); @@ -664,7 +664,7 @@ public function testShowShareInvalid(): void { $file->method('isReadable')->willReturn(true); $share = Server::get(\OCP\Share\IManager::class)->newShare(); - $share->setId(42); + $share->setId('42'); $share->setPassword('password') ->setShareOwner('ownerUID') ->setNode($file) @@ -757,7 +757,7 @@ public function testDisabledOwner(): void { $folder = $this->createMock(Folder::class); $share = Server::get(\OCP\Share\IManager::class)->newShare(); - $share->setId(42); + $share->setId('42'); $share->setPermissions(Constants::PERMISSION_CREATE) ->setShareOwner('ownerUID') ->setSharedBy('initiatorUID') @@ -798,7 +798,7 @@ public function testDisabledInitiator(): void { $folder = $this->createMock(Folder::class); $share = Server::get(\OCP\Share\IManager::class)->newShare(); - $share->setId(42); + $share->setId('42'); $share->setPermissions(Constants::PERMISSION_CREATE) ->setShareOwner('ownerUID') ->setSharedBy('initiatorUID') diff --git a/apps/files_sharing/tests/Controller/ShareesAPIControllerTest.php b/apps/files_sharing/tests/Controller/ShareesAPIControllerTest.php index dcf0fcb962fd4..889ae3fb86ebb 100644 --- a/apps/files_sharing/tests/Controller/ShareesAPIControllerTest.php +++ b/apps/files_sharing/tests/Controller/ShareesAPIControllerTest.php @@ -26,7 +26,7 @@ * * @package OCA\Files_Sharing\Tests\API */ -#[\PHPUnit\Framework\Attributes\Group('DB')] +#[\PHPUnit\Framework\Attributes\Group(name: 'DB')] class ShareesAPIControllerTest extends TestCase { /** @var ShareesAPIController */ protected $sharees; @@ -211,7 +211,7 @@ public static function dataSearch(): array { * @param bool $allowGroupSharing * @throws OCSBadRequestException */ - #[\PHPUnit\Framework\Attributes\DataProvider('dataSearch')] + #[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'dataSearch')] public function testSearch( array $getData, string $apiSetting, @@ -333,7 +333,7 @@ public static function dataSearchInvalid(): array { * @param array $getData * @param string $message */ - #[\PHPUnit\Framework\Attributes\DataProvider('dataSearchInvalid')] + #[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'dataSearchInvalid')] public function testSearchInvalid($getData, $message): void { $page = $getData['page'] ?? 1; $perPage = $getData['perPage'] ?? 200; @@ -391,7 +391,7 @@ public static function dataIsRemoteSharingAllowed() { * @param string $itemType * @param bool $expected */ - #[\PHPUnit\Framework\Attributes\DataProvider('dataIsRemoteSharingAllowed')] + #[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'dataIsRemoteSharingAllowed')] public function testIsRemoteSharingAllowed($itemType, $expected): void { $this->assertSame($expected, $this->invokePrivate($this->sharees, 'isRemoteSharingAllowed', [$itemType])); } @@ -434,7 +434,7 @@ public static function dataGetPaginationLink() { * @param array $params * @param array $expected */ - #[\PHPUnit\Framework\Attributes\DataProvider('dataGetPaginationLink')] + #[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'dataGetPaginationLink')] public function testGetPaginationLink($page, $scriptName, $params, $expected): void { $this->request->expects($this->once()) ->method('getScriptName') @@ -455,7 +455,7 @@ public static function dataIsV2() { * @param string $scriptName * @param bool $expected */ - #[\PHPUnit\Framework\Attributes\DataProvider('dataIsV2')] + #[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'dataIsV2')] public function testIsV2($scriptName, $expected): void { $this->request->expects($this->once()) ->method('getScriptName') diff --git a/apps/files_sharing/tests/DeleteOrphanedSharesJobTest.php b/apps/files_sharing/tests/DeleteOrphanedSharesJobTest.php index 9e01f5cd4ad90..bc67141f88d8e 100644 --- a/apps/files_sharing/tests/DeleteOrphanedSharesJobTest.php +++ b/apps/files_sharing/tests/DeleteOrphanedSharesJobTest.php @@ -23,7 +23,7 @@ * * @package OCA\Files_Sharing\Tests */ -#[\PHPUnit\Framework\Attributes\Group('DB')] +#[\PHPUnit\Framework\Attributes\Group(name: 'DB')] class DeleteOrphanedSharesJobTest extends \Test\TestCase { /** * @var bool diff --git a/apps/files_sharing/tests/EncryptedSizePropagationTest.php b/apps/files_sharing/tests/EncryptedSizePropagationTest.php index 284fe61721219..92773bdc72d78 100644 --- a/apps/files_sharing/tests/EncryptedSizePropagationTest.php +++ b/apps/files_sharing/tests/EncryptedSizePropagationTest.php @@ -12,7 +12,7 @@ use OCP\Server; use Test\Traits\EncryptionTrait; -#[\PHPUnit\Framework\Attributes\Group('DB')] +#[\PHPUnit\Framework\Attributes\Group(name: 'DB')] class EncryptedSizePropagationTest extends SizePropagationTest { use EncryptionTrait; diff --git a/apps/files_sharing/tests/EtagPropagationTest.php b/apps/files_sharing/tests/EtagPropagationTest.php index 11350082ca0f2..597e584fa2f9d 100644 --- a/apps/files_sharing/tests/EtagPropagationTest.php +++ b/apps/files_sharing/tests/EtagPropagationTest.php @@ -20,7 +20,7 @@ * * @package OCA\Files_Sharing\Tests */ -#[\PHPUnit\Framework\Attributes\Group('SLOWDB')] +#[\PHPUnit\Framework\Attributes\Group(name: 'SLOWDB')] class EtagPropagationTest extends PropagationTestCase { /** diff --git a/apps/files_sharing/tests/ExpireSharesJobTest.php b/apps/files_sharing/tests/ExpireSharesJobTest.php index adb6f6d2b814a..50c490a7cea60 100644 --- a/apps/files_sharing/tests/ExpireSharesJobTest.php +++ b/apps/files_sharing/tests/ExpireSharesJobTest.php @@ -26,7 +26,7 @@ * * @package OCA\Files_Sharing\Tests */ -#[\PHPUnit\Framework\Attributes\Group('DB')] +#[\PHPUnit\Framework\Attributes\Group(name: 'DB')] class ExpireSharesJobTest extends \Test\TestCase { private ExpireSharesJob $job; @@ -107,7 +107,7 @@ public static function dataExpireLinkShare() { * @param bool $addInterval If true add to the current time if false subtract * @param bool $shouldExpire Should this share be expired */ - #[DataProvider('dataExpireLinkShare')] + #[DataProvider(methodName: 'dataExpireLinkShare')] public function testExpireLinkShare(bool $addExpiration, string $interval, bool $addInterval, bool $shouldExpire): void { $this->loginAsUser($this->user1->getUID()); diff --git a/apps/files_sharing/tests/External/CacheTest.php b/apps/files_sharing/tests/External/CacheTest.php index 7af8af4fb5fa5..38aff2573578e 100644 --- a/apps/files_sharing/tests/External/CacheTest.php +++ b/apps/files_sharing/tests/External/CacheTest.php @@ -26,7 +26,7 @@ * * @package OCA\Files_Sharing\Tests\External */ -#[\PHPUnit\Framework\Attributes\Group('DB')] +#[\PHPUnit\Framework\Attributes\Group(name: 'DB')] class CacheTest extends TestCase { protected IManager&MockObject $contactsManager; private Storage&MockObject $storage; diff --git a/apps/files_sharing/tests/External/ManagerTest.php b/apps/files_sharing/tests/External/ManagerTest.php index 4cdc9cf1cbdee..e9e89de25fe81 100644 --- a/apps/files_sharing/tests/External/ManagerTest.php +++ b/apps/files_sharing/tests/External/ManagerTest.php @@ -50,7 +50,7 @@ * * @package OCA\Files_Sharing\Tests\External */ -#[\PHPUnit\Framework\Attributes\Group('DB')] +#[\PHPUnit\Framework\Attributes\Group(name: 'DB')] class ManagerTest extends TestCase { use UserTrait; diff --git a/apps/files_sharing/tests/External/ScannerTest.php b/apps/files_sharing/tests/External/ScannerTest.php index e7d1375539477..89e3d1a48b31c 100644 --- a/apps/files_sharing/tests/External/ScannerTest.php +++ b/apps/files_sharing/tests/External/ScannerTest.php @@ -12,7 +12,7 @@ use OCA\Files_Sharing\External\Storage; use Test\TestCase; -#[\PHPUnit\Framework\Attributes\Group('DB')] +#[\PHPUnit\Framework\Attributes\Group(name: 'DB')] class ScannerTest extends TestCase { protected Scanner $scanner; /** @var Storage|\PHPUnit\Framework\MockObject\MockObject */ diff --git a/apps/files_sharing/tests/ExternalStorageTest.php b/apps/files_sharing/tests/ExternalStorageTest.php index 84013e3cb2126..d63ce008435b5 100644 --- a/apps/files_sharing/tests/ExternalStorageTest.php +++ b/apps/files_sharing/tests/ExternalStorageTest.php @@ -17,7 +17,7 @@ /** * Tests for the external Storage class for remote shares. */ -#[\PHPUnit\Framework\Attributes\Group('DB')] +#[\PHPUnit\Framework\Attributes\Group(name: 'DB')] class ExternalStorageTest extends \Test\TestCase { public static function optionsProvider() { return [ @@ -87,7 +87,7 @@ private function getTestStorage($uri) { ); } - #[\PHPUnit\Framework\Attributes\DataProvider('optionsProvider')] + #[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'optionsProvider')] public function testStorageMountOptions($inputUri, $baseUri): void { $storage = $this->getTestStorage($inputUri); $this->assertEquals($baseUri, $storage->getBaseUri()); diff --git a/apps/files_sharing/tests/GroupEtagPropagationTest.php b/apps/files_sharing/tests/GroupEtagPropagationTest.php index 2a499ac8a4f2c..9cabc52e14b84 100644 --- a/apps/files_sharing/tests/GroupEtagPropagationTest.php +++ b/apps/files_sharing/tests/GroupEtagPropagationTest.php @@ -15,7 +15,7 @@ /** * @package OCA\Files_Sharing\Tests */ -#[\PHPUnit\Framework\Attributes\Group('SLOWDB')] +#[\PHPUnit\Framework\Attributes\Group(name: 'SLOWDB')] class GroupEtagPropagationTest extends PropagationTestCase { /** * "user1" creates /test, /test/sub and shares with group1 diff --git a/apps/files_sharing/tests/HelperTest.php b/apps/files_sharing/tests/HelperTest.php index 6df3d07bbf470..b84f85f244bd9 100644 --- a/apps/files_sharing/tests/HelperTest.php +++ b/apps/files_sharing/tests/HelperTest.php @@ -15,7 +15,7 @@ /** * Class HelperTest */ -#[\PHPUnit\Framework\Attributes\Group('DB')] +#[\PHPUnit\Framework\Attributes\Group(name: 'DB')] class HelperTest extends TestCase { /** diff --git a/apps/files_sharing/tests/LockingTest.php b/apps/files_sharing/tests/LockingTest.php index f691d2ddfaeb9..0377812679b9d 100644 --- a/apps/files_sharing/tests/LockingTest.php +++ b/apps/files_sharing/tests/LockingTest.php @@ -22,7 +22,7 @@ * * @package OCA\Files_Sharing\Tests */ -#[\PHPUnit\Framework\Attributes\Group('DB')] +#[\PHPUnit\Framework\Attributes\Group(name: 'DB')] class LockingTest extends TestCase { /** * @var \Test\Util\User\Dummy diff --git a/apps/files_sharing/tests/Middleware/OCSShareAPIMiddlewareTest.php b/apps/files_sharing/tests/Middleware/OCSShareAPIMiddlewareTest.php index b36fb9c7bf698..a2b0f06f13203 100644 --- a/apps/files_sharing/tests/Middleware/OCSShareAPIMiddlewareTest.php +++ b/apps/files_sharing/tests/Middleware/OCSShareAPIMiddlewareTest.php @@ -72,7 +72,7 @@ public static function dataBeforeController() { ]; } - #[DataProvider('dataBeforeController')] + #[DataProvider(methodName: 'dataBeforeController')] public function testBeforeController(string $controllerClass, bool $enabled, bool $exception): void { $controller = $this->createMock($controllerClass); $this->shareManager->method('shareApiEnabled')->willReturn($enabled); @@ -99,7 +99,7 @@ public static function dataAfterController(): array { ]; } - #[DataProvider('dataAfterController')] + #[DataProvider(methodName: 'dataAfterController')] public function testAfterController(string $controllerClass): void { $controller = $this->createMock($controllerClass); if ($controller instanceof ShareAPIController) { diff --git a/apps/files_sharing/tests/Middleware/SharingCheckMiddlewareTest.php b/apps/files_sharing/tests/Middleware/SharingCheckMiddlewareTest.php index 3d86007a54c3a..0169668130f46 100644 --- a/apps/files_sharing/tests/Middleware/SharingCheckMiddlewareTest.php +++ b/apps/files_sharing/tests/Middleware/SharingCheckMiddlewareTest.php @@ -115,7 +115,7 @@ public static function externalSharesChecksDataProvider() { return $data; } - #[\PHPUnit\Framework\Attributes\DataProvider('externalSharesChecksDataProvider')] + #[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'externalSharesChecksDataProvider')] public function testExternalSharesChecks($annotations, $config, $expectedResult): void { $this->reflector ->expects($this->atLeastOnce()) @@ -129,7 +129,7 @@ public function testExternalSharesChecks($annotations, $config, $expectedResult) $this->assertEquals($expectedResult, self::invokePrivate($this->sharingCheckMiddleware, 'externalSharesChecks')); } - #[\PHPUnit\Framework\Attributes\DataProvider('externalSharesChecksDataProvider')] + #[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'externalSharesChecksDataProvider')] public function testBeforeControllerWithExternalShareControllerWithSharingEnabled($annotations, $config, $noException): void { $this->appManager ->expects($this->once()) diff --git a/apps/files_sharing/tests/Migration/SetPasswordColumnTest.php b/apps/files_sharing/tests/Migration/SetPasswordColumnTest.php index 9afa188cbc7e0..610f3658e4b29 100644 --- a/apps/files_sharing/tests/Migration/SetPasswordColumnTest.php +++ b/apps/files_sharing/tests/Migration/SetPasswordColumnTest.php @@ -18,7 +18,7 @@ /** * Class SetPasswordColumnTest */ -#[\PHPUnit\Framework\Attributes\Group('DB')] +#[\PHPUnit\Framework\Attributes\Group(name: 'DB')] class SetPasswordColumnTest extends TestCase { /** @var IDBConnection */ diff --git a/apps/files_sharing/tests/MountProviderTest.php b/apps/files_sharing/tests/MountProviderTest.php index 20db33d62e8f7..c6a7de0137dd5 100644 --- a/apps/files_sharing/tests/MountProviderTest.php +++ b/apps/files_sharing/tests/MountProviderTest.php @@ -25,7 +25,7 @@ use PHPUnit\Framework\MockObject\MockObject; use Psr\Log\LoggerInterface; -#[\PHPUnit\Framework\Attributes\Group('DB')] +#[\PHPUnit\Framework\Attributes\Group(name: 'DB')] class MountProviderTest extends \Test\TestCase { protected MountProvider $provider; @@ -41,7 +41,7 @@ protected function setUp(): void { $this->config = $this->getMockBuilder(IConfig::class)->getMock(); $this->user = $this->getMockBuilder(IUser::class)->getMock(); - $this->loader = $this->getMockBuilder('OCP\Files\Storage\IStorageFactory')->getMock(); + $this->loader = $this->getMockBuilder(IStorageFactory::class)->getMock(); $this->shareManager = $this->getMockBuilder(IManager::class)->getMock(); $this->logger = $this->getMockBuilder(LoggerInterface::class)->getMock(); $eventDispatcher = $this->createMock(IEventDispatcher::class); @@ -156,13 +156,13 @@ public function testExcludeShares(): void { return new Share($rootFolder, $userManager); }); + /** @var SharedMount[] $mounts */ $mounts = $this->provider->getMountsForUser($this->user, $this->loader); $this->assertCount(4, $mounts); $this->assertInstanceOf('OCA\Files_Sharing\SharedMount', $mounts[0]); $this->assertInstanceOf('OCA\Files_Sharing\SharedMount', $mounts[1]); $this->assertInstanceOf('OCA\Files_Sharing\SharedMount', $mounts[2]); $this->assertInstanceOf('OCA\Files_Sharing\SharedMount', $mounts[3]); - /** @var SharedMount[] $mounts */ $mountedShare1 = $mounts[0]->getShare(); $this->assertEquals('2', $mountedShare1->getId()); $this->assertEquals('user2', $mountedShare1->getShareOwner()); @@ -335,7 +335,7 @@ public static function mergeSharesDataProvider(): array { * @param array $groupShares array of group share specs * @param array $expectedShares array of expected supershare specs */ - #[\PHPUnit\Framework\Attributes\DataProvider('mergeSharesDataProvider')] + #[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'mergeSharesDataProvider')] public function testMergeShares(array $userShares, array $groupShares, array $expectedShares, bool $moveFails = false): void { $rootFolder = $this->createMock(IRootFolder::class); $userManager = $this->createMock(IUserManager::class); diff --git a/apps/files_sharing/tests/ShareTest.php b/apps/files_sharing/tests/ShareTest.php index 472d9ecaa9107..a6d143fc6d56b 100644 --- a/apps/files_sharing/tests/ShareTest.php +++ b/apps/files_sharing/tests/ShareTest.php @@ -20,7 +20,7 @@ /** * Class ShareTest */ -#[\PHPUnit\Framework\Attributes\Group('DB')] +#[\PHPUnit\Framework\Attributes\Group(name: 'DB')] class ShareTest extends TestCase { public const TEST_FOLDER_NAME = '/folder_share_api_test'; @@ -189,7 +189,7 @@ public function testShareWithGroupUniqueName(): void { /** * shared files should never have delete permissions */ - #[\PHPUnit\Framework\Attributes\DataProvider('dataProviderTestFileSharePermissions')] + #[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'dataProviderTestFileSharePermissions')] public function testFileSharePermissions($permission, $expectedvalid): void { $pass = true; try { diff --git a/apps/files_sharing/tests/SharedMountTest.php b/apps/files_sharing/tests/SharedMountTest.php index f70dae065d234..48cd940bf50c5 100644 --- a/apps/files_sharing/tests/SharedMountTest.php +++ b/apps/files_sharing/tests/SharedMountTest.php @@ -23,7 +23,7 @@ /** * Class SharedMountTest */ -#[\PHPUnit\Framework\Attributes\Group('SLOWDB')] +#[\PHPUnit\Framework\Attributes\Group(name: 'SLOWDB')] class SharedMountTest extends TestCase { /** @var IGroupManager */ @@ -225,7 +225,7 @@ public function testMoveGroupShare(): void { * @param string $expectedResult * @param bool $exception if a exception is expected */ - #[\PHPUnit\Framework\Attributes\DataProvider('dataProviderTestStripUserFilesPath')] + #[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'dataProviderTestStripUserFilesPath')] public function testStripUserFilesPath($path, $expectedResult, $exception): void { $testClass = new DummyTestClassSharedMount(null, null); try { diff --git a/apps/files_sharing/tests/SharedStorageTest.php b/apps/files_sharing/tests/SharedStorageTest.php index f437238e6d904..ada3d84734c7d 100644 --- a/apps/files_sharing/tests/SharedStorageTest.php +++ b/apps/files_sharing/tests/SharedStorageTest.php @@ -26,7 +26,7 @@ /** * Class SharedStorageTest */ -#[\PHPUnit\Framework\Attributes\Group('DB')] +#[\PHPUnit\Framework\Attributes\Group(name: 'DB')] class SharedStorageTest extends TestCase { protected function setUp(): void { parent::setUp(); diff --git a/apps/files_sharing/tests/SharesReminderJobTest.php b/apps/files_sharing/tests/SharesReminderJobTest.php index dcf2fb1fae175..475d418f1e2fe 100644 --- a/apps/files_sharing/tests/SharesReminderJobTest.php +++ b/apps/files_sharing/tests/SharesReminderJobTest.php @@ -32,7 +32,7 @@ * * @package OCA\Files_Sharing\Tests */ -#[\PHPUnit\Framework\Attributes\Group('DB')] +#[\PHPUnit\Framework\Attributes\Group(name: 'DB')] class SharesReminderJobTest extends \Test\TestCase { private SharesReminderJob $job; private IDBConnection $db; @@ -151,7 +151,7 @@ public static function dataSharesReminder() { * @param int $permissions * @param bool $shouldBeReminded */ - #[\PHPUnit\Framework\Attributes\DataProvider('dataSharesReminder')] + #[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'dataSharesReminder')] public function testSharesReminder( ?\DateTime $expirationDate, string $email, bool $isEmpty, int $permissions, bool $shouldBeReminded, ): void { diff --git a/apps/files_sharing/tests/SizePropagationTest.php b/apps/files_sharing/tests/SizePropagationTest.php index 58429b2339435..9b2f82cc99e0d 100644 --- a/apps/files_sharing/tests/SizePropagationTest.php +++ b/apps/files_sharing/tests/SizePropagationTest.php @@ -20,7 +20,7 @@ * * @package OCA\Files_Sharing\Tests */ -#[\PHPUnit\Framework\Attributes\Group('DB')] +#[\PHPUnit\Framework\Attributes\Group(name: 'DB')] class SizePropagationTest extends TestCase { use UserTrait; diff --git a/apps/files_sharing/tests/TestCase.php b/apps/files_sharing/tests/TestCase.php index 0e466e4aff24e..6b72ecb259cab 100644 --- a/apps/files_sharing/tests/TestCase.php +++ b/apps/files_sharing/tests/TestCase.php @@ -29,7 +29,7 @@ /** * Base class for sharing tests. */ -#[\PHPUnit\Framework\Attributes\Group('DB')] +#[\PHPUnit\Framework\Attributes\Group(name: 'DB')] abstract class TestCase extends \Test\TestCase { use MountProviderTrait; diff --git a/apps/files_sharing/tests/UnshareChildrenTest.php b/apps/files_sharing/tests/UnshareChildrenTest.php index cabb3812c0257..1174a3204aae7 100644 --- a/apps/files_sharing/tests/UnshareChildrenTest.php +++ b/apps/files_sharing/tests/UnshareChildrenTest.php @@ -18,7 +18,7 @@ * * @package OCA\Files_Sharing\Tests */ -#[\PHPUnit\Framework\Attributes\Group('DB')] +#[\PHPUnit\Framework\Attributes\Group(name: 'DB')] class UnshareChildrenTest extends TestCase { protected $subsubfolder; diff --git a/apps/files_sharing/tests/UpdaterTest.php b/apps/files_sharing/tests/UpdaterTest.php index c6eb0018842c2..6ca9801dc98f7 100644 --- a/apps/files_sharing/tests/UpdaterTest.php +++ b/apps/files_sharing/tests/UpdaterTest.php @@ -22,7 +22,7 @@ /** * Class UpdaterTest */ -#[\PHPUnit\Framework\Attributes\Group('DB')] +#[\PHPUnit\Framework\Attributes\Group(name: 'DB')] class UpdaterTest extends TestCase { public const TEST_FOLDER_NAME = '/folder_share_updater_test'; @@ -136,7 +136,7 @@ public static function shareFolderProvider() { * * @param string $shareFolder share folder to use */ - #[\PHPUnit\Framework\Attributes\DataProvider('shareFolderProvider')] + #[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'shareFolderProvider')] public function testShareFile($shareFolder): void { $config = Server::get(IConfig::class); $oldShareFolder = $config->getSystemValue('share_folder'); diff --git a/apps/files_sharing/tests/WatcherTest.php b/apps/files_sharing/tests/WatcherTest.php index 6b08b1e2371b1..8c3c3890c88ed 100644 --- a/apps/files_sharing/tests/WatcherTest.php +++ b/apps/files_sharing/tests/WatcherTest.php @@ -16,7 +16,7 @@ /** * Class WatcherTest */ -#[\PHPUnit\Framework\Attributes\Group('DB')] +#[\PHPUnit\Framework\Attributes\Group(name: 'DB')] class WatcherTest extends TestCase { /** @var Storage */ diff --git a/apps/files_trashbin/tests/Command/CleanUpTest.php b/apps/files_trashbin/tests/Command/CleanUpTest.php index dd0352a6a19a7..d9451a3e09a57 100644 --- a/apps/files_trashbin/tests/Command/CleanUpTest.php +++ b/apps/files_trashbin/tests/Command/CleanUpTest.php @@ -27,7 +27,7 @@ * * @package OCA\Files_Trashbin\Tests\Command */ -#[\PHPUnit\Framework\Attributes\Group('DB')] +#[\PHPUnit\Framework\Attributes\Group(name: 'DB')] class CleanUpTest extends TestCase { protected IUserManager&MockObject $userManager; protected IRootFolder&MockObject $rootFolder; @@ -69,7 +69,7 @@ public function initTable(): void { $this->assertCount(10, $result); } - #[\PHPUnit\Framework\Attributes\DataProvider('dataTestRemoveDeletedFiles')] + #[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'dataTestRemoveDeletedFiles')] public function testRemoveDeletedFiles(bool $nodeExists): void { $this->initTable(); $this->rootFolder diff --git a/apps/files_trashbin/tests/Command/ExpireTest.php b/apps/files_trashbin/tests/Command/ExpireTest.php index 69804babcf5aa..e6d96c6d79e5f 100644 --- a/apps/files_trashbin/tests/Command/ExpireTest.php +++ b/apps/files_trashbin/tests/Command/ExpireTest.php @@ -17,7 +17,7 @@ * * @package OCA\Files_Trashbin\Tests\Command */ -#[\PHPUnit\Framework\Attributes\Group('DB')] +#[\PHPUnit\Framework\Attributes\Group(name: 'DB')] class ExpireTest extends TestCase { public function testExpireNonExistingUser(): void { $command = new Expire('test'); diff --git a/apps/files_trashbin/tests/Command/ExpireTrashTest.php b/apps/files_trashbin/tests/Command/ExpireTrashTest.php index 37d90bcccd9e3..366c27cf1e600 100644 --- a/apps/files_trashbin/tests/Command/ExpireTrashTest.php +++ b/apps/files_trashbin/tests/Command/ExpireTrashTest.php @@ -10,12 +10,14 @@ use OCA\Files_Trashbin\Expiration; use OCA\Files_Trashbin\Helper; use OCP\AppFramework\Utility\ITimeFactory; +use OCP\Files\Folder; use OCP\Files\IRootFolder; -use OCP\Files\Node; use OCP\IConfig; use OCP\IUser; use OCP\IUserManager; use OCP\Server; +use PHPUnit\Framework\Attributes\Group; +use PHPUnit\Framework\MockObject\MockObject; use Psr\Log\LoggerInterface; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; @@ -27,14 +29,14 @@ * * @package OCA\Files_Trashbin\Tests\Command */ -#[\PHPUnit\Framework\Attributes\Group('DB')] +#[Group(name: 'DB')] class ExpireTrashTest extends TestCase { private Expiration $expiration; - private Node $userFolder; + private Folder $userFolder; private IConfig $config; private IUserManager $userManager; private IUser $user; - private ITimeFactory $timeFactory; + private ITimeFactory&MockObject $timeFactory; protected function setUp(): void { @@ -64,7 +66,7 @@ protected function tearDown(): void { parent::tearDown(); } - #[\PHPUnit\Framework\Attributes\DataProvider('retentionObligationProvider')] + #[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'retentionObligationProvider')] public function testRetentionObligation(string $obligation, string $quota, int $elapsed, int $fileSize, bool $shouldExpire): void { $this->config->setSystemValues(['trashbin_retention_obligation' => $obligation]); $this->expiration->setRetentionObligation($obligation); diff --git a/apps/files_trashbin/tests/ExpirationTest.php b/apps/files_trashbin/tests/ExpirationTest.php index 3348edc40166a..fdc80977d79c8 100644 --- a/apps/files_trashbin/tests/ExpirationTest.php +++ b/apps/files_trashbin/tests/ExpirationTest.php @@ -82,7 +82,7 @@ public static function expirationData(): array { ]; } - #[\PHPUnit\Framework\Attributes\DataProvider('expirationData')] + #[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'expirationData')] public function testExpiration(string $retentionObligation, int $timeNow, int $timestamp, bool $quotaExceeded, bool $expectedResult): void { $mockedConfig = $this->getMockedConfig($retentionObligation); $mockedTimeFactory = $this->getMockedTimeFactory($timeNow); @@ -108,7 +108,7 @@ public static function timestampTestData(): array { } - #[\PHPUnit\Framework\Attributes\DataProvider('timestampTestData')] + #[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'timestampTestData')] public function testGetMaxAgeAsTimestamp(string $configValue, bool|int $expectedMaxAgeTimestamp): void { $mockedConfig = $this->getMockedConfig($configValue); $mockedTimeFactory = $this->getMockedTimeFactory( diff --git a/apps/files_trashbin/tests/Sabre/TrashbinPluginTest.php b/apps/files_trashbin/tests/Sabre/TrashbinPluginTest.php index 87aca2753effd..3d3f5df1c918a 100644 --- a/apps/files_trashbin/tests/Sabre/TrashbinPluginTest.php +++ b/apps/files_trashbin/tests/Sabre/TrashbinPluginTest.php @@ -29,7 +29,7 @@ protected function setUp(): void { $this->server = new Server($tree); } - #[\PHPUnit\Framework\Attributes\DataProvider('quotaProvider')] + #[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'quotaProvider')] public function testQuota(int $quota, int $fileSize, bool $expectedResult): void { $fileInfo = $this->createMock(ITrashItem::class); $fileInfo->method('getSize') diff --git a/apps/files_trashbin/tests/StorageTest.php b/apps/files_trashbin/tests/StorageTest.php index 3b8441a412443..de8df1d293218 100644 --- a/apps/files_trashbin/tests/StorageTest.php +++ b/apps/files_trashbin/tests/StorageTest.php @@ -49,7 +49,7 @@ public function moveFromStorage(IStorage $sourceStorage, string $sourceInternalP * * @package OCA\Files_Trashbin\Tests */ -#[\PHPUnit\Framework\Attributes\Group('DB')] +#[\PHPUnit\Framework\Attributes\Group(name: 'DB')] class StorageTest extends \Test\TestCase { use MountProviderTrait; @@ -560,7 +560,7 @@ public function testSingleStorageDeleteFolderFail(): void { $this->assertCount(0, $results); } - #[\PHPUnit\Framework\Attributes\DataProvider('dataTestShouldMoveToTrash')] + #[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'dataTestShouldMoveToTrash')] public function testShouldMoveToTrash(string $mountPoint, string $path, bool $userExists, bool $appDisablesTrash, bool $expected): void { $fileID = 1; $cache = $this->createMock(ICache::class); diff --git a/apps/files_trashbin/tests/TrashbinTest.php b/apps/files_trashbin/tests/TrashbinTest.php index 21c8bdb92f5a0..e34897330edd6 100644 --- a/apps/files_trashbin/tests/TrashbinTest.php +++ b/apps/files_trashbin/tests/TrashbinTest.php @@ -23,6 +23,7 @@ use OCP\App\IAppManager; use OCP\AppFramework\Utility\ITimeFactory; use OCP\Constants; +use OCP\Files\File; use OCP\Files\FileInfo; use OCP\Files\IRootFolder; use OCP\IConfig; @@ -34,7 +35,7 @@ /** * Class Test_Encryption */ -#[\PHPUnit\Framework\Attributes\Group('DB')] +#[\PHPUnit\Framework\Attributes\Group(name: 'DB')] class TrashbinTest extends \Test\TestCase { public const TEST_TRASHBIN_USER1 = 'test-trashbin-user1'; public const TEST_TRASHBIN_USER2 = 'test-trashbin-user2'; @@ -377,6 +378,7 @@ public function testRestoreFileInRoot(): void { ) ); + /** @var File $file */ $file = $userFolder->get('file1.txt'); $this->assertEquals('foo', $file->getContent()); } @@ -410,6 +412,7 @@ public function testRestoreFileInSubfolder(): void { ) ); + /** @var File $file */ $file = $userFolder->get('folder/file1.txt'); $this->assertEquals('foo', $file->getContent()); } @@ -443,6 +446,7 @@ public function testRestoreFolder(): void { ) ); + /** @var File $file */ $file = $userFolder->get('folder/file1.txt'); $this->assertEquals('foo', $file->getContent()); } @@ -476,6 +480,7 @@ public function testRestoreFileFromTrashedSubfolder(): void { ) ); + /** @var File $file */ $file = $userFolder->get('file1.txt'); $this->assertEquals('foo', $file->getContent()); } @@ -513,6 +518,7 @@ public function testRestoreFileWithMissingSourceFolder(): void { ) ); + /** @var File $file */ $file = $userFolder->get('file1.txt'); $this->assertEquals('foo', $file->getContent()); } @@ -550,9 +556,11 @@ public function testRestoreFileDoesNotOverwriteExistingInRoot(): void { ) ); + /** @var File $anotherFile */ $anotherFile = $userFolder->get('file1.txt'); $this->assertEquals('bar', $anotherFile->getContent()); + /** @var File $restoredFile */ $restoredFile = $userFolder->get('file1 (restored).txt'); $this->assertEquals('foo', $restoredFile->getContent()); } @@ -591,9 +599,11 @@ public function testRestoreFileDoesNotOverwriteExistingInSubfolder(): void { ) ); + /** @var File $anotherFile */ $anotherFile = $userFolder->get('folder/file1.txt'); $this->assertEquals('bar', $anotherFile->getContent()); + /** @var File $restoredFile */ $restoredFile = $userFolder->get('folder/file1 (restored).txt'); $this->assertEquals('foo', $restoredFile->getContent()); } @@ -648,6 +658,7 @@ public function testRestoreFileIntoReadOnlySourceFolder(): void { ) ); + /** @var File $file */ $file = $userFolder->get('file1.txt'); $this->assertEquals('foo', $file->getContent()); diff --git a/apps/files_versions/tests/Command/CleanupTest.php b/apps/files_versions/tests/Command/CleanupTest.php index 99b17bc2981bf..446b62f145d9d 100644 --- a/apps/files_versions/tests/Command/CleanupTest.php +++ b/apps/files_versions/tests/Command/CleanupTest.php @@ -25,7 +25,7 @@ * * @package OCA\Files_Versions\Tests\Command */ -#[\PHPUnit\Framework\Attributes\Group('DB')] +#[\PHPUnit\Framework\Attributes\Group(name: 'DB')] class CleanupTest extends TestCase { protected Manager&MockObject $userManager; protected IRootFolder&MockObject $rootFolder; @@ -45,7 +45,7 @@ protected function setUp(): void { /** * @param boolean $nodeExists */ - #[\PHPUnit\Framework\Attributes\DataProvider('dataTestDeleteVersions')] + #[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'dataTestDeleteVersions')] public function testDeleteVersions(bool $nodeExists): void { $this->rootFolder->expects($this->once()) ->method('nodeExists') diff --git a/apps/files_versions/tests/Command/ExpireTest.php b/apps/files_versions/tests/Command/ExpireTest.php index 9320e3e873f28..030e7a1b98ab4 100644 --- a/apps/files_versions/tests/Command/ExpireTest.php +++ b/apps/files_versions/tests/Command/ExpireTest.php @@ -17,7 +17,7 @@ * * @package OCA\Files_Versions\Tests\Command */ -#[\PHPUnit\Framework\Attributes\Group('DB')] +#[\PHPUnit\Framework\Attributes\Group(name: 'DB')] class ExpireTest extends TestCase { public function testExpireNonExistingUser(): void { $command = new Expire($this->getUniqueID('test'), ''); diff --git a/apps/files_versions/tests/ExpirationTest.php b/apps/files_versions/tests/ExpirationTest.php index 8cf412c3fe0b5..252b7218b6277 100644 --- a/apps/files_versions/tests/ExpirationTest.php +++ b/apps/files_versions/tests/ExpirationTest.php @@ -81,7 +81,7 @@ public static function expirationData(): array { ]; } - #[\PHPUnit\Framework\Attributes\DataProvider('expirationData')] + #[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'expirationData')] public function testExpiration(string $retentionObligation, int $timeNow, int $timestamp, bool $quotaExceeded, bool $expectedResult): void { $mockedConfig = $this->getMockedConfig($retentionObligation); $mockedTimeFactory = $this->getMockedTimeFactory($timeNow); diff --git a/apps/files_versions/tests/StorageTest.php b/apps/files_versions/tests/StorageTest.php index 596271c6edf5b..f9ed28e16d9bb 100644 --- a/apps/files_versions/tests/StorageTest.php +++ b/apps/files_versions/tests/StorageTest.php @@ -16,7 +16,7 @@ use Test\TestCase; use Test\Traits\UserTrait; -#[\PHPUnit\Framework\Attributes\Group('DB')] +#[\PHPUnit\Framework\Attributes\Group(name: 'DB')] class StorageTest extends TestCase { use UserTrait; diff --git a/apps/files_versions/tests/VersioningTest.php b/apps/files_versions/tests/VersioningTest.php index 0783032863e16..6faa324f9ca1b 100644 --- a/apps/files_versions/tests/VersioningTest.php +++ b/apps/files_versions/tests/VersioningTest.php @@ -35,7 +35,7 @@ * Class Test_Files_versions * this class provide basic files versions test */ -#[\PHPUnit\Framework\Attributes\Group('DB')] +#[\PHPUnit\Framework\Attributes\Group(name: 'DB')] class VersioningTest extends \Test\TestCase { public const TEST_VERSIONS_USER = 'test-versions-user'; public const TEST_VERSIONS_USER2 = 'test-versions-user2'; @@ -139,7 +139,7 @@ protected function tearDown(): void { /** * test expire logic */ - #[\PHPUnit\Framework\Attributes\DataProvider('versionsProvider')] + #[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'versionsProvider')] public function testGetExpireList($versions, $sizeOfAllDeletedFiles): void { // last interval end at 2592000 diff --git a/apps/files_versions/tests/Versions/VersionManagerTest.php b/apps/files_versions/tests/Versions/VersionManagerTest.php index 79caa65d5f1f7..623b18c904428 100644 --- a/apps/files_versions/tests/Versions/VersionManagerTest.php +++ b/apps/files_versions/tests/Versions/VersionManagerTest.php @@ -26,6 +26,9 @@ private function getBackend(bool $shouldUse = true): IVersionBackend { return $backend; } + /** + * @param class-string $class + */ private function getStorage(string $class): IStorage&MockObject { return $this->getMockBuilder($class) ->disableOriginalConstructor() diff --git a/apps/oauth2/tests/Controller/LoginRedirectorControllerTest.php b/apps/oauth2/tests/Controller/LoginRedirectorControllerTest.php index bbcbe44909fd6..673c95ebcde9a 100644 --- a/apps/oauth2/tests/Controller/LoginRedirectorControllerTest.php +++ b/apps/oauth2/tests/Controller/LoginRedirectorControllerTest.php @@ -23,7 +23,7 @@ use PHPUnit\Framework\MockObject\MockObject; use Test\TestCase; -#[\PHPUnit\Framework\Attributes\Group('DB')] +#[\PHPUnit\Framework\Attributes\Group(name: 'DB')] class LoginRedirectorControllerTest extends TestCase { private IRequest&MockObject $request; private IURLGenerator&MockObject $urlGenerator; diff --git a/apps/oauth2/tests/Controller/OauthApiControllerTest.php b/apps/oauth2/tests/Controller/OauthApiControllerTest.php index 53dd85491962c..8386ab9ad0e45 100644 --- a/apps/oauth2/tests/Controller/OauthApiControllerTest.php +++ b/apps/oauth2/tests/Controller/OauthApiControllerTest.php @@ -236,7 +236,7 @@ public static function invalidClientProvider() { * @param string $clientId * @param string $clientSecret */ - #[\PHPUnit\Framework\Attributes\DataProvider('invalidClientProvider')] + #[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'invalidClientProvider')] public function testRefreshTokenInvalidClient($clientId, $clientSecret): void { $expected = new JSONResponse([ 'error' => 'invalid_client', diff --git a/apps/oauth2/tests/Controller/SettingsControllerTest.php b/apps/oauth2/tests/Controller/SettingsControllerTest.php index 19498b1645432..f7b9fb392574b 100644 --- a/apps/oauth2/tests/Controller/SettingsControllerTest.php +++ b/apps/oauth2/tests/Controller/SettingsControllerTest.php @@ -22,7 +22,7 @@ use OCP\Server; use Test\TestCase; -#[\PHPUnit\Framework\Attributes\Group('DB')] +#[\PHPUnit\Framework\Attributes\Group(name: 'DB')] class SettingsControllerTest extends TestCase { /** @var IRequest|\PHPUnit\Framework\MockObject\MockObject */ private $request; diff --git a/apps/oauth2/tests/Db/AccessTokenMapperTest.php b/apps/oauth2/tests/Db/AccessTokenMapperTest.php index f99d12e971a1e..20765b7a7010f 100644 --- a/apps/oauth2/tests/Db/AccessTokenMapperTest.php +++ b/apps/oauth2/tests/Db/AccessTokenMapperTest.php @@ -14,7 +14,7 @@ use OCP\Server; use Test\TestCase; -#[\PHPUnit\Framework\Attributes\Group('DB')] +#[\PHPUnit\Framework\Attributes\Group(name: 'DB')] class AccessTokenMapperTest extends TestCase { /** @var AccessTokenMapper */ private $accessTokenMapper; @@ -28,7 +28,7 @@ public function testGetByCode(): void { $this->accessTokenMapper->deleteByClientId(1234); $token = new AccessToken(); $token->setClientId(1234); - $token->setTokenId((string)time()); + $token->setTokenId(time()); $token->setEncryptedToken('MyEncryptedToken'); $token->setHashedCode(hash('sha512', 'MyAwesomeToken')); $this->accessTokenMapper->insert($token); @@ -46,7 +46,7 @@ public function testDeleteByClientId(): void { $this->accessTokenMapper->deleteByClientId(1234); $token = new AccessToken(); $token->setClientId(1234); - $token->setTokenId((string)time()); + $token->setTokenId(time()); $token->setEncryptedToken('MyEncryptedToken'); $token->setHashedCode(hash('sha512', 'MyAwesomeToken')); $this->accessTokenMapper->insert($token); diff --git a/apps/oauth2/tests/Db/ClientMapperTest.php b/apps/oauth2/tests/Db/ClientMapperTest.php index 2f0b220cb755e..1b0a18710ec6a 100644 --- a/apps/oauth2/tests/Db/ClientMapperTest.php +++ b/apps/oauth2/tests/Db/ClientMapperTest.php @@ -13,7 +13,7 @@ use OCP\Server; use Test\TestCase; -#[\PHPUnit\Framework\Attributes\Group('DB')] +#[\PHPUnit\Framework\Attributes\Group(name: 'DB')] class ClientMapperTest extends TestCase { /** @var ClientMapper */ private $clientMapper; diff --git a/apps/profile/tests/Controller/ProfilePageControllerTest.php b/apps/profile/tests/Controller/ProfilePageControllerTest.php index 6c6c5ec79dfcb..2da0d86bddc09 100644 --- a/apps/profile/tests/Controller/ProfilePageControllerTest.php +++ b/apps/profile/tests/Controller/ProfilePageControllerTest.php @@ -20,11 +20,12 @@ use OCP\IUserManager; use OCP\IUserSession; use OCP\Share\IManager; +use PHPUnit\Framework\MockObject\MockObject; use Test\TestCase; class ProfilePageControllerTest extends TestCase { - private IUserManager $userManager; + private IUserManager&MockObject $userManager; private ProfilePageController $controller; protected function setUp(): void { diff --git a/apps/provisioning_api/tests/CapabilitiesTest.php b/apps/provisioning_api/tests/CapabilitiesTest.php index 43d22a7123251..463d0f064989c 100644 --- a/apps/provisioning_api/tests/CapabilitiesTest.php +++ b/apps/provisioning_api/tests/CapabilitiesTest.php @@ -20,7 +20,7 @@ * * @package OCA\Provisioning_API\Tests */ -#[\PHPUnit\Framework\Attributes\Group('DB')] +#[\PHPUnit\Framework\Attributes\Group(name: 'DB')] class CapabilitiesTest extends TestCase { protected IAppManager&MockObject $appManager; @@ -48,7 +48,7 @@ public static function getCapabilitiesProvider(): array { ]; } - #[\PHPUnit\Framework\Attributes\DataProvider('getCapabilitiesProvider')] + #[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'getCapabilitiesProvider')] public function testGetCapabilities(bool $federationAppEnabled, bool $federatedFileSharingAppEnabled, bool $lookupServerEnabled, bool $expectedFederatedScopeEnabled, bool $expectedPublishedScopeEnabled): void { $this->appManager->expects($this->any()) ->method('isEnabledForUser') diff --git a/apps/provisioning_api/tests/Controller/AppConfigControllerTest.php b/apps/provisioning_api/tests/Controller/AppConfigControllerTest.php index 2657f5c8bba23..55885aabf0a42 100644 --- a/apps/provisioning_api/tests/Controller/AppConfigControllerTest.php +++ b/apps/provisioning_api/tests/Controller/AppConfigControllerTest.php @@ -108,7 +108,7 @@ public static function dataGetKeys(): array { ]; } - #[\PHPUnit\Framework\Attributes\DataProvider('dataGetKeys')] + #[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'dataGetKeys')] public function testGetKeys(string $app, ?array $keys, ?\Throwable $throws, int $status): void { $api = $this->getInstance(['verifyAppId']); if ($throws instanceof \Exception) { @@ -147,7 +147,7 @@ public static function dataGetValue(): array { ]; } - #[\PHPUnit\Framework\Attributes\DataProvider('dataGetValue')] + #[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'dataGetValue')] public function testGetValue(string $app, string $key, string $default, ?string $return, ?\Throwable $throws, int $status): void { $api = $this->getInstance(['verifyAppId']); if ($throws instanceof \Exception) { @@ -191,7 +191,7 @@ public static function dataSetValue(): array { ]; } - #[\PHPUnit\Framework\Attributes\DataProvider('dataSetValue')] + #[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'dataSetValue')] public function testSetValue(string $app, string $key, string $value, ?\Throwable $appThrows, ?\Throwable $keyThrows, int $status, int|\Throwable $type = IAppConfig::VALUE_MIXED): void { $adminUser = $this->createMock(IUser::class); $adminUser->expects($this->once()) @@ -289,7 +289,7 @@ public static function dataDeleteValue(): array { ]; } - #[\PHPUnit\Framework\Attributes\DataProvider('dataDeleteValue')] + #[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'dataDeleteValue')] public function testDeleteValue(string $app, string $key, ?\Throwable $appThrows, ?\Throwable $keyThrows, int $status): void { $api = $this->getInstance(['verifyAppId', 'verifyConfigKey']); if ($appThrows instanceof \Exception) { @@ -353,7 +353,7 @@ public static function dataVerifyAppIdThrows(): array { ]; } - #[\PHPUnit\Framework\Attributes\DataProvider('dataVerifyAppIdThrows')] + #[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'dataVerifyAppIdThrows')] public function testVerifyAppIdThrows(string $app): void { $this->expectException(\InvalidArgumentException::class); @@ -370,7 +370,7 @@ public static function dataVerifyConfigKey(): array { ]; } - #[\PHPUnit\Framework\Attributes\DataProvider('dataVerifyConfigKey')] + #[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'dataVerifyConfigKey')] public function testVerifyConfigKey(string $app, string $key, string $value): void { $api = $this->getInstance(); $this->invokePrivate($api, 'verifyConfigKey', [$app, $key, $value]); @@ -391,7 +391,7 @@ public static function dataVerifyConfigKeyThrows(): array { ]; } - #[\PHPUnit\Framework\Attributes\DataProvider('dataVerifyConfigKeyThrows')] + #[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'dataVerifyConfigKeyThrows')] public function testVerifyConfigKeyThrows(string $app, string $key, string $value): void { $this->expectException(\InvalidArgumentException::class); diff --git a/apps/provisioning_api/tests/Controller/AppsControllerTest.php b/apps/provisioning_api/tests/Controller/AppsControllerTest.php index 6fc38311037b4..aac589d9a1575 100644 --- a/apps/provisioning_api/tests/Controller/AppsControllerTest.php +++ b/apps/provisioning_api/tests/Controller/AppsControllerTest.php @@ -25,7 +25,7 @@ * * @package OCA\Provisioning_API\Tests */ -#[\PHPUnit\Framework\Attributes\Group('DB')] +#[\PHPUnit\Framework\Attributes\Group(name: 'DB')] class AppsControllerTest extends TestCase { private IAppManager $appManager; private IAppConfig&MockObject $appConfig; diff --git a/apps/provisioning_api/tests/Controller/GroupsControllerTest.php b/apps/provisioning_api/tests/Controller/GroupsControllerTest.php index 85e5d733b1fb7..129853d0c9bd2 100644 --- a/apps/provisioning_api/tests/Controller/GroupsControllerTest.php +++ b/apps/provisioning_api/tests/Controller/GroupsControllerTest.php @@ -161,7 +161,7 @@ public static function dataGetGroups(): array { ]; } - #[\PHPUnit\Framework\Attributes\DataProvider('dataGetGroups')] + #[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'dataGetGroups')] public function testGetGroups(?string $search, int $limit, int $offset): void { $groups = [$this->createGroup('group1'), $this->createGroup('group2')]; @@ -183,7 +183,7 @@ public function testGetGroups(?string $search, int $limit, int $offset): void { * @param int|null $limit * @param int|null $offset */ - #[\PHPUnit\Framework\Attributes\DataProvider('dataGetGroups')] + #[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'dataGetGroups')] public function testGetGroupsDetails($search, $limit, $offset): void { $groups = [$this->createGroup('group1'), $this->createGroup('group2')]; diff --git a/apps/provisioning_api/tests/Controller/UsersControllerTest.php b/apps/provisioning_api/tests/Controller/UsersControllerTest.php index 1a1c7c80fae09..da3548375ab15 100644 --- a/apps/provisioning_api/tests/Controller/UsersControllerTest.php +++ b/apps/provisioning_api/tests/Controller/UsersControllerTest.php @@ -482,9 +482,6 @@ public function testAddUserSuccessful(): void { } public function testAddUserSuccessfulWithDisplayName(): void { - /** - * @var UserController - */ $api = $this->getMockBuilder(UsersController::class) ->setConstructorArgs([ 'provisioning_api', @@ -1590,7 +1587,7 @@ public static function dataSearchByPhoneNumbers(): array { ]; } - #[\PHPUnit\Framework\Attributes\DataProvider('dataSearchByPhoneNumbers')] + #[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'dataSearchByPhoneNumbers')] public function testSearchByPhoneNumbers(string $location, array $search, int $status, ?array $searchUsers, ?array $userMatches, array $expected): void { $knownTo = 'knownTo'; $user = $this->createMock(IUser::class); @@ -1917,7 +1914,7 @@ public static function selfEditChangePropertyProvider(): array { ]; } - #[\PHPUnit\Framework\Attributes\DataProvider('selfEditChangePropertyProvider')] + #[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'selfEditChangePropertyProvider')] public function testEditUserRegularUserSelfEditChangeProperty($propertyName, $oldValue, $newValue): void { $loggedInUser = $this->getMockBuilder(IUser::class) ->disableOriginalConstructor() @@ -1994,7 +1991,7 @@ public function selfEditChangePropertyScopeProvider() { ]; } - #[\PHPUnit\Framework\Attributes\DataProvider('selfEditChangePropertyProvider')] + #[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'selfEditChangePropertyProvider')] public function testEditUserRegularUserSelfEditChangePropertyScope($propertyName, $oldScope, $newScope): void { $loggedInUser = $this->getMockBuilder(IUser::class) ->disableOriginalConstructor() @@ -2329,7 +2326,7 @@ public static function dataEditUserSelfEditChangeLanguageButForced(): array { ]; } - #[\PHPUnit\Framework\Attributes\DataProvider('dataEditUserSelfEditChangeLanguageButForced')] + #[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'dataEditUserSelfEditChangeLanguageButForced')] public function testEditUserSelfEditChangeLanguageButForced($forced): void { $this->expectException(OCSException::class); @@ -2423,7 +2420,7 @@ public function testEditUserAdminEditChangeLanguage(): void { $this->assertEquals([], $this->api->editUser('UserToEdit', 'language', 'de')->getData()); } - #[\PHPUnit\Framework\Attributes\DataProvider('dataEditUserSelfEditChangeLanguageButForced')] + #[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'dataEditUserSelfEditChangeLanguageButForced')] public function testEditUserAdminEditChangeLanguageInvalidLanguage(): void { $this->expectException(OCSException::class); @@ -4422,7 +4419,7 @@ public static function dataGetEditableFields(): array { ]; } - #[\PHPUnit\Framework\Attributes\DataProvider('dataGetEditableFields')] + #[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'dataGetEditableFields')] public function testGetEditableFields(bool $allowedToChangeDisplayName, bool $allowedToChangeEmail, string $userBackend, array $expected): void { $this->config->method('getSystemValue')->willReturnCallback(fn (string $key, mixed $default) => match ($key) { 'allow_user_to_change_display_name' => $allowedToChangeDisplayName, diff --git a/apps/provisioning_api/tests/Middleware/ProvisioningApiMiddlewareTest.php b/apps/provisioning_api/tests/Middleware/ProvisioningApiMiddlewareTest.php index c027e518a3d63..0e84adca09f5b 100644 --- a/apps/provisioning_api/tests/Middleware/ProvisioningApiMiddlewareTest.php +++ b/apps/provisioning_api/tests/Middleware/ProvisioningApiMiddlewareTest.php @@ -44,7 +44,7 @@ public static function dataAnnotation(): array { ]; } - #[\PHPUnit\Framework\Attributes\DataProvider('dataAnnotation')] + #[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'dataAnnotation')] public function testBeforeController(bool $subadminRequired, bool $isAdmin, bool $isSubAdmin, bool $hasSettingAuthorizationAnnotation, bool $shouldThrowException): void { $middleware = new ProvisioningApiMiddleware( $this->reflector, @@ -81,7 +81,7 @@ public static function dataAfterException(): array { ]; } - #[\PHPUnit\Framework\Attributes\DataProvider('dataAfterException')] + #[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'dataAfterException')] public function testAfterException(\Exception $exception, bool $forwared): void { $middleware = new ProvisioningApiMiddleware( $this->reflector, diff --git a/apps/provisioning_api/tests/TestCase.php b/apps/provisioning_api/tests/TestCase.php index 30e7f3a4ecf09..b69da0b76ebb1 100644 --- a/apps/provisioning_api/tests/TestCase.php +++ b/apps/provisioning_api/tests/TestCase.php @@ -15,13 +15,9 @@ abstract class TestCase extends \Test\TestCase { /** @var IUser[] */ - protected $users = []; - - /** @var IUserManager */ - protected $userManager; - - /** @var IGroupManager */ - protected $groupManager; + protected array $users = []; + protected IUserManager $userManager; + protected IGroupManager $groupManager; protected function setUp(): void { parent::setUp(); @@ -43,7 +39,9 @@ protected function generateUsers($num = 1) { $this->users[] = $user; $users[] = $user; } - return count($users) == 1 ? reset($users) : $users; + $result = count($users) === 1 ? reset($users) : $users; + $this->assertNotEquals(false, $result); + return $result; } protected function tearDown(): void { diff --git a/apps/settings/tests/Activity/SecurityProviderTest.php b/apps/settings/tests/Activity/SecurityProviderTest.php index ed9de362a8765..3f7fe468da360 100644 --- a/apps/settings/tests/Activity/SecurityProviderTest.php +++ b/apps/settings/tests/Activity/SecurityProviderTest.php @@ -50,7 +50,7 @@ public static function subjectData(): array { ]; } - #[\PHPUnit\Framework\Attributes\DataProvider('subjectData')] + #[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'subjectData')] public function testParse(string $subject): void { $lang = 'ru'; $event = $this->createMock(IEvent::class); diff --git a/apps/settings/tests/AppInfo/ApplicationTest.php b/apps/settings/tests/AppInfo/ApplicationTest.php index f016c7a86a8ac..7154d008a4db0 100644 --- a/apps/settings/tests/AppInfo/ApplicationTest.php +++ b/apps/settings/tests/AppInfo/ApplicationTest.php @@ -26,7 +26,7 @@ * * @package Tests\Settings */ -#[\PHPUnit\Framework\Attributes\Group('DB')] +#[\PHPUnit\Framework\Attributes\Group(name: 'DB')] class ApplicationTest extends TestCase { protected Application $app; protected IAppContainer $container; @@ -56,7 +56,7 @@ public static function dataContainerQuery(): array { ]; } - #[\PHPUnit\Framework\Attributes\DataProvider('dataContainerQuery')] + #[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'dataContainerQuery')] public function testContainerQuery(string $service, string $expected): void { $this->assertTrue($this->container->query($service) instanceof $expected); } diff --git a/apps/settings/tests/Controller/AdminSettingsControllerTest.php b/apps/settings/tests/Controller/AdminSettingsControllerTest.php index 775f19707c703..218be8dbeeb80 100644 --- a/apps/settings/tests/Controller/AdminSettingsControllerTest.php +++ b/apps/settings/tests/Controller/AdminSettingsControllerTest.php @@ -29,7 +29,7 @@ * * @package Tests\Settings\Controller */ -#[\PHPUnit\Framework\Attributes\Group('DB')] +#[\PHPUnit\Framework\Attributes\Group(name: 'DB')] class AdminSettingsControllerTest extends TestCase { private IRequest&MockObject $request; diff --git a/apps/settings/tests/Controller/AppSettingsControllerTest.php b/apps/settings/tests/Controller/AppSettingsControllerTest.php index de96a10d31ee9..258cdb3bf0fb5 100644 --- a/apps/settings/tests/Controller/AppSettingsControllerTest.php +++ b/apps/settings/tests/Controller/AppSettingsControllerTest.php @@ -35,7 +35,7 @@ * * @package Tests\Settings\Controller */ -#[\PHPUnit\Framework\Attributes\Group('DB')] +#[\PHPUnit\Framework\Attributes\Group(name: 'DB')] class AppSettingsControllerTest extends TestCase { private IRequest&MockObject $request; private IL10N&MockObject $l10n; diff --git a/apps/settings/tests/Controller/AuthSettingsControllerTest.php b/apps/settings/tests/Controller/AuthSettingsControllerTest.php index d195dbf83d394..65c0e916a5f26 100644 --- a/apps/settings/tests/Controller/AuthSettingsControllerTest.php +++ b/apps/settings/tests/Controller/AuthSettingsControllerTest.php @@ -213,7 +213,7 @@ public static function dataRenameToken(): array { ]; } - #[\PHPUnit\Framework\Attributes\DataProvider('dataRenameToken')] + #[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'dataRenameToken')] public function testUpdateRename(string $name, string $newName): void { $tokenId = 42; $token = $this->createMock(PublicKeyToken::class); @@ -251,7 +251,7 @@ public static function dataUpdateFilesystemScope(): array { ]; } - #[\PHPUnit\Framework\Attributes\DataProvider('dataUpdateFilesystemScope')] + #[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'dataUpdateFilesystemScope')] public function testUpdateFilesystemScope(bool $filesystem, bool $newFilesystem): void { $tokenId = 42; $token = $this->createMock(PublicKeyToken::class); diff --git a/apps/settings/tests/Controller/UsersControllerTest.php b/apps/settings/tests/Controller/UsersControllerTest.php index 195387a5d78ce..f8e25279df1be 100644 --- a/apps/settings/tests/Controller/UsersControllerTest.php +++ b/apps/settings/tests/Controller/UsersControllerTest.php @@ -42,7 +42,7 @@ /** * @package Tests\Settings\Controller */ -#[\PHPUnit\Framework\Attributes\Group('DB')] +#[\PHPUnit\Framework\Attributes\Group(name: 'DB')] class UsersControllerTest extends \Test\TestCase { private IGroupManager&MockObject $groupManager; private UserManager&MockObject $userManager; @@ -250,7 +250,7 @@ protected function getDefaultAccountMock(): MockObject { return $account; } - #[\PHPUnit\Framework\Attributes\DataProvider('dataTestSetUserSettings')] + #[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'dataTestSetUserSettings')] public function testSetUserSettings(string $email, bool $validEmail, int $expectedStatus): void { $controller = $this->getController(false, ['saveUserSettings']); $user = $this->createMock(IUser::class); @@ -516,7 +516,7 @@ public function testSetUserSettingsWhenFederatedFilesharingNotEnabled(): void { ); } - #[\PHPUnit\Framework\Attributes\DataProvider('dataTestSetUserSettingsSubset')] + #[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'dataTestSetUserSettingsSubset')] public function testSetUserSettingsSubset(string $property, string $propertyValue): void { $controller = $this->getController(false, ['saveUserSettings']); $user = $this->createMock(IUser::class); @@ -668,7 +668,7 @@ public static function dataTestSetUserSettingsSubset(): array { ]; } - #[\PHPUnit\Framework\Attributes\DataProvider('dataTestSaveUserSettings')] + #[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'dataTestSaveUserSettings')] public function testSaveUserSettings(array $data, ?string $oldEmailAddress, ?string $oldDisplayName): void { $controller = $this->getController(); $user = $this->createMock(IUser::class); @@ -783,7 +783,7 @@ public static function dataTestSaveUserSettings(): array { ]; } - #[\PHPUnit\Framework\Attributes\DataProvider('dataTestSaveUserSettingsException')] + #[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'dataTestSaveUserSettingsException')] public function testSaveUserSettingsException( array $data, string $oldEmailAddress, @@ -866,7 +866,7 @@ public static function dataTestSaveUserSettingsException(): array { ]; } - #[\PHPUnit\Framework\Attributes\DataProvider('dataTestGetVerificationCode')] + #[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'dataTestGetVerificationCode')] public function testGetVerificationCode(string $account, string $type, array $dataBefore, array $expectedData, bool $onlyVerificationCode): void { $message = 'Use my Federated Cloud ID to share with me: user@nextcloud.com'; $signature = 'theSignature'; @@ -961,7 +961,7 @@ public function testGetVerificationCodeInvalidUser(): void { $this->assertSame(Http::STATUS_BAD_REQUEST, $result->getStatus()); } - #[\PHPUnit\Framework\Attributes\DataProvider('dataTestCanAdminChangeUserPasswords')] + #[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'dataTestCanAdminChangeUserPasswords')] public function testCanAdminChangeUserPasswords( bool $encryptionEnabled, bool $encryptionModuleLoaded, @@ -1003,7 +1003,7 @@ public static function dataTestCanAdminChangeUserPasswords(): array { [false, false, false, true], ]; } - #[\PHPUnit\Framework\Attributes\DataProvider('dataSetPreference')] + #[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'dataSetPreference')] public function testSetPreference(string $key, string $value, bool $isUserValue, bool $isAppValue, int $expectedStatus): void { $controller = $this->getController(false, []); $user = $this->createMock(IUser::class); diff --git a/apps/settings/tests/Integration/DuplicateAssignmentIntegrationTest.php b/apps/settings/tests/Integration/DuplicateAssignmentIntegrationTest.php index a66f2d398c9a5..281e6335ee913 100644 --- a/apps/settings/tests/Integration/DuplicateAssignmentIntegrationTest.php +++ b/apps/settings/tests/Integration/DuplicateAssignmentIntegrationTest.php @@ -17,7 +17,7 @@ * Integration test for duplicate prevention in AuthorizedGroupService * This test verifies the complete flow of duplicate detection and prevention */ -#[\PHPUnit\Framework\Attributes\Group('DB')] +#[\PHPUnit\Framework\Attributes\Group(name: 'DB')] class DuplicateAssignmentIntegrationTest extends TestCase { private AuthorizedGroupService $service; diff --git a/apps/settings/tests/Settings/Admin/MailTest.php b/apps/settings/tests/Settings/Admin/MailTest.php index 992c7d43dba4c..44e0e2ada18c8 100644 --- a/apps/settings/tests/Settings/Admin/MailTest.php +++ b/apps/settings/tests/Settings/Admin/MailTest.php @@ -38,7 +38,7 @@ public static function dataGetForm(): array { ]; } - #[\PHPUnit\Framework\Attributes\DataProvider('dataGetForm')] + #[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'dataGetForm')] public function testGetForm(bool $sendmail) { $finder = $this->createMock(IBinaryFinder::class); $finder->expects(self::once()) diff --git a/apps/settings/tests/Settings/Admin/SecurityTest.php b/apps/settings/tests/Settings/Admin/SecurityTest.php index 89a6d8c0d88f3..c27e5c9992612 100644 --- a/apps/settings/tests/Settings/Admin/SecurityTest.php +++ b/apps/settings/tests/Settings/Admin/SecurityTest.php @@ -17,8 +17,8 @@ use Test\TestCase; class SecurityTest extends TestCase { - private Manager $manager; - private IUserManager $userManager; + private Manager&MockObject $manager; + private IUserManager&MockObject $userManager; private MandatoryTwoFactor&MockObject $mandatoryTwoFactor; private IInitialState&MockObject $initialState; private Security $admin; @@ -46,7 +46,7 @@ public static function encryptionSettingsProvider(): array { ]; } - #[\PHPUnit\Framework\Attributes\DataProvider('encryptionSettingsProvider')] + #[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'encryptionSettingsProvider')] public function testGetFormWithOnlyOneBackend(bool $enabled): void { $this->manager ->expects($this->once()) @@ -76,7 +76,7 @@ public function testGetFormWithOnlyOneBackend(bool $enabled): void { /** * @param bool $enabled */ - #[\PHPUnit\Framework\Attributes\DataProvider('encryptionSettingsProvider')] + #[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'encryptionSettingsProvider')] public function testGetFormWithMultipleBackends($enabled): void { $this->manager ->expects($this->once()) diff --git a/apps/settings/tests/Settings/Admin/ServerTest.php b/apps/settings/tests/Settings/Admin/ServerTest.php index 81ca77bd6a488..b99e3c1f2a997 100644 --- a/apps/settings/tests/Settings/Admin/ServerTest.php +++ b/apps/settings/tests/Settings/Admin/ServerTest.php @@ -17,11 +17,11 @@ use OCP\IConfig; use OCP\IDBConnection; use OCP\IL10N; -use OCP\IUrlGenerator; +use OCP\IURLGenerator; use PHPUnit\Framework\MockObject\MockObject; use Test\TestCase; -#[\PHPUnit\Framework\Attributes\Group('DB')] +#[\PHPUnit\Framework\Attributes\Group(name: 'DB')] class ServerTest extends TestCase { private IDBConnection $connection; private Server&MockObject $admin; @@ -31,7 +31,7 @@ class ServerTest extends TestCase { private IConfig&MockObject $config; private IAppConfig&MockObject $appConfig; private IL10N&MockObject $l10n; - private IUrlGenerator&MockObject $urlGenerator; + private IURLGenerator&MockObject $urlGenerator; protected function setUp(): void { parent::setUp(); @@ -42,7 +42,7 @@ protected function setUp(): void { $this->config = $this->createMock(IConfig::class); $this->appConfig = $this->createMock(IAppConfig::class); $this->l10n = $this->createMock(IL10N::class); - $this->urlGenerator = $this->createMock(IUrlGenerator::class); + $this->urlGenerator = $this->createMock(IURLGenerator::class); $this->admin = $this->getMockBuilder(Server::class) ->onlyMethods(['cronMaxAge']) diff --git a/apps/settings/tests/SetupChecks/DataDirectoryProtectedTest.php b/apps/settings/tests/SetupChecks/DataDirectoryProtectedTest.php index c20c78c6e1630..2081e8151e776 100644 --- a/apps/settings/tests/SetupChecks/DataDirectoryProtectedTest.php +++ b/apps/settings/tests/SetupChecks/DataDirectoryProtectedTest.php @@ -54,7 +54,7 @@ protected function setUp(): void { ->getMock(); } - #[\PHPUnit\Framework\Attributes\DataProvider('dataTestStatusCode')] + #[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'dataTestStatusCode')] public function testStatusCode(array $status, string $expected, bool $hasBody): void { $responses = array_map(function ($state) use ($hasBody) { $response = $this->createMock(IResponse::class); diff --git a/apps/settings/tests/SetupChecks/ForwardedForHeadersTest.php b/apps/settings/tests/SetupChecks/ForwardedForHeadersTest.php index 9b4878b45ccf2..92896af868d80 100644 --- a/apps/settings/tests/SetupChecks/ForwardedForHeadersTest.php +++ b/apps/settings/tests/SetupChecks/ForwardedForHeadersTest.php @@ -14,13 +14,15 @@ use OCP\IRequest; use OCP\IURLGenerator; use OCP\SetupCheck\SetupResult; +use PHPUnit\Framework\Attributes\DataProvider; +use PHPUnit\Framework\MockObject\MockObject; use Test\TestCase; class ForwardedForHeadersTest extends TestCase { - private IL10N $l10n; - private IConfig $config; - private IURLGenerator $urlGenerator; - private IRequest $request; + private IL10N&MockObject $l10n; + private IConfig&MockObject $config; + private IURLGenerator&MockObject $urlGenerator; + private IRequest&MockObject $request; private ForwardedForHeaders $check; protected function setUp(): void { @@ -32,9 +34,9 @@ protected function setUp(): void { ->willReturnCallback(function ($message, array $replace) { return vsprintf($message, $replace); }); - $this->config = $this->getMockBuilder(IConfig::class)->getMock(); - $this->urlGenerator = $this->getMockBuilder(IURLGenerator::class)->getMock(); - $this->request = $this->getMockBuilder(IRequest::class)->getMock(); + $this->config = $this->createMock(IConfig::class); + $this->urlGenerator = $this->createMock(IURLGenerator::class); + $this->request = $this->createMock(IRequest::class); $this->check = new ForwardedForHeaders( $this->l10n, $this->config, @@ -43,7 +45,7 @@ protected function setUp(): void { ); } - #[\PHPUnit\Framework\Attributes\DataProvider('dataForwardedForHeadersWorking')] + #[DataProvider(methodName: 'dataForwardedForHeadersWorking')] public function testForwardedForHeadersWorking(array $trustedProxies, string $remoteAddrNotForwarded, string $remoteAddr, string $result): void { $this->config->expects($this->once()) ->method('getSystemValue') diff --git a/apps/settings/tests/SetupChecks/LoggingLevelTest.php b/apps/settings/tests/SetupChecks/LoggingLevelTest.php index 67224e11e3a70..feeee792a3483 100644 --- a/apps/settings/tests/SetupChecks/LoggingLevelTest.php +++ b/apps/settings/tests/SetupChecks/LoggingLevelTest.php @@ -59,7 +59,7 @@ public static function dataRun(): array { ]; } - #[\PHPUnit\Framework\Attributes\DataProvider('dataRun')] + #[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'dataRun')] public function testRun(string|int $value, string $expected): void { $this->urlGenerator->method('linkToDocs')->willReturn('admin-logging'); diff --git a/apps/settings/tests/SetupChecks/SecurityHeadersTest.php b/apps/settings/tests/SetupChecks/SecurityHeadersTest.php index 1f75907d42712..1180bdadcef5d 100644 --- a/apps/settings/tests/SetupChecks/SecurityHeadersTest.php +++ b/apps/settings/tests/SetupChecks/SecurityHeadersTest.php @@ -106,7 +106,7 @@ public static function dataSuccess(): array { ]; } - #[\PHPUnit\Framework\Attributes\DataProvider('dataSuccess')] + #[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'dataSuccess')] public function testSuccess(array $headers): void { $headers = array_merge( [ @@ -145,7 +145,7 @@ public static function dataFailure(): array { ]; } - #[\PHPUnit\Framework\Attributes\DataProvider('dataFailure')] + #[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'dataFailure')] public function testFailure(array $headers, string $msg): void { $headers = array_merge( [ diff --git a/apps/settings/tests/SetupChecks/SupportedDatabaseTest.php b/apps/settings/tests/SetupChecks/SupportedDatabaseTest.php index dc16d044dc1c4..f63326e782162 100644 --- a/apps/settings/tests/SetupChecks/SupportedDatabaseTest.php +++ b/apps/settings/tests/SetupChecks/SupportedDatabaseTest.php @@ -16,7 +16,7 @@ use OCP\SetupCheck\SetupResult; use Test\TestCase; -#[\PHPUnit\Framework\Attributes\Group('DB')] +#[\PHPUnit\Framework\Attributes\Group(name: 'DB')] class SupportedDatabaseTest extends TestCase { private IL10N $l10n; private IUrlGenerator $urlGenerator; diff --git a/apps/settings/tests/SetupChecks/TaskProcessingPickupSpeedTest.php b/apps/settings/tests/SetupChecks/TaskProcessingPickupSpeedTest.php index 6375d9f6e7fa2..f914f03451641 100644 --- a/apps/settings/tests/SetupChecks/TaskProcessingPickupSpeedTest.php +++ b/apps/settings/tests/SetupChecks/TaskProcessingPickupSpeedTest.php @@ -14,21 +14,22 @@ use OCP\SetupCheck\SetupResult; use OCP\TaskProcessing\IManager; use OCP\TaskProcessing\Task; +use PHPUnit\Framework\MockObject\MockObject; use Test\TestCase; class TaskProcessingPickupSpeedTest extends TestCase { - private IL10N $l10n; - private ITimeFactory $timeFactory; - private IManager $taskProcessingManager; + private IL10N&MockObject $l10n; + private ITimeFactory&MockObject $timeFactory; + private IManager&MockObject $taskProcessingManager; private TaskProcessingPickupSpeed $check; protected function setUp(): void { parent::setUp(); - $this->l10n = $this->getMockBuilder(IL10N::class)->getMock(); - $this->timeFactory = $this->getMockBuilder(ITimeFactory::class)->getMock(); - $this->taskProcessingManager = $this->getMockBuilder(IManager::class)->getMock(); + $this->l10n = $this->createMock(IL10N::class); + $this->timeFactory = $this->createMock(ITimeFactory::class); + $this->taskProcessingManager = $this->createMock(IManager::class); $this->check = new TaskProcessingPickupSpeed( $this->l10n, diff --git a/apps/settings/tests/SetupChecks/TaskProcessingSuccessRateTest.php b/apps/settings/tests/SetupChecks/TaskProcessingSuccessRateTest.php index 2c8b850ff6ae8..7a1857c3a2d5c 100644 --- a/apps/settings/tests/SetupChecks/TaskProcessingSuccessRateTest.php +++ b/apps/settings/tests/SetupChecks/TaskProcessingSuccessRateTest.php @@ -14,12 +14,13 @@ use OCP\SetupCheck\SetupResult; use OCP\TaskProcessing\IManager; use OCP\TaskProcessing\Task; +use PHPUnit\Framework\MockObject\MockObject; use Test\TestCase; class TaskProcessingSuccessRateTest extends TestCase { - private IL10N $l10n; - private ITimeFactory $timeFactory; - private IManager $taskProcessingManager; + private IL10N&MockObject $l10n; + private ITimeFactory&MockObject $timeFactory; + private IManager&MockObject $taskProcessingManager; private TaskProcessingSuccessRate $check; diff --git a/apps/settings/tests/SetupChecks/WellKnownUrlsTest.php b/apps/settings/tests/SetupChecks/WellKnownUrlsTest.php index 06675f658c8bf..0bbb2fcf02522 100644 --- a/apps/settings/tests/SetupChecks/WellKnownUrlsTest.php +++ b/apps/settings/tests/SetupChecks/WellKnownUrlsTest.php @@ -97,7 +97,7 @@ public function testNoResponse(): void { /** * Test responses */ - #[\PHPUnit\Framework\Attributes\DataProvider('dataTestResponses')] + #[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'dataTestResponses')] public function testResponses($responses, string $expectedSeverity): void { $createResponse = function (int $statuscode, array $header = []): IResponse&MockObject { $response = $this->createMock(IResponse::class); diff --git a/apps/settings/tests/UserMigration/AccountMigratorTest.php b/apps/settings/tests/UserMigration/AccountMigratorTest.php index 162eeef526fdd..0938f36c48cf0 100644 --- a/apps/settings/tests/UserMigration/AccountMigratorTest.php +++ b/apps/settings/tests/UserMigration/AccountMigratorTest.php @@ -23,7 +23,7 @@ use Symfony\Component\Console\Output\OutputInterface; use Test\TestCase; -#[\PHPUnit\Framework\Attributes\Group('DB')] +#[\PHPUnit\Framework\Attributes\Group(name: 'DB')] class AccountMigratorTest extends TestCase { private IUserManager $userManager; private IAvatarManager $avatarManager; @@ -83,7 +83,7 @@ static function (string $filename): array { ); } - #[\PHPUnit\Framework\Attributes\DataProvider('dataImportExportAccount')] + #[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'dataImportExportAccount')] public function testImportExportAccount(string $userId, array $importData, string $avatarPath, array $importConfig): void { $user = $this->userManager->createUser($userId, 'topsecretpassword'); $avatarExt = pathinfo($avatarPath, PATHINFO_EXTENSION); diff --git a/apps/sharebymail/tests/ShareByMailProviderTest.php b/apps/sharebymail/tests/ShareByMailProviderTest.php index 3386e55abd88d..66afbd3335bcd 100644 --- a/apps/sharebymail/tests/ShareByMailProviderTest.php +++ b/apps/sharebymail/tests/ShareByMailProviderTest.php @@ -48,7 +48,7 @@ * * @package OCA\ShareByMail\Tests */ -#[\PHPUnit\Framework\Attributes\Group('DB')] +#[\PHPUnit\Framework\Attributes\Group(name: 'DB')] class ShareByMailProviderTest extends TestCase { use EmailValidatorTrait; @@ -827,7 +827,7 @@ public static function dataUpdateSendPassword(): array { ]; } - #[\PHPUnit\Framework\Attributes\DataProvider('dataUpdateSendPassword')] + #[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'dataUpdateSendPassword')] public function testUpdateSendPassword(?string $plainTextPassword, string $originalPassword, string $newPassword, bool $originalSendPasswordByTalk, bool $newSendPasswordByTalk, bool $sendMail): void { $node = $this->createMock(File::class); $node->expects($this->any())->method('getName')->willReturn('filename'); diff --git a/apps/theming/tests/CapabilitiesTest.php b/apps/theming/tests/CapabilitiesTest.php index aa08a45a28b1e..7201301d1087e 100644 --- a/apps/theming/tests/CapabilitiesTest.php +++ b/apps/theming/tests/CapabilitiesTest.php @@ -130,7 +130,7 @@ public static function dataGetCapabilities(): array { /** * @param non-empty-array $expected */ - #[\PHPUnit\Framework\Attributes\DataProvider('dataGetCapabilities')] + #[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'dataGetCapabilities')] public function testGetCapabilities(string $name, string $url, string $slogan, string $color, string $textColor, string $logo, string $background, string $backgroundColor, string $backgroundTextColor, string $baseUrl, bool $backgroundThemed, array $expected): void { $this->config->expects($this->once()) ->method('getAppValue') diff --git a/apps/theming/tests/Controller/IconControllerTest.php b/apps/theming/tests/Controller/IconControllerTest.php index c5034600e0364..018947d4a67e9 100644 --- a/apps/theming/tests/Controller/IconControllerTest.php +++ b/apps/theming/tests/Controller/IconControllerTest.php @@ -18,6 +18,7 @@ use OCP\AppFramework\Http\DataDisplayResponse; use OCP\AppFramework\Http\FileDisplayResponse; use OCP\AppFramework\Utility\ITimeFactory; +use OCP\Files\File; use OCP\Files\NotFoundException; use OCP\IRequest; use PHPUnit\Framework\MockObject\MockObject; @@ -61,8 +62,8 @@ protected function setUp(): void { parent::setUp(); } - private function iconFileMock($filename, $data) { - $icon = $this->getMockBuilder('OCP\Files\File')->getMock(); + private function iconFileMock($filename, $data): SimpleFile { + $icon = $this->createMock(File::class); $icon->expects($this->any())->method('getContent')->willReturn($data); $icon->expects($this->any())->method('getMimeType')->willReturn('image type'); $icon->expects($this->any())->method('getEtag')->willReturn('my etag'); diff --git a/apps/theming/tests/Controller/ThemingControllerTest.php b/apps/theming/tests/Controller/ThemingControllerTest.php index cfac9125c10f5..5925404b4ea2b 100644 --- a/apps/theming/tests/Controller/ThemingControllerTest.php +++ b/apps/theming/tests/Controller/ThemingControllerTest.php @@ -98,7 +98,7 @@ public static function dataUpdateStylesheetSuccess(): array { ]; } - #[\PHPUnit\Framework\Attributes\DataProvider('dataUpdateStylesheetSuccess')] + #[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'dataUpdateStylesheetSuccess')] public function testUpdateStylesheetSuccess(string $setting, string $value, string $message, ?string $realSetting = null): void { $this->themingDefaults ->expects($this->once()) @@ -156,7 +156,7 @@ public static function dataUpdateStylesheetError(): array { ]; } - #[\PHPUnit\Framework\Attributes\DataProvider('dataUpdateStylesheetError')] + #[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'dataUpdateStylesheetError')] public function testUpdateStylesheetError(string $setting, string $value, string $message): void { $this->themingDefaults ->expects($this->never()) @@ -345,7 +345,7 @@ public static function dataUpdateImages(): array { ]; } - #[\PHPUnit\Framework\Attributes\DataProvider('dataUpdateImages')] + #[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'dataUpdateImages')] public function testUpdateLogoNormalLogoUpload(string $mimeType, bool $folderExists = true): void { $tmpLogo = Server::get(ITempManager::class)->getTemporaryFolder() . '/logo.svg'; $destination = Server::get(ITempManager::class)->getTemporaryFolder(); @@ -501,7 +501,7 @@ public static function dataPhpUploadErrors(): array { ]; } - #[\PHPUnit\Framework\Attributes\DataProvider('dataPhpUploadErrors')] + #[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'dataPhpUploadErrors')] public function testUpdateLogoLoginScreenUploadWithInvalidImageUpload(int $error, string $expectedErrorMessage): void { $this->request ->expects($this->once()) @@ -538,7 +538,7 @@ public function testUpdateLogoLoginScreenUploadWithInvalidImageUpload(int $error $this->assertEquals($expected, $this->themingController->uploadImage()); } - #[\PHPUnit\Framework\Attributes\DataProvider('dataPhpUploadErrors')] + #[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'dataPhpUploadErrors')] public function testUpdateLogoUploadWithInvalidImageUpload($error, $expectedErrorMessage): void { $this->request ->expects($this->once()) @@ -607,7 +607,7 @@ public static function dataUndoDelete(): array { ]; } - #[\PHPUnit\Framework\Attributes\DataProvider('dataUndoDelete')] + #[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'dataUndoDelete')] public function testUndoDelete(string $value, string $filename): void { $this->l10n ->expects($this->once()) @@ -707,7 +707,7 @@ public static function dataGetManifest(): array { ]; } - #[\PHPUnit\Framework\Attributes\DataProvider('dataGetManifest')] + #[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'dataGetManifest')] public function testGetManifest(bool $standalone): void { $this->config ->expects($this->once()) diff --git a/apps/theming/tests/Controller/UserThemeControllerTest.php b/apps/theming/tests/Controller/UserThemeControllerTest.php index 9a8c1cd19aa19..ccdd0420dc44c 100644 --- a/apps/theming/tests/Controller/UserThemeControllerTest.php +++ b/apps/theming/tests/Controller/UserThemeControllerTest.php @@ -92,7 +92,7 @@ public static function dataTestThemes(): array { ]; } - #[\PHPUnit\Framework\Attributes\DataProvider('dataTestThemes')] + #[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'dataTestThemes')] public function testEnableTheme(string $themeId, ?string $exception = null): void { $this->themesService ->expects($this->any()) @@ -107,7 +107,7 @@ public function testEnableTheme(string $themeId, ?string $exception = null): voi $this->assertEquals($expected, $this->userThemeController->enableTheme($themeId)); } - #[\PHPUnit\Framework\Attributes\DataProvider('dataTestThemes')] + #[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'dataTestThemes')] public function testDisableTheme(string $themeId, ?string $exception = null): void { $this->themesService ->expects($this->any()) diff --git a/apps/theming/tests/IconBuilderTest.php b/apps/theming/tests/IconBuilderTest.php index d881e4eb75cc3..ac3de267c7fd8 100644 --- a/apps/theming/tests/IconBuilderTest.php +++ b/apps/theming/tests/IconBuilderTest.php @@ -63,7 +63,7 @@ public static function dataRenderAppIcon(): array { ]; } - #[\PHPUnit\Framework\Attributes\DataProvider('dataRenderAppIcon')] + #[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'dataRenderAppIcon')] public function testRenderAppIcon(string $app, string $color, string $file): void { $this->checkImagick(); $this->themingDefaults->expects($this->once()) @@ -87,7 +87,7 @@ public function testRenderAppIcon(string $app, string $color, string $file): voi // cloud be something like $expectedIcon->compareImages($icon, Imagick::METRIC_MEANABSOLUTEERROR)[1]) } - #[\PHPUnit\Framework\Attributes\DataProvider('dataRenderAppIcon')] + #[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'dataRenderAppIcon')] public function testGetTouchIcon(string $app, string $color, string $file): void { $this->checkImagick(); $this->themingDefaults->expects($this->once()) @@ -112,7 +112,7 @@ public function testGetTouchIcon(string $app, string $color, string $file): void // cloud be something like $expectedIcon->compareImages($icon, Imagick::METRIC_MEANABSOLUTEERROR)[1]) } - #[\PHPUnit\Framework\Attributes\DataProvider('dataRenderAppIcon')] + #[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'dataRenderAppIcon')] public function testGetFavicon(string $app, string $color, string $file): void { $this->checkImagick(); $this->imageManager->expects($this->once()) diff --git a/apps/theming/tests/ImageManagerTest.php b/apps/theming/tests/ImageManagerTest.php index 0c4d555cc00ef..9f64dd6a3854e 100644 --- a/apps/theming/tests/ImageManagerTest.php +++ b/apps/theming/tests/ImageManagerTest.php @@ -313,7 +313,7 @@ public static function dataUpdateImage(): array { ]; } - #[\PHPUnit\Framework\Attributes\DataProvider('dataUpdateImage')] + #[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'dataUpdateImage')] public function testUpdateImage(string $key, string $tmpFile, bool $folderExists, bool $shouldConvert): void { $file = $this->createMock(ISimpleFile::class); $folder = $this->createMock(ISimpleFolder::class); diff --git a/apps/theming/tests/Migration/Version2006Date20240905111627Test.php b/apps/theming/tests/Migration/Version2006Date20240905111627Test.php index 430b0b45e24e0..0b721225bd2e7 100644 --- a/apps/theming/tests/Migration/Version2006Date20240905111627Test.php +++ b/apps/theming/tests/Migration/Version2006Date20240905111627Test.php @@ -12,6 +12,7 @@ use OCA\Theming\Migration\Version2006Date20240905111627; use OCP\BackgroundJob\IJobList; use OCP\Config\IUserConfig; +use OCP\DB\ISchemaWrapper; use OCP\IAppConfig; use OCP\IDBConnection; use OCP\IUserManager; @@ -20,7 +21,7 @@ use PHPUnit\Framework\MockObject\MockObject; use Test\TestCase; -#[\PHPUnit\Framework\Attributes\Group('DB')] +#[\PHPUnit\Framework\Attributes\Group(name: 'DB')] class Version2006Date20240905111627Test extends TestCase { private IAppConfig&MockObject $appConfig; @@ -65,7 +66,7 @@ public function testRestoreSystemColors(): void { }); $output = $this->createMock(IOutput::class); - $this->migration->changeSchema($output, fn () => null, []); + $this->migration->changeSchema($output, fn () => $this->createMock(ISchemaWrapper::class), []); $this->assertEquals([ ['theming', 'background_color', 'ffab00', false, false], @@ -73,7 +74,7 @@ public function testRestoreSystemColors(): void { ], $setValueCalls); } - #[\PHPUnit\Framework\Attributes\Group('DB')] + #[\PHPUnit\Framework\Attributes\Group(name: 'DB')] public function testRestoreUserColors(): void { $this->appConfig->expects(self::once()) ->method('getValueString') @@ -109,7 +110,7 @@ public function testRestoreUserColors(): void { Server::get(IDBConnection::class), ); // Run the migration - $migration->changeSchema($output, fn () => null, []); + $migration->changeSchema($output, fn () => $this->createMock(ISchemaWrapper::class), []); // See new value $config->clearCache('theming_legacy'); @@ -123,7 +124,7 @@ public function testRestoreUserColors(): void { /** * Ensure only users with background color but no primary color are migrated */ - #[\PHPUnit\Framework\Attributes\Group('DB')] + #[\PHPUnit\Framework\Attributes\Group(name: 'DB')] public function testRestoreUserColorsWithConflicts(): void { $this->appConfig->expects(self::once()) ->method('getValueString') @@ -163,7 +164,7 @@ public function testRestoreUserColorsWithConflicts(): void { Server::get(IDBConnection::class), ); // Run the migration - $migration->changeSchema($output, fn () => null, []); + $migration->changeSchema($output, fn () => $this->createMock(ISchemaWrapper::class), []); // See new value of only the legacy user $config->clearCacheAll(); diff --git a/apps/theming/tests/Service/ThemesServiceTest.php b/apps/theming/tests/Service/ThemesServiceTest.php index 354ed1dec8559..c14d8f4f48ca0 100644 --- a/apps/theming/tests/Service/ThemesServiceTest.php +++ b/apps/theming/tests/Service/ThemesServiceTest.php @@ -130,7 +130,7 @@ public static function dataTestEnableTheme(): array { * @param string[] $enabledThemes * @param string[] $expectedEnabled */ - #[\PHPUnit\Framework\Attributes\DataProvider('dataTestEnableTheme')] + #[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'dataTestEnableTheme')] public function testEnableTheme(string $toEnable, array $enabledThemes, array $expectedEnabled): void { $user = $this->createMock(IUser::class); $this->userSession->expects($this->any()) @@ -163,7 +163,7 @@ public static function dataTestDisableTheme(): array { * @param string[] $enabledThemes * @param string[] $expectedEnabled */ - #[\PHPUnit\Framework\Attributes\DataProvider('dataTestDisableTheme')] + #[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'dataTestDisableTheme')] public function testDisableTheme(string $toDisable, array $enabledThemes, array $expectedEnabled): void { $user = $this->createMock(IUser::class); $this->userSession->expects($this->any()) @@ -195,7 +195,7 @@ public static function dataTestIsEnabled(): array { /** * @param string[] $enabledThemes */ - #[\PHPUnit\Framework\Attributes\DataProvider('dataTestIsEnabled')] + #[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'dataTestIsEnabled')] public function testIsEnabled(string $themeId, array $enabledThemes, bool $expected): void { $user = $this->createMock(IUser::class); $this->userSession->expects($this->any()) @@ -273,7 +273,7 @@ public static function dataTestSetEnabledThemes(): array { * @param string[] $enabledThemes * @param string[] $expected */ - #[\PHPUnit\Framework\Attributes\DataProvider('dataTestSetEnabledThemes')] + #[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'dataTestSetEnabledThemes')] public function testSetEnabledThemes(array $enabledThemes, array $expected): void { $user = $this->createMock(IUser::class); $this->userSession->expects($this->any()) diff --git a/apps/theming/tests/ServicesTest.php b/apps/theming/tests/ServicesTest.php index 7bacd43cf08a8..20883bd04ef10 100644 --- a/apps/theming/tests/ServicesTest.php +++ b/apps/theming/tests/ServicesTest.php @@ -26,7 +26,7 @@ * * @package OCA\Theming\Tests */ -#[\PHPUnit\Framework\Attributes\Group('DB')] +#[\PHPUnit\Framework\Attributes\Group(name: 'DB')] class ServicesTest extends TestCase { protected App $app; @@ -60,7 +60,7 @@ public static function queryData(): array { ]; } - #[\PHPUnit\Framework\Attributes\DataProvider('queryData')] + #[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'queryData')] public function testContainerQuery(string $service, ?string $expected = null): void { if ($expected === null) { $expected = $service; diff --git a/apps/theming/tests/Settings/PersonalTest.php b/apps/theming/tests/Settings/PersonalTest.php index 6446464f02e9d..4ac9d97e4ae1e 100644 --- a/apps/theming/tests/Settings/PersonalTest.php +++ b/apps/theming/tests/Settings/PersonalTest.php @@ -85,7 +85,7 @@ public static function dataTestGetForm(): array { ]; } - #[DataProvider('dataTestGetForm')] + #[DataProvider(methodName: 'dataTestGetForm')] public function testGetForm(string $enforcedTheme, array $themesState): void { $themesState = array_map( $this->formatThemeForm(...), diff --git a/apps/theming/tests/Themes/AccessibleThemeTestCase.php b/apps/theming/tests/Themes/AccessibleThemeTestCase.php index 145dd33531d3a..e1cdb795b1b27 100644 --- a/apps/theming/tests/Themes/AccessibleThemeTestCase.php +++ b/apps/theming/tests/Themes/AccessibleThemeTestCase.php @@ -201,7 +201,7 @@ public static function dataAccessibilityPairs(): array { ]; } - #[\PHPUnit\Framework\Attributes\DataProvider('dataAccessibilityPairs')] + #[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'dataAccessibilityPairs')] public function testAccessibilityOfVariables(array $mainColors, array $backgroundColors, float $minContrast): void { if (!isset($this->theme)) { $this->markTestSkipped('You need to setup $this->theme in your setUp function'); diff --git a/apps/theming/tests/Themes/DyslexiaFontTest.php b/apps/theming/tests/Themes/DyslexiaFontTest.php index 7d56fb4b1be3d..997f3f685d52d 100644 --- a/apps/theming/tests/Themes/DyslexiaFontTest.php +++ b/apps/theming/tests/Themes/DyslexiaFontTest.php @@ -149,7 +149,7 @@ public static function dataTestGetCustomCss(): array { * Ensure the fonts are always loaded from the web root * despite having url rewriting enabled or not */ - #[\PHPUnit\Framework\Attributes\DataProvider('dataTestGetCustomCss')] + #[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'dataTestGetCustomCss')] public function testGetCustomCss(string $webRoot, bool $prettyUrlsEnabled): void { \OC::$WEBROOT = $webRoot; $this->config->expects($this->any()) diff --git a/apps/theming/tests/ThemingDefaultsTest.php b/apps/theming/tests/ThemingDefaultsTest.php index 54ea6e0c5ee44..0338752f2a687 100644 --- a/apps/theming/tests/ThemingDefaultsTest.php +++ b/apps/theming/tests/ThemingDefaultsTest.php @@ -185,7 +185,7 @@ public static function legalUrlProvider(): array { ]; } - #[\PHPUnit\Framework\Attributes\DataProvider('legalUrlProvider')] + #[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'legalUrlProvider')] public function testGetImprintURL(string $imprintUrl): void { $this->appConfig ->expects($this->once()) @@ -196,7 +196,7 @@ public function testGetImprintURL(string $imprintUrl): void { $this->assertEquals($imprintUrl, $this->template->getImprintUrl()); } - #[\PHPUnit\Framework\Attributes\DataProvider('legalUrlProvider')] + #[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'legalUrlProvider')] public function testGetPrivacyURL(string $privacyUrl): void { $this->appConfig ->expects($this->once()) @@ -344,7 +344,7 @@ public static function invalidLegalUrlProvider(): array { ]; } - #[\PHPUnit\Framework\Attributes\DataProvider('invalidLegalUrlProvider')] + #[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'invalidLegalUrlProvider')] public function testGetShortFooterInvalidImprint(string $invalidImprintUrl): void { $this->navigationManager->expects($this->once())->method('getAll')->with(INavigationManager::TYPE_GUEST)->willReturn([]); $this->appConfig @@ -361,7 +361,7 @@ public function testGetShortFooterInvalidImprint(string $invalidImprintUrl): voi $this->assertEquals('Name – Slogan', $this->template->getShortFooter()); } - #[\PHPUnit\Framework\Attributes\DataProvider('invalidLegalUrlProvider')] + #[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'invalidLegalUrlProvider')] public function testGetShortFooterInvalidPrivacy(string $invalidPrivacyUrl): void { $this->navigationManager->expects($this->once())->method('getAll')->with(INavigationManager::TYPE_GUEST)->willReturn([]); $this->appConfig @@ -449,7 +449,7 @@ public static function dataGetColorPrimary(): array { ]; } - #[\PHPUnit\Framework\Attributes\DataProvider('dataGetColorPrimary')] + #[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'dataGetColorPrimary')] public function testGetColorPrimary(bool $disableTheming, string $primaryColor, string $userPrimaryColor, string $expected): void { $user = $this->createMock(IUser::class); $this->userSession->expects($this->any()) @@ -803,7 +803,7 @@ public static function dataReplaceImagePath(): array { ]; } - #[\PHPUnit\Framework\Attributes\DataProvider('dataReplaceImagePath')] + #[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'dataReplaceImagePath')] public function testReplaceImagePath(string $app, string $image, string|bool $result = 'themingRoute?v=1234abcd'): void { $this->cache->expects($this->any()) ->method('get') @@ -835,7 +835,7 @@ public static function setTypesProvider(): array { ]; } - #[\PHPUnit\Framework\Attributes\DataProvider('setTypesProvider')] + #[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'setTypesProvider')] public function testSetTypes(string $setting, string $value, mixed $expected): void { $setValue = null; $cb = function ($setting, $value) use (&$setValue) { diff --git a/apps/theming/tests/UtilTest.php b/apps/theming/tests/UtilTest.php index 1e944027e32cd..301d8ddd1e782 100644 --- a/apps/theming/tests/UtilTest.php +++ b/apps/theming/tests/UtilTest.php @@ -48,7 +48,7 @@ public static function dataColorContrast(): array { ]; } - #[\PHPUnit\Framework\Attributes\DataProvider('dataColorContrast')] + #[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'dataColorContrast')] public function testColorContrast(string $color1, string $color2, int|float $contrast): void { $this->assertEqualsWithDelta($contrast, $this->util->colorContrast($color1, $color2), .001); } @@ -61,7 +61,7 @@ public static function dataInvertTextColor(): array { ['#ffff00', true], ]; } - #[\PHPUnit\Framework\Attributes\DataProvider('dataInvertTextColor')] + #[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'dataInvertTextColor')] public function testInvertTextColor(string $color, bool $expected): void { $invert = $this->util->invertTextColor($color); $this->assertEquals($expected, $invert); @@ -139,7 +139,7 @@ public function testGenerateRadioButtonBlack(): void { $this->assertEquals($expected, $button); } - #[\PHPUnit\Framework\Attributes\DataProvider('dataGetAppIcon')] + #[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'dataGetAppIcon')] public function testGetAppIcon(string $app, string $expected): void { $this->appData->expects($this->any()) ->method('getFolder') @@ -172,7 +172,7 @@ public function testGetAppIconThemed(): void { $this->assertEquals($file, $icon); } - #[\PHPUnit\Framework\Attributes\DataProvider('dataGetAppImage')] + #[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'dataGetAppImage')] public function testGetAppImage(string $app, string $image, string|bool $expected): void { $this->assertEquals($expected, $this->util->getAppImage($app, $image)); } @@ -218,7 +218,7 @@ public static function dataIsBackgroundThemed(): array { ['backgroundColor', false], ]; } - #[\PHPUnit\Framework\Attributes\DataProvider('dataIsBackgroundThemed')] + #[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'dataIsBackgroundThemed')] public function testIsBackgroundThemed(string $backgroundMime, bool $expected): void { $this->config->expects($this->once()) ->method('getAppValue') diff --git a/apps/twofactor_backupcodes/tests/Db/BackupCodeMapperTest.php b/apps/twofactor_backupcodes/tests/Db/BackupCodeMapperTest.php index b0c5be0f9c662..0da2e96c69d38 100644 --- a/apps/twofactor_backupcodes/tests/Db/BackupCodeMapperTest.php +++ b/apps/twofactor_backupcodes/tests/Db/BackupCodeMapperTest.php @@ -15,7 +15,7 @@ use OCP\Server; use Test\TestCase; -#[\PHPUnit\Framework\Attributes\Group('DB')] +#[\PHPUnit\Framework\Attributes\Group(name: 'DB')] class BackupCodeMapperTest extends TestCase { private IDBConnection $db; private BackupCodeMapper $mapper; diff --git a/apps/twofactor_backupcodes/tests/Service/BackupCodeStorageTest.php b/apps/twofactor_backupcodes/tests/Service/BackupCodeStorageTest.php index afba7d6d985f7..dd86e96137caf 100644 --- a/apps/twofactor_backupcodes/tests/Service/BackupCodeStorageTest.php +++ b/apps/twofactor_backupcodes/tests/Service/BackupCodeStorageTest.php @@ -16,7 +16,7 @@ use PHPUnit\Framework\MockObject\MockObject; use Test\TestCase; -#[\PHPUnit\Framework\Attributes\Group('DB')] +#[\PHPUnit\Framework\Attributes\Group(name: 'DB')] class BackupCodeStorageTest extends TestCase { private IManager&MockObject $notificationManager; private string $testUID = 'test123456789'; diff --git a/apps/twofactor_backupcodes/tests/Unit/Activity/ProviderTest.php b/apps/twofactor_backupcodes/tests/Unit/Activity/ProviderTest.php index 152ff80194a82..99e695a103505 100644 --- a/apps/twofactor_backupcodes/tests/Unit/Activity/ProviderTest.php +++ b/apps/twofactor_backupcodes/tests/Unit/Activity/ProviderTest.php @@ -51,7 +51,7 @@ public static function subjectData(): array { ]; } - #[\PHPUnit\Framework\Attributes\DataProvider('subjectData')] + #[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'subjectData')] public function testParse(string $subject): void { $lang = 'ru'; $event = $this->createMock(IEvent::class); diff --git a/apps/twofactor_backupcodes/tests/Unit/Listener/ClearNotificationsTest.php b/apps/twofactor_backupcodes/tests/Unit/Listener/ClearNotificationsTest.php index 229d8df05d350..01decdaa59e5f 100644 --- a/apps/twofactor_backupcodes/tests/Unit/Listener/ClearNotificationsTest.php +++ b/apps/twofactor_backupcodes/tests/Unit/Listener/ClearNotificationsTest.php @@ -10,7 +10,6 @@ use OCA\TwoFactorBackupCodes\Event\CodesGenerated; use OCA\TwoFactorBackupCodes\Listener\ClearNotifications; -use OCP\EventDispatcher\Event; use OCP\IUser; use OCP\Notification\IManager; use OCP\Notification\INotification; @@ -32,14 +31,6 @@ protected function setUp(): void { $this->listener = new ClearNotifications($this->notificationManager); } - public function testHandleGenericEvent(): void { - $event = $this->createMock(Event::class); - $this->notificationManager->expects($this->never()) - ->method($this->anything()); - - $this->listener->handle($event); - } - public function testHandleCodesGeneratedEvent(): void { $user = $this->createMock(IUser::class); $user->method('getUID')->willReturn('fritz'); diff --git a/apps/twofactor_backupcodes/tests/Unit/Listener/ProviderDisabledTest.php b/apps/twofactor_backupcodes/tests/Unit/Listener/ProviderDisabledTest.php index ea4f530cab4d4..fb606e45efdd4 100644 --- a/apps/twofactor_backupcodes/tests/Unit/Listener/ProviderDisabledTest.php +++ b/apps/twofactor_backupcodes/tests/Unit/Listener/ProviderDisabledTest.php @@ -13,7 +13,6 @@ use OCP\Authentication\TwoFactorAuth\IRegistry; use OCP\Authentication\TwoFactorAuth\TwoFactorProviderForUserUnregistered; use OCP\BackgroundJob\IJobList; -use OCP\EventDispatcher\Event; use OCP\IUser; use PHPUnit\Framework\MockObject\MockObject; use Test\TestCase; @@ -32,14 +31,6 @@ protected function setUp(): void { $this->listener = new ProviderDisabled($this->registy, $this->jobList); } - public function testHandleGenericEvent(): void { - $event = $this->createMock(Event::class); - $this->jobList->expects($this->never()) - ->method($this->anything()); - - $this->listener->handle($event); - } - public function testHandleStillActiveProvider(): void { $user = $this->createMock(IUser::class); $user->method('getUID') diff --git a/apps/twofactor_backupcodes/tests/Unit/Listener/ProviderEnabledTest.php b/apps/twofactor_backupcodes/tests/Unit/Listener/ProviderEnabledTest.php index 50aac6139c043..926bd34dc50db 100644 --- a/apps/twofactor_backupcodes/tests/Unit/Listener/ProviderEnabledTest.php +++ b/apps/twofactor_backupcodes/tests/Unit/Listener/ProviderEnabledTest.php @@ -13,7 +13,6 @@ use OCP\Authentication\TwoFactorAuth\IRegistry; use OCP\Authentication\TwoFactorAuth\TwoFactorProviderForUserRegistered; use OCP\BackgroundJob\IJobList; -use OCP\EventDispatcher\Event; use OCP\IUser; use PHPUnit\Framework\MockObject\MockObject; use Test\TestCase; @@ -32,14 +31,6 @@ protected function setUp(): void { $this->listener = new ProviderEnabled($this->registy, $this->jobList); } - public function testHandleGenericEvent(): void { - $event = $this->createMock(Event::class); - $this->jobList->expects($this->never()) - ->method($this->anything()); - - $this->listener->handle($event); - } - public function testHandleCodesGeneratedEventAlraedyBackupcodes(): void { $user = $this->createMock(IUser::class); $user->method('getUID') diff --git a/apps/twofactor_backupcodes/tests/Unit/Listener/RegistryUpdaterTest.php b/apps/twofactor_backupcodes/tests/Unit/Listener/RegistryUpdaterTest.php index 86d890f0d5e84..1749bb49ae967 100644 --- a/apps/twofactor_backupcodes/tests/Unit/Listener/RegistryUpdaterTest.php +++ b/apps/twofactor_backupcodes/tests/Unit/Listener/RegistryUpdaterTest.php @@ -12,7 +12,6 @@ use OCA\TwoFactorBackupCodes\Listener\RegistryUpdater; use OCA\TwoFactorBackupCodes\Provider\BackupCodesProvider; use OCP\Authentication\TwoFactorAuth\IRegistry; -use OCP\EventDispatcher\Event; use OCP\IUser; use PHPUnit\Framework\MockObject\MockObject; use Test\TestCase; @@ -31,14 +30,6 @@ protected function setUp(): void { $this->listener = new RegistryUpdater($this->registry, $this->provider); } - public function testHandleGenericEvent(): void { - $event = $this->createMock(Event::class); - $this->registry->expects($this->never()) - ->method('enableProviderFor'); - - $this->listener->handle($event); - } - public function testHandleCodesGeneratedEvent(): void { $user = $this->createMock(IUser::class); $event = new CodesGenerated($user); diff --git a/apps/twofactor_backupcodes/tests/Unit/Migration/CheckBackupCodeTest.php b/apps/twofactor_backupcodes/tests/Unit/Migration/CheckBackupCodeTest.php index c68ab18511692..8c1080754fb42 100644 --- a/apps/twofactor_backupcodes/tests/Unit/Migration/CheckBackupCodeTest.php +++ b/apps/twofactor_backupcodes/tests/Unit/Migration/CheckBackupCodeTest.php @@ -11,7 +11,7 @@ use OCA\TwoFactorBackupCodes\Migration\CheckBackupCodes; use OCP\BackgroundJob\IJobList; use OCP\Migration\IOutput; -use PHPunit\Framework\MockObject\MockObject; +use PHPUnit\Framework\MockObject\MockObject; use Test\TestCase; class CheckBackupCodeTest extends TestCase { diff --git a/apps/twofactor_backupcodes/tests/Unit/Service/BackupCodeStorageTest.php b/apps/twofactor_backupcodes/tests/Unit/Service/BackupCodeStorageTest.php index 069e50b71fd66..ef7e6674afaa3 100644 --- a/apps/twofactor_backupcodes/tests/Unit/Service/BackupCodeStorageTest.php +++ b/apps/twofactor_backupcodes/tests/Unit/Service/BackupCodeStorageTest.php @@ -102,7 +102,7 @@ public function testGetBackupCodeState(): void { $code1 = new BackupCode(); $code1->setUsed(1); $code2 = new BackupCode(); - $code2->setUsed('0'); + $code2->setUsed(0); $codes = [ $code1, $code2, @@ -168,7 +168,7 @@ public function testValidateCode(): void { public function testValidateUsedCode(): void { $user = $this->createMock(IUser::class); $code = new BackupCode(); - $code->setUsed('1'); + $code->setUsed(1); $code->setCode('HASHEDVALUE'); $codes = [ $code, diff --git a/apps/updatenotification/tests/BackgroundJob/UpdateAvailableNotificationsTest.php b/apps/updatenotification/tests/BackgroundJob/UpdateAvailableNotificationsTest.php index 26a5ecde05293..9bdf633ca781e 100644 --- a/apps/updatenotification/tests/BackgroundJob/UpdateAvailableNotificationsTest.php +++ b/apps/updatenotification/tests/BackgroundJob/UpdateAvailableNotificationsTest.php @@ -49,10 +49,7 @@ protected function setUp(): void { $this->versionCheck = $this->createMock(VersionCheck::class); } - /** - * @return UpdateAvailableNotifications|MockObject - */ - protected function getJob(array $methods = []): UpdateAvailableNotifications { + protected function getJob(array $methods = []): UpdateAvailableNotifications|MockObject { if (empty($methods)) { return new UpdateAvailableNotifications( $this->timeFactory, @@ -152,7 +149,7 @@ public static function dataCheckCoreUpdate(): array { ]; } - #[\PHPUnit\Framework\Attributes\DataProvider('dataCheckCoreUpdate')] + #[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'dataCheckCoreUpdate')] public function testCheckCoreUpdate(string $channel, mixed $versionCheck, mixed $version, ?string $readableVersion, ?int $errorDays): void { $job = $this->getJob([ 'createNotifications', @@ -229,7 +226,7 @@ public static function dataCheckAppUpdates(): array { ]; } - #[\PHPUnit\Framework\Attributes\DataProvider('dataCheckAppUpdates')] + #[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'dataCheckAppUpdates')] public function testCheckAppUpdates(array $apps, array $isUpdateAvailable, array $notifications): void { $job = $this->getJob([ 'isUpdateAvailable', @@ -264,7 +261,7 @@ public static function dataCreateNotifications(): array { ]; } - #[\PHPUnit\Framework\Attributes\DataProvider('dataCreateNotifications')] + #[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'dataCreateNotifications')] public function testCreateNotifications(string $app, string $version, string|false $lastNotification, string|false $callDelete, bool $createNotification, ?array $users, ?array $userNotifications): void { $job = $this->getJob([ 'deleteOutdatedNotifications', @@ -345,7 +342,7 @@ public static function dataGetUsersToNotify(): array { ]; } - #[\PHPUnit\Framework\Attributes\DataProvider('dataGetUsersToNotify')] + #[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'dataGetUsersToNotify')] public function testGetUsersToNotify(array $groups, array $groupUsers, array $expected): void { $job = $this->getJob(); @@ -389,7 +386,7 @@ public static function dataDeleteOutdatedNotifications(): array { * @param string $app * @param string $version */ - #[\PHPUnit\Framework\Attributes\DataProvider('dataDeleteOutdatedNotifications')] + #[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'dataDeleteOutdatedNotifications')] public function testDeleteOutdatedNotifications(string $app, string $version): void { $notification = $this->createMock(INotification::class); $notification->expects($this->once()) diff --git a/apps/updatenotification/tests/Controller/APIControllerTest.php b/apps/updatenotification/tests/Controller/APIControllerTest.php index 84973e64c2204..fb7ef8ba761ce 100644 --- a/apps/updatenotification/tests/Controller/APIControllerTest.php +++ b/apps/updatenotification/tests/Controller/APIControllerTest.php @@ -55,7 +55,7 @@ protected function setUp(): void { ); } - #[\PHPUnit\Framework\Attributes\DataProvider('dataGetAppChangelog')] + #[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'dataGetAppChangelog')] public function testGetAppChangelogEntry( array $params, bool $hasChanges, diff --git a/apps/updatenotification/tests/Notification/NotifierTest.php b/apps/updatenotification/tests/Notification/NotifierTest.php index aab5a84d6f35b..689dde8b55496 100644 --- a/apps/updatenotification/tests/Notification/NotifierTest.php +++ b/apps/updatenotification/tests/Notification/NotifierTest.php @@ -49,9 +49,8 @@ protected function setUp(): void { /** * @param array $methods - * @return Notifier|MockObject */ - protected function getNotifier(array $methods = []): Notifier { + protected function getNotifier(array $methods = []): Notifier|MockObject { if (empty($methods)) { return new Notifier( $this->urlGenerator, @@ -89,7 +88,7 @@ public static function dataUpdateAlreadyInstalledCheck(): array { ]; } - #[\PHPUnit\Framework\Attributes\DataProvider('dataUpdateAlreadyInstalledCheck')] + #[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'dataUpdateAlreadyInstalledCheck')] public function testUpdateAlreadyInstalledCheck(string $versionNotification, string $versionInstalled, bool $exception): void { $notifier = $this->getNotifier(); diff --git a/apps/updatenotification/tests/Settings/AdminTest.php b/apps/updatenotification/tests/Settings/AdminTest.php index 0429c6280497d..38eb602a0e819 100644 --- a/apps/updatenotification/tests/Settings/AdminTest.php +++ b/apps/updatenotification/tests/Settings/AdminTest.php @@ -448,7 +448,7 @@ public static function changesProvider(): array { ]; } - #[\PHPUnit\Framework\Attributes\DataProvider('changesProvider')] + #[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'changesProvider')] public function testFilterChanges($changes, $userLang, $expectation): void { $iterator = $this->createMock(ILanguageIterator::class); $iterator->expects($this->any()) diff --git a/apps/user_ldap/tests/AccessTest.php b/apps/user_ldap/tests/AccessTest.php index 9154580cc92ec..fc63e5cb73c50 100644 --- a/apps/user_ldap/tests/AccessTest.php +++ b/apps/user_ldap/tests/AccessTest.php @@ -41,7 +41,7 @@ * * @package OCA\User_LDAP\Tests */ -#[\PHPUnit\Framework\Attributes\Group('DB')] +#[\PHPUnit\Framework\Attributes\Group(name: 'DB')] class AccessTest extends TestCase { protected UserMapping&MockObject $userMapper; protected IManager&MockObject $shareManager; @@ -86,7 +86,10 @@ protected function setUp(): void { $this->access->setGroupMapper($this->groupMapper); } - private function getConnectorAndLdapMock() { + /** + * @return array{0: ILDAPWrapper&MockObject, 1: Connection&MockObject, 2: Manager&MockObject, 3: Helper} + */ + private function getConnectorAndLdapMock(): array { /** @var ILDAPWrapper&MockObject */ $lw = $this->createMock(ILDAPWrapper::class); /** @var Connection&MockObject */ @@ -135,7 +138,7 @@ public function testEscapeFilterPartEscapeWildcard2(): void { * @param array $sidArray * @param $sidExpected */ - #[\PHPUnit\Framework\Attributes\DataProvider('convertSID2StrSuccessData')] + #[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'convertSID2StrSuccessData')] public function testConvertSID2StrSuccess(array $sidArray, $sidExpected): void { $sidBinary = implode('', $sidArray); $this->assertSame($sidExpected, $this->access->convertSID2Str($sidBinary)); @@ -219,7 +222,7 @@ public static function dnInputDataProvider(): array { ]; } - #[\PHPUnit\Framework\Attributes\DataProvider('dnInputDataProvider')] + #[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'dnInputDataProvider')] public function testStringResemblesDN(string $input, array|bool $interResult, bool $expectedResult): void { [$lw, $con, $um, $helper] = $this->getConnectorAndLdapMock(); $access = new Access($lw, $con, $um, $helper, $this->ncUserManager, $this->logger, $this->appConfig, $this->dispatcher); @@ -236,7 +239,7 @@ public function testStringResemblesDN(string $input, array|bool $interResult, bo $this->assertSame($expectedResult, $access->stringResemblesDN($input)); } - #[\PHPUnit\Framework\Attributes\DataProvider('dnInputDataProvider')] + #[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'dnInputDataProvider')] public function testStringResemblesDNLDAPmod(string $input, array|bool $interResult, bool $expectedResult): void { [, $con, $um, $helper] = $this->getConnectorAndLdapMock(); $lw = new LDAP(); @@ -406,7 +409,7 @@ public static function dNAttributeProvider(): array { ]; } - #[\PHPUnit\Framework\Attributes\DataProvider('dNAttributeProvider')] + #[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'dNAttributeProvider')] public function testSanitizeDN(string $attribute): void { [$lw, $con, $um, $helper] = $this->getConnectorAndLdapMock(); $dnFromServer = 'cn=Mixed Cases,ou=Are Sufficient To,ou=Test,dc=example,dc=org'; @@ -685,7 +688,7 @@ public static function groupIDCandidateProvider(): array { ]; } - #[\PHPUnit\Framework\Attributes\DataProvider('intUsernameProvider')] + #[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'intUsernameProvider')] public function testSanitizeUsername(string $name, ?string $expected): void { if ($expected === null) { $this->expectException(\InvalidArgumentException::class); @@ -694,7 +697,7 @@ public function testSanitizeUsername(string $name, ?string $expected): void { $this->assertSame($expected, $sanitizedName); } - #[\PHPUnit\Framework\Attributes\DataProvider('groupIDCandidateProvider')] + #[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'groupIDCandidateProvider')] public function testSanitizeGroupIDCandidate(string $name, string $expected): void { $sanitizedName = $this->access->sanitizeGroupIDCandidate($name); $this->assertSame($expected, $sanitizedName); diff --git a/apps/user_ldap/tests/ConfigurationTest.php b/apps/user_ldap/tests/ConfigurationTest.php index db92598fcfde3..c5173331f6de7 100644 --- a/apps/user_ldap/tests/ConfigurationTest.php +++ b/apps/user_ldap/tests/ConfigurationTest.php @@ -86,7 +86,7 @@ public static function configurationDataProvider(): array { ]; } - #[\PHPUnit\Framework\Attributes\DataProvider('configurationDataProvider')] + #[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'configurationDataProvider')] public function testSetValue(string $key, string|array $input, string|array $expected): void { $this->configuration->setConfiguration([$key => $input]); $this->assertSame($this->configuration->$key, $expected); @@ -103,13 +103,13 @@ public static function avatarRuleValueProvider(): array { ]; } - #[\PHPUnit\Framework\Attributes\DataProvider('avatarRuleValueProvider')] + #[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'avatarRuleValueProvider')] public function testGetAvatarAttributes(string $setting, array $expected): void { $this->configuration->setConfiguration(['ldapUserAvatarRule' => $setting]); $this->assertSame($expected, $this->configuration->getAvatarAttributes()); } - #[\PHPUnit\Framework\Attributes\DataProvider('avatarRuleValueProvider')] + #[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'avatarRuleValueProvider')] public function testResolveRule(string $setting, array $expected): void { $this->configuration->setConfiguration(['ldapUserAvatarRule' => $setting]); // so far the only thing that can get resolved :) diff --git a/apps/user_ldap/tests/ConnectionTest.php b/apps/user_ldap/tests/ConnectionTest.php index ad99636f62c38..681c9fbeeb769 100644 --- a/apps/user_ldap/tests/ConnectionTest.php +++ b/apps/user_ldap/tests/ConnectionTest.php @@ -19,7 +19,7 @@ * * @package OCA\User_LDAP\Tests */ -#[\PHPUnit\Framework\Attributes\Group('DB')] +#[\PHPUnit\Framework\Attributes\Group(name: 'DB')] class ConnectionTest extends \Test\TestCase { protected ILDAPWrapper&MockObject $ldap; protected Connection $connection; diff --git a/apps/user_ldap/tests/HelperTest.php b/apps/user_ldap/tests/HelperTest.php index 86df86da2e4f7..97661243b911e 100644 --- a/apps/user_ldap/tests/HelperTest.php +++ b/apps/user_ldap/tests/HelperTest.php @@ -13,7 +13,7 @@ use OCP\Server; use PHPUnit\Framework\MockObject\MockObject; -#[\PHPUnit\Framework\Attributes\Group('DB')] +#[\PHPUnit\Framework\Attributes\Group(name: 'DB')] class HelperTest extends \Test\TestCase { private IAppConfig&MockObject $appConfig; diff --git a/apps/user_ldap/tests/Jobs/SyncTest.php b/apps/user_ldap/tests/Jobs/SyncTest.php index e1ff30a1724c5..f58a891d02f9c 100644 --- a/apps/user_ldap/tests/Jobs/SyncTest.php +++ b/apps/user_ldap/tests/Jobs/SyncTest.php @@ -27,7 +27,7 @@ use PHPUnit\Framework\MockObject\MockObject; use Test\TestCase; -#[\PHPUnit\Framework\Attributes\Group('DB')] +#[\PHPUnit\Framework\Attributes\Group(name: 'DB')] class SyncTest extends TestCase { protected Helper&MockObject $helper; protected LDAP&MockObject $ldapWrapper; @@ -100,7 +100,7 @@ public static function intervalDataProvider(): array { ]; } - #[DataProvider('intervalDataProvider')] + #[DataProvider(methodName: 'intervalDataProvider')] public function testUpdateInterval(int $userCount, int $pagingSize1, int $pagingSize2): void { $this->appConfig->expects($this->once()) ->method('setAppValueInt') @@ -141,7 +141,7 @@ public static function moreResultsProvider(): array { ]; } - #[DataProvider('moreResultsProvider')] + #[DataProvider(methodName: 'moreResultsProvider')] public function testMoreResults($pagingSize, $results, $expected): void { $connection = $this->getMockBuilder(Connection::class) ->setConstructorArgs([ @@ -198,7 +198,7 @@ public static function cycleDataProvider(): array { ]; } - #[DataProvider('cycleDataProvider')] + #[DataProvider(methodName: 'cycleDataProvider')] public function testDetermineNextCycle(?array $cycleData, array $prefixes, ?array $expectedCycle): void { $this->helper->expects($this->any()) ->method('getServerConfigurationPrefixes') @@ -275,7 +275,7 @@ public static function runDataProvider(): array { ]; } - #[DataProvider('runDataProvider')] + #[DataProvider(methodName: 'runDataProvider')] public function testRun(array $runData): void { $this->globalAppConfig->expects($this->any()) ->method('getValueString') diff --git a/apps/user_ldap/tests/LDAPProviderTest.php b/apps/user_ldap/tests/LDAPProviderTest.php index 5548f47d4455d..116654929808f 100644 --- a/apps/user_ldap/tests/LDAPProviderTest.php +++ b/apps/user_ldap/tests/LDAPProviderTest.php @@ -31,7 +31,7 @@ * * @package OCA\User_LDAP\Tests */ -#[\PHPUnit\Framework\Attributes\Group('DB')] +#[\PHPUnit\Framework\Attributes\Group(name: 'DB')] class LDAPProviderTest extends \Test\TestCase { private function getServerMock(IUserLDAP $userBackend, IGroupLDAP $groupBackend) { $server = $this->getMockBuilder('OC\Server') diff --git a/apps/user_ldap/tests/LDAPTest.php b/apps/user_ldap/tests/LDAPTest.php index 6da592ad6a16a..70a36cd4714fb 100644 --- a/apps/user_ldap/tests/LDAPTest.php +++ b/apps/user_ldap/tests/LDAPTest.php @@ -33,7 +33,7 @@ public static function errorProvider(): array { ]; } - #[\PHPUnit\Framework\Attributes\DataProvider('errorProvider')] + #[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'errorProvider')] public function testSearchWithErrorHandler(string $errorMessage, bool $passThrough): void { $wasErrorHandlerCalled = false; $errorHandler = function ($number, $message, $file, $line) use (&$wasErrorHandlerCalled): void { diff --git a/apps/user_ldap/tests/Mapping/GroupMappingTest.php b/apps/user_ldap/tests/Mapping/GroupMappingTest.php index efa1c11f48275..3384f1eecc314 100644 --- a/apps/user_ldap/tests/Mapping/GroupMappingTest.php +++ b/apps/user_ldap/tests/Mapping/GroupMappingTest.php @@ -19,7 +19,7 @@ * * @package OCA\User_LDAP\Tests\Mapping */ -#[\PHPUnit\Framework\Attributes\Group('DB')] +#[\PHPUnit\Framework\Attributes\Group(name: 'DB')] class GroupMappingTest extends AbstractMappingTestCase { public function getMapper(IDBConnection $dbMock, ICacheFactory $cacheFactory, IAppConfig $appConfig): GroupMapping { return new GroupMapping($dbMock, $cacheFactory, $appConfig, true); diff --git a/apps/user_ldap/tests/Mapping/UserMappingTest.php b/apps/user_ldap/tests/Mapping/UserMappingTest.php index 5fc57e44c7bc0..b352e4e3b0a1c 100644 --- a/apps/user_ldap/tests/Mapping/UserMappingTest.php +++ b/apps/user_ldap/tests/Mapping/UserMappingTest.php @@ -20,7 +20,7 @@ * * @package OCA\User_LDAP\Tests\Mapping */ -#[\PHPUnit\Framework\Attributes\Group('DB')] +#[\PHPUnit\Framework\Attributes\Group(name: 'DB')] class UserMappingTest extends AbstractMappingTestCase { public function getMapper(IDBConnection $dbMock, ICacheFactory $cacheFactory, IAppConfig $appConfig): UserMapping { return new UserMapping($dbMock, $cacheFactory, $appConfig, true, $this->createMock(IAssertion::class)); diff --git a/apps/user_ldap/tests/Migration/AbstractUUIDFixTestCase.php b/apps/user_ldap/tests/Migration/AbstractUUIDFixTestCase.php index 7a85b885bc1a7..fa52491cdca5c 100644 --- a/apps/user_ldap/tests/Migration/AbstractUUIDFixTestCase.php +++ b/apps/user_ldap/tests/Migration/AbstractUUIDFixTestCase.php @@ -24,7 +24,7 @@ abstract class AbstractUUIDFixTestCase extends TestCase { protected LDAP&MockObject $ldap; protected AbstractMapping $mapper; protected UUIDFix $job; - protected Proxy $proxy; + protected Proxy&MockObject $proxy; protected Access&MockObject $access; protected ITimeFactory&MockObject $time; protected bool $isUser = true; diff --git a/apps/user_ldap/tests/Migration/UUIDFixGroupTest.php b/apps/user_ldap/tests/Migration/UUIDFixGroupTest.php index 9ba54d046af76..30a2731521b1a 100644 --- a/apps/user_ldap/tests/Migration/UUIDFixGroupTest.php +++ b/apps/user_ldap/tests/Migration/UUIDFixGroupTest.php @@ -16,7 +16,7 @@ * * @package OCA\Group_LDAP\Tests\Migration */ -#[\PHPUnit\Framework\Attributes\Group('DB')] +#[\PHPUnit\Framework\Attributes\Group(name: 'DB')] class UUIDFixGroupTest extends AbstractUUIDFixTestCase { protected function setUp(): void { $this->isUser = false; diff --git a/apps/user_ldap/tests/Migration/UUIDFixInsertTest.php b/apps/user_ldap/tests/Migration/UUIDFixInsertTest.php index 1033a64cd0b81..35c19d5403247 100644 --- a/apps/user_ldap/tests/Migration/UUIDFixInsertTest.php +++ b/apps/user_ldap/tests/Migration/UUIDFixInsertTest.php @@ -86,7 +86,7 @@ public static function recordProviderTooLongAndNone(): array { ]; } - #[\PHPUnit\Framework\Attributes\DataProvider('recordProvider')] + #[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'recordProvider')] public function testRun(array $userBatches, array $groupBatches): void { $this->appConfig->expects($this->once()) ->method('getAppValueString') @@ -114,7 +114,7 @@ public function testRun(array $userBatches, array $groupBatches): void { $this->job->run($out); } - #[\PHPUnit\Framework\Attributes\DataProvider('recordProviderTooLongAndNone')] + #[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'recordProviderTooLongAndNone')] public function testRunWithManyAndNone(array $userBatches, array $groupBatches): void { $this->appConfig->expects($this->once()) ->method('getAppValueString') diff --git a/apps/user_ldap/tests/Migration/UUIDFixUserTest.php b/apps/user_ldap/tests/Migration/UUIDFixUserTest.php index 0c0db000953d9..b9a11191d565b 100644 --- a/apps/user_ldap/tests/Migration/UUIDFixUserTest.php +++ b/apps/user_ldap/tests/Migration/UUIDFixUserTest.php @@ -16,7 +16,7 @@ * * @package OCA\User_LDAP\Tests\Migration */ -#[\PHPUnit\Framework\Attributes\Group('DB')] +#[\PHPUnit\Framework\Attributes\Group(name: 'DB')] class UUIDFixUserTest extends AbstractUUIDFixTestCase { protected function setUp(): void { $this->isUser = true; diff --git a/apps/user_ldap/tests/Service/BirthdateParserServiceTest.php b/apps/user_ldap/tests/Service/BirthdateParserServiceTest.php index 061118f10c1de..5b7ccc8500606 100644 --- a/apps/user_ldap/tests/Service/BirthdateParserServiceTest.php +++ b/apps/user_ldap/tests/Service/BirthdateParserServiceTest.php @@ -35,7 +35,7 @@ public static function parseBirthdateDataProvider(): array { ]; } - #[\PHPUnit\Framework\Attributes\DataProvider('parseBirthdateDataProvider')] + #[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'parseBirthdateDataProvider')] public function testParseBirthdate( string $value, ?DateTimeImmutable $expected, diff --git a/apps/user_ldap/tests/Settings/AdminTest.php b/apps/user_ldap/tests/Settings/AdminTest.php index 51abba3091b55..a05d08b3cf4d6 100644 --- a/apps/user_ldap/tests/Settings/AdminTest.php +++ b/apps/user_ldap/tests/Settings/AdminTest.php @@ -20,7 +20,7 @@ /** * @package OCA\User_LDAP\Tests\Settings */ -#[\PHPUnit\Framework\Attributes\Group('DB')] +#[\PHPUnit\Framework\Attributes\Group(name: 'DB')] class AdminTest extends TestCase { private IL10N&MockObject $l10n; private ITemplateManager $templateManager; diff --git a/apps/user_ldap/tests/User/DeletedUsersIndexTest.php b/apps/user_ldap/tests/User/DeletedUsersIndexTest.php index 841a4d70f9f65..cbcd5bfcfc6bc 100644 --- a/apps/user_ldap/tests/User/DeletedUsersIndexTest.php +++ b/apps/user_ldap/tests/User/DeletedUsersIndexTest.php @@ -21,7 +21,7 @@ * * @package OCA\User_LDAP\Tests\User */ -#[\PHPUnit\Framework\Attributes\Group('DB')] +#[\PHPUnit\Framework\Attributes\Group(name: 'DB')] class DeletedUsersIndexTest extends \Test\TestCase { protected DeletedUsersIndex $dui; protected IUserConfig $userConfig; diff --git a/apps/user_ldap/tests/User/ManagerTest.php b/apps/user_ldap/tests/User/ManagerTest.php index 2140cbf272eba..6f59c36702a11 100644 --- a/apps/user_ldap/tests/User/ManagerTest.php +++ b/apps/user_ldap/tests/User/ManagerTest.php @@ -31,7 +31,7 @@ * * @package OCA\User_LDAP\Tests\User */ -#[\PHPUnit\Framework\Attributes\Group('DB')] +#[\PHPUnit\Framework\Attributes\Group(name: 'DB')] class ManagerTest extends \Test\TestCase { protected Access&MockObject $access; protected IConfig&MockObject $config; @@ -93,7 +93,7 @@ public static function dnProvider(): array { ]; } - #[\PHPUnit\Framework\Attributes\DataProvider('dnProvider')] + #[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'dnProvider')] public function testGetByDNExisting(string $inputDN): void { $uid = '563418fc-423b-1033-8d1c-ad5f418ee02e'; @@ -190,7 +190,7 @@ public static function attributeRequestProvider(): array { ]; } - #[\PHPUnit\Framework\Attributes\DataProvider('attributeRequestProvider')] + #[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'attributeRequestProvider')] public function testGetAttributes($minimal): void { $this->connection->setConfiguration([ 'ldapEmailAttribute' => 'MAIL', diff --git a/apps/user_ldap/tests/User/OfflineUserTest.php b/apps/user_ldap/tests/User/OfflineUserTest.php index 932dac77e7905..4599414005e1b 100644 --- a/apps/user_ldap/tests/User/OfflineUserTest.php +++ b/apps/user_ldap/tests/User/OfflineUserTest.php @@ -47,7 +47,7 @@ public static function shareOwnerProvider(): array { ]; } - #[\PHPUnit\Framework\Attributes\DataProvider('shareOwnerProvider')] + #[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'shareOwnerProvider')] public function testHasActiveShares(array $existingShareTypes, bool $expected): void { $shareMock = $this->createMock(IShare::class); diff --git a/apps/user_ldap/tests/User/UserTest.php b/apps/user_ldap/tests/User/UserTest.php index 4bf775efa9db3..3e9b90fe0e6ac 100644 --- a/apps/user_ldap/tests/User/UserTest.php +++ b/apps/user_ldap/tests/User/UserTest.php @@ -32,7 +32,7 @@ * * @package OCA\User_LDAP\Tests\User */ -#[\PHPUnit\Framework\Attributes\Group('DB')] +#[\PHPUnit\Framework\Attributes\Group(name: 'DB')] class UserTest extends \Test\TestCase { protected Access&MockObject $access; protected Connection&MockObject $connection; @@ -788,7 +788,7 @@ public static function extStorageHomeDataProvider(): array { ]; } - #[\PHPUnit\Framework\Attributes\DataProvider('extStorageHomeDataProvider')] + #[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'extStorageHomeDataProvider')] public function testUpdateExtStorageHome(string $expected, ?string $valueFromLDAP = null, bool $isSet = true): void { if ($valueFromLDAP === null) { $this->connection->expects($this->once()) @@ -944,7 +944,7 @@ public static function emptyHomeFolderAttributeValueProvider(): array { ]; } - #[\PHPUnit\Framework\Attributes\DataProvider('emptyHomeFolderAttributeValueProvider')] + #[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'emptyHomeFolderAttributeValueProvider')] public function testGetHomePathNotConfigured(string $attributeValue): void { $this->connection->expects($this->any()) ->method('__get') @@ -1018,7 +1018,7 @@ public static function displayNameProvider(): array { ]; } - #[\PHPUnit\Framework\Attributes\DataProvider('displayNameProvider')] + #[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'displayNameProvider')] public function testComposeAndStoreDisplayName(string $part1, string $part2, string $expected, bool $expectTriggerChange): void { $this->userConfig->expects($this->once()) ->method('setValueString'); diff --git a/apps/user_ldap/tests/User_LDAPTest.php b/apps/user_ldap/tests/User_LDAPTest.php index ae9d5f75f30f5..4720b0a570935 100644 --- a/apps/user_ldap/tests/User_LDAPTest.php +++ b/apps/user_ldap/tests/User_LDAPTest.php @@ -37,7 +37,7 @@ * * @package OCA\User_LDAP\Tests */ -#[\PHPUnit\Framework\Attributes\Group('DB')] +#[\PHPUnit\Framework\Attributes\Group(name: 'DB')] class User_LDAPTest extends TestCase { protected Access&MockObject $access; protected OfflineUser&MockObject $offlineUser; @@ -1324,7 +1324,7 @@ public static function avatarDataProvider(): array { ]; } - #[\PHPUnit\Framework\Attributes\DataProvider('avatarDataProvider')] + #[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'avatarDataProvider')] public function testCanChangeAvatar(string|bool $imageData, bool $expected): void { $isValidImage = str_starts_with((string)$imageData, 'valid'); @@ -1449,7 +1449,7 @@ public static function actionProvider(): array { ]; } - #[\PHPUnit\Framework\Attributes\DataProvider('actionProvider')] + #[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'actionProvider')] public function testImplementsAction(string $configurable, string|int $value, int $actionCode, bool $expected): void { $this->pluginManager->expects($this->once()) ->method('getImplementedActions') diff --git a/apps/user_ldap/tests/WizardTest.php b/apps/user_ldap/tests/WizardTest.php index b492b93256898..0209a676502e2 100644 --- a/apps/user_ldap/tests/WizardTest.php +++ b/apps/user_ldap/tests/WizardTest.php @@ -21,7 +21,7 @@ * * @package OCA\User_LDAP\Tests */ -#[\PHPUnit\Framework\Attributes\Group('DB')] +#[\PHPUnit\Framework\Attributes\Group(name: 'DB')] class WizardTest extends TestCase { protected function setUp(): void { parent::setUp(); diff --git a/apps/user_status/tests/Integration/Service/StatusServiceIntegrationTest.php b/apps/user_status/tests/Integration/Service/StatusServiceIntegrationTest.php index 61c07db51e9cf..a2acfe4458b7d 100644 --- a/apps/user_status/tests/Integration/Service/StatusServiceIntegrationTest.php +++ b/apps/user_status/tests/Integration/Service/StatusServiceIntegrationTest.php @@ -18,7 +18,7 @@ use function sleep; use function time; -#[\PHPUnit\Framework\Attributes\Group('DB')] +#[\PHPUnit\Framework\Attributes\Group(name: 'DB')] class StatusServiceIntegrationTest extends TestCase { private StatusService $service; diff --git a/apps/user_status/tests/Unit/CapabilitiesTest.php b/apps/user_status/tests/Unit/CapabilitiesTest.php index 601fb207df4b5..514999acc1215 100644 --- a/apps/user_status/tests/Unit/CapabilitiesTest.php +++ b/apps/user_status/tests/Unit/CapabilitiesTest.php @@ -24,7 +24,7 @@ protected function setUp(): void { $this->capabilities = new Capabilities($this->emojiHelper); } - #[\PHPUnit\Framework\Attributes\DataProvider('getCapabilitiesDataProvider')] + #[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'getCapabilitiesDataProvider')] public function testGetCapabilities(bool $supportsEmojis): void { $this->emojiHelper->expects($this->once()) ->method('doesPlatformSupportEmoji') diff --git a/apps/user_status/tests/Unit/Controller/UserStatusControllerTest.php b/apps/user_status/tests/Unit/Controller/UserStatusControllerTest.php index e99290319ed3b..90b18c5b5253f 100644 --- a/apps/user_status/tests/Unit/Controller/UserStatusControllerTest.php +++ b/apps/user_status/tests/Unit/Controller/UserStatusControllerTest.php @@ -87,7 +87,7 @@ public function testGetStatusDoesNotExist(): void { $this->controller->getStatus(); } - #[\PHPUnit\Framework\Attributes\DataProvider('setStatusDataProvider')] + #[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'setStatusDataProvider')] public function testSetStatus( string $statusType, ?string $statusIcon, @@ -147,7 +147,7 @@ public static function setStatusDataProvider(): array { ]; } - #[\PHPUnit\Framework\Attributes\DataProvider('setPredefinedMessageDataProvider')] + #[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'setPredefinedMessageDataProvider')] public function testSetPredefinedMessage( string $messageId, ?int $clearAt, @@ -207,7 +207,7 @@ public static function setPredefinedMessageDataProvider(): array { ]; } - #[\PHPUnit\Framework\Attributes\DataProvider('setCustomMessageDataProvider')] + #[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'setCustomMessageDataProvider')] public function testSetCustomMessage( ?string $statusIcon, string $message, diff --git a/apps/user_status/tests/Unit/Db/UserStatusMapperTest.php b/apps/user_status/tests/Unit/Db/UserStatusMapperTest.php index ce920a02a8fbb..3cbd4e6d93045 100644 --- a/apps/user_status/tests/Unit/Db/UserStatusMapperTest.php +++ b/apps/user_status/tests/Unit/Db/UserStatusMapperTest.php @@ -134,7 +134,7 @@ public function testUserIdUnique(): void { $this->mapper->insert($userStatus2); } - #[\PHPUnit\Framework\Attributes\DataProvider('clearStatusesOlderThanDataProvider')] + #[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'clearStatusesOlderThanDataProvider')] public function testClearStatusesOlderThan(string $status, bool $isUserDefined, int $timestamp, bool $expectsClean): void { $oldStatus = UserStatus::fromParams([ 'userId' => 'john.doe', @@ -231,7 +231,7 @@ public static function dataCreateBackupStatus(): array { ]; } - #[\PHPUnit\Framework\Attributes\DataProvider('dataCreateBackupStatus')] + #[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'dataCreateBackupStatus')] public function testCreateBackupStatus(bool $hasStatus, bool $hasBackup, bool $backupCreated): void { if ($hasStatus) { $userStatus1 = new UserStatus(); diff --git a/apps/user_status/tests/Unit/Listener/UserDeletedListenerTest.php b/apps/user_status/tests/Unit/Listener/UserDeletedListenerTest.php index fbcea23338da1..5a2d52fea0a2c 100644 --- a/apps/user_status/tests/Unit/Listener/UserDeletedListenerTest.php +++ b/apps/user_status/tests/Unit/Listener/UserDeletedListenerTest.php @@ -10,7 +10,6 @@ use OCA\UserStatus\Listener\UserDeletedListener; use OCA\UserStatus\Service\StatusService; -use OCP\EventDispatcher\GenericEvent; use OCP\IUser; use OCP\User\Events\UserDeletedEvent; use PHPUnit\Framework\MockObject\MockObject; @@ -40,12 +39,4 @@ public function testHandleWithCorrectEvent(): void { $event = new UserDeletedEvent($user); $this->listener->handle($event); } - - public function testHandleWithWrongEvent(): void { - $this->service->expects($this->never()) - ->method('removeUserStatus'); - - $event = new GenericEvent(); - $this->listener->handle($event); - } } diff --git a/apps/user_status/tests/Unit/Listener/UserLiveStatusListenerTest.php b/apps/user_status/tests/Unit/Listener/UserLiveStatusListenerTest.php index c03eed0089e08..d7db72f60a4de 100644 --- a/apps/user_status/tests/Unit/Listener/UserLiveStatusListenerTest.php +++ b/apps/user_status/tests/Unit/Listener/UserLiveStatusListenerTest.php @@ -15,7 +15,6 @@ use OCA\UserStatus\Service\StatusService; use OCP\AppFramework\Db\DoesNotExistException; use OCP\AppFramework\Utility\ITimeFactory; -use OCP\EventDispatcher\GenericEvent; use OCP\IUser; use OCP\User\Events\UserLiveStatusEvent; use PHPUnit\Framework\MockObject\MockObject; @@ -49,7 +48,7 @@ protected function setUp(): void { ); } - #[\PHPUnit\Framework\Attributes\DataProvider('handleEventWithCorrectEventDataProvider')] + #[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'handleEventWithCorrectEventDataProvider')] public function testHandleWithCorrectEvent( string $userId, string $previousStatus, @@ -138,12 +137,4 @@ public static function handleEventWithCorrectEventDataProvider(): array { ['john.doe', 'online', 5000, true, 'away', 5000, true, false], ]; } - - public function testHandleWithWrongEvent(): void { - $this->mapper->expects($this->never()) - ->method('insertOrUpdate'); - - $event = new GenericEvent(); - $this->listener->handle($event); - } } diff --git a/apps/user_status/tests/Unit/Service/PredefinedStatusServiceTest.php b/apps/user_status/tests/Unit/Service/PredefinedStatusServiceTest.php index 78e4a18d9f1eb..bf337a3c152d1 100644 --- a/apps/user_status/tests/Unit/Service/PredefinedStatusServiceTest.php +++ b/apps/user_status/tests/Unit/Service/PredefinedStatusServiceTest.php @@ -102,7 +102,7 @@ public function testGetDefaultStatuses(): void { ], $actual); } - #[\PHPUnit\Framework\Attributes\DataProvider('getIconForIdDataProvider')] + #[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'getIconForIdDataProvider')] public function testGetIconForId(string $id, ?string $expectedIcon): void { $actual = $this->service->getIconForId($id); $this->assertEquals($expectedIcon, $actual); @@ -121,7 +121,7 @@ public static function getIconForIdDataProvider(): array { ]; } - #[\PHPUnit\Framework\Attributes\DataProvider('getTranslatedStatusForIdDataProvider')] + #[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'getTranslatedStatusForIdDataProvider')] public function testGetTranslatedStatusForId(string $id, ?string $expected): void { $this->l10n->method('t') ->willReturnArgument(0); @@ -143,7 +143,7 @@ public static function getTranslatedStatusForIdDataProvider(): array { ]; } - #[\PHPUnit\Framework\Attributes\DataProvider('isValidIdDataProvider')] + #[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'isValidIdDataProvider')] public function testIsValidId(string $id, bool $expected): void { $actual = $this->service->isValidId($id); $this->assertEquals($expected, $actual); diff --git a/apps/user_status/tests/Unit/Service/StatusServiceTest.php b/apps/user_status/tests/Unit/Service/StatusServiceTest.php index 3d7578caf40a0..88c32d477d41d 100644 --- a/apps/user_status/tests/Unit/Service/StatusServiceTest.php +++ b/apps/user_status/tests/Unit/Service/StatusServiceTest.php @@ -219,7 +219,7 @@ public function testFindAllClearMessage(): void { $this->assertNull($status->getMessageId()); } - #[\PHPUnit\Framework\Attributes\DataProvider('setStatusDataProvider')] + #[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'setStatusDataProvider')] public function testSetStatus( string $userId, string $status, @@ -340,7 +340,7 @@ public static function setStatusDataProvider(): array { ]; } - #[\PHPUnit\Framework\Attributes\DataProvider('setPredefinedMessageDataProvider')] + #[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'setPredefinedMessageDataProvider')] public function testSetPredefinedMessage( string $userId, string $messageId, @@ -427,7 +427,7 @@ public static function setPredefinedMessageDataProvider(): array { ]; } - #[\PHPUnit\Framework\Attributes\DataProvider('setCustomMessageDataProvider')] + #[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'setCustomMessageDataProvider')] public function testSetCustomMessage( string $userId, ?string $statusIcon, @@ -791,7 +791,7 @@ public static function dataSetUserStatus(): array { ]; } - #[\PHPUnit\Framework\Attributes\DataProvider('dataSetUserStatus')] + #[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'dataSetUserStatus')] public function testSetUserStatus(string $messageId, string $oldMessageId, bool $expectedUpdateShortcut): void { $previous = new UserStatus(); $previous->setId(1); diff --git a/apps/webhook_listeners/tests/Db/WebhookListenerMapperTest.php b/apps/webhook_listeners/tests/Db/WebhookListenerMapperTest.php index ee6f2fc909e27..8c0ed240b7df2 100644 --- a/apps/webhook_listeners/tests/Db/WebhookListenerMapperTest.php +++ b/apps/webhook_listeners/tests/Db/WebhookListenerMapperTest.php @@ -18,7 +18,7 @@ use OCP\User\Events\UserCreatedEvent; use Test\TestCase; -#[\PHPUnit\Framework\Attributes\Group('DB')] +#[\PHPUnit\Framework\Attributes\Group(name: 'DB')] class WebhookListenerMapperTest extends TestCase { private IDBConnection $connection; private WebhookListenerMapper $mapper; diff --git a/apps/webhook_listeners/tests/Service/PHPMongoQueryTest.php b/apps/webhook_listeners/tests/Service/PHPMongoQueryTest.php index 337b876dfef15..4bbf94925dc5d 100644 --- a/apps/webhook_listeners/tests/Service/PHPMongoQueryTest.php +++ b/apps/webhook_listeners/tests/Service/PHPMongoQueryTest.php @@ -38,7 +38,7 @@ public static function dataExecuteQuery(): array { ]; } - #[\PHPUnit\Framework\Attributes\DataProvider('dataExecuteQuery')] + #[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'dataExecuteQuery')] public function testExecuteQuery(array $query, array $document, bool $matches): void { $this->assertEquals($matches, PHPMongoQuery::executeQuery($query, $document)); } diff --git a/apps/workflowengine/lib/Manager.php b/apps/workflowengine/lib/Manager.php index bbc76d9894f32..a4d39ef2c91f1 100644 --- a/apps/workflowengine/lib/Manager.php +++ b/apps/workflowengine/lib/Manager.php @@ -264,7 +264,7 @@ protected function insertOperation( /** * @param string $class * @param string $name - * @param array $checks + * @param list $checks * @param string $operation * @return array The added operation * @throws \UnexpectedValueException @@ -455,7 +455,7 @@ protected function validateEvents(string $entity, array $events, IOperation $ope /** * @param class-string $class - * @param array $checks + * @param list $checks * @param array $events * @throws \UnexpectedValueException */ diff --git a/apps/workflowengine/tests/Check/AbstractStringCheckTest.php b/apps/workflowengine/tests/Check/AbstractStringCheckTest.php index 26d4ccb8553c2..86e7c5cca4dcf 100644 --- a/apps/workflowengine/tests/Check/AbstractStringCheckTest.php +++ b/apps/workflowengine/tests/Check/AbstractStringCheckTest.php @@ -50,7 +50,7 @@ public static function dataExecuteStringCheck(): array { ]; } - #[\PHPUnit\Framework\Attributes\DataProvider('dataExecuteStringCheck')] + #[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'dataExecuteStringCheck')] public function testExecuteStringCheck(string $operation, string $checkValue, string $actualValue, bool $expected): void { $check = $this->getCheckMock(); @@ -67,7 +67,7 @@ public static function dataValidateCheck(): array { ]; } - #[\PHPUnit\Framework\Attributes\DataProvider('dataValidateCheck')] + #[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'dataValidateCheck')] public function testValidateCheck(string $operator, string $value): void { $check = $this->getCheckMock(); @@ -86,7 +86,7 @@ public static function dataValidateCheckInvalid(): array { ]; } - #[\PHPUnit\Framework\Attributes\DataProvider('dataValidateCheckInvalid')] + #[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'dataValidateCheckInvalid')] public function testValidateCheckInvalid(string $operator, string $value, int $exceptionCode, string $exceptionMessage): void { $check = $this->getCheckMock(); @@ -106,7 +106,7 @@ public static function dataMatch(): array { ]; } - #[\PHPUnit\Framework\Attributes\DataProvider('dataMatch')] + #[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'dataMatch')] public function testMatch(string $pattern, string $subject, array $matches, bool $expected): void { $check = $this->getCheckMock(); diff --git a/apps/workflowengine/tests/Check/FileMimeTypeTest.php b/apps/workflowengine/tests/Check/FileMimeTypeTest.php index 89e0676392eef..60e9087d223e7 100644 --- a/apps/workflowengine/tests/Check/FileMimeTypeTest.php +++ b/apps/workflowengine/tests/Check/FileMimeTypeTest.php @@ -25,7 +25,7 @@ public function instanceOfStorage(string $class): bool { } } -#[\PHPUnit\Framework\Attributes\Group('DB')] +#[\PHPUnit\Framework\Attributes\Group(name: 'DB')] class FileMimeTypeTest extends TestCase { /** @var IL10N */ private $l10n; diff --git a/apps/workflowengine/tests/Check/RequestRemoteAddressTest.php b/apps/workflowengine/tests/Check/RequestRemoteAddressTest.php index c0e56daefa86e..666a97ffecfcf 100644 --- a/apps/workflowengine/tests/Check/RequestRemoteAddressTest.php +++ b/apps/workflowengine/tests/Check/RequestRemoteAddressTest.php @@ -44,7 +44,7 @@ public static function dataExecuteCheckIPv4(): array { ]; } - #[\PHPUnit\Framework\Attributes\DataProvider('dataExecuteCheckIPv4')] + #[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'dataExecuteCheckIPv4')] public function testExecuteCheckMatchesIPv4(string $value, string $ip, bool $expected): void { $check = new RequestRemoteAddress($this->getL10NMock(), $this->request); @@ -55,7 +55,7 @@ public function testExecuteCheckMatchesIPv4(string $value, string $ip, bool $exp $this->assertEquals($expected, $check->executeCheck('matchesIPv4', $value)); } - #[\PHPUnit\Framework\Attributes\DataProvider('dataExecuteCheckIPv4')] + #[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'dataExecuteCheckIPv4')] public function testExecuteCheckNotMatchesIPv4(string $value, string $ip, bool $expected): void { $check = new RequestRemoteAddress($this->getL10NMock(), $this->request); @@ -78,7 +78,7 @@ public static function dataExecuteCheckIPv6(): array { ]; } - #[\PHPUnit\Framework\Attributes\DataProvider('dataExecuteCheckIPv6')] + #[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'dataExecuteCheckIPv6')] public function testExecuteCheckMatchesIPv6(string $value, string $ip, bool $expected): void { $check = new RequestRemoteAddress($this->getL10NMock(), $this->request); @@ -89,7 +89,7 @@ public function testExecuteCheckMatchesIPv6(string $value, string $ip, bool $exp $this->assertEquals($expected, $check->executeCheck('matchesIPv6', $value)); } - #[\PHPUnit\Framework\Attributes\DataProvider('dataExecuteCheckIPv6')] + #[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'dataExecuteCheckIPv6')] public function testExecuteCheckNotMatchesIPv6(string $value, string $ip, bool $expected): void { $check = new RequestRemoteAddress($this->getL10NMock(), $this->request); diff --git a/apps/workflowengine/tests/Check/RequestTimeTest.php b/apps/workflowengine/tests/Check/RequestTimeTest.php index a8439b8b9f4b3..ff1490d92b75e 100644 --- a/apps/workflowengine/tests/Check/RequestTimeTest.php +++ b/apps/workflowengine/tests/Check/RequestTimeTest.php @@ -63,7 +63,7 @@ public static function dataExecuteCheck(): array { ]; } - #[\PHPUnit\Framework\Attributes\DataProvider('dataExecuteCheck')] + #[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'dataExecuteCheck')] public function testExecuteCheckIn(string $value, int $timestamp, bool $expected): void { $check = new RequestTime($this->getL10NMock(), $this->timeFactory); @@ -74,7 +74,7 @@ public function testExecuteCheckIn(string $value, int $timestamp, bool $expected $this->assertEquals($expected, $check->executeCheck('in', $value)); } - #[\PHPUnit\Framework\Attributes\DataProvider('dataExecuteCheck')] + #[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'dataExecuteCheck')] public function testExecuteCheckNotIn(string $value, int $timestamp, bool $expected): void { $check = new RequestTime($this->getL10NMock(), $this->timeFactory); @@ -93,7 +93,7 @@ public static function dataValidateCheck(): array { ]; } - #[\PHPUnit\Framework\Attributes\DataProvider('dataValidateCheck')] + #[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'dataValidateCheck')] public function testValidateCheck(string $operator, string $value): void { $check = new RequestTime($this->getL10NMock(), $this->timeFactory); $check->validateCheck($operator, $value); @@ -112,7 +112,7 @@ public static function dataValidateCheckInvalid(): array { ]; } - #[\PHPUnit\Framework\Attributes\DataProvider('dataValidateCheckInvalid')] + #[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'dataValidateCheckInvalid')] public function testValidateCheckInvalid(string $operator, string $value, int $exceptionCode, string $exceptionMessage): void { $check = new RequestTime($this->getL10NMock(), $this->timeFactory); diff --git a/apps/workflowengine/tests/Check/RequestUserAgentTest.php b/apps/workflowengine/tests/Check/RequestUserAgentTest.php index 09eaea6555b57..2fbb632a43eda 100644 --- a/apps/workflowengine/tests/Check/RequestUserAgentTest.php +++ b/apps/workflowengine/tests/Check/RequestUserAgentTest.php @@ -82,7 +82,7 @@ public static function dataExecuteCheck(): array { ]; } - #[\PHPUnit\Framework\Attributes\DataProvider('dataExecuteCheck')] + #[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'dataExecuteCheck')] public function testExecuteCheck(string $operation, string $checkValue, string $actualValue, bool $expected): void { $this->request->expects($this->once()) ->method('getHeader') diff --git a/apps/workflowengine/tests/ManagerTest.php b/apps/workflowengine/tests/ManagerTest.php index c32367738e047..e5b32cd78f403 100644 --- a/apps/workflowengine/tests/ManagerTest.php +++ b/apps/workflowengine/tests/ManagerTest.php @@ -73,7 +73,7 @@ public function getDisplayName(): string { * * @package OCA\WorkflowEngine\Tests */ -#[\PHPUnit\Framework\Attributes\Group('DB')] +#[\PHPUnit\Framework\Attributes\Group(name: 'DB')] class ManagerTest extends TestCase { protected Manager $manager; protected IDBConnection $db; @@ -394,6 +394,7 @@ public function testUpdateOperation(): void { $operationMock->expects($this->any()) ->method('isAvailableForScope') ->willReturnCallback(function () use (&$expectedCalls, &$i): bool { + $this->assertLessThanOrEqual(1, $i); $this->assertEquals($expectedCalls[$i], func_get_args()); $i++; return true; @@ -559,9 +560,11 @@ public function testGetEntitiesList(): void { public function testValidateOperationOK(): void { $check = [ + 'id' => 1, 'class' => ICheck::class, 'operator' => 'is', 'value' => 'barfoo', + 'hash' => 'abc', ]; $operationMock = $this->createMock(IOperation::class); @@ -619,9 +622,11 @@ public function testValidateOperationOK(): void { public function testValidateOperationCheckInputLengthError(): void { $check = [ + 'id' => 1, 'class' => ICheck::class, 'operator' => 'is', 'value' => str_pad('', IManager::MAX_CHECK_VALUE_BYTES + 1, 'FooBar'), + 'hash' => 'abc', ]; $operationMock = $this->createMock(IOperation::class); @@ -660,18 +665,13 @@ public function testValidateOperationCheckInputLengthError(): void { $this->container->expects($this->any()) ->method('get') ->willReturnCallback(function ($className) use ($operationMock, $entityMock, $eventEntityMock, $checkMock) { - switch ($className) { - case IOperation::class: - return $operationMock; - case IEntity::class: - return $entityMock; - case IEntityEvent::class: - return $eventEntityMock; - case ICheck::class: - return $checkMock; - default: - return $this->createMock($className); - } + return match ($className) { + IOperation::class => $operationMock, + IEntity::class => $entityMock, + IEntityEvent::class => $eventEntityMock, + ICheck::class => $checkMock, + default => $this->createMock($className), + }; }); try { @@ -683,9 +683,11 @@ public function testValidateOperationCheckInputLengthError(): void { public function testValidateOperationDataLengthError(): void { $check = [ + 'id' => 1, 'class' => ICheck::class, 'operator' => 'is', 'value' => 'barfoo', + 'hash' => 'abc', ]; $operationData = str_pad('', IManager::MAX_OPERATION_VALUE_BYTES + 1, 'FooBar'); @@ -719,18 +721,13 @@ public function testValidateOperationDataLengthError(): void { $this->container->expects($this->any()) ->method('get') ->willReturnCallback(function ($className) use ($operationMock, $entityMock, $eventEntityMock, $checkMock) { - switch ($className) { - case IOperation::class: - return $operationMock; - case IEntity::class: - return $entityMock; - case IEntityEvent::class: - return $eventEntityMock; - case ICheck::class: - return $checkMock; - default: - return $this->createMock($className); - } + return match ($className) { + IOperation::class => $operationMock, + IEntity::class => $entityMock, + IEntityEvent::class => $eventEntityMock, + ICheck::class => $checkMock, + default => $this->createMock($className), + }; }); try { @@ -742,6 +739,7 @@ public function testValidateOperationDataLengthError(): void { public function testValidateOperationScopeNotAvailable(): void { $check = [ + 'id' => 1, 'class' => ICheck::class, 'operator' => 'is', 'value' => 'barfoo', @@ -783,18 +781,13 @@ public function testValidateOperationScopeNotAvailable(): void { $this->container->expects($this->any()) ->method('get') ->willReturnCallback(function ($className) use ($operationMock, $entityMock, $eventEntityMock, $checkMock) { - switch ($className) { - case IOperation::class: - return $operationMock; - case IEntity::class: - return $entityMock; - case IEntityEvent::class: - return $eventEntityMock; - case ICheck::class: - return $checkMock; - default: - return $this->createMock($className); - } + return match ($className) { + IOperation::class => $operationMock, + IEntity::class => $entityMock, + IEntityEvent::class => $eventEntityMock, + ICheck::class => $checkMock, + default => $this->createMock($className), + }; }); try { diff --git a/composer.json b/composer.json index 33520b1bd7a4b..5e7a093bcc33b 100644 --- a/composer.json +++ b/composer.json @@ -66,6 +66,7 @@ "psalm:ocp": "psalm --no-cache --threads=$(nproc) -c psalm-ocp.xml", "psalm:ncu": "psalm --no-cache --threads=$(nproc) -c psalm-ncu.xml", "psalm:security": "psalm --no-cache --threads=$(nproc) --taint-analysis --use-baseline=build/psalm-baseline-security.xml", + "psalm:fix": "psalm --alter --issues=InvalidReturnType,InvalidNullableReturnType,MissingParamType,InvalidFalsableReturnType", "psalm:update-baseline": "psalm --no-cache --threads=$(nproc) --update-baseline", "serve": [ "Composer\\Config::disableProcessTimeout", diff --git a/psalm.xml b/psalm.xml index 61fc300f1015e..576c482532cd5 100644 --- a/psalm.xml +++ b/psalm.xml @@ -64,8 +64,8 @@ - + @@ -170,37 +170,54 @@ + + + + + + + + + + + + + + + + +