chore: run rector

Signed-off-by: Robin Appelman <robin@icewind.nl>
pull/53728/head
Robin Appelman 3 months ago
parent 1620a0c051
commit aa15f9d16d
No known key found for this signature in database
GPG Key ID: 42B69D8A64526EFB
  1. 2
      apps/comments/tests/Unit/Collaboration/CommentersSorterTest.php
  2. 2
      apps/comments/tests/Unit/Controller/NotificationsTest.php
  3. 4
      apps/comments/tests/Unit/EventHandlerTest.php
  4. 6
      apps/comments/tests/Unit/Notification/ListenerTest.php
  5. 6
      apps/dav/tests/integration/UserMigration/CalendarMigratorTest.php
  6. 4
      apps/dav/tests/integration/UserMigration/ContactsMigratorTest.php
  7. 12
      apps/dav/tests/unit/Avatars/AvatarHomeTest.php
  8. 2
      apps/dav/tests/unit/BackgroundJob/EventReminderJobTest.php
  9. 4
      apps/dav/tests/unit/BackgroundJob/PruneOutdatedSyncTokensJobTest.php
  10. 3
      apps/dav/tests/unit/BackgroundJob/RefreshWebcalJobTest.php
  11. 4
      apps/dav/tests/unit/BackgroundJob/UserStatusAutomationTest.php
  12. 12
      apps/dav/tests/unit/CalDAV/Activity/BackendTest.php
  13. 2
      apps/dav/tests/unit/CalDAV/Activity/Filter/CalendarTest.php
  14. 28
      apps/dav/tests/unit/CalDAV/Activity/Filter/GenericTest.php
  15. 2
      apps/dav/tests/unit/CalDAV/Activity/Filter/TodoTest.php
  16. 16
      apps/dav/tests/unit/CalDAV/Activity/Provider/BaseTest.php
  17. 12
      apps/dav/tests/unit/CalDAV/Activity/Provider/EventTest.php
  18. 32
      apps/dav/tests/unit/CalDAV/Activity/Setting/GenericTest.php
  19. 2
      apps/dav/tests/unit/CalDAV/AppCalendar/AppCalendarTest.php
  20. 18
      apps/dav/tests/unit/CalDAV/CalDavBackendTest.php
  21. 16
      apps/dav/tests/unit/CalDAV/CalendarTest.php
  22. 4
      apps/dav/tests/unit/CalDAV/Integration/ExternalCalendarTest.php
  23. 4
      apps/dav/tests/unit/CalDAV/PluginTest.php
  24. 8
      apps/dav/tests/unit/CalDAV/PublicCalendarTest.php
  25. 2
      apps/dav/tests/unit/CalDAV/Reminder/NotificationProvider/PushProviderTest.php
  26. 4
      apps/dav/tests/unit/CalDAV/Reminder/NotifierTest.php
  27. 2
      apps/dav/tests/unit/CalDAV/Reminder/ReminderServiceTest.php
  28. 4
      apps/dav/tests/unit/CalDAV/ResourceBooking/AbstractPrincipalBackendTestCase.php
  29. 6
      apps/dav/tests/unit/CalDAV/Schedule/PluginTest.php
  30. 6
      apps/dav/tests/unit/CalDAV/WebcalCaching/ConnectionTest.php
  31. 16
      apps/dav/tests/unit/CalDAV/WebcalCaching/RefreshWebcalServiceTest.php
  32. 12
      apps/dav/tests/unit/CardDAV/Activity/BackendTest.php
  33. 8
      apps/dav/tests/unit/CardDAV/AddressBookImplTest.php
  34. 4
      apps/dav/tests/unit/CardDAV/AddressBookTest.php
  35. 22
      apps/dav/tests/unit/CardDAV/BirthdayServiceTest.php
  36. 8
      apps/dav/tests/unit/CardDAV/CardDavBackendTest.php
  37. 8
      apps/dav/tests/unit/CardDAV/ConverterTest.php
  38. 12
      apps/dav/tests/unit/CardDAV/ImageExportPluginTest.php
  39. 8
      apps/dav/tests/unit/CardDAV/SyncServiceTest.php
  40. 4
      apps/dav/tests/unit/Command/ListAddressbooksTest.php
  41. 4
      apps/dav/tests/unit/Command/ListCalendarsTest.php
  42. 12
      apps/dav/tests/unit/Command/MoveCalendarTest.php
  43. 8
      apps/dav/tests/unit/Comments/CommentsNodeTest.php
  44. 2
      apps/dav/tests/unit/Comments/CommentsPluginTest.php
  45. 4
      apps/dav/tests/unit/Comments/EntityCollectionTest.php
  46. 2
      apps/dav/tests/unit/Connector/Sabre/AuthTest.php
  47. 10
      apps/dav/tests/unit/Connector/Sabre/BlockLegacyClientPluginTest.php
  48. 12
      apps/dav/tests/unit/Connector/Sabre/CommentsPropertiesPluginTest.php
  49. 12
      apps/dav/tests/unit/Connector/Sabre/DirectoryTest.php
  50. 4
      apps/dav/tests/unit/Connector/Sabre/ExceptionLoggerPluginTest.php
  51. 8
      apps/dav/tests/unit/Connector/Sabre/FakeLockerPluginTest.php
  52. 8
      apps/dav/tests/unit/Connector/Sabre/FileTest.php
  53. 8
      apps/dav/tests/unit/Connector/Sabre/FilesPluginTest.php
  54. 4
      apps/dav/tests/unit/Connector/Sabre/FilesReportPluginTest.php
  55. 16
      apps/dav/tests/unit/Connector/Sabre/NodeTest.php
  56. 12
      apps/dav/tests/unit/Connector/Sabre/ObjectTreeTest.php
  57. 12
      apps/dav/tests/unit/Connector/Sabre/PrincipalTest.php
  58. 2
      apps/dav/tests/unit/Connector/Sabre/PublicAuthTest.php
  59. 16
      apps/dav/tests/unit/Connector/Sabre/QuotaPluginTest.php
  60. 3
      apps/dav/tests/unit/Connector/Sabre/RequestTest/DeleteTest.php
  61. 8
      apps/dav/tests/unit/Connector/Sabre/SharesPluginTest.php
  62. 12
      apps/dav/tests/unit/Connector/Sabre/TagsPluginTest.php
  63. 20
      apps/dav/tests/unit/Controller/InvitationResponseControllerTest.php
  64. 4
      apps/dav/tests/unit/DAV/BrowserErrorPagePluginTest.php
  65. 16
      apps/dav/tests/unit/DAV/CustomPropertiesBackendTest.php
  66. 8
      apps/dav/tests/unit/DAV/GroupPrincipalTest.php
  67. 16
      apps/dav/tests/unit/DAV/SystemPrincipalBackendTest.php
  68. 4
      apps/dav/tests/unit/DAV/ViewOnlyPluginTest.php
  69. 8
      apps/dav/tests/unit/Listener/ActivityUpdaterListenerTest.php
  70. 2
      apps/dav/tests/unit/Migration/RefreshWebcalJobRegistrarTest.php
  71. 4
      apps/dav/tests/unit/Migration/RemoveDeletedUsersCalendarSubscriptionsTest.php
  72. 2
      apps/dav/tests/unit/Provisioning/Apple/AppleProvisioningPluginTest.php
  73. 4
      apps/dav/tests/unit/Search/EventsSearchProviderTest.php
  74. 4
      apps/dav/tests/unit/Search/TasksSearchProviderTest.php
  75. 4
      apps/dav/tests/unit/ServerTest.php
  76. 4
      apps/dav/tests/unit/Service/ExampleContactServiceTest.php
  77. 4
      apps/dav/tests/unit/Service/ExampleEventServiceTest.php
  78. 2
      apps/dav/tests/unit/Settings/CalDAVSettingsTest.php
  79. 6
      apps/dav/tests/unit/SystemTag/SystemTagMappingNodeTest.php
  80. 26
      apps/dav/tests/unit/SystemTag/SystemTagNodeTest.php
  81. 20
      apps/dav/tests/unit/SystemTag/SystemTagPluginTest.php
  82. 12
      apps/dav/tests/unit/SystemTag/SystemTagsByIdCollectionTest.php
  83. 14
      apps/dav/tests/unit/SystemTag/SystemTagsObjectMappingCollectionTest.php
  84. 12
      apps/dav/tests/unit/Upload/AssemblyStreamTest.php
  85. 4
      apps/dav/tests/unit/Upload/UploadAutoMkcolPluginTest.php
  86. 4
      apps/encryption/tests/Command/TestEnableMasterKey.php
  87. 6
      apps/encryption/tests/Controller/RecoveryControllerTest.php
  88. 2
      apps/encryption/tests/Controller/StatusControllerTest.php
  89. 26
      apps/encryption/tests/Crypto/CryptTest.php
  90. 2
      apps/encryption/tests/Crypto/DecryptAllTest.php
  91. 6
      apps/encryption/tests/Crypto/EncryptAllTest.php
  92. 13
      apps/encryption/tests/Crypto/EncryptionTest.php
  93. 16
      apps/encryption/tests/KeyManagerTest.php
  94. 2
      apps/encryption/tests/SessionTest.php
  95. 4
      apps/encryption/tests/Settings/AdminTest.php
  96. 2
      apps/encryption/tests/Users/SetupTest.php
  97. 6
      apps/encryption/tests/UtilTest.php
  98. 20
      apps/federatedfilesharing/tests/AddressHandlerTest.php
  99. 4
      apps/federatedfilesharing/tests/Controller/MountPublicLinkControllerTest.php
  100. 26
      apps/federatedfilesharing/tests/FederatedShareProviderTest.php
  101. Some files were not shown because too many files have changed in this diff Show More

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

@ -138,7 +138,7 @@ class NotificationsTest extends TestCase {
$this->commentsManager->expects($this->any())
->method('get')
->with('42')
->will($this->throwException(new NotFoundException()));
->willThrowException(new NotFoundException());
$this->rootFolder->expects($this->never())
->method('getUserFolder');

@ -57,9 +57,7 @@ class EventHandlerTest extends TestCase {
];
}
/**
* @dataProvider handledProvider
*/
#[\PHPUnit\Framework\Attributes\DataProvider('handledProvider')]
public function testHandled(string $eventType): void {
/** @var IComment|MockObject $comment */
$comment = $this->createMock(IComment::class);

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

@ -44,7 +44,7 @@ class CalendarMigratorTest extends TestCase {
$this->output = $this->createMock(OutputInterface::class);
}
public function dataAssets(): array {
public static function dataAssets(): array {
return array_map(
function (string $filename) {
/** @var VCalendar $vCalendar */
@ -89,9 +89,7 @@ class CalendarMigratorTest extends TestCase {
);
}
/**
* @dataProvider dataAssets
*/
#[\PHPUnit\Framework\Attributes\DataProvider('dataAssets')]
public function testImportExportAsset(string $userId, string $filename, string $initialCalendarUri, VCalendar $importCalendar): void {
$user = $this->userManager->createUser($userId, 'topsecretpassword');

@ -44,7 +44,7 @@ class ContactsMigratorTest extends TestCase {
$this->output = $this->createMock(OutputInterface::class);
}
public function dataAssets(): array {
public static function dataAssets(): array {
return array_map(
function (string $filename) {
$vCardSplitter = new VCardSplitter(
@ -91,11 +91,11 @@ class ContactsMigratorTest extends TestCase {
}
/**
* @dataProvider dataAssets
*
* @param array{displayName: string, description?: string} $importMetadata
* @param VCard[] $importCards
*/
#[\PHPUnit\Framework\Attributes\DataProvider('dataAssets')]
public function testImportExportAsset(string $userId, string $filename, string $initialAddressBookUri, array $importMetadata, array $importCards): void {
$user = $this->userManager->createUser($userId, 'topsecretpassword');

@ -27,9 +27,7 @@ class AvatarHomeTest extends TestCase {
$this->home = new AvatarHome(['uri' => 'principals/users/admin'], $this->avatarManager);
}
/**
* @dataProvider providesForbiddenMethods
*/
#[\PHPUnit\Framework\Attributes\DataProvider('providesForbiddenMethods')]
public function testForbiddenMethods($method): void {
$this->expectException(\Sabre\DAV\Exception\Forbidden::class);
@ -60,9 +58,7 @@ class AvatarHomeTest extends TestCase {
];
}
/**
* @dataProvider providesTestGetChild
*/
#[\PHPUnit\Framework\Attributes\DataProvider('providesTestGetChild')]
public function testGetChild(?string $expectedException, bool $hasAvatar, string $path): void {
if ($expectedException !== null) {
$this->expectException($expectedException);
@ -87,9 +83,7 @@ class AvatarHomeTest extends TestCase {
self::assertEquals(1, count($avatarNodes));
}
/**
* @dataProvider providesTestGetChild
*/
#[\PHPUnit\Framework\Attributes\DataProvider('providesTestGetChild')]
public function testChildExists(?string $expectedException, bool $hasAvatar, string $path): void {
$avatar = $this->createMock(IAvatar::class);
$avatar->method('exists')->willReturn($hasAvatar);

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

@ -39,9 +39,7 @@ class PruneOutdatedSyncTokensJobTest extends TestCase {
$this->backgroundJob = new PruneOutdatedSyncTokensJob($this->timeFactory, $this->calDavBackend, $this->cardDavBackend, $this->config, $this->logger);
}
/**
* @dataProvider dataForTestRun
*/
#[\PHPUnit\Framework\Attributes\DataProvider('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')

@ -41,9 +41,8 @@ class RefreshWebcalJobTest extends TestCase {
* @param int $lastRun
* @param int $time
* @param bool $process
*
* @dataProvider runDataProvider
*/
#[\PHPUnit\Framework\Attributes\DataProvider('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);

@ -88,9 +88,7 @@ class UserStatusAutomationTest extends TestCase {
];
}
/**
* @dataProvider dataRun
*/
#[\PHPUnit\Framework\Attributes\DataProvider('dataRun')]
public function testRunNoOOO(string $ruleDay, string $currentTime, bool $isAvailable): void {
$user = $this->createConfiguredMock(IUser::class, [
'getUID' => 'user'

@ -71,9 +71,7 @@ class BackendTest extends TestCase {
];
}
/**
* @dataProvider dataCallTriggerCalendarActivity
*/
#[\PHPUnit\Framework\Attributes\DataProvider('dataCallTriggerCalendarActivity')]
public function testCallTriggerCalendarActivity(string $method, array $payload, string $expectedSubject, array $expectedPayload): void {
$backend = $this->getBackend(['triggerCalendarActivity']);
$backend->expects($this->once())
@ -168,9 +166,7 @@ class BackendTest extends TestCase {
];
}
/**
* @dataProvider dataTriggerCalendarActivity
*/
#[\PHPUnit\Framework\Attributes\DataProvider('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']);
@ -299,9 +295,7 @@ class BackendTest extends TestCase {
];
}
/**
* @dataProvider dataGetUsersForShares
*/
#[\PHPUnit\Framework\Attributes\DataProvider('dataGetUsersForShares')]
public function testGetUsersForShares(array $shares, array $groups, array $expected): void {
$backend = $this->getBackend();

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

@ -24,35 +24,27 @@ class GenericTest extends TestCase {
];
}
/**
* @dataProvider dataFilters
*/
#[\PHPUnit\Framework\Attributes\DataProvider('dataFilters')]
public function testImplementsInterface(string $filterClass): void {
$filter = Server::get($filterClass);
$this->assertInstanceOf(IFilter::class, $filter);
}
/**
* @dataProvider dataFilters
*/
#[\PHPUnit\Framework\Attributes\DataProvider('dataFilters')]
public function testGetIdentifier(string $filterClass): void {
/** @var IFilter $filter */
$filter = Server::get($filterClass);
$this->assertIsString($filter->getIdentifier());
}
/**
* @dataProvider dataFilters
*/
#[\PHPUnit\Framework\Attributes\DataProvider('dataFilters')]
public function testGetName(string $filterClass): void {
/** @var IFilter $filter */
$filter = Server::get($filterClass);
$this->assertIsString($filter->getName());
}
/**
* @dataProvider dataFilters
*/
#[\PHPUnit\Framework\Attributes\DataProvider('dataFilters')]
public function testGetPriority(string $filterClass): void {
/** @var IFilter $filter */
$filter = Server::get($filterClass);
@ -62,9 +54,7 @@ class GenericTest extends TestCase {
$this->assertLessThanOrEqual(100, $priority);
}
/**
* @dataProvider dataFilters
*/
#[\PHPUnit\Framework\Attributes\DataProvider('dataFilters')]
public function testGetIcon(string $filterClass): void {
/** @var IFilter $filter */
$filter = Server::get($filterClass);
@ -72,18 +62,14 @@ class GenericTest extends TestCase {
$this->assertStringStartsWith('http', $filter->getIcon());
}
/**
* @dataProvider dataFilters
*/
#[\PHPUnit\Framework\Attributes\DataProvider('dataFilters')]
public function testFilterTypes(string $filterClass): void {
/** @var IFilter $filter */
$filter = Server::get($filterClass);
$this->assertIsArray($filter->filterTypes([]));
}
/**
* @dataProvider dataFilters
*/
#[\PHPUnit\Framework\Attributes\DataProvider('dataFilters')]
public function testAllowedApps(string $filterClass): void {
/** @var IFilter $filter */
$filter = Server::get($filterClass);

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

@ -44,9 +44,7 @@ class BaseTest extends TestCase {
];
}
/**
* @dataProvider dataSetSubjects
*/
#[\PHPUnit\Framework\Attributes\DataProvider('dataSetSubjects')]
public function testSetSubjects(string $subject, array $parameters): void {
$event = $this->createMock(IEvent::class);
$event->expects($this->once())
@ -68,9 +66,7 @@ class BaseTest extends TestCase {
];
}
/**
* @dataProvider dataGenerateCalendarParameter
*/
#[\PHPUnit\Framework\Attributes\DataProvider('dataGenerateCalendarParameter')]
public function testGenerateCalendarParameter(array $data, string $name): void {
$l = $this->createMock(IL10N::class);
$l->expects($this->any())
@ -93,9 +89,7 @@ class BaseTest extends TestCase {
];
}
/**
* @dataProvider dataGenerateLegacyCalendarParameter
*/
#[\PHPUnit\Framework\Attributes\DataProvider('dataGenerateLegacyCalendarParameter')]
public function testGenerateLegacyCalendarParameter(int $id, string $name): void {
$this->assertEquals([
'type' => 'calendar',
@ -111,9 +105,7 @@ class BaseTest extends TestCase {
];
}
/**
* @dataProvider dataGenerateGroupParameter
*/
#[\PHPUnit\Framework\Attributes\DataProvider('dataGenerateGroupParameter')]
public function testGenerateGroupParameter(string $gid): void {
$this->assertEquals([
'type' => 'user-group',

@ -67,9 +67,7 @@ class EventTest extends TestCase {
];
}
/**
* @dataProvider dataGenerateObjectParameter
*/
#[\PHPUnit\Framework\Attributes\DataProvider('dataGenerateObjectParameter')]
public function testGenerateObjectParameter(int $id, string $name, ?array $link, bool $calendarAppEnabled = true): void {
$affectedUser = 'otheruser';
if ($link) {
@ -150,9 +148,7 @@ class EventTest extends TestCase {
];
}
/**
* @dataProvider generateObjectParameterLinkEncodingDataProvider
*/
#[\PHPUnit\Framework\Attributes\DataProvider('generateObjectParameterLinkEncodingDataProvider')]
public function testGenerateObjectParameterLinkEncoding(array $link, string $objectId): void {
$generatedLink = [
'objectId' => $objectId,
@ -185,9 +181,7 @@ class EventTest extends TestCase {
];
}
/**
* @dataProvider dataGenerateObjectParameterThrows
*/
#[\PHPUnit\Framework\Attributes\DataProvider('dataGenerateObjectParameterThrows')]
public function testGenerateObjectParameterThrows(string|array $eventData, string $exception = InvalidArgumentException::class): void {
$this->expectException($exception);

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

@ -61,7 +61,7 @@ class AppCalendarTest extends TestCase {
];
$this->writeableCalendar->expects($this->exactly(3))
->method('createFromString')
->willReturnCallback(function () use (&$calls) {
->willReturnCallback(function () use (&$calls): void {
$expected = array_shift($calls);
$this->assertEquals($expected, func_get_args());
});

@ -112,9 +112,7 @@ class CalDavBackendTest extends AbstractCalDavBackend {
];
}
/**
* @dataProvider providesSharingData
*/
#[\PHPUnit\Framework\Attributes\DataProvider('providesSharingData')]
public function testCalendarSharing($userCanRead, $userCanWrite, $groupCanRead, $groupCanWrite, $add, $principals): void {
$logger = $this->createMock(\Psr\Log\LoggerInterface::class);
$config = $this->createMock(IConfig::class);
@ -403,9 +401,7 @@ EOD;
$this->assertCount(0, $calendarObjects);
}
/**
* @dataProvider providesCalendarQueryParameters
*/
#[\PHPUnit\Framework\Attributes\DataProvider('providesCalendarQueryParameters')]
public function testCalendarQuery($expectedEventsInResult, $propFilters, $compFilter): void {
$calendarId = $this->createTestCalendar();
$events = [];
@ -692,9 +688,9 @@ EOS;
}
/**
* @dataProvider providesSchedulingData
* @param $objectData
*/
#[\PHPUnit\Framework\Attributes\DataProvider('providesSchedulingData')]
public function testScheduling($objectData): void {
$this->backend->createSchedulingObject(self::UNIT_TEST_USER, 'Sample Schedule', $objectData);
@ -710,9 +706,7 @@ EOS;
$this->assertCount(0, $sos);
}
/**
* @dataProvider providesCalDataForGetDenormalizedData
*/
#[\PHPUnit\Framework\Attributes\DataProvider('providesCalDataForGetDenormalizedData')]
public function testGetDenormalizedData($expected, $key, $calData): void {
try {
$actual = $this->backend->getDenormalizedData($calData);
@ -878,9 +872,7 @@ EOD;
$this->assertEquals(count($search5), 0);
}
/**
* @dataProvider searchDataProvider
*/
#[\PHPUnit\Framework\Attributes\DataProvider('searchDataProvider')]
public function testSearch(bool $isShared, array $searchOptions, int $count): void {
$calendarId = $this->createTestCalendar();

@ -144,9 +144,7 @@ class CalendarTest extends TestCase {
];
}
/**
* @dataProvider dataPropPatch
*/
#[\PHPUnit\Framework\Attributes\DataProvider('dataPropPatch')]
public function testPropPatch(string $ownerPrincipal, string $principalUri, array $mutations, bool $shared): void {
/** @var CalDavBackend&MockObject $backend */
$backend = $this->createMock(CalDavBackend::class);
@ -168,9 +166,7 @@ class CalendarTest extends TestCase {
$this->addToAssertionCount(1);
}
/**
* @dataProvider providesReadOnlyInfo
*/
#[\PHPUnit\Framework\Attributes\DataProvider('providesReadOnlyInfo')]
public function testAcl($expectsWrite, $readOnlyValue, $hasOwnerSet, $uri = 'default'): void {
/** @var CalDavBackend&MockObject $backend */
$backend = $this->createMock(CalDavBackend::class);
@ -270,9 +266,7 @@ class CalendarTest extends TestCase {
];
}
/**
* @dataProvider providesConfidentialClassificationData
*/
#[\PHPUnit\Framework\Attributes\DataProvider('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];
@ -310,9 +304,7 @@ class CalendarTest extends TestCase {
$this->assertEquals(!$isShared, $c->childExists('event-2'));
}
/**
* @dataProvider providesConfidentialClassificationData
*/
#[\PHPUnit\Framework\Attributes\DataProvider('providesConfidentialClassificationData')]
public function testConfidentialClassification(int $expectedChildren, bool $isShared): void {
$start = '20160609';
$end = '20160610';

@ -66,9 +66,7 @@ class ExternalCalendarTest extends TestCase {
$this->assertTrue(ExternalCalendar::isAppGeneratedCalendar('app-generated--example--foo--2'));
}
/**
* @dataProvider splitAppGeneratedCalendarUriDataProvider
*/
#[\PHPUnit\Framework\Attributes\DataProvider('splitAppGeneratedCalendarUriDataProvider')]
public function testSplitAppGeneratedCalendarUriInvalid(string $name):void {
$this->expectException(\InvalidArgumentException::class);
$this->expectExceptionMessage('Provided calendar uri was not app-generated');

@ -36,9 +36,7 @@ class PluginTest extends TestCase {
];
}
/**
* @dataProvider linkProvider
*/
#[\PHPUnit\Framework\Attributes\DataProvider('linkProvider')]
public function testGetCalendarHomeForPrincipal(string $input, string $expected): void {
$this->assertSame($expected, $this->plugin->getCalendarHomeForPrincipal($input));
}

@ -16,9 +16,7 @@ use Sabre\VObject\Reader;
class PublicCalendarTest extends CalendarTest {
/**
* @dataProvider providesConfidentialClassificationData
*/
#[\PHPUnit\Framework\Attributes\DataProvider('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];
@ -57,9 +55,7 @@ class PublicCalendarTest extends CalendarTest {
$this->assertFalse($c->childExists('event-2'));
}
/**
* @dataProvider providesConfidentialClassificationData
*/
#[\PHPUnit\Framework\Attributes\DataProvider('providesConfidentialClassificationData')]
public function testConfidentialClassification(int $expectedChildren, bool $isShared): void {
$start = '20160609';
$end = '20160610';

@ -107,7 +107,7 @@ class PushProviderTest extends AbstractNotificationProviderTestCase {
];
$this->manager->expects($this->exactly(3))
->method('notify')
->willReturnCallback(function ($notification) use (&$calls) {
->willReturnCallback(function ($notification) use (&$calls): void {
$expected = array_shift($calls);
$this->assertEquals($expected, $notification);
});

@ -170,9 +170,7 @@ class NotifierTest extends TestCase {
];
}
/**
* @dataProvider dataPrepare
*/
#[\PHPUnit\Framework\Attributes\DataProvider('dataPrepare')]
public function testPrepare(string $subjectType, array $subjectParams, string $subject, array $messageParams, string $message): void {
/** @var INotification&MockObject $notification */
$notification = $this->createMock(INotification::class);

@ -747,7 +747,7 @@ EOD;
];
$this->backend->expects($this->exactly(5))
->method('removeReminder')
->willReturnCallback(function () use (&$removeReminderCalls) {
->willReturnCallback(function () use (&$removeReminderCalls): void {
$expected = array_shift($removeReminderCalls);
$this->assertEquals($expected, func_get_args());
});

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

@ -74,7 +74,7 @@ class PluginTest extends TestCase {
];
$this->server->expects($this->exactly(count($calls)))
->method('on')
->willReturnCallback(function () use (&$calls) {
->willReturnCallback(function () use (&$calls): void {
$expected = array_shift($calls);
$this->assertEquals($expected, func_get_args());
});
@ -251,9 +251,7 @@ class PluginTest extends TestCase {
];
}
/**
* @dataProvider propFindDefaultCalendarUrlProvider
*/
#[\PHPUnit\Framework\Attributes\DataProvider('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,

@ -32,9 +32,7 @@ class ConnectionTest extends TestCase {
$this->connection = new Connection($this->clientService, $this->config, $this->logger);
}
/**
* @dataProvider runLocalURLDataProvider
*/
#[\PHPUnit\Framework\Attributes\DataProvider('runLocalURLDataProvider')]
public function testLocalUrl($source): void {
$subscription = [
'id' => 42,
@ -94,8 +92,8 @@ class ConnectionTest extends TestCase {
/**
* @param string $result
* @param string $contentType
* @dataProvider urlDataProvider
*/
#[\PHPUnit\Framework\Attributes\DataProvider('urlDataProvider')]
public function testConnection(string $url, string $result, string $contentType): void {
$client = $this->createMock(IClient::class);
$response = $this->createMock(IResponse::class);

@ -34,9 +34,7 @@ class RefreshWebcalServiceTest extends TestCase {
$this->time = $this->createMock(ITimeFactory::class);
}
/**
* @dataProvider runDataProvider
*/
#[\PHPUnit\Framework\Attributes\DataProvider('runDataProvider')]
public function testRun(string $body, string $contentType, string $result): void {
$refreshWebcalService = $this->getMockBuilder(RefreshWebcalService::class)
->onlyMethods(['getRandomCalendarObjectUri'])
@ -83,9 +81,7 @@ class RefreshWebcalServiceTest extends TestCase {
$refreshWebcalService->refreshSubscription('principals/users/testuser', 'sub123');
}
/**
* @dataProvider identicalDataProvider
*/
#[\PHPUnit\Framework\Attributes\DataProvider('identicalDataProvider')]
public function testRunIdentical(string $uid, array $calendarObject, string $body, string $contentType, string $result): void {
$refreshWebcalService = $this->getMockBuilder(RefreshWebcalService::class)
->onlyMethods(['getRandomCalendarObjectUri'])
@ -200,9 +196,7 @@ class RefreshWebcalServiceTest extends TestCase {
$refreshWebcalService->refreshSubscription('principals/users/testuser', 'sub123');
}
/**
* @dataProvider runDataProvider
*/
#[\PHPUnit\Framework\Attributes\DataProvider('runDataProvider')]
public function testRunCreateCalendarNoException(string $body, string $contentType, string $result): void {
$refreshWebcalService = $this->getMockBuilder(RefreshWebcalService::class)
->onlyMethods(['getRandomCalendarObjectUri', 'getSubscription',])
@ -246,9 +240,7 @@ class RefreshWebcalServiceTest extends TestCase {
$refreshWebcalService->refreshSubscription('principals/users/testuser', 'sub123');
}
/**
* @dataProvider runDataProvider
*/
#[\PHPUnit\Framework\Attributes\DataProvider('runDataProvider')]
public function testRunCreateCalendarBadRequest(string $body, string $contentType, string $result): void {
$refreshWebcalService = $this->getMockBuilder(RefreshWebcalService::class)
->onlyMethods(['getRandomCalendarObjectUri', 'getSubscription'])

@ -71,9 +71,7 @@ class BackendTest extends TestCase {
];
}
/**
* @dataProvider dataCallTriggerAddressBookActivity
*/
#[\PHPUnit\Framework\Attributes\DataProvider('dataCallTriggerAddressBookActivity')]
public function testCallTriggerAddressBookActivity(string $method, array $payload, string $expectedSubject, array $expectedPayload): void {
$backend = $this->getBackend(['triggerAddressbookActivity']);
$backend->expects($this->once())
@ -151,10 +149,10 @@ class BackendTest extends TestCase {
}
/**
* @dataProvider dataTriggerAddressBookActivity
* @param string[]|null $shareUsers
* @param string[] $users
*/
#[\PHPUnit\Framework\Attributes\DataProvider('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']);
@ -315,10 +313,10 @@ class BackendTest extends TestCase {
}
/**
* @dataProvider dataTriggerCardActivity
* @param string[]|null $shareUsers
* @param string[] $users
*/
#[\PHPUnit\Framework\Attributes\DataProvider('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']);
@ -432,9 +430,7 @@ class BackendTest extends TestCase {
];
}
/**
* @dataProvider dataGetUsersForShares
*/
#[\PHPUnit\Framework\Attributes\DataProvider('dataGetUsersForShares')]
public function testGetUsersForShares(array $shares, array $groups, array $expected): void {
$backend = $this->getBackend();

@ -103,9 +103,7 @@ class AddressBookImplTest extends TestCase {
$this->assertSame(2, count($result));
}
/**
* @dataProvider dataTestCreate
*/
#[\PHPUnit\Framework\Attributes\DataProvider('dataTestCreate')]
public function testCreate(array $properties): void {
$uid = 'uid';
@ -230,9 +228,7 @@ class AddressBookImplTest extends TestCase {
$addressBookImpl->createOrUpdate($properties);
}
/**
* @dataProvider dataTestGetPermissions
*/
#[\PHPUnit\Framework\Attributes\DataProvider('dataTestGetPermissions')]
public function testGetPermissions(array $permissions, int $expected): void {
$this->addressBook->expects($this->once())->method('getACL')
->willReturn($permissions);

@ -117,9 +117,7 @@ class AddressBookTest extends TestCase {
$addressBook->propPatch(new PropPatch(['{DAV:}displayname' => 'Test address book']));
}
/**
* @dataProvider providesReadOnlyInfo
*/
#[\PHPUnit\Framework\Attributes\DataProvider('providesReadOnlyInfo')]
public function testAcl(bool $expectsWrite, ?bool $readOnlyValue, bool $hasOwnerSet): void {
/** @var MockObject | CardDavBackend $backend */
$backend = $this->createMock(CardDavBackend::class);

@ -50,9 +50,7 @@ class BirthdayServiceTest extends TestCase {
$this->dbConnection, $this->l10n);
}
/**
* @dataProvider providesVCards
*/
#[\PHPUnit\Framework\Attributes\DataProvider('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);
@ -146,7 +144,7 @@ class BirthdayServiceTest extends TestCase {
];
$this->calDav->expects($this->exactly(count($calls)))
->method('deleteCalendarObject')
->willReturnCallback(function ($calendarId, $objectUri) use (&$calls) {
->willReturnCallback(function ($calendarId, $objectUri) use (&$calls): void {
$expected = array_shift($calls);
$this->assertEquals($expected, [$calendarId, $objectUri]);
});
@ -200,9 +198,7 @@ class BirthdayServiceTest extends TestCase {
$service->onCardChanged(666, 'gump.vcf', '');
}
/**
* @dataProvider providesCardChanges
*/
#[\PHPUnit\Framework\Attributes\DataProvider('providesCardChanges')]
public function testOnCardChanged(string $expectedOp): void {
$this->config->expects($this->once())
->method('getAppValue')
@ -246,7 +242,7 @@ class BirthdayServiceTest extends TestCase {
];
$this->calDav->expects($this->exactly(count($calls)))
->method('deleteCalendarObject')
->willReturnCallback(function ($calendarId, $objectUri) use (&$calls) {
->willReturnCallback(function ($calendarId, $objectUri) use (&$calls): void {
$expected = array_shift($calls);
$this->assertEquals($expected, [$calendarId, $objectUri]);
});
@ -264,7 +260,7 @@ class BirthdayServiceTest extends TestCase {
];
$this->calDav->expects($this->exactly(count($createCalendarObjectCalls)))
->method('createCalendarObject')
->willReturnCallback(function ($calendarId, $objectUri, $calendarData) use (&$createCalendarObjectCalls) {
->willReturnCallback(function ($calendarId, $objectUri, $calendarData) use (&$createCalendarObjectCalls): void {
$expected = array_shift($createCalendarObjectCalls);
$this->assertEquals($expected, [$calendarId, $objectUri, $calendarData]);
});
@ -284,7 +280,7 @@ class BirthdayServiceTest extends TestCase {
];
$this->calDav->expects($this->exactly(count($updateCalendarObjectCalls)))
->method('updateCalendarObject')
->willReturnCallback(function ($calendarId, $objectUri, $calendarData) use (&$updateCalendarObjectCalls) {
->willReturnCallback(function ($calendarId, $objectUri, $calendarData) use (&$updateCalendarObjectCalls): void {
$expected = array_shift($updateCalendarObjectCalls);
$this->assertEquals($expected, [$calendarId, $objectUri, $calendarData]);
});
@ -293,9 +289,7 @@ class BirthdayServiceTest extends TestCase {
$service->onCardChanged(666, 'gump.vcf', '');
}
/**
* @dataProvider providesBirthday
*/
#[\PHPUnit\Framework\Attributes\DataProvider('providesBirthday')]
public function testBirthdayEvenChanged(bool $expected, string $old, string $new): void {
$new = Reader::read($new);
$this->assertEquals($expected, $this->service->birthdayEvenChanged($old, $new));
@ -369,7 +363,7 @@ class BirthdayServiceTest extends TestCase {
];
$this->calDav->expects($this->exactly(count($calls)))
->method('deleteCalendarObject')
->willReturnCallback(function ($calendarId, $objectUri, $calendarType) use (&$calls) {
->willReturnCallback(function ($calendarId, $objectUri, $calendarType) use (&$calls): void {
$expected = array_shift($calls);
$this->assertEquals($expected, [$calendarId, $objectUri, $calendarType]);
});

@ -249,7 +249,7 @@ class CardDavBackendTest extends TestCase {
];
$backend->expects($this->exactly(count($calls)))
->method('updateProperties')
->willReturnCallback(function () use (&$calls) {
->willReturnCallback(function () use (&$calls): void {
$expected = array_shift($calls);
$this->assertEquals($expected, func_get_args());
});
@ -437,7 +437,7 @@ class CardDavBackendTest extends TestCase {
];
$this->backend->expects($this->exactly(count($calls)))
->method('addChange')
->willReturnCallback(function () use (&$calls) {
->willReturnCallback(function () use (&$calls): void {
$expected = array_shift($calls);
$this->assertEquals($expected, func_get_args());
});
@ -645,9 +645,7 @@ class CardDavBackendTest extends TestCase {
$this->invokePrivate($this->backend, 'getCardId', [1, 'uri']);
}
/**
* @dataProvider dataTestSearch
*/
#[\PHPUnit\Framework\Attributes\DataProvider('dataTestSearch')]
public function testSearch(string $pattern, array $properties, array $options, array $expected): void {
/** @var VCard $vCards */
$vCards = [];

@ -79,9 +79,7 @@ class ConverterTest extends TestCase {
return $accountManager;
}
/**
* @dataProvider providesNewUsers
*/
#[\PHPUnit\Framework\Attributes\DataProvider('providesNewUsers')]
public function testCreation($expectedVCard, $displayName = null, $eMailAddress = null, $cloudId = null): void {
$user = $this->getUserMock((string)$displayName, $eMailAddress, $cloudId);
$accountManager = $this->getAccountManager($user);
@ -189,9 +187,7 @@ class ConverterTest extends TestCase {
];
}
/**
* @dataProvider providesNames
*/
#[\PHPUnit\Framework\Attributes\DataProvider('providesNames')]
public function testNameSplitter(string $expected, string $fullName): void {
$converter = new Converter($this->accountManager, $this->userManager, $this->urlGenerator, $this->logger);
$r = $converter->splitFullName($fullName);

@ -45,9 +45,7 @@ class ImageExportPluginTest extends TestCase {
$this->plugin->initialize($this->server);
}
/**
* @dataProvider providesQueryParams
*/
#[\PHPUnit\Framework\Attributes\DataProvider('providesQueryParams')]
public function testQueryParams(array $param): void {
$this->request->expects($this->once())->method('getQueryParameters')->willReturn($param);
$result = $this->plugin->httpGet($this->request, $this->response);
@ -88,9 +86,7 @@ class ImageExportPluginTest extends TestCase {
];
}
/**
* @dataProvider dataTestCard
*/
#[\PHPUnit\Framework\Attributes\DataProvider('dataTestCard')]
public function testCard(?int $size, bool $photo): void {
$query = ['photo' => null];
if ($size !== null) {
@ -142,7 +138,7 @@ class ImageExportPluginTest extends TestCase {
];
$this->response->expects($this->exactly(count($setHeaderCalls)))
->method('setHeader')
->willReturnCallback(function () use (&$setHeaderCalls) {
->willReturnCallback(function () use (&$setHeaderCalls): void {
$expected = array_shift($setHeaderCalls);
$this->assertEquals($expected, func_get_args());
});
@ -160,7 +156,7 @@ class ImageExportPluginTest extends TestCase {
];
$this->response->expects($this->exactly(count($setHeaderCalls)))
->method('setHeader')
->willReturnCallback(function () use (&$setHeaderCalls) {
->willReturnCallback(function () use (&$setHeaderCalls): void {
$expected = array_shift($setHeaderCalls);
$this->assertEquals($expected, func_get_args());
});

@ -325,9 +325,7 @@ END:VCARD';
];
}
/**
* @dataProvider dataActivatedUsers
*/
#[\PHPUnit\Framework\Attributes\DataProvider('dataActivatedUsers')]
public function testUpdateAndDeleteUser(bool $activated, int $createCalls, int $updateCalls, int $deleteCalls): void {
/** @var CardDavBackend | MockObject $backend */
$backend = $this->getMockBuilder(CardDavBackend::class)->disableOriginalConstructor()->getMock();
@ -427,9 +425,7 @@ END:VCARD';
);
}
/**
* @dataProvider providerUseAbsoluteUriReport
*/
#[\PHPUnit\Framework\Attributes\DataProvider('providerUseAbsoluteUriReport')]
public function testUseAbsoluteUriReport(string $host, string $expected): void {
$body = '<?xml version="1.0"?>
<d:multistatus xmlns:d="DAV:" xmlns:s="http://sabredav.org/ns" xmlns:card="urn:ietf:params:xml:ns:carddav" xmlns:oc="http://owncloud.org/ns">

@ -78,9 +78,7 @@ class ListAddressbooksTest extends TestCase {
];
}
/**
* @dataProvider dataExecute
*/
#[\PHPUnit\Framework\Attributes\DataProvider('dataExecute')]
public function testWithCorrectUser(bool $readOnly, string $output): void {
$this->userManager->expects($this->once())
->method('userExists')

@ -79,9 +79,7 @@ class ListCalendarsTest extends TestCase {
];
}
/**
* @dataProvider dataExecute
*/
#[\PHPUnit\Framework\Attributes\DataProvider('dataExecute')]
public function testWithCorrectUser(bool $readOnly, string $output): void {
$this->userManager->expects($this->once())
->method('userExists')

@ -64,9 +64,7 @@ class MoveCalendarTest extends TestCase {
];
}
/**
* @dataProvider dataExecute
*/
#[\PHPUnit\Framework\Attributes\DataProvider('dataExecute')]
public function testWithBadUserOrigin(bool $userOriginExists, bool $userDestinationExists): void {
$this->expectException(\InvalidArgumentException::class);
@ -178,9 +176,7 @@ class MoveCalendarTest extends TestCase {
];
}
/**
* @dataProvider dataTestMoveWithDestinationNotPartOfGroup
*/
#[\PHPUnit\Framework\Attributes\DataProvider('dataTestMoveWithDestinationNotPartOfGroup')]
public function testMoveWithDestinationNotPartOfGroup(bool $shareWithGroupMembersOnly): void {
$this->userManager->expects($this->exactly(2))
->method('userExists')
@ -311,9 +307,7 @@ class MoveCalendarTest extends TestCase {
];
}
/**
* @dataProvider dataTestMoveWithCalendarAlreadySharedToDestination
*/
#[\PHPUnit\Framework\Attributes\DataProvider('dataTestMoveWithCalendarAlreadySharedToDestination')]
public function testMoveWithCalendarAlreadySharedToDestination(bool $force): void {
$this->userManager->expects($this->exactly(2))
->method('userExists')

@ -174,7 +174,7 @@ class CommentsNodeTest extends \Test\TestCase {
$this->comment->expects($this->once())
->method('setMessage')
->with($msg)
->will($this->throwException(new \Exception('buh!')));
->willThrowException(new \Exception('buh!'));
$this->comment->expects($this->any())
->method('getActorType')
@ -209,7 +209,7 @@ class CommentsNodeTest extends \Test\TestCase {
$this->comment->expects($this->once())
->method('setMessage')
->will($this->throwException(new MessageTooLongException()));
->willThrowException(new MessageTooLongException());
$this->comment->expects($this->any())
->method('getActorType')
@ -469,9 +469,7 @@ class CommentsNodeTest extends \Test\TestCase {
];
}
/**
* @dataProvider readCommentProvider
*/
#[\PHPUnit\Framework\Attributes\DataProvider('readCommentProvider')]
public function testGetPropertiesUnreadProperty(\DateTime $creationDT, ?\DateTime $readDT, string $expected): void {
$this->comment->expects($this->any())
->method('getCreationDateTime')

@ -184,7 +184,7 @@ class CommentsPluginTest extends \Test\TestCase {
$this->tree->expects($this->any())
->method('getNodeForPath')
->with('/' . $path)
->will($this->throwException(new \Sabre\DAV\Exception\NotFound()));
->willThrowException(new \Sabre\DAV\Exception\NotFound());
$request = $this->getMockBuilder(RequestInterface::class)
->disableOriginalConstructor()

@ -68,7 +68,7 @@ class EntityCollectionTest extends \Test\TestCase {
$this->commentsManager->expects($this->once())
->method('get')
->with('55')
->will($this->throwException(new NotFoundException()));
->willThrowException(new NotFoundException());
$this->collection->getChild('55');
}
@ -114,7 +114,7 @@ class EntityCollectionTest extends \Test\TestCase {
$this->commentsManager->expects($this->once())
->method('get')
->with('44')
->will($this->throwException(new NotFoundException()));
->willThrowException(new NotFoundException());
$this->assertFalse($this->collection->childExists('44'));
}

@ -196,7 +196,7 @@ class AuthTest extends TestCase {
->expects($this->once())
->method('logClientIn')
->with('MyTestUser', 'MyTestPassword')
->will($this->throwException(new PasswordLoginForbiddenException()));
->willThrowException(new PasswordLoginForbiddenException());
$this->session
->expects($this->once())
->method('close');

@ -55,9 +55,7 @@ class BlockLegacyClientPluginTest extends TestCase {
];
}
/**
* @dataProvider oldDesktopClientProvider
*/
#[\PHPUnit\Framework\Attributes\DataProvider('oldDesktopClientProvider')]
public function testBeforeHandlerException(string $userAgent, ERROR_TYPE $errorType): void {
$this->themingDefaults
->expects($this->atMost(1))
@ -95,8 +93,8 @@ class BlockLegacyClientPluginTest extends TestCase {
/**
* Ensure that there is no room for XSS attack through configured URL / version
* @dataProvider oldDesktopClientProvider
*/
#[\PHPUnit\Framework\Attributes\DataProvider('oldDesktopClientProvider')]
public function testBeforeHandlerExceptionPreventXSSAttack(string $userAgent, ERROR_TYPE $errorType): void {
$this->expectException(\Sabre\DAV\Exception\Forbidden::class);
@ -142,9 +140,7 @@ class BlockLegacyClientPluginTest extends TestCase {
];
}
/**
* @dataProvider newAndAlternateDesktopClientProvider
*/
#[\PHPUnit\Framework\Attributes\DataProvider('newAndAlternateDesktopClientProvider')]
public function testBeforeHandlerSuccess(string $userAgent): void {
/** @var RequestInterface|MockObject $request */
$request = $this->createMock(RequestInterface::class);

@ -43,9 +43,7 @@ class CommentsPropertiesPluginTest extends \Test\TestCase {
];
}
/**
* @dataProvider nodeProvider
*/
#[\PHPUnit\Framework\Attributes\DataProvider('nodeProvider')]
public function testHandleGetProperties(string $class, bool $expectedSuccessful): void {
$propFind = $this->createMock(PropFind::class);
@ -69,9 +67,7 @@ class CommentsPropertiesPluginTest extends \Test\TestCase {
];
}
/**
* @dataProvider baseUriProvider
*/
#[\PHPUnit\Framework\Attributes\DataProvider('baseUriProvider')]
public function testGetCommentsLink(string $baseUri, string $fid, ?string $expectedHref): void {
$node = $this->createMock(File::class);
$node->expects($this->any())
@ -93,9 +89,7 @@ class CommentsPropertiesPluginTest extends \Test\TestCase {
];
}
/**
* @dataProvider userProvider
*/
#[\PHPUnit\Framework\Attributes\DataProvider('userProvider')]
public function testGetUnreadCount(?string $user): void {
$node = $this->createMock(File::class);
$node->expects($this->any())

@ -373,26 +373,20 @@ class DirectoryTest extends \Test\TestCase {
$this->assertEquals([200, 800], $dir->getQuotaInfo()); //200 used, 800 free
}
/**
* @dataProvider moveFailedProvider
*/
#[\PHPUnit\Framework\Attributes\DataProvider('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);
}
/**
* @dataProvider moveSuccessProvider
*/
#[\PHPUnit\Framework\Attributes\DataProvider('moveSuccessProvider')]
public function testMoveSuccess(string $source, string $destination, array $updatables, array $deletables): void {
$this->moveTest($source, $destination, $updatables, $deletables);
$this->addToAssertionCount(1);
}
/**
* @dataProvider moveFailedInvalidCharsProvider
*/
#[\PHPUnit\Framework\Attributes\DataProvider('moveFailedInvalidCharsProvider')]
public function testMoveFailedInvalidChars(string $source, string $destination, array $updatables, array $deletables): void {
$this->expectException(InvalidPath::class);

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

@ -41,7 +41,7 @@ class FakeLockerPluginTest extends TestCase {
];
$server->expects($this->exactly(count($calls)))
->method('on')
->willReturnCallback(function () use (&$calls) {
->willReturnCallback(function () use (&$calls): void {
$expected = array_shift($calls);
$this->assertEquals($expected, func_get_args());
});
@ -74,7 +74,7 @@ class FakeLockerPluginTest extends TestCase {
];
$propFind->expects($this->exactly(count($calls)))
->method('handle')
->willReturnCallback(function ($propertyName) use (&$calls) {
->willReturnCallback(function ($propertyName) use (&$calls): void {
$expected = array_shift($calls);
$this->assertEquals($expected, $propertyName);
});
@ -119,9 +119,7 @@ class FakeLockerPluginTest extends TestCase {
];
}
/**
* @dataProvider tokenDataProvider
*/
#[\PHPUnit\Framework\Attributes\DataProvider('tokenDataProvider')]
public function testValidateTokens(array $input, array $expected): void {
$request = $this->createMock(RequestInterface::class);
$this->fakeLockerPlugin->validateTokens($request, $input);

@ -150,9 +150,7 @@ class FileTest extends TestCase {
];
}
/**
* @dataProvider fopenFailuresProvider
*/
#[\PHPUnit\Framework\Attributes\DataProvider('fopenFailuresProvider')]
public function testSimplePutFails(?\Throwable $thrownException, string $expectedException, bool $checkPreviousClass = true): void {
// setup
$storage = $this->getMockBuilder(Local::class)
@ -175,7 +173,7 @@ class FileTest extends TestCase {
if ($thrownException !== null) {
$storage->expects($this->once())
->method('writeStream')
->will($this->throwException($thrownException));
->willThrowException($thrownException);
} else {
$storage->expects($this->once())
->method('writeStream')
@ -316,8 +314,8 @@ class FileTest extends TestCase {
/**
* Test putting a file with string Mtime
* @dataProvider legalMtimeProvider
*/
#[\PHPUnit\Framework\Attributes\DataProvider('legalMtimeProvider')]
public function testPutSingleFileLegalMtime(mixed $requestMtime, ?int $resultMtime): void {
$request = new Request([
'server' => [

@ -294,7 +294,7 @@ class FilesPluginTest extends TestCase {
$node->expects($this->once())
->method('getDirectDownload')
->will($this->throwException(new StorageNotAvailableException()));
->willThrowException(new StorageNotAvailableException());
$this->plugin->handleGetProperties(
$propFind,
@ -652,9 +652,7 @@ class FilesPluginTest extends TestCase {
];
}
/**
* @dataProvider downloadHeadersProvider
*/
#[\PHPUnit\Framework\Attributes\DataProvider('downloadHeadersProvider')]
public function testDownloadHeaders(bool $isClumsyAgent, string $contentDispositionHeader): void {
$request = $this->createMock(RequestInterface::class);
$response = $this->createMock(ResponseInterface::class);
@ -688,7 +686,7 @@ class FilesPluginTest extends TestCase {
$response
->expects($this->exactly(count($calls)))
->method('addHeader')
->willReturnCallback(function () use (&$calls) {
->willReturnCallback(function () use (&$calls): void {
$expected = array_shift($calls);
$this->assertSame($expected, func_get_args());
});

@ -846,9 +846,7 @@ class FilesReportPluginTest extends \Test\TestCase {
];
}
/**
* @dataProvider filesBaseUriProvider
*/
#[\PHPUnit\Framework\Attributes\DataProvider('filesBaseUriProvider')]
public function testFilesBaseUri(string $uri, string $reportPath, string $expectedUri): void {
$this->assertEquals($expectedUri, self::invokePrivate($this->plugin, 'getFilesBaseUri', [$uri, $reportPath]));
}

@ -51,9 +51,7 @@ class NodeTest extends \Test\TestCase {
];
}
/**
* @dataProvider davPermissionsProvider
*/
#[\PHPUnit\Framework\Attributes\DataProvider('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()
@ -141,9 +139,7 @@ class NodeTest extends \Test\TestCase {
];
}
/**
* @dataProvider sharePermissionsProvider
*/
#[\PHPUnit\Framework\Attributes\DataProvider('sharePermissionsProvider')]
public function testSharePermissions(string $type, ?string $user, int $permissions, int $expected): void {
$storage = $this->createMock(IStorage::class);
$storage->method('getPermissions')->willReturn($permissions);
@ -242,9 +238,7 @@ class NodeTest extends \Test\TestCase {
];
}
/**
* @dataProvider sanitizeMtimeProvider
*/
#[\PHPUnit\Framework\Attributes\DataProvider('sanitizeMtimeProvider')]
public function testSanitizeMtime(string|int $mtime, int $expected): void {
$view = $this->getMockBuilder(View::class)
->disableOriginalConstructor()
@ -264,9 +258,7 @@ class NodeTest extends \Test\TestCase {
];
}
/**
* @dataProvider invalidSanitizeMtimeProvider
*/
#[\PHPUnit\Framework\Attributes\DataProvider('invalidSanitizeMtimeProvider')]
public function testInvalidSanitizeMtime(int|string $mtime): void {
$this->expectException(\InvalidArgumentException::class);

@ -39,9 +39,7 @@ class ObjectTreeTest extends \Test\TestCase {
];
}
/**
* @dataProvider copyDataProvider
*/
#[\PHPUnit\Framework\Attributes\DataProvider('copyDataProvider')]
public function testCopy(string $sourcePath, string $targetPath, string $targetParent): void {
$view = $this->createMock(View::class);
$view->expects($this->once())
@ -83,9 +81,7 @@ class ObjectTreeTest extends \Test\TestCase {
$objectTree->copy($sourcePath, $targetPath);
}
/**
* @dataProvider copyDataProvider
*/
#[\PHPUnit\Framework\Attributes\DataProvider('copyDataProvider')]
public function testCopyFailNotCreatable($sourcePath, $targetPath, $targetParent): void {
$this->expectException(\Sabre\DAV\Exception\Forbidden::class);
@ -124,9 +120,7 @@ class ObjectTreeTest extends \Test\TestCase {
$objectTree->copy($sourcePath, $targetPath);
}
/**
* @dataProvider nodeForPathProvider
*/
#[\PHPUnit\Framework\Attributes\DataProvider('nodeForPathProvider')]
public function testGetNodeForPath(
string $inputFileName,
string $fileInfoQueryPath,

@ -463,9 +463,7 @@ class PrincipalTest extends TestCase {
['{http://sabredav.org/ns}email-address' => 'foo']));
}
/**
* @dataProvider searchPrincipalsDataProvider
*/
#[\PHPUnit\Framework\Attributes\DataProvider('searchPrincipalsDataProvider')]
public function testSearchPrincipals(bool $sharingEnabled, bool $groupsOnly, string $test, array $result): void {
$this->shareManager->expects($this->once())
->method('shareAPIEnabled')
@ -826,9 +824,7 @@ class PrincipalTest extends TestCase {
$this->assertEquals(null, $this->connector->findByUri('mailto:user@foo.com', 'principals/users'));
}
/**
* @dataProvider findByUriWithGroupRestrictionDataProvider
*/
#[\PHPUnit\Framework\Attributes\DataProvider('findByUriWithGroupRestrictionDataProvider')]
public function testFindByUriWithGroupRestriction(string $uri, string $email, ?string $expects): void {
$this->shareManager->expects($this->once())
->method('shareApiEnabled')
@ -879,9 +875,7 @@ class PrincipalTest extends TestCase {
];
}
/**
* @dataProvider findByUriWithoutGroupRestrictionDataProvider
*/
#[\PHPUnit\Framework\Attributes\DataProvider('findByUriWithoutGroupRestrictionDataProvider')]
public function testFindByUriWithoutGroupRestriction(string $uri, string $email, string $expects): void {
$this->shareManager->expects($this->once())
->method('shareApiEnabled')

@ -114,7 +114,7 @@ class PublicAuthTest extends \Test\TestCase {
->expects($this->once())
->method('getShareByToken')
->with('GX9HSGQrGE')
->will($this->throwException(new ShareNotFound()));
->willThrowException(new ShareNotFound());
$this->expectException(\Sabre\DAV\Exception\NotFound::class);
self::invokePrivate($this->auth, 'checkToken');

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

@ -9,6 +9,7 @@ declare(strict_types=1);
namespace OCA\DAV\Tests\unit\Connector\Sabre\RequestTest;
use OCP\AppFramework\Http;
use OCP\Files\FileInfo;
/**
* Class DeleteTest
@ -30,7 +31,7 @@ class DeleteTest extends RequestTestCase {
$mount->getStorage()->unlink($mount->getInternalPath($internalPath));
// cache entry still exists
$this->assertInstanceOf(\OCP\Files\FileInfo::class, $view->getFileInfo('foo.txt'));
$this->assertInstanceOf(FileInfo::class, $view->getFileInfo('foo.txt'));
$response = $this->request($view, $user, 'pass', 'DELETE', '/foo.txt');

@ -54,9 +54,7 @@ class SharesPluginTest extends \Test\TestCase {
$this->plugin->initialize($this->server);
}
/**
* @dataProvider sharesGetPropertiesDataProvider
*/
#[\PHPUnit\Framework\Attributes\DataProvider('sharesGetPropertiesDataProvider')]
public function testGetProperties(array $shareTypes): void {
$sabreNode = $this->createMock(Node::class);
$sabreNode->expects($this->any())
@ -119,9 +117,7 @@ class SharesPluginTest extends \Test\TestCase {
$this->assertEquals($shareTypes, $result[200][self::SHARETYPES_PROPERTYNAME]->getShareTypes());
}
/**
* @dataProvider sharesGetPropertiesDataProvider
*/
#[\PHPUnit\Framework\Attributes\DataProvider('sharesGetPropertiesDataProvider')]
public function testPreloadThenGetProperties(array $shareTypes): void {
$sabreNode1 = $this->createMock(File::class);
$sabreNode1->method('getId')

@ -58,9 +58,7 @@ class TagsPluginTest extends \Test\TestCase {
$this->plugin->initialize($this->server);
}
/**
* @dataProvider tagsGetPropertiesDataProvider
*/
#[\PHPUnit\Framework\Attributes\DataProvider('tagsGetPropertiesDataProvider')]
public function testGetProperties(array $tags, array $requestedProperties, array $expectedProperties): void {
$node = $this->createMock(Node::class);
$node->expects($this->any())
@ -95,9 +93,7 @@ class TagsPluginTest extends \Test\TestCase {
$this->assertEquals($expectedProperties, $result);
}
/**
* @dataProvider tagsGetPropertiesDataProvider
*/
#[\PHPUnit\Framework\Attributes\DataProvider('tagsGetPropertiesDataProvider')]
public function testPreloadThenGetProperties(array $tags, array $requestedProperties, array $expectedProperties): void {
$node1 = $this->createMock(File::class);
$node1->expects($this->any())
@ -269,7 +265,7 @@ class TagsPluginTest extends \Test\TestCase {
];
$this->tagger->expects($this->exactly(count($calls)))
->method('tagAs')
->willReturnCallback(function () use (&$calls) {
->willReturnCallback(function () use (&$calls): void {
$expected = array_shift($calls);
$this->assertEquals($expected, func_get_args());
});
@ -322,7 +318,7 @@ class TagsPluginTest extends \Test\TestCase {
];
$this->tagger->expects($this->exactly(count($calls)))
->method('tagAs')
->willReturnCallback(function () use (&$calls) {
->willReturnCallback(function () use (&$calls): void {
$expected = array_shift($calls);
$this->assertEquals($expected, func_get_args());
});

@ -53,9 +53,7 @@ class InvitationResponseControllerTest extends TestCase {
];
}
/**
* @dataProvider attendeeProvider
*/
#[\PHPUnit\Framework\Attributes\DataProvider('attendeeProvider')]
public function testAccept(bool $isExternalAttendee): void {
$this->buildQueryExpects('TOKEN123', [
'id' => 0,
@ -117,9 +115,7 @@ EOF;
$this->assertTrue($called);
}
/**
* @dataProvider attendeeProvider
*/
#[\PHPUnit\Framework\Attributes\DataProvider('attendeeProvider')]
public function testAcceptSequence(bool $isExternalAttendee): void {
$this->buildQueryExpects('TOKEN123', [
'id' => 0,
@ -181,9 +177,7 @@ EOF;
$this->assertTrue($called);
}
/**
* @dataProvider attendeeProvider
*/
#[\PHPUnit\Framework\Attributes\DataProvider('attendeeProvider')]
public function testAcceptRecurrenceId(bool $isExternalAttendee): void {
$this->buildQueryExpects('TOKEN123', [
'id' => 0,
@ -273,9 +267,7 @@ EOF;
$this->assertEquals([], $response->getParams());
}
/**
* @dataProvider attendeeProvider
*/
#[\PHPUnit\Framework\Attributes\DataProvider('attendeeProvider')]
public function testDecline(bool $isExternalAttendee): void {
$this->buildQueryExpects('TOKEN123', [
'id' => 0,
@ -344,9 +336,7 @@ EOF;
$this->assertEquals(['token' => 'TOKEN123'], $response->getParams());
}
/**
* @dataProvider attendeeProvider
*/
#[\PHPUnit\Framework\Attributes\DataProvider('attendeeProvider')]
public function testProcessMoreOptionsResult(bool $isExternalAttendee): void {
$this->request->expects($this->once())
->method('getParam')

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

@ -271,9 +271,7 @@ class CustomPropertiesBackendTest extends TestCase {
}
/**
* @dataProvider propFindPrincipalScheduleDefaultCalendarProviderUrlProvider
*/
#[\PHPUnit\Framework\Attributes\DataProvider('propFindPrincipalScheduleDefaultCalendarProviderUrlProvider')]
public function testPropFindPrincipalScheduleDefaultCalendarUrl(
string $user,
array $nodes,
@ -335,9 +333,7 @@ class CustomPropertiesBackendTest extends TestCase {
$this->assertEquals($returnedProps, $setProps);
}
/**
* @dataProvider propPatchProvider
*/
#[\PHPUnit\Framework\Attributes\DataProvider('propPatchProvider')]
public function testPropPatch(string $path, array $existing, array $props, array $result): void {
$this->server->method('calculateUri')
->willReturnCallback(function ($uri) {
@ -418,9 +414,7 @@ class CustomPropertiesBackendTest extends TestCase {
$this->assertEquals([], $storedProps);
}
/**
* @dataProvider deleteProvider
*/
#[\PHPUnit\Framework\Attributes\DataProvider('deleteProvider')]
public function testDelete(string $path): void {
$this->insertProps('dummy_user_42', $path, ['foo' => 'bar']);
$this->backend->delete($path);
@ -434,9 +428,7 @@ class CustomPropertiesBackendTest extends TestCase {
];
}
/**
* @dataProvider moveProvider
*/
#[\PHPUnit\Framework\Attributes\DataProvider('moveProvider')]
public function testMove(string $source, string $target): void {
$this->insertProps('dummy_user_42', $source, ['foo' => 'bar']);
$this->backend->move($source, $target);

@ -192,9 +192,7 @@ class GroupPrincipalTest extends \Test\TestCase {
['{DAV:}displayname' => 'Foo']));
}
/**
* @dataProvider searchPrincipalsDataProvider
*/
#[\PHPUnit\Framework\Attributes\DataProvider('searchPrincipalsDataProvider')]
public function testSearchPrincipals(bool $sharingEnabled, bool $groupSharingEnabled, bool $groupsOnly, string $test, array $result): void {
$this->shareManager->expects($this->once())
->method('shareAPIEnabled')
@ -265,9 +263,7 @@ class GroupPrincipalTest extends \Test\TestCase {
];
}
/**
* @dataProvider findByUriDataProvider
*/
#[\PHPUnit\Framework\Attributes\DataProvider('findByUriDataProvider')]
public function testFindByUri(bool $sharingEnabled, bool $groupSharingEnabled, bool $groupsOnly, string $findUri, ?string $result): void {
$this->shareManager->expects($this->once())
->method('shareAPIEnabled')

@ -14,9 +14,7 @@ use Test\TestCase;
class SystemPrincipalBackendTest extends TestCase {
/**
* @dataProvider providesPrefix
*/
#[\PHPUnit\Framework\Attributes\DataProvider('providesPrefix')]
public function testGetPrincipalsByPrefix(array $expected, string $prefix): void {
$backend = new SystemPrincipalBackend();
$result = $backend->getPrincipalsByPrefix($prefix);
@ -38,9 +36,7 @@ class SystemPrincipalBackendTest extends TestCase {
];
}
/**
* @dataProvider providesPath
*/
#[\PHPUnit\Framework\Attributes\DataProvider('providesPath')]
public function testGetPrincipalByPath(?array $expected, string $path): void {
$backend = new SystemPrincipalBackend();
$result = $backend->getPrincipalByPath($path);
@ -59,9 +55,7 @@ class SystemPrincipalBackendTest extends TestCase {
];
}
/**
* @dataProvider providesPrincipalForGetGroupMemberSet
*/
#[\PHPUnit\Framework\Attributes\DataProvider('providesPrincipalForGetGroupMemberSet')]
public function testGetGroupMemberSetExceptional(?string $principal): void {
$this->expectException(Exception::class);
$this->expectExceptionMessage('Principal not found');
@ -83,9 +77,7 @@ class SystemPrincipalBackendTest extends TestCase {
$this->assertEquals(['principals/system/system'], $result);
}
/**
* @dataProvider providesPrincipalForGetGroupMembership
*/
#[\PHPUnit\Framework\Attributes\DataProvider('providesPrincipalForGetGroupMembership')]
public function testGetGroupMembershipExceptional(string $principal): void {
$this->expectException(Exception::class);
$this->expectExceptionMessage('Principal not found');

@ -94,9 +94,7 @@ class ViewOnlyPluginTest extends TestCase {
];
}
/**
* @dataProvider providesDataForCanGet
*/
#[\PHPUnit\Framework\Attributes\DataProvider('providesDataForCanGet')]
public function testCanGet(bool $isVersion, ?bool $attrEnabled, bool $expectCanDownloadFile, bool $allowViewWithoutDownload): void {
$nodeInfo = $this->createMock(File::class);
if ($isVersion) {

@ -36,9 +36,7 @@ class ActivityUpdaterListenerTest extends TestCase {
);
}
/**
* @dataProvider dataForTestHandleCalendarObjectDeletedEvent
*/
#[\PHPUnit\Framework\Attributes\DataProvider('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(
@ -60,9 +58,7 @@ class ActivityUpdaterListenerTest extends TestCase {
];
}
/**
* @dataProvider dataForTestHandleCalendarDeletedEvent
*/
#[\PHPUnit\Framework\Attributes\DataProvider('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(

@ -105,7 +105,7 @@ class RefreshWebcalJobRegistrarTest extends TestCase {
];
$this->jobList->expects($this->exactly(2))
->method('add')
->willReturnCallback(function () use (&$calls) {
->willReturnCallback(function () use (&$calls): void {
$expected = array_shift($calls);
$this->assertEquals($expected, func_get_args());
});

@ -45,9 +45,7 @@ class RemoveDeletedUsersCalendarSubscriptionsTest extends TestCase {
);
}
/**
* @dataProvider dataTestRun
*/
#[\PHPUnit\Framework\Attributes\DataProvider('dataTestRun')]
public function testRun(array $subscriptions, array $userExists, int $deletions): void {
$qb = $this->createMock(IQueryBuilder::class);

@ -153,7 +153,7 @@ class AppleProvisioningPluginTest extends TestCase {
];
$this->sabreResponse->expects($this->exactly(2))
->method('setHeader')
->willReturnCallback(function () use (&$calls) {
->willReturnCallback(function () use (&$calls): void {
$expected = array_shift($calls);
$this->assertEquals($expected, func_get_args());
});

@ -418,9 +418,7 @@ class EventsSearchProviderTest extends TestCase {
$this->assertEquals('absolute-url-to-route', $actual);
}
/**
* @dataProvider generateSublineDataProvider
*/
#[\PHPUnit\Framework\Attributes\DataProvider('generateSublineDataProvider')]
public function testGenerateSubline(string $ics, string $expectedSubline): void {
$vCalendar = Reader::read($ics, Reader::OPTION_FORGIVING);
$eventComponent = $vCalendar->VEVENT;

@ -289,9 +289,7 @@ class TasksSearchProviderTest extends TestCase {
$this->assertEquals('absolute-url-link-to-route-tasks.indexcalendars/uri-john.doe/tasks/task-uri.ics', $actual);
}
/**
* @dataProvider generateSublineDataProvider
*/
#[\PHPUnit\Framework\Attributes\DataProvider('generateSublineDataProvider')]
public function testGenerateSubline(string $ics, string $expectedSubline): void {
$vCalendar = Reader::read($ics, Reader::OPTION_FORGIVING);
$taskComponent = $vCalendar->VTODO;

@ -20,9 +20,7 @@ use OCP\IRequest;
*/
class ServerTest extends \Test\TestCase {
/**
* @dataProvider providesUris
*/
#[\PHPUnit\Framework\Attributes\DataProvider('providesUris')]
public function test(string $uri, array $plugins): void {
/** @var IRequest | \PHPUnit\Framework\MockObject\MockObject $r */
$r = $this->createMock(IRequest::class);

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

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

@ -57,7 +57,7 @@ class CalDAVSettingsTest extends TestCase {
['sendEventRemindersPush', true],
];
$this->initialState->method('provideInitialState')
->willReturnCallback(function () use (&$calls) {
->willReturnCallback(function () use (&$calls): void {
$expected = array_shift($calls);
$this->assertEquals($expected, func_get_args());
});

@ -107,9 +107,7 @@ class SystemTagMappingNodeTest extends \Test\TestCase {
];
}
/**
* @dataProvider tagNodeDeleteProviderPermissionException
*/
#[\PHPUnit\Framework\Attributes\DataProvider('tagNodeDeleteProviderPermissionException')]
public function testDeleteTagExpectedException(ISystemTag $tag, $expectedException): void {
$this->tagManager->expects($this->any())
->method('canUserSeeTag')
@ -152,7 +150,7 @@ class SystemTagMappingNodeTest extends \Test\TestCase {
$this->tagMapper->expects($this->once())
->method('unassignTags')
->with(123, 'files', 1)
->will($this->throwException(new TagNotFoundException()));
->willThrowException(new TagNotFoundException());
$this->getMappingNode($tag, [123])->delete();
}

@ -49,9 +49,7 @@ class SystemTagNodeTest extends \Test\TestCase {
return [[true], [false]];
}
/**
* @dataProvider adminFlagProvider
*/
#[\PHPUnit\Framework\Attributes\DataProvider('adminFlagProvider')]
public function testGetters(bool $isAdmin): void {
$tag = new SystemTag('1', 'Test', true, true);
$node = $this->getTagNode($isAdmin, $tag);
@ -89,9 +87,7 @@ class SystemTagNodeTest extends \Test\TestCase {
];
}
/**
* @dataProvider tagNodeProvider
*/
#[\PHPUnit\Framework\Attributes\DataProvider('tagNodeProvider')]
public function testUpdateTag(bool $isAdmin, ISystemTag $originalTag, array $changedArgs): void {
$this->tagManager->expects($this->once())
->method('canUserSeeTag')
@ -149,9 +145,7 @@ class SystemTagNodeTest extends \Test\TestCase {
];
}
/**
* @dataProvider tagNodeProviderPermissionException
*/
#[\PHPUnit\Framework\Attributes\DataProvider('tagNodeProviderPermissionException')]
public function testUpdateTagPermissionException(ISystemTag $originalTag, array $changedArgs, string $expectedException): void {
$this->tagManager->expects($this->any())
->method('canUserSeeTag')
@ -192,7 +186,7 @@ class SystemTagNodeTest extends \Test\TestCase {
$this->tagManager->expects($this->once())
->method('updateTag')
->with(1, 'Renamed', true, true)
->will($this->throwException(new TagAlreadyExistsException()));
->willThrowException(new TagAlreadyExistsException());
$this->getTagNode(false, $tag)->update('Renamed', true, true, null);
}
@ -212,13 +206,11 @@ class SystemTagNodeTest extends \Test\TestCase {
$this->tagManager->expects($this->once())
->method('updateTag')
->with(1, 'Renamed', true, true)
->will($this->throwException(new TagNotFoundException()));
->willThrowException(new TagNotFoundException());
$this->getTagNode(false, $tag)->update('Renamed', true, true, null);
}
/**
* @dataProvider adminFlagProvider
*/
#[\PHPUnit\Framework\Attributes\DataProvider('adminFlagProvider')]
public function testDeleteTag(bool $isAdmin): void {
$tag = new SystemTag('1', 'tag1', true, true);
$this->tagManager->expects($isAdmin ? $this->once() : $this->never())
@ -249,9 +241,7 @@ class SystemTagNodeTest extends \Test\TestCase {
];
}
/**
* @dataProvider tagNodeDeleteProviderPermissionException
*/
#[\PHPUnit\Framework\Attributes\DataProvider('tagNodeDeleteProviderPermissionException')]
public function testDeleteTagPermissionException(ISystemTag $tag, string $expectedException): void {
$this->tagManager->expects($this->any())
->method('canUserSeeTag')
@ -276,7 +266,7 @@ class SystemTagNodeTest extends \Test\TestCase {
$this->tagManager->expects($this->once())
->method('deleteTags')
->with('1')
->will($this->throwException(new TagNotFoundException()));
->willThrowException(new TagNotFoundException());
$this->getTagNode(true, $tag)->delete();
}
}

@ -142,9 +142,7 @@ class SystemTagPluginTest extends \Test\TestCase {
];
}
/**
* @dataProvider getPropertiesDataProvider
*/
#[\PHPUnit\Framework\Attributes\DataProvider('getPropertiesDataProvider')]
public function testGetProperties(ISystemTag $systemTag, array $groups, array $requestedProperties, array $expectedProperties): void {
$this->user->expects($this->any())
->method('getUID')
@ -341,9 +339,7 @@ class SystemTagPluginTest extends \Test\TestCase {
[true, true, 'group1|group2'],
];
}
/**
* @dataProvider createTagInsufficientPermissionsProvider
*/
#[\PHPUnit\Framework\Attributes\DataProvider('createTagInsufficientPermissionsProvider')]
public function testCreateNotAssignableTagAsRegularUser(bool $userVisible, bool $userAssignable, string $groups): void {
$this->expectException(\Sabre\DAV\Exception\BadRequest::class);
$this->expectExceptionMessage('Not sufficient permissions');
@ -452,9 +448,7 @@ class SystemTagPluginTest extends \Test\TestCase {
];
}
/**
* @dataProvider createTagProvider
*/
#[\PHPUnit\Framework\Attributes\DataProvider('createTagProvider')]
public function testCreateTagInByIdCollection(bool $userVisible, bool $userAssignable, string $groups): void {
$this->user->expects($this->once())
->method('getUID')
@ -601,7 +595,7 @@ class SystemTagPluginTest extends \Test\TestCase {
$this->tree->expects($this->any())
->method('getNodeForPath')
->will($this->throwException(new \Sabre\DAV\Exception\NotFound()));
->willThrowException(new \Sabre\DAV\Exception\NotFound());
$this->tagManager->expects($this->never())
->method('createTag');
@ -619,9 +613,7 @@ class SystemTagPluginTest extends \Test\TestCase {
$this->plugin->httpPost($request, $response);
}
/**
* @dataProvider nodeClassProvider
*/
#[\PHPUnit\Framework\Attributes\DataProvider('nodeClassProvider')]
public function testCreateTagConflict(string $nodeClass): void {
$this->expectException(\Sabre\DAV\Exception\Conflict::class);
@ -644,7 +636,7 @@ class SystemTagPluginTest extends \Test\TestCase {
$this->tagManager->expects($this->once())
->method('createTag')
->with('Test', true, false)
->will($this->throwException(new TagAlreadyExistsException('Tag already exists')));
->willThrowException(new TagAlreadyExistsException('Tag already exists'));
$this->tree->expects($this->any())
->method('getNodeForPath')

@ -101,7 +101,7 @@ class SystemTagsByIdCollectionTest extends \Test\TestCase {
$this->tagManager->expects($this->once())
->method('getTagsByIds')
->with(['invalid'])
->will($this->throwException(new \InvalidArgumentException()));
->willThrowException(new \InvalidArgumentException());
$this->getNode()->getChild('invalid');
}
@ -113,7 +113,7 @@ class SystemTagsByIdCollectionTest extends \Test\TestCase {
$this->tagManager->expects($this->once())
->method('getTagsByIds')
->with(['444'])
->will($this->throwException(new TagNotFoundException()));
->willThrowException(new TagNotFoundException());
$this->getNode()->getChild('444');
}
@ -185,9 +185,7 @@ class SystemTagsByIdCollectionTest extends \Test\TestCase {
];
}
/**
* @dataProvider childExistsProvider
*/
#[\PHPUnit\Framework\Attributes\DataProvider('childExistsProvider')]
public function testChildExists(bool $userVisible, bool $expectedResult): void {
$tag = new SystemTag('123', 'One', $userVisible, false);
$this->tagManager->expects($this->once())
@ -207,7 +205,7 @@ class SystemTagsByIdCollectionTest extends \Test\TestCase {
$this->tagManager->expects($this->once())
->method('getTagsByIds')
->with(['123'])
->will($this->throwException(new TagNotFoundException()));
->willThrowException(new TagNotFoundException());
$this->assertFalse($this->getNode()->childExists('123'));
}
@ -219,7 +217,7 @@ class SystemTagsByIdCollectionTest extends \Test\TestCase {
$this->tagManager->expects($this->once())
->method('getTagsByIds')
->with(['invalid'])
->will($this->throwException(new \InvalidArgumentException()));
->willThrowException(new \InvalidArgumentException());
$this->getNode()->childExists('invalid');
}

@ -93,9 +93,7 @@ class SystemTagsObjectMappingCollectionTest extends \Test\TestCase {
];
}
/**
* @dataProvider permissionsProvider
*/
#[\PHPUnit\Framework\Attributes\DataProvider('permissionsProvider')]
public function testAssignTagNoPermission(bool $userVisible, bool $userAssignable, string $expectedException): void {
$tag = new SystemTag('1', 'Test', $userVisible, $userAssignable);
$this->tagManager->expects($this->once())
@ -131,7 +129,7 @@ class SystemTagsObjectMappingCollectionTest extends \Test\TestCase {
$this->tagManager->expects($this->once())
->method('getTagsByIds')
->with(['555'])
->will($this->throwException(new TagNotFoundException()));
->willThrowException(new TagNotFoundException());
$this->getNode()->createFile('555');
}
@ -208,7 +206,7 @@ class SystemTagsObjectMappingCollectionTest extends \Test\TestCase {
$this->tagMapper->expects($this->once())
->method('haveTag')
->with([111], 'files', 'badid')
->will($this->throwException(new \InvalidArgumentException()));
->willThrowException(new \InvalidArgumentException());
$this->getNode()->getChild('badid');
}
@ -220,7 +218,7 @@ class SystemTagsObjectMappingCollectionTest extends \Test\TestCase {
$this->tagMapper->expects($this->once())
->method('haveTag')
->with([111], 'files', '777')
->will($this->throwException(new TagNotFoundException()));
->willThrowException(new TagNotFoundException());
$this->getNode()->getChild('777');
}
@ -312,7 +310,7 @@ class SystemTagsObjectMappingCollectionTest extends \Test\TestCase {
$this->tagMapper->expects($this->once())
->method('haveTag')
->with([111], 'files', '555')
->will($this->throwException(new TagNotFoundException()));
->willThrowException(new TagNotFoundException());
$this->assertFalse($this->getNode()->childExists('555'));
}
@ -324,7 +322,7 @@ class SystemTagsObjectMappingCollectionTest extends \Test\TestCase {
$this->tagMapper->expects($this->once())
->method('haveTag')
->with([111], 'files', '555')
->will($this->throwException(new \InvalidArgumentException()));
->willThrowException(new \InvalidArgumentException());
$this->getNode()->childExists('555');
}

@ -12,9 +12,7 @@ use Sabre\DAV\File;
class AssemblyStreamTest extends \Test\TestCase {
/**
* @dataProvider providesNodes()
*/
#[\PHPUnit\Framework\Attributes\DataProvider('providesNodes')]
public function testGetContents(string $expected, array $nodeData): void {
$nodes = [];
foreach ($nodeData as $data) {
@ -26,9 +24,7 @@ class AssemblyStreamTest extends \Test\TestCase {
$this->assertEquals($expected, $content);
}
/**
* @dataProvider providesNodes()
*/
#[\PHPUnit\Framework\Attributes\DataProvider('providesNodes')]
public function testGetContentsFread(string $expected, array $nodeData, int $chunkLength = 3): void {
$nodes = [];
foreach ($nodeData as $data) {
@ -48,9 +44,7 @@ class AssemblyStreamTest extends \Test\TestCase {
$this->assertEquals($expected, $content);
}
/**
* @dataProvider providesNodes()
*/
#[\PHPUnit\Framework\Attributes\DataProvider('providesNodes')]
public function testSeek(string $expected, array $nodeData): void {
$nodes = [];
foreach ($nodeData as $data) {

@ -50,9 +50,7 @@ class UploadAutoMkcolPluginTest extends TestCase {
$this->assertTrue($return);
}
/**
* @dataProvider dataMissingHeaderShouldReturnTrue
*/
#[\PHPUnit\Framework\Attributes\DataProvider('dataMissingHeaderShouldReturnTrue')]
public function testBeforeMethodWithMissingHeaderShouldReturnTrue(?string $header): void {
$this->request->expects(self::once())
->method('getHeader')

@ -55,11 +55,11 @@ class TestEnableMasterKey extends TestCase {
}
/**
* @dataProvider dataTestExecute
*
* @param bool $isAlreadyEnabled
* @param string $answer
*/
#[\PHPUnit\Framework\Attributes\DataProvider('dataTestExecute')]
public function testExecute($isAlreadyEnabled, $answer): void {
$this->util->expects($this->once())->method('isMasterKeyEnabled')
->willReturn($isAlreadyEnabled);
@ -81,7 +81,7 @@ class TestEnableMasterKey extends TestCase {
$this->invokePrivate($this->enableMasterKey, 'execute', [$this->input, $this->output]);
}
public function dataTestExecute() {
public static function dataTestExecute() {
return [
[true, ''],
[false, 'y'],

@ -37,13 +37,13 @@ class RecoveryControllerTest extends TestCase {
}
/**
* @dataProvider adminRecoveryProvider
* @param $recoveryPassword
* @param $passConfirm
* @param $enableRecovery
* @param $expectedMessage
* @param $expectedStatus
*/
#[\PHPUnit\Framework\Attributes\DataProvider('adminRecoveryProvider')]
public function testAdminRecovery($recoveryPassword, $passConfirm, $enableRecovery, $expectedMessage, $expectedStatus): void {
$this->recoveryMock->expects($this->any())
->method('enableAdminRecovery')
@ -73,13 +73,13 @@ class RecoveryControllerTest extends TestCase {
}
/**
* @dataProvider changeRecoveryPasswordProvider
* @param $password
* @param $confirmPassword
* @param $oldPassword
* @param $expectedMessage
* @param $expectedStatus
*/
#[\PHPUnit\Framework\Attributes\DataProvider('changeRecoveryPasswordProvider')]
public function testChangeRecoveryPassword($password, $confirmPassword, $oldPassword, $expectedMessage, $expectedStatus): void {
$this->recoveryMock->expects($this->any())
->method('changeRecoveryKeyPassword')
@ -105,11 +105,11 @@ class RecoveryControllerTest extends TestCase {
}
/**
* @dataProvider userSetRecoveryProvider
* @param $enableRecovery
* @param $expectedMessage
* @param $expectedStatus
*/
#[\PHPUnit\Framework\Attributes\DataProvider('userSetRecoveryProvider')]
public function testUserSetRecovery($enableRecovery, $expectedMessage, $expectedStatus): void {
$this->recoveryMock->expects($this->any())
->method('setRecoveryForUser')

@ -50,11 +50,11 @@ class StatusControllerTest extends TestCase {
}
/**
* @dataProvider dataTestGetStatus
*
* @param string $status
* @param string $expectedStatus
*/
#[\PHPUnit\Framework\Attributes\DataProvider('dataTestGetStatus')]
public function testGetStatus($status, $expectedStatus): void {
$this->sessionMock->expects($this->once())
->method('getStatus')->willReturn($status);

@ -80,9 +80,8 @@ class CryptTest extends TestCase {
/**
* test generateHeader with valid key formats
*
* @dataProvider dataTestGenerateHeader
*/
#[\PHPUnit\Framework\Attributes\DataProvider('dataTestGenerateHeader')]
public function testGenerateHeader($keyFormat, $expected): void {
$this->config->expects($this->once())
->method('getSystemValueString')
@ -130,10 +129,10 @@ class CryptTest extends TestCase {
}
/**
* @dataProvider dataProviderGetCipher
* @param string $configValue
* @param string $expected
*/
#[\PHPUnit\Framework\Attributes\DataProvider('dataProviderGetCipher')]
public function testGetCipher($configValue, $expected): void {
$this->config->expects($this->once())
->method('getSystemValueString')
@ -173,9 +172,7 @@ class CryptTest extends TestCase {
);
}
/**
* @dataProvider dataTestSplitMetaData
*/
#[\PHPUnit\Framework\Attributes\DataProvider('dataTestSplitMetaData')]
public function testSplitMetaData($data, $expected): void {
$this->config->method('getSystemValueBool')
->with('encryption_skip_signature_check', false)
@ -200,9 +197,7 @@ class CryptTest extends TestCase {
];
}
/**
* @dataProvider dataTestHasSignature
*/
#[\PHPUnit\Framework\Attributes\DataProvider('dataTestHasSignature')]
public function testHasSignature($data, $expected): void {
$this->config->method('getSystemValueBool')
->with('encryption_skip_signature_check', false)
@ -219,9 +214,7 @@ class CryptTest extends TestCase {
];
}
/**
* @dataProvider dataTestHasSignatureFail
*/
#[\PHPUnit\Framework\Attributes\DataProvider('dataTestHasSignatureFail')]
public function testHasSignatureFail($cipher): void {
$this->expectException(GenericEncryptionException::class);
@ -249,10 +242,10 @@ class CryptTest extends TestCase {
/**
* test removePadding()
*
* @dataProvider dataProviderRemovePadding
* @param $data
* @param $expected
*/
#[\PHPUnit\Framework\Attributes\DataProvider('dataProviderRemovePadding')]
public function testRemovePadding($data, $expected): void {
$result = self::invokePrivate($this->crypt, 'removePadding', [$data]);
$this->assertSame($expected, $result);
@ -327,9 +320,8 @@ class CryptTest extends TestCase {
/**
* test return values of valid ciphers
*
* @dataProvider dataTestGetKeySize
*/
#[\PHPUnit\Framework\Attributes\DataProvider('dataTestGetKeySize')]
public function testGetKeySize($cipher, $expected): void {
$result = $this->invokePrivate($this->crypt, 'getKeySize', [$cipher]);
$this->assertSame($expected, $result);
@ -354,9 +346,7 @@ class CryptTest extends TestCase {
];
}
/**
* @dataProvider dataTestDecryptPrivateKey
*/
#[\PHPUnit\Framework\Attributes\DataProvider('dataTestDecryptPrivateKey')]
public function testDecryptPrivateKey($header, $privateKey, $expectedCipher, $isValidKey, $expected): void {
$this->config->method('getSystemValueBool')
->willReturnMap([

@ -59,11 +59,11 @@ class DecryptAllTest extends TestCase {
}
/**
* @dataProvider dataTestGetPrivateKey
*
* @param string $user
* @param string $recoveryKeyId
*/
#[\PHPUnit\Framework\Attributes\DataProvider('dataTestGetPrivateKey')]
public function testGetPrivateKey($user, $recoveryKeyId, $masterKeyId): void {
$password = 'passwd';
$recoveryKey = 'recoveryKey';

@ -249,7 +249,7 @@ class EncryptAllTest extends TestCase {
$encryptAllCalls = [];
$encryptAll->expects($this->exactly(2))
->method('encryptUsersFiles')
->willReturnCallback(function ($uid) use (&$encryptAllCalls) {
->willReturnCallback(function ($uid) use (&$encryptAllCalls): void {
$encryptAllCalls[] = $uid;
});
@ -317,7 +317,7 @@ class EncryptAllTest extends TestCase {
$encryptAllCalls = [];
$encryptAll->expects($this->exactly(2))
->method('encryptFile')
->willReturnCallback(function (string $path) use (&$encryptAllCalls) {
->willReturnCallback(function (string $path) use (&$encryptAllCalls): void {
$encryptAllCalls[] = $path;
});
@ -346,9 +346,9 @@ class EncryptAllTest extends TestCase {
}
/**
* @dataProvider dataTestEncryptFile
* @param $isEncrypted
*/
#[\PHPUnit\Framework\Attributes\DataProvider('dataTestEncryptFile')]
public function testEncryptFile($isEncrypted): void {
$fileInfo = $this->createMock(FileInfo::class);
$fileInfo->expects($this->any())->method('isEncrypted')

@ -152,9 +152,7 @@ class EncryptionTest extends TestCase {
return $publicKeys;
}
/**
* @dataProvider dataProviderForTestGetPathToRealFile
*/
#[\PHPUnit\Framework\Attributes\DataProvider('dataProviderForTestGetPathToRealFile')]
public function testGetPathToRealFile($path, $expected): void {
$this->assertSame($expected,
self::invokePrivate($this->instance, 'getPathToRealFile', [$path])
@ -170,9 +168,7 @@ class EncryptionTest extends TestCase {
];
}
/**
* @dataProvider dataTestBegin
*/
#[\PHPUnit\Framework\Attributes\DataProvider('dataTestBegin')]
public function testBegin($mode, $header, $legacyCipher, $defaultCipher, $fileKey, $expected): void {
$this->sessionMock->expects($this->once())
->method('decryptAllModeActivated')
@ -265,11 +261,11 @@ class EncryptionTest extends TestCase {
}
/**
* @dataProvider dataTestUpdate
*
* @param string $fileKey
* @param boolean $expected
*/
#[\PHPUnit\Framework\Attributes\DataProvider('dataTestUpdate')]
public function testUpdate($fileKey, $expected): void {
$this->keyManagerMock->expects($this->once())
->method('getFileKey')->willReturn($fileKey);
@ -354,9 +350,8 @@ class EncryptionTest extends TestCase {
/**
* by default the encryption module should encrypt regular files, files in
* files_versions and files in files_trashbin
*
* @dataProvider dataTestShouldEncrypt
*/
#[\PHPUnit\Framework\Attributes\DataProvider('dataTestShouldEncrypt')]
public function testShouldEncrypt($path, $shouldEncryptHomeStorage, $isHomeStorage, $expected): void {
$this->utilMock->expects($this->once())->method('shouldEncryptHomeStorage')
->willReturn($shouldEncryptHomeStorage);

@ -166,9 +166,7 @@ class KeyManagerTest extends TestCase {
);
}
/**
* @dataProvider dataTestUserHasKeys
*/
#[\PHPUnit\Framework\Attributes\DataProvider('dataTestUserHasKeys')]
public function testUserHasKeys($key, $expected): void {
$this->keyStorageMock->expects($this->exactly(2))
->method('getUserKey')
@ -221,10 +219,9 @@ class KeyManagerTest extends TestCase {
}
/**
* @dataProvider dataTestInit
*
* @param bool $useMasterKey
*/
#[\PHPUnit\Framework\Attributes\DataProvider('dataTestInit')]
public function testInit($useMasterKey): void {
/** @var KeyManager&MockObject $instance */
$instance = $this->getMockBuilder(KeyManager::class)
@ -248,7 +245,7 @@ class KeyManagerTest extends TestCase {
$sessionSetStatusCalls = [];
$this->sessionMock->expects($this->exactly(2))
->method('setStatus')
->willReturnCallback(function (string $status) use (&$sessionSetStatusCalls) {
->willReturnCallback(function (string $status) use (&$sessionSetStatusCalls): void {
$sessionSetStatusCalls[] = $status;
});
@ -356,13 +353,13 @@ class KeyManagerTest extends TestCase {
}
/**
* @dataProvider dataTestGetFileKey
*
* @param $uid
* @param $isMasterKeyEnabled
* @param $privateKey
* @param $expected
*/
#[\PHPUnit\Framework\Attributes\DataProvider('dataTestGetFileKey')]
public function testGetFileKey($uid, $isMasterKeyEnabled, $privateKey, $encryptedFileKey, $expected): void {
$path = '/foo.txt';
@ -452,13 +449,13 @@ class KeyManagerTest extends TestCase {
/**
* test add public share key and or recovery key to the list of public keys
*
* @dataProvider dataTestAddSystemKeys
*
* @param array $accessList
* @param array $publicKeys
* @param string $uid
* @param array $expectedKeys
*/
#[\PHPUnit\Framework\Attributes\DataProvider('dataTestAddSystemKeys')]
public function testAddSystemKeys($accessList, $publicKeys, $uid, $expectedKeys): void {
$publicShareKeyId = 'publicShareKey';
$recoveryKeyId = 'recoveryKey';
@ -539,10 +536,9 @@ class KeyManagerTest extends TestCase {
}
/**
* @dataProvider dataTestValidateMasterKey
*
* @param $masterKey
*/
#[\PHPUnit\Framework\Attributes\DataProvider('dataTestValidateMasterKey')]
public function testValidateMasterKey($masterKey): void {
/** @var KeyManager&MockObject $instance */
$instance = $this->getMockBuilder(KeyManager::class)

@ -115,11 +115,11 @@ class SessionTest extends TestCase {
}
/**
* @dataProvider dataTestIsReady
*
* @param int $status
* @param bool $expected
*/
#[\PHPUnit\Framework\Attributes\DataProvider('dataTestIsReady')]
public function testIsReady($status, $expected): void {
/** @var Session&MockObject $instance */
$instance = $this->getMockBuilder(Session::class)

@ -53,7 +53,7 @@ class AdminTest extends TestCase {
public function testGetForm(): void {
$this->config
->method('getAppValue')
->will($this->returnCallback(function ($app, $key, $default) {
->willReturnCallback(function ($app, $key, $default) {
if ($app === 'encryption' && $key === 'recoveryAdminEnabled' && $default === '0') {
return '1';
}
@ -61,7 +61,7 @@ class AdminTest extends TestCase {
return '1';
}
return $default;
}));
});
$params = [
'recoveryEnabled' => '1',
'initStatus' => '0',

@ -46,11 +46,11 @@ class SetupTest extends TestCase {
}
/**
* @dataProvider dataTestSetupUser
*
* @param bool $hasKeys
* @param bool $expected
*/
#[\PHPUnit\Framework\Attributes\DataProvider('dataTestSetupUser')]
public function testSetupUser($hasKeys, $expected): void {
$this->keyManagerMock->expects($this->once())->method('userHasKeys')
->with('uid')->willReturn($hasKeys);

@ -115,11 +115,11 @@ class UtilTest extends TestCase {
}
/**
* @dataProvider dataTestIsMasterKeyEnabled
*
* @param string $value
* @param bool $expect
*/
#[\PHPUnit\Framework\Attributes\DataProvider('dataTestIsMasterKeyEnabled')]
public function testIsMasterKeyEnabled($value, $expect): void {
$this->configMock->expects($this->once())->method('getAppValue')
->with('encryption', 'useMasterKey', '1')->willReturn($value);
@ -136,10 +136,10 @@ class UtilTest extends TestCase {
}
/**
* @dataProvider dataTestShouldEncryptHomeStorage
* @param string $returnValue return value from getAppValue()
* @param bool $expected
*/
#[\PHPUnit\Framework\Attributes\DataProvider('dataTestShouldEncryptHomeStorage')]
public function testShouldEncryptHomeStorage($returnValue, $expected): void {
$this->configMock->expects($this->once())->method('getAppValue')
->with('encryption', 'encryptHomeStorage', '1')
@ -157,10 +157,10 @@ class UtilTest extends TestCase {
}
/**
* @dataProvider dataTestSetEncryptHomeStorage
* @param $value
* @param $expected
*/
#[\PHPUnit\Framework\Attributes\DataProvider('dataTestSetEncryptHomeStorage')]
public function testSetEncryptHomeStorage($value, $expected): void {
$this->configMock->expects($this->once())->method('setAppValue')
->with('encryption', 'encryptHomeStorage', $expected);

@ -80,9 +80,7 @@ class AddressHandlerTest extends \Test\TestCase {
return $testCases;
}
/**
* @dataProvider dataTestSplitUserRemote
*/
#[\PHPUnit\Framework\Attributes\DataProvider('dataTestSplitUserRemote')]
public function testSplitUserRemote(string $remote, string $expectedUser, string $expectedUrl): void {
$this->contactsManager->expects($this->any())
->method('search')
@ -111,18 +109,14 @@ class AddressHandlerTest extends \Test\TestCase {
];
}
/**
* @dataProvider dataTestSplitUserRemoteError
*/
#[\PHPUnit\Framework\Attributes\DataProvider('dataTestSplitUserRemoteError')]
public function testSplitUserRemoteError(string $id): void {
$this->expectException(HintException::class);
$this->addressHandler->splitUserRemote($id);
}
/**
* @dataProvider dataTestCompareAddresses
*/
#[\PHPUnit\Framework\Attributes\DataProvider('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)
@ -149,9 +143,7 @@ class AddressHandlerTest extends \Test\TestCase {
];
}
/**
* @dataProvider dataTestRemoveProtocolFromUrl
*/
#[\PHPUnit\Framework\Attributes\DataProvider('dataTestRemoveProtocolFromUrl')]
public function testRemoveProtocolFromUrl(string $url, string $expectedResult): void {
$result = $this->addressHandler->removeProtocolFromUrl($url);
$this->assertSame($expectedResult, $result);
@ -165,9 +157,7 @@ class AddressHandlerTest extends \Test\TestCase {
];
}
/**
* @dataProvider dataTestUrlContainProtocol
*/
#[\PHPUnit\Framework\Attributes\DataProvider('dataTestUrlContainProtocol')]
public function testUrlContainProtocol(string $url, bool $expectedResult): void {
$result = $this->addressHandler->urlContainProtocol($url);
$this->assertSame($expectedResult, $result);

@ -85,9 +85,7 @@ class MountPublicLinkControllerTest extends \Test\TestCase {
);
}
/**
* @dataProvider dataTestCreateFederatedShare
*/
#[\PHPUnit\Framework\Attributes\DataProvider('dataTestCreateFederatedShare')]
public function testCreateFederatedShare(
string $shareWith,
bool $outgoingSharesAllowed,

@ -117,9 +117,7 @@ class FederatedShareProviderTest extends \Test\TestCase {
];
}
/**
* @dataProvider dataTestCreate
*/
#[\PHPUnit\Framework\Attributes\DataProvider('dataTestCreate')]
public function testCreate(?\DateTime $expirationDate, ?string $expectedDataDate): void {
$share = $this->shareManager->newShare();
@ -419,9 +417,7 @@ class FederatedShareProviderTest extends \Test\TestCase {
}
}
/**
* @dataProvider dataTestUpdate
*/
#[\PHPUnit\Framework\Attributes\DataProvider('dataTestUpdate')]
public function testUpdate(string $owner, string $sharedBy, ?\DateTime $expirationDate): void {
$this->provider = $this->getMockBuilder(FederatedShareProvider::class)
->setConstructorArgs(
@ -705,7 +701,6 @@ class FederatedShareProviderTest extends \Test\TestCase {
}
/**
* @dataProvider dataDeleteUser
*
* @param string $owner The owner of the share (uid)
* @param string $initiator The initiator of the share (uid)
@ -713,6 +708,7 @@ class FederatedShareProviderTest extends \Test\TestCase {
* @param string $deletedUser The user that is deleted
* @param bool $rowDeleted Is the row deleted in this setup
*/
#[\PHPUnit\Framework\Attributes\DataProvider('dataDeleteUser')]
public function testDeleteUser(string $owner, string $initiator, string $recipient, string $deletedUser, bool $rowDeleted): void {
$qb = $this->connection->getQueryBuilder();
$qb->insert('share')
@ -742,9 +738,7 @@ class FederatedShareProviderTest extends \Test\TestCase {
$this->assertCount($rowDeleted ? 0 : 1, $data);
}
/**
* @dataProvider dataTestIsOutgoingServer2serverShareEnabled
*/
#[\PHPUnit\Framework\Attributes\DataProvider('dataTestIsOutgoingServer2serverShareEnabled')]
public function testIsOutgoingServer2serverShareEnabled(bool $internalOnly, string $isEnabled, bool $expected): void {
$this->gsConfig->expects($this->once())->method('onlyInternalFederation')
->willReturn($internalOnly);
@ -766,9 +760,7 @@ class FederatedShareProviderTest extends \Test\TestCase {
];
}
/**
* @dataProvider dataTestIsIncomingServer2serverShareEnabled
*/
#[\PHPUnit\Framework\Attributes\DataProvider('dataTestIsIncomingServer2serverShareEnabled')]
public function testIsIncomingServer2serverShareEnabled(bool $onlyInternal, string $isEnabled, bool $expected): void {
$this->gsConfig->expects($this->once())->method('onlyInternalFederation')
->willReturn($onlyInternal);
@ -790,9 +782,7 @@ class FederatedShareProviderTest extends \Test\TestCase {
];
}
/**
* @dataProvider dataTestIsLookupServerQueriesEnabled
*/
#[\PHPUnit\Framework\Attributes\DataProvider('dataTestIsLookupServerQueriesEnabled')]
public function testIsLookupServerQueriesEnabled(bool $gsEnabled, string $isEnabled, bool $expected): void {
$this->gsConfig->expects($this->once())->method('isGlobalScaleEnabled')
->willReturn($gsEnabled);
@ -818,9 +808,7 @@ class FederatedShareProviderTest extends \Test\TestCase {
];
}
/**
* @dataProvider dataTestIsLookupServerUploadEnabled
*/
#[\PHPUnit\Framework\Attributes\DataProvider('dataTestIsLookupServerUploadEnabled')]
public function testIsLookupServerUploadEnabled(bool $gsEnabled, string $isEnabled, bool $expected): void {
$this->gsConfig->expects($this->once())->method('isGlobalScaleEnabled')
->willReturn($gsEnabled);

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

Loading…
Cancel
Save