diff options
Diffstat (limited to 'apps')
252 files changed, 1638 insertions, 1638 deletions
diff --git a/apps/comments/tests/Unit/Activity/ListenerTest.php b/apps/comments/tests/Unit/Activity/ListenerTest.php index c1606aee745..19dcae4c8ab 100644 --- a/apps/comments/tests/Unit/Activity/ListenerTest.php +++ b/apps/comments/tests/Unit/Activity/ListenerTest.php @@ -65,7 +65,7 @@ class ListenerTest extends TestCase { ); } - public function testCommentEvent() { + public function testCommentEvent(): void { $this->appManager->expects($this->any()) ->method('isInstalled') ->with('activity') diff --git a/apps/comments/tests/Unit/AppInfo/ApplicationTest.php b/apps/comments/tests/Unit/AppInfo/ApplicationTest.php index c4e9bc7d45d..4b87982ab45 100644 --- a/apps/comments/tests/Unit/AppInfo/ApplicationTest.php +++ b/apps/comments/tests/Unit/AppInfo/ApplicationTest.php @@ -30,7 +30,7 @@ class ApplicationTest extends TestCase { parent::tearDown(); } - public function test() { + public function test(): void { $app = new Application(); $c = $app->getContainer(); diff --git a/apps/comments/tests/Unit/Collaboration/CommentersSorterTest.php b/apps/comments/tests/Unit/Collaboration/CommentersSorterTest.php index 334f24aec83..c0de0016c31 100644 --- a/apps/comments/tests/Unit/Collaboration/CommentersSorterTest.php +++ b/apps/comments/tests/Unit/Collaboration/CommentersSorterTest.php @@ -28,7 +28,7 @@ class CommentersSorterTest extends TestCase { * @dataProvider sortDataProvider * @param $data */ - public function testSort($data) { + public function testSort($data): void { $commentMocks = []; foreach ($data['actors'] as $actorType => $actors) { foreach ($actors as $actorId => $noOfComments) { diff --git a/apps/comments/tests/Unit/Controller/NotificationsTest.php b/apps/comments/tests/Unit/Controller/NotificationsTest.php index 03eba79e6c8..ccd808895c8 100644 --- a/apps/comments/tests/Unit/Controller/NotificationsTest.php +++ b/apps/comments/tests/Unit/Controller/NotificationsTest.php @@ -63,7 +63,7 @@ class NotificationsTest extends TestCase { ); } - public function testViewGuestRedirect() { + public function testViewGuestRedirect(): void { $this->commentsManager->expects($this->never()) ->method('get'); @@ -96,7 +96,7 @@ class NotificationsTest extends TestCase { $this->assertSame('link-to-login', $response->getRedirectURL()); } - public function testViewSuccess() { + public function testViewSuccess(): void { $comment = $this->createMock(IComment::class); $comment->expects($this->any()) ->method('getObjectType') @@ -146,7 +146,7 @@ class NotificationsTest extends TestCase { $this->assertInstanceOf(RedirectResponse::class, $response); } - public function testViewInvalidComment() { + public function testViewInvalidComment(): void { $this->commentsManager->expects($this->any()) ->method('get') ->with('42') @@ -174,7 +174,7 @@ class NotificationsTest extends TestCase { $this->assertInstanceOf(NotFoundResponse::class, $response); } - public function testViewNoFile() { + public function testViewNoFile(): void { $comment = $this->createMock(IComment::class); $comment->expects($this->any()) ->method('getObjectType') diff --git a/apps/comments/tests/Unit/EventHandlerTest.php b/apps/comments/tests/Unit/EventHandlerTest.php index 6459924ee8a..83ce1af57da 100644 --- a/apps/comments/tests/Unit/EventHandlerTest.php +++ b/apps/comments/tests/Unit/EventHandlerTest.php @@ -36,7 +36,7 @@ class EventHandlerTest extends TestCase { $this->eventHandler = new CommentsEventListener($this->activityListener, $this->notificationListener); } - public function testNotFiles() { + public function testNotFiles(): void { /** @var IComment|\PHPUnit\Framework\MockObject\MockObject $comment */ $comment = $this->getMockBuilder(IComment::class)->getMock(); $comment->expects($this->once()) @@ -69,7 +69,7 @@ class EventHandlerTest extends TestCase { * @dataProvider handledProvider * @param string $eventType */ - public function testHandled($eventType) { + public function testHandled($eventType): void { /** @var IComment|\PHPUnit\Framework\MockObject\MockObject $comment */ $comment = $this->getMockBuilder(IComment::class)->getMock(); $comment->expects($this->once()) diff --git a/apps/comments/tests/Unit/Notification/ListenerTest.php b/apps/comments/tests/Unit/Notification/ListenerTest.php index 3082333e8a3..4cdb5f93b15 100644 --- a/apps/comments/tests/Unit/Notification/ListenerTest.php +++ b/apps/comments/tests/Unit/Notification/ListenerTest.php @@ -55,7 +55,7 @@ class ListenerTest extends TestCase { * @param string $eventType * @param string $notificationMethod */ - public function testEvaluate($eventType, $notificationMethod) { + public function testEvaluate($eventType, $notificationMethod): void { /** @var IComment|\PHPUnit\Framework\MockObject\MockObject $comment */ $comment = $this->getMockBuilder(IComment::class)->getMock(); $comment->expects($this->any()) @@ -123,7 +123,7 @@ class ListenerTest extends TestCase { * @dataProvider eventProvider * @param string $eventType */ - public function testEvaluateNoMentions($eventType) { + public function testEvaluateNoMentions($eventType): void { /** @var IComment|\PHPUnit\Framework\MockObject\MockObject $comment */ $comment = $this->getMockBuilder(IComment::class)->getMock(); $comment->expects($this->any()) @@ -160,7 +160,7 @@ class ListenerTest extends TestCase { $this->listener->evaluate($event); } - public function testEvaluateUserDoesNotExist() { + public function testEvaluateUserDoesNotExist(): void { /** @var IComment|\PHPUnit\Framework\MockObject\MockObject $comment */ $comment = $this->getMockBuilder(IComment::class)->getMock(); $comment->expects($this->any()) diff --git a/apps/comments/tests/Unit/Notification/NotifierTest.php b/apps/comments/tests/Unit/Notification/NotifierTest.php index a01c08a6760..87b87e646af 100644 --- a/apps/comments/tests/Unit/Notification/NotifierTest.php +++ b/apps/comments/tests/Unit/Notification/NotifierTest.php @@ -72,7 +72,7 @@ class NotifierTest extends TestCase { $this->comment = $this->createMock(IComment::class); } - public function testPrepareSuccess() { + public function testPrepareSuccess(): void { $fileName = 'Gre\'thor.odp'; $displayName = 'Huraga'; $message = '@Huraga mentioned you in a comment on "Gre\'thor.odp"'; @@ -190,7 +190,7 @@ class NotifierTest extends TestCase { $this->notifier->prepare($this->notification, $this->lc); } - public function testPrepareSuccessDeletedUser() { + public function testPrepareSuccessDeletedUser(): void { $fileName = 'Gre\'thor.odp'; $message = 'You were mentioned on "Gre\'thor.odp", in a comment by an account that has since been deleted'; @@ -305,7 +305,7 @@ class NotifierTest extends TestCase { } - public function testPrepareDifferentApp() { + public function testPrepareDifferentApp(): void { $this->expectException(UnknownNotificationException::class); $this->folder @@ -342,7 +342,7 @@ class NotifierTest extends TestCase { } - public function testPrepareNotFound() { + public function testPrepareNotFound(): void { $this->expectException(UnknownNotificationException::class); $this->folder @@ -380,7 +380,7 @@ class NotifierTest extends TestCase { } - public function testPrepareDifferentSubject() { + public function testPrepareDifferentSubject(): void { $this->expectException(UnknownNotificationException::class); $displayName = 'Huraga'; @@ -437,7 +437,7 @@ class NotifierTest extends TestCase { } - public function testPrepareNotFiles() { + public function testPrepareNotFiles(): void { $this->expectException(UnknownNotificationException::class); $displayName = 'Huraga'; @@ -495,7 +495,7 @@ class NotifierTest extends TestCase { } - public function testPrepareUnresolvableFileID() { + public function testPrepareUnresolvableFileID(): void { $this->expectException(AlreadyProcessedException::class); $displayName = 'Huraga'; diff --git a/apps/dav/tests/unit/BackgroundJob/OutOfOfficeEventDispatcherJobTest.php b/apps/dav/tests/unit/BackgroundJob/OutOfOfficeEventDispatcherJobTest.php index b42334523f8..5ddd9eba6f8 100644 --- a/apps/dav/tests/unit/BackgroundJob/OutOfOfficeEventDispatcherJobTest.php +++ b/apps/dav/tests/unit/BackgroundJob/OutOfOfficeEventDispatcherJobTest.php @@ -62,7 +62,7 @@ class OutOfOfficeEventDispatcherJobTest extends TestCase { ); } - public function testDispatchStartEvent() { + public function testDispatchStartEvent(): void { $this->timezoneService->method('getUserTimezone')->with('user')->willReturn('Europe/Berlin'); $absence = new Absence(); @@ -94,7 +94,7 @@ class OutOfOfficeEventDispatcherJobTest extends TestCase { ]); } - public function testDispatchStopEvent() { + public function testDispatchStopEvent(): void { $this->timezoneService->method('getUserTimezone')->with('user')->willReturn('Europe/Berlin'); $absence = new Absence(); @@ -126,7 +126,7 @@ class OutOfOfficeEventDispatcherJobTest extends TestCase { ]); } - public function testDoesntDispatchUnknownEvent() { + public function testDoesntDispatchUnknownEvent(): void { $this->timezoneService->method('getUserTimezone')->with('user')->willReturn('Europe/Berlin'); $absence = new Absence(); diff --git a/apps/dav/tests/unit/CalDAV/AppCalendar/AppCalendarTest.php b/apps/dav/tests/unit/CalDAV/AppCalendar/AppCalendarTest.php index b8983350348..f7fa114ff28 100644 --- a/apps/dav/tests/unit/CalDAV/AppCalendar/AppCalendarTest.php +++ b/apps/dav/tests/unit/CalDAV/AppCalendar/AppCalendarTest.php @@ -52,7 +52,7 @@ class AppCalendarTest extends TestCase { $this->appCalendar->delete(); } - public function testCreateFile() { + public function testCreateFile(): void { $this->writeableCalendar->expects($this->exactly(3)) ->method('createFromString') ->withConsecutive(['some-name', 'data'], ['other-name', ''], ['name', 'some data']); @@ -69,7 +69,7 @@ class AppCalendarTest extends TestCase { fclose($fp); } - public function testCreateFile_readOnly() { + public function testCreateFile_readOnly(): void { // If writing is not supported $this->expectException(\Sabre\DAV\Exception\Forbidden::class); $this->expectExceptionMessage('Creating a new entry is not allowed'); diff --git a/apps/dav/tests/unit/CalDAV/AppCalendar/CalendarObjectTest.php b/apps/dav/tests/unit/CalDAV/AppCalendar/CalendarObjectTest.php index 92288f5dfb0..a913c2dde6f 100644 --- a/apps/dav/tests/unit/CalDAV/AppCalendar/CalendarObjectTest.php +++ b/apps/dav/tests/unit/CalDAV/AppCalendar/CalendarObjectTest.php @@ -33,15 +33,15 @@ class CalendarObjectTest extends TestCase { $this->calendarObject = new CalendarObject($this->calendar, $this->backend, $this->vobject); } - public function testGetOwner() { + public function testGetOwner(): void { $this->assertEquals($this->calendarObject->getOwner(), 'owner'); } - public function testGetGroup() { + public function testGetGroup(): void { $this->assertEquals($this->calendarObject->getGroup(), 'group'); } - public function testGetACL() { + public function testGetACL(): void { $this->calendar->expects($this->exactly(2)) ->method('getPermissions') ->willReturnOnConsecutiveCalls(Constants::PERMISSION_READ, Constants::PERMISSION_ALL); @@ -70,17 +70,17 @@ class CalendarObjectTest extends TestCase { ]); } - public function testSetACL() { + public function testSetACL(): void { $this->expectException(\Sabre\DAV\Exception\Forbidden::class); $this->calendarObject->setACL([]); } - public function testPut_readOnlyBackend() { + public function testPut_readOnlyBackend(): void { $this->expectException(\Sabre\DAV\Exception\Forbidden::class); $this->calendarObject->put('foo'); } - public function testPut_noPermissions() { + public function testPut_noPermissions(): void { $this->expectException(\Sabre\DAV\Exception\Forbidden::class); $backend = $this->createMock(ICreateFromString::class); @@ -93,7 +93,7 @@ class CalendarObjectTest extends TestCase { $calendarObject->put('foo'); } - public function testPut() { + public function testPut(): void { $backend = $this->createMock(ICreateFromString::class); $calendarObject = new CalendarObject($this->calendar, $backend, $this->vobject); @@ -110,19 +110,19 @@ class CalendarObjectTest extends TestCase { $calendarObject->put('foo'); } - public function testGet() { + public function testGet(): void { $this->vobject->expects($this->once()) ->method('serialize') ->willReturn('foo'); $this->assertEquals($this->calendarObject->get(), 'foo'); } - public function testDelete_notWriteable() { + public function testDelete_notWriteable(): void { $this->expectException(\Sabre\DAV\Exception\Forbidden::class); $this->calendarObject->delete(); } - public function testDelete_noPermission() { + public function testDelete_noPermission(): void { $backend = $this->createMock(ICreateFromString::class); $calendarObject = new CalendarObject($this->calendar, $backend, $this->vobject); @@ -130,7 +130,7 @@ class CalendarObjectTest extends TestCase { $calendarObject->delete(); } - public function testDelete() { + public function testDelete(): void { $backend = $this->createMock(ICreateFromString::class); $calendarObject = new CalendarObject($this->calendar, $backend, $this->vobject); @@ -153,7 +153,7 @@ class CalendarObjectTest extends TestCase { $calendarObject->delete(); } - public function testGetName() { + public function testGetName(): void { $this->vobject->expects($this->exactly(2)) ->method('getBaseComponent') ->willReturnOnConsecutiveCalls((object)['UID' => 'someid'], (object)['UID' => 'someid', 'X-FILENAME' => 'real-filename.ics']); @@ -162,7 +162,7 @@ class CalendarObjectTest extends TestCase { $this->assertEquals($this->calendarObject->getName(), 'real-filename.ics'); } - public function testSetName() { + public function testSetName(): void { $this->expectException(\Sabre\DAV\Exception\Forbidden::class); $this->calendarObject->setName('Some name'); } diff --git a/apps/dav/tests/unit/CalDAV/CachedSubscriptionProviderTest.php b/apps/dav/tests/unit/CalDAV/CachedSubscriptionProviderTest.php index 22998eec3d9..be47b2bf640 100644 --- a/apps/dav/tests/unit/CalDAV/CachedSubscriptionProviderTest.php +++ b/apps/dav/tests/unit/CalDAV/CachedSubscriptionProviderTest.php @@ -47,7 +47,7 @@ class CachedSubscriptionProviderTest extends TestCase { $this->provider = new CachedSubscriptionProvider($this->backend); } - public function testGetCalendars() { + public function testGetCalendars(): void { $calendars = $this->provider->getCalendars( 'user-principal-123', [] @@ -58,7 +58,7 @@ class CachedSubscriptionProviderTest extends TestCase { $this->assertInstanceOf(CachedSubscriptionImpl::class, $calendars[1]); } - public function testGetCalendarsFilterByUri() { + public function testGetCalendarsFilterByUri(): void { $calendars = $this->provider->getCalendars( 'user-principal-123', ['subscription-1'] diff --git a/apps/dav/tests/unit/CalDAV/CalDavBackendTest.php b/apps/dav/tests/unit/CalDAV/CalDavBackendTest.php index ac4045ea757..c82ca350c90 100644 --- a/apps/dav/tests/unit/CalDAV/CalDavBackendTest.php +++ b/apps/dav/tests/unit/CalDAV/CalDavBackendTest.php @@ -1490,7 +1490,7 @@ EOD; self::assertSame(0, $deleted); } - public function testSearchAndExpandRecurrences() { + public function testSearchAndExpandRecurrences(): void { $calendarId = $this->createTestCalendar(); $calendarInfo = [ 'id' => $calendarId, @@ -1646,7 +1646,7 @@ EOD; self::assertEquals([$uri2], $changesAfter['deleted']); } - public function testSearchWithLimitAndTimeRange() { + public function testSearchWithLimitAndTimeRange(): void { $calendarId = $this->createTestCalendar(); $calendarInfo = [ 'id' => $calendarId, @@ -1703,7 +1703,7 @@ EOD; ); } - public function testSearchWithLimitAndTimeRangeShouldNotReturnMoreObjectsThenLimit() { + public function testSearchWithLimitAndTimeRangeShouldNotReturnMoreObjectsThenLimit(): void { $calendarId = $this->createTestCalendar(); $calendarInfo = [ 'id' => $calendarId, @@ -1753,7 +1753,7 @@ EOD; ); } - public function testSearchWithLimitAndTimeRangeShouldReturnObjectsInTheSameOrder() { + public function testSearchWithLimitAndTimeRangeShouldReturnObjectsInTheSameOrder(): void { $calendarId = $this->createTestCalendar(); $calendarInfo = [ 'id' => $calendarId, @@ -1810,7 +1810,7 @@ EOD; ); } - public function testSearchShouldReturnObjectsInTheSameOrderMissingDate() { + public function testSearchShouldReturnObjectsInTheSameOrderMissingDate(): void { $calendarId = $this->createTestCalendar(); $calendarInfo = [ 'id' => $calendarId, diff --git a/apps/dav/tests/unit/CalDAV/CalendarTest.php b/apps/dav/tests/unit/CalDAV/CalendarTest.php index a2854823cbc..6433af8c340 100644 --- a/apps/dav/tests/unit/CalDAV/CalendarTest.php +++ b/apps/dav/tests/unit/CalDAV/CalendarTest.php @@ -442,7 +442,7 @@ EOD; ]; } - public function testRemoveVAlarms() { + public function testRemoveVAlarms(): void { $publicObjectData = <<<EOD BEGIN:VCALENDAR VERSION:2.0 diff --git a/apps/dav/tests/unit/CalDAV/Schedule/IMipPluginTest.php b/apps/dav/tests/unit/CalDAV/Schedule/IMipPluginTest.php index 104f7cd7f51..e02ce89352d 100644 --- a/apps/dav/tests/unit/CalDAV/Schedule/IMipPluginTest.php +++ b/apps/dav/tests/unit/CalDAV/Schedule/IMipPluginTest.php @@ -467,7 +467,7 @@ class IMipPluginTest extends TestCase { $this->assertEquals('1.1', $message->getScheduleStatus()); } - public function testEmailValidationFailed() { + public function testEmailValidationFailed(): void { $message = new Message(); $message->method = 'REQUEST'; $message->message = new VCalendar(); diff --git a/apps/dav/tests/unit/CalDAV/Schedule/PluginTest.php b/apps/dav/tests/unit/CalDAV/Schedule/PluginTest.php index aa2903b519f..8d98a765fc1 100644 --- a/apps/dav/tests/unit/CalDAV/Schedule/PluginTest.php +++ b/apps/dav/tests/unit/CalDAV/Schedule/PluginTest.php @@ -400,7 +400,7 @@ class PluginTest extends TestCase { * * Should generate 2 messages for attendees User 2 and User External */ - public function testCalendarObjectChangePersonalCalendarCreate() { + public function testCalendarObjectChangePersonalCalendarCreate(): void { // define place holders /** @var Message[] $iTipMessages */ @@ -504,7 +504,7 @@ class PluginTest extends TestCase { * * Should generate 3 messages for attendees User 2 (Sharee), User 3 (Non-Sharee) and User External */ - public function testCalendarObjectChangeSharedCalendarSharerCreate() { + public function testCalendarObjectChangeSharedCalendarSharerCreate(): void { // define place holders /** @var Message[] $iTipMessages */ @@ -620,7 +620,7 @@ class PluginTest extends TestCase { * * Should generate 3 messages for attendees User 1 (Sharer/Owner), User 3 (Non-Sharee) and User External */ - public function testCalendarObjectChangeSharedCalendarShreeCreate() { + public function testCalendarObjectChangeSharedCalendarShreeCreate(): void { // define place holders /** @var Message[] $iTipMessages */ diff --git a/apps/dav/tests/unit/CalDAV/WebcalCaching/ConnectionTest.php b/apps/dav/tests/unit/CalDAV/WebcalCaching/ConnectionTest.php index ee903a5e0fa..0d836e44949 100644 --- a/apps/dav/tests/unit/CalDAV/WebcalCaching/ConnectionTest.php +++ b/apps/dav/tests/unit/CalDAV/WebcalCaching/ConnectionTest.php @@ -37,7 +37,7 @@ class ConnectionTest extends TestCase { /** * @dataProvider runLocalURLDataProvider */ - public function testLocalUrl($source) { + public function testLocalUrl($source): void { $subscription = [ 'id' => 42, 'uri' => 'sub123', diff --git a/apps/dav/tests/unit/Controller/UpcomingEventsControllerTest.php b/apps/dav/tests/unit/Controller/UpcomingEventsControllerTest.php index 9e5c03bb245..bab0ef77bd0 100644 --- a/apps/dav/tests/unit/Controller/UpcomingEventsControllerTest.php +++ b/apps/dav/tests/unit/Controller/UpcomingEventsControllerTest.php @@ -28,7 +28,7 @@ class UpcomingEventsControllerTest extends TestCase { $this->service = $this->createMock(UpcomingEventsService::class); } - public function testGetEventsAnonymously() { + public function testGetEventsAnonymously(): void { $controller = new UpcomingEventsController( $this->request, null, @@ -41,7 +41,7 @@ class UpcomingEventsControllerTest extends TestCase { self::assertSame(401, $response->getStatus()); } - public function testGetEventsByLocation() { + public function testGetEventsByLocation(): void { $controller = new UpcomingEventsController( $this->request, 'u1', diff --git a/apps/dav/tests/unit/Service/AbsenceServiceTest.php b/apps/dav/tests/unit/Service/AbsenceServiceTest.php index 1bc5f53f18c..5cff29a6f61 100644 --- a/apps/dav/tests/unit/Service/AbsenceServiceTest.php +++ b/apps/dav/tests/unit/Service/AbsenceServiceTest.php @@ -62,7 +62,7 @@ class AbsenceServiceTest extends TestCase { ); } - public function testCreateAbsenceEmitsScheduledEvent() { + public function testCreateAbsenceEmitsScheduledEvent(): void { $tz = new DateTimeZone('Europe/Berlin'); $user = $this->createMock(IUser::class); $user->method('getUID') @@ -117,7 +117,7 @@ class AbsenceServiceTest extends TestCase { ); } - public function testUpdateAbsenceEmitsChangedEvent() { + public function testUpdateAbsenceEmitsChangedEvent(): void { $tz = new DateTimeZone('Europe/Berlin'); $user = $this->createMock(IUser::class); $user->method('getUID') @@ -181,7 +181,7 @@ class AbsenceServiceTest extends TestCase { ); } - public function testCreateAbsenceSchedulesBothJobs() { + public function testCreateAbsenceSchedulesBothJobs(): void { $tz = new DateTimeZone('Europe/Berlin'); $startDateString = '2023-01-05'; $startDate = new DateTimeImmutable($startDateString, $tz); @@ -230,7 +230,7 @@ class AbsenceServiceTest extends TestCase { ); } - public function testCreateAbsenceSchedulesOnlyEndJob() { + public function testCreateAbsenceSchedulesOnlyEndJob(): void { $tz = new DateTimeZone('Europe/Berlin'); $endDateString = '2023-01-10'; $endDate = new DateTimeImmutable($endDateString, $tz); @@ -271,7 +271,7 @@ class AbsenceServiceTest extends TestCase { ); } - public function testCreateAbsenceSchedulesNoJob() { + public function testCreateAbsenceSchedulesNoJob(): void { $tz = new DateTimeZone('Europe/Berlin'); $user = $this->createMock(IUser::class); $user->method('getUID') @@ -306,7 +306,7 @@ class AbsenceServiceTest extends TestCase { ); } - public function testUpdateAbsenceSchedulesBothJobs() { + public function testUpdateAbsenceSchedulesBothJobs(): void { $tz = new DateTimeZone('Europe/Berlin'); $startDateString = '2023-01-05'; $startDate = new DateTimeImmutable($startDateString, $tz); @@ -362,7 +362,7 @@ class AbsenceServiceTest extends TestCase { ); } - public function testUpdateSchedulesOnlyEndJob() { + public function testUpdateSchedulesOnlyEndJob(): void { $tz = new DateTimeZone('Europe/Berlin'); $endDateString = '2023-01-10'; $endDate = new DateTimeImmutable($endDateString, $tz); @@ -410,7 +410,7 @@ class AbsenceServiceTest extends TestCase { ); } - public function testUpdateAbsenceSchedulesNoJob() { + public function testUpdateAbsenceSchedulesNoJob(): void { $tz = new DateTimeZone('Europe/Berlin'); $user = $this->createMock(IUser::class); $user->method('getUID') diff --git a/apps/encryption/tests/Command/FixEncryptedVersionTest.php b/apps/encryption/tests/Command/FixEncryptedVersionTest.php index c021c366ad8..fd6e27e030b 100644 --- a/apps/encryption/tests/Command/FixEncryptedVersionTest.php +++ b/apps/encryption/tests/Command/FixEncryptedVersionTest.php @@ -75,7 +75,7 @@ class FixEncryptedVersionTest extends TestCase { * In this test the encrypted version of the file is less than the original value * but greater than zero */ - public function testEncryptedVersionLessThanOriginalValue() { + public function testEncryptedVersionLessThanOriginalValue(): void { $this->util->expects($this->once())->method('isMasterKeyEnabled') ->willReturn(true); @@ -143,7 +143,7 @@ Fixed the file: \"/$this->userId/files/world.txt\" with version 4", $output); * In this test the encrypted version of the file is greater than the original value * but greater than zero */ - public function testEncryptedVersionGreaterThanOriginalValue() { + public function testEncryptedVersionGreaterThanOriginalValue(): void { $this->util->expects($this->once())->method('isMasterKeyEnabled') ->willReturn(true); @@ -202,7 +202,7 @@ The file \"/$this->userId/files/world.txt\" is: OK Fixed the file: \"/$this->userId/files/world.txt\" with version 4", $output); } - public function testVersionIsRestoredToOriginalIfNoFixIsFound() { + public function testVersionIsRestoredToOriginalIfNoFixIsFound(): void { $this->util->expects($this->once())->method('isMasterKeyEnabled') ->willReturn(true); @@ -232,7 +232,7 @@ Fixed the file: \"/$this->userId/files/world.txt\" with version 4", $output); $this->assertEquals(15, $encryptedVersion); } - public function testRepairUnencryptedFileWhenVersionIsSet() { + public function testRepairUnencryptedFileWhenVersionIsSet(): void { $this->util->expects($this->once())->method('isMasterKeyEnabled') ->willReturn(true); @@ -275,7 +275,7 @@ Fixed the file: \"/$this->userId/files/hello.txt\" with version 0 (unencrypted)" /** * Test commands with a file path */ - public function testExecuteWithFilePathOption() { + public function testExecuteWithFilePathOption(): void { $this->util->expects($this->once())->method('isMasterKeyEnabled') ->willReturn(true); @@ -299,7 +299,7 @@ The file \"/$this->userId/files/hello.txt\" is: OK", $output); /** * Test commands with a directory path */ - public function testExecuteWithDirectoryPathOption() { + public function testExecuteWithDirectoryPathOption(): void { $this->util->expects($this->once())->method('isMasterKeyEnabled') ->willReturn(true); @@ -321,7 +321,7 @@ The file \"/$this->userId/files/sub/hello.txt\" is: OK", $output); $this->assertStringNotContainsString('world.txt', $output); } - public function testExecuteWithNoUser() { + public function testExecuteWithNoUser(): void { $this->util->expects($this->once())->method('isMasterKeyEnabled') ->willReturn(true); @@ -335,7 +335,7 @@ The file \"/$this->userId/files/sub/hello.txt\" is: OK", $output); $this->assertStringContainsString('Either a user id or --all needs to be provided', $output); } - public function testExecuteWithBadUser() { + public function testExecuteWithBadUser(): void { $this->util->expects($this->once())->method('isMasterKeyEnabled') ->willReturn(true); @@ -352,7 +352,7 @@ The file \"/$this->userId/files/sub/hello.txt\" is: OK", $output); /** * Test commands with a directory path */ - public function testExecuteWithNonExistentPath() { + public function testExecuteWithNonExistentPath(): void { $this->util->expects($this->once())->method('isMasterKeyEnabled') ->willReturn(true); @@ -369,7 +369,7 @@ The file \"/$this->userId/files/sub/hello.txt\" is: OK", $output); /** * Test commands without master key */ - public function testExecuteWithNoMasterKey() { + public function testExecuteWithNoMasterKey(): void { \OC::$server->getConfig()->setAppValue('encryption', 'useMasterKey', '0'); $this->util->expects($this->once())->method('isMasterKeyEnabled') ->willReturn(false); diff --git a/apps/encryption/tests/Command/TestEnableMasterKey.php b/apps/encryption/tests/Command/TestEnableMasterKey.php index 47bc978627d..2ed29becf2a 100644 --- a/apps/encryption/tests/Command/TestEnableMasterKey.php +++ b/apps/encryption/tests/Command/TestEnableMasterKey.php @@ -58,7 +58,7 @@ class TestEnableMasterKey extends TestCase { * @param bool $isAlreadyEnabled * @param string $answer */ - public function testExecute($isAlreadyEnabled, $answer) { + public function testExecute($isAlreadyEnabled, $answer): void { $this->util->expects($this->once())->method('isMasterKeyEnabled') ->willReturn($isAlreadyEnabled); diff --git a/apps/encryption/tests/Controller/RecoveryControllerTest.php b/apps/encryption/tests/Controller/RecoveryControllerTest.php index 955e9c7c964..8398a22039b 100644 --- a/apps/encryption/tests/Controller/RecoveryControllerTest.php +++ b/apps/encryption/tests/Controller/RecoveryControllerTest.php @@ -45,7 +45,7 @@ class RecoveryControllerTest extends TestCase { * @param $expectedMessage * @param $expectedStatus */ - public function testAdminRecovery($recoveryPassword, $passConfirm, $enableRecovery, $expectedMessage, $expectedStatus) { + public function testAdminRecovery($recoveryPassword, $passConfirm, $enableRecovery, $expectedMessage, $expectedStatus): void { $this->recoveryMock->expects($this->any()) ->method('enableAdminRecovery') ->willReturn(true); @@ -81,7 +81,7 @@ class RecoveryControllerTest extends TestCase { * @param $expectedMessage * @param $expectedStatus */ - public function testChangeRecoveryPassword($password, $confirmPassword, $oldPassword, $expectedMessage, $expectedStatus) { + public function testChangeRecoveryPassword($password, $confirmPassword, $oldPassword, $expectedMessage, $expectedStatus): void { $this->recoveryMock->expects($this->any()) ->method('changeRecoveryKeyPassword') ->with($password, $oldPassword) @@ -111,7 +111,7 @@ class RecoveryControllerTest extends TestCase { * @param $expectedMessage * @param $expectedStatus */ - public function testUserSetRecovery($enableRecovery, $expectedMessage, $expectedStatus) { + public function testUserSetRecovery($enableRecovery, $expectedMessage, $expectedStatus): void { $this->recoveryMock->expects($this->any()) ->method('setRecoveryForUser') ->with($enableRecovery) diff --git a/apps/encryption/tests/Controller/SettingsControllerTest.php b/apps/encryption/tests/Controller/SettingsControllerTest.php index ee49972001c..dcad23cd759 100644 --- a/apps/encryption/tests/Controller/SettingsControllerTest.php +++ b/apps/encryption/tests/Controller/SettingsControllerTest.php @@ -115,7 +115,7 @@ class SettingsControllerTest extends TestCase { /** * test updatePrivateKeyPassword() if wrong new password was entered */ - public function testUpdatePrivateKeyPasswordWrongNewPassword() { + public function testUpdatePrivateKeyPasswordWrongNewPassword(): void { $oldPassword = 'old'; $newPassword = 'new'; @@ -140,7 +140,7 @@ class SettingsControllerTest extends TestCase { /** * test updatePrivateKeyPassword() if wrong old password was entered */ - public function testUpdatePrivateKeyPasswordWrongOldPassword() { + public function testUpdatePrivateKeyPasswordWrongOldPassword(): void { $oldPassword = 'old'; $newPassword = 'new'; @@ -166,7 +166,7 @@ class SettingsControllerTest extends TestCase { /** * test updatePrivateKeyPassword() with the correct old and new password */ - public function testUpdatePrivateKeyPassword() { + public function testUpdatePrivateKeyPassword(): void { $oldPassword = 'old'; $newPassword = 'new'; @@ -227,7 +227,7 @@ class SettingsControllerTest extends TestCase { $data['message']); } - public function testSetEncryptHomeStorage() { + public function testSetEncryptHomeStorage(): void { $value = true; $this->utilMock->expects($this->once())->method('setEncryptHomeStorage')->with($value); $this->controller->setEncryptHomeStorage($value); diff --git a/apps/encryption/tests/Controller/StatusControllerTest.php b/apps/encryption/tests/Controller/StatusControllerTest.php index 26210946cce..c88b0497abf 100644 --- a/apps/encryption/tests/Controller/StatusControllerTest.php +++ b/apps/encryption/tests/Controller/StatusControllerTest.php @@ -60,7 +60,7 @@ class StatusControllerTest extends TestCase { * @param string $status * @param string $expectedStatus */ - public function testGetStatus($status, $expectedStatus) { + public function testGetStatus($status, $expectedStatus): void { $this->sessionMock->expects($this->once()) ->method('getStatus')->willReturn($status); $result = $this->controller->getStatus(); diff --git a/apps/encryption/tests/Crypto/CryptTest.php b/apps/encryption/tests/Crypto/CryptTest.php index 301ffaeaef3..a9869af99d9 100644 --- a/apps/encryption/tests/Crypto/CryptTest.php +++ b/apps/encryption/tests/Crypto/CryptTest.php @@ -53,7 +53,7 @@ class CryptTest extends TestCase { /** * test getOpenSSLConfig without any additional parameters */ - public function testGetOpenSSLConfigBasic() { + public function testGetOpenSSLConfigBasic(): void { $this->config->expects($this->once()) ->method('getSystemValue') ->with($this->equalTo('openssl'), $this->equalTo([])) @@ -68,7 +68,7 @@ class CryptTest extends TestCase { /** * test getOpenSSLConfig with additional parameters defined in config.php */ - public function testGetOpenSSLConfig() { + public function testGetOpenSSLConfig(): void { $this->config->expects($this->once()) ->method('getSystemValue') ->with($this->equalTo('openssl'), $this->equalTo([])) @@ -88,7 +88,7 @@ class CryptTest extends TestCase { * * @dataProvider dataTestGenerateHeader */ - public function testGenerateHeader($keyFormat, $expected) { + public function testGenerateHeader($keyFormat, $expected): void { $this->config->expects($this->once()) ->method('getSystemValueString') ->with($this->equalTo('cipher'), $this->equalTo('AES-256-CTR')) @@ -107,7 +107,7 @@ class CryptTest extends TestCase { * test generateHeader with invalid key format * */ - public function testGenerateHeaderInvalid() { + public function testGenerateHeaderInvalid(): void { $this->expectException(\InvalidArgumentException::class); $this->crypt->generateHeader('unknown'); @@ -124,7 +124,7 @@ class CryptTest extends TestCase { ]; } - public function testGetCipherWithInvalidCipher() { + public function testGetCipherWithInvalidCipher(): void { $this->config->expects($this->once()) ->method('getSystemValueString') ->with($this->equalTo('cipher'), $this->equalTo('AES-256-CTR')) @@ -142,7 +142,7 @@ class CryptTest extends TestCase { * @param string $configValue * @param string $expected */ - public function testGetCipher($configValue, $expected) { + public function testGetCipher($configValue, $expected): void { $this->config->expects($this->once()) ->method('getSystemValueString') ->with($this->equalTo('cipher'), $this->equalTo('AES-256-CTR')) @@ -172,7 +172,7 @@ class CryptTest extends TestCase { /** * test concatIV() */ - public function testConcatIV() { + public function testConcatIV(): void { $result = self::invokePrivate( $this->crypt, 'concatIV', @@ -186,7 +186,7 @@ class CryptTest extends TestCase { /** * @dataProvider dataTestSplitMetaData */ - public function testSplitMetaData($data, $expected) { + public function testSplitMetaData($data, $expected): void { $this->config->method('getSystemValueBool') ->with('encryption_skip_signature_check', false) ->willReturn(true); @@ -213,7 +213,7 @@ class CryptTest extends TestCase { /** * @dataProvider dataTestHasSignature */ - public function testHasSignature($data, $expected) { + public function testHasSignature($data, $expected): void { $this->config->method('getSystemValueBool') ->with('encryption_skip_signature_check', false) ->willReturn(true); @@ -232,7 +232,7 @@ class CryptTest extends TestCase { /** * @dataProvider dataTestHasSignatureFail */ - public function testHasSignatureFail($cipher) { + public function testHasSignatureFail($cipher): void { $this->expectException(\OCP\Encryption\Exceptions\GenericEncryptionException::class); $data = 'encryptedContent00iv001234567890123456xx'; @@ -251,7 +251,7 @@ class CryptTest extends TestCase { /** * test addPadding() */ - public function testAddPadding() { + public function testAddPadding(): void { $result = self::invokePrivate($this->crypt, 'addPadding', ['data']); $this->assertSame('dataxxx', $result); } @@ -263,7 +263,7 @@ class CryptTest extends TestCase { * @param $data * @param $expected */ - public function testRemovePadding($data, $expected) { + public function testRemovePadding($data, $expected): void { $result = self::invokePrivate($this->crypt, 'removePadding', [$data]); $this->assertSame($expected, $result); } @@ -283,7 +283,7 @@ class CryptTest extends TestCase { /** * test parseHeader() */ - public function testParseHeader() { + public function testParseHeader(): void { $header = 'HBEGIN:foo:bar:cipher:AES-256-CFB:encoding:binary:HEND'; $result = self::invokePrivate($this->crypt, 'parseHeader', [$header]); @@ -328,7 +328,7 @@ class CryptTest extends TestCase { * * @depends testEncrypt */ - public function testDecrypt($data) { + public function testDecrypt($data): void { $result = self::invokePrivate( $this->crypt, 'decrypt', @@ -342,7 +342,7 @@ class CryptTest extends TestCase { * * @dataProvider dataTestGetKeySize */ - public function testGetKeySize($cipher, $expected) { + public function testGetKeySize($cipher, $expected): void { $result = $this->invokePrivate($this->crypt, 'getKeySize', [$cipher]); $this->assertSame($expected, $result); } @@ -351,7 +351,7 @@ class CryptTest extends TestCase { * test exception if cipher is unknown * */ - public function testGetKeySizeFailure() { + public function testGetKeySizeFailure(): void { $this->expectException(\InvalidArgumentException::class); $this->invokePrivate($this->crypt, 'getKeySize', ['foo']); @@ -372,7 +372,7 @@ class CryptTest extends TestCase { /** * @dataProvider dataTestDecryptPrivateKey */ - public function testDecryptPrivateKey($header, $privateKey, $expectedCipher, $isValidKey, $expected) { + public function testDecryptPrivateKey($header, $privateKey, $expectedCipher, $isValidKey, $expected): void { $this->config->method('getSystemValueBool') ->withConsecutive(['encryption.legacy_format_support', false], ['encryption.use_legacy_base64_encoding', false]) @@ -430,7 +430,7 @@ class CryptTest extends TestCase { ]; } - public function testIsValidPrivateKey() { + public function testIsValidPrivateKey(): void { $res = openssl_pkey_new(); openssl_pkey_export($res, $privateKey); @@ -445,7 +445,7 @@ class CryptTest extends TestCase { ); } - public function testMultiKeyEncrypt() { + public function testMultiKeyEncrypt(): void { $res = openssl_pkey_new(); openssl_pkey_export($res, $privateKey); $publicKeyPem = openssl_pkey_get_details($res)['key']; diff --git a/apps/encryption/tests/Crypto/DecryptAllTest.php b/apps/encryption/tests/Crypto/DecryptAllTest.php index 2a46e542804..0d8543153ef 100644 --- a/apps/encryption/tests/Crypto/DecryptAllTest.php +++ b/apps/encryption/tests/Crypto/DecryptAllTest.php @@ -58,7 +58,7 @@ class DecryptAllTest extends TestCase { ); } - public function testUpdateSession() { + public function testUpdateSession(): void { $this->session->expects($this->once())->method('prepareDecryptAll') ->with('user1', 'key1'); @@ -71,7 +71,7 @@ class DecryptAllTest extends TestCase { * @param string $user * @param string $recoveryKeyId */ - public function testGetPrivateKey($user, $recoveryKeyId, $masterKeyId) { + public function testGetPrivateKey($user, $recoveryKeyId, $masterKeyId): void { $password = 'passwd'; $recoveryKey = 'recoveryKey'; $userKey = 'userKey'; diff --git a/apps/encryption/tests/Crypto/EncryptAllTest.php b/apps/encryption/tests/Crypto/EncryptAllTest.php index a63b826bf3c..f58ea2119e6 100644 --- a/apps/encryption/tests/Crypto/EncryptAllTest.php +++ b/apps/encryption/tests/Crypto/EncryptAllTest.php @@ -135,7 +135,7 @@ class EncryptAllTest extends TestCase { ); } - public function testEncryptAll() { + public function testEncryptAll(): void { /** @var EncryptAll | \PHPUnit\Framework\MockObject\MockObject $encryptAll */ $encryptAll = $this->getMockBuilder(EncryptAll::class) ->setConstructorArgs( @@ -164,7 +164,7 @@ class EncryptAllTest extends TestCase { $encryptAll->encryptAll($this->inputInterface, $this->outputInterface); } - public function testEncryptAllWithMasterKey() { + public function testEncryptAllWithMasterKey(): void { /** @var EncryptAll | \PHPUnit\Framework\MockObject\MockObject $encryptAll */ $encryptAll = $this->getMockBuilder(EncryptAll::class) ->setConstructorArgs( @@ -194,7 +194,7 @@ class EncryptAllTest extends TestCase { $encryptAll->encryptAll($this->inputInterface, $this->outputInterface); } - public function testCreateKeyPairs() { + public function testCreateKeyPairs(): void { /** @var EncryptAll | \PHPUnit\Framework\MockObject\MockObject $encryptAll */ $encryptAll = $this->getMockBuilder(EncryptAll::class) ->setConstructorArgs( @@ -244,7 +244,7 @@ class EncryptAllTest extends TestCase { $this->assertSame('', $userPasswords['user2']); } - public function testEncryptAllUsersFiles() { + public function testEncryptAllUsersFiles(): void { /** @var EncryptAll | \PHPUnit\Framework\MockObject\MockObject $encryptAll */ $encryptAll = $this->getMockBuilder(EncryptAll::class) ->setConstructorArgs( @@ -280,7 +280,7 @@ class EncryptAllTest extends TestCase { $this->invokePrivate($encryptAll, 'encryptAllUsersFiles'); } - public function testEncryptUsersFiles() { + public function testEncryptUsersFiles(): void { /** @var EncryptAll | \PHPUnit\Framework\MockObject\MockObject $encryptAll */ $encryptAll = $this->getMockBuilder(EncryptAll::class) ->setConstructorArgs( @@ -343,7 +343,7 @@ class EncryptAllTest extends TestCase { $this->invokePrivate($encryptAll, 'encryptUsersFiles', ['user1', $progressBar, '']); } - public function testGenerateOneTimePassword() { + public function testGenerateOneTimePassword(): void { $password = $this->invokePrivate($this->encryptAll, 'generateOneTimePassword', ['user1']); $this->assertTrue(is_string($password)); $this->assertSame(8, strlen($password)); @@ -357,7 +357,7 @@ class EncryptAllTest extends TestCase { * @dataProvider dataTestEncryptFile * @param $isEncrypted */ - public function testEncryptFile($isEncrypted) { + public function testEncryptFile($isEncrypted): void { $fileInfo = $this->createMock(FileInfo::class); $fileInfo->expects($this->any())->method('isEncrypted') ->willReturn($isEncrypted); diff --git a/apps/encryption/tests/Crypto/EncryptionTest.php b/apps/encryption/tests/Crypto/EncryptionTest.php index 4767d22339d..b07bd0a6b25 100644 --- a/apps/encryption/tests/Crypto/EncryptionTest.php +++ b/apps/encryption/tests/Crypto/EncryptionTest.php @@ -102,7 +102,7 @@ class EncryptionTest extends TestCase { /** * test if public key from one of the recipients is missing */ - public function testEndUser1() { + public function testEndUser1(): void { $this->sessionMock->expects($this->once()) ->method('decryptAllModeActivated') ->willReturn(false); @@ -115,7 +115,7 @@ class EncryptionTest extends TestCase { * test if public key from owner is missing * */ - public function testEndUser2() { + public function testEndUser2(): void { $this->sessionMock->expects($this->once()) ->method('decryptAllModeActivated') ->willReturn(false); @@ -167,7 +167,7 @@ class EncryptionTest extends TestCase { /** * @dataProvider dataProviderForTestGetPathToRealFile */ - public function testGetPathToRealFile($path, $expected) { + public function testGetPathToRealFile($path, $expected): void { $this->assertSame($expected, self::invokePrivate($this->instance, 'getPathToRealFile', [$path]) ); @@ -185,7 +185,7 @@ class EncryptionTest extends TestCase { /** * @dataProvider dataTestBegin */ - public function testBegin($mode, $header, $legacyCipher, $defaultCipher, $fileKey, $expected) { + public function testBegin($mode, $header, $legacyCipher, $defaultCipher, $fileKey, $expected): void { $this->sessionMock->expects($this->once()) ->method('decryptAllModeActivated') ->willReturn(false); @@ -239,7 +239,7 @@ class EncryptionTest extends TestCase { /** * test begin() if decryptAll mode was activated */ - public function testBeginDecryptAll() { + public function testBeginDecryptAll(): void { $path = '/user/files/foo.txt'; $fileKey = 'fileKey'; @@ -263,7 +263,7 @@ class EncryptionTest extends TestCase { * in this case we can initialize the encryption without a username/password * and continue */ - public function testBeginInitMasterKey() { + public function testBeginInitMasterKey(): void { $this->sessionMock->expects($this->once()) ->method('decryptAllModeActivated') ->willReturn(false); @@ -282,7 +282,7 @@ class EncryptionTest extends TestCase { * @param string $fileKey * @param boolean $expected */ - public function testUpdate($fileKey, $expected) { + public function testUpdate($fileKey, $expected): void { $this->keyManagerMock->expects($this->once()) ->method('getFileKey')->willReturn($fileKey); @@ -310,7 +310,7 @@ class EncryptionTest extends TestCase { ]; } - public function testUpdateNoUsers() { + public function testUpdateNoUsers(): void { $this->invokePrivate($this->instance, 'rememberVersion', [['path' => 2]]); $this->keyManagerMock->expects($this->never())->method('getFileKey'); @@ -329,7 +329,7 @@ class EncryptionTest extends TestCase { * Test case if the public key is missing. Nextcloud should still encrypt * the file for the remaining users */ - public function testUpdateMissingPublicKey() { + public function testUpdateMissingPublicKey(): void { $this->keyManagerMock->expects($this->once()) ->method('getFileKey')->willReturn('fileKey'); @@ -369,7 +369,7 @@ class EncryptionTest extends TestCase { * * @dataProvider dataTestShouldEncrypt */ - public function testShouldEncrypt($path, $shouldEncryptHomeStorage, $isHomeStorage, $expected) { + public function testShouldEncrypt($path, $shouldEncryptHomeStorage, $isHomeStorage, $expected): void { $this->utilMock->expects($this->once())->method('shouldEncryptHomeStorage') ->willReturn($shouldEncryptHomeStorage); @@ -402,14 +402,14 @@ class EncryptionTest extends TestCase { } - public function testDecrypt() { + public function testDecrypt(): void { $this->expectException(\OC\Encryption\Exceptions\DecryptionFailedException::class); $this->expectExceptionMessage('Cannot decrypt this file, probably this is a shared file. Please ask the file owner to reshare the file with you.'); $this->instance->decrypt('abc'); } - public function testPrepareDecryptAll() { + public function testPrepareDecryptAll(): void { /** @var \Symfony\Component\Console\Input\InputInterface $input */ $input = $this->createMock(InputInterface::class); /** @var \Symfony\Component\Console\Output\OutputInterface $output */ diff --git a/apps/encryption/tests/EncryptedStorageTest.php b/apps/encryption/tests/EncryptedStorageTest.php index 26d5d9c4941..7671eab4992 100644 --- a/apps/encryption/tests/EncryptedStorageTest.php +++ b/apps/encryption/tests/EncryptedStorageTest.php @@ -30,7 +30,7 @@ class EncryptedStorageTest extends TestCase { use EncryptionTrait; use UserTrait; - public function testMoveFromEncrypted() { + public function testMoveFromEncrypted(): void { $this->createUser('test1', 'test2'); $this->setupForUser('test1', 'test2'); diff --git a/apps/encryption/tests/HookManagerTest.php b/apps/encryption/tests/HookManagerTest.php index 4a662f3bc4a..ad1fac3407f 100644 --- a/apps/encryption/tests/HookManagerTest.php +++ b/apps/encryption/tests/HookManagerTest.php @@ -20,7 +20,7 @@ class HookManagerTest extends TestCase { private static $instance; - public function testRegisterHookWithArray() { + public function testRegisterHookWithArray(): void { self::$instance->registerHook([ $this->getMockBuilder(IHook::class)->disableOriginalConstructor()->getMock(), $this->getMockBuilder(IHook::class)->disableOriginalConstructor()->getMock(), @@ -41,7 +41,7 @@ class HookManagerTest extends TestCase { } - public function testRegisterHooksWithInstance() { + public function testRegisterHooksWithInstance(): void { $mock = $this->getMockBuilder(IHook::class)->disableOriginalConstructor()->getMock(); /** @var \OCA\Encryption\Hooks\Contracts\IHook $mock */ self::$instance->registerHook($mock); diff --git a/apps/encryption/tests/Hooks/UserHooksTest.php b/apps/encryption/tests/Hooks/UserHooksTest.php index 5c67a5313b6..3bb0b559fdf 100644 --- a/apps/encryption/tests/Hooks/UserHooksTest.php +++ b/apps/encryption/tests/Hooks/UserHooksTest.php @@ -76,7 +76,7 @@ class UserHooksTest extends TestCase { private $params = ['uid' => 'testUser', 'password' => 'password']; - public function testLogin() { + public function testLogin(): void { $this->userSetupMock->expects($this->once()) ->method('setupUser') ->willReturnOnConsecutiveCalls(true, false); @@ -88,14 +88,14 @@ class UserHooksTest extends TestCase { $this->assertNull($this->instance->login($this->params)); } - public function testLogout() { + public function testLogout(): void { $this->sessionMock->expects($this->once()) ->method('clear'); $this->instance->logout(); $this->addToAssertionCount(1); } - public function testPostCreateUser() { + public function testPostCreateUser(): void { $this->userSetupMock->expects($this->once()) ->method('setupUser'); @@ -103,7 +103,7 @@ class UserHooksTest extends TestCase { $this->addToAssertionCount(1); } - public function testPostDeleteUser() { + public function testPostDeleteUser(): void { $this->keyManagerMock->expects($this->once()) ->method('deletePublicKey') ->with('testUser'); @@ -112,7 +112,7 @@ class UserHooksTest extends TestCase { $this->addToAssertionCount(1); } - public function testPrePasswordReset() { + public function testPrePasswordReset(): void { $params = ['uid' => 'user1']; $expected = ['user1' => true]; $this->instance->prePasswordReset($params); @@ -121,7 +121,7 @@ class UserHooksTest extends TestCase { $this->assertSame($expected, $passwordResetUsers); } - public function testPostPasswordReset() { + public function testPostPasswordReset(): void { $params = ['uid' => 'user1', 'password' => 'password']; $this->invokePrivate($this->instance, 'passwordResetUsers', [['user1' => true]]); $this->keyManagerMock->expects($this->once())->method('backupUserKeys') @@ -139,7 +139,7 @@ class UserHooksTest extends TestCase { /** * @dataProvider dataTestPreSetPassphrase */ - public function testPreSetPassphrase($canChange) { + public function testPreSetPassphrase($canChange): void { /** @var UserHooks | \PHPUnit\Framework\MockObject\MockObject $instance */ $instance = $this->getMockBuilder(UserHooks::class) ->setConstructorArgs( @@ -269,7 +269,7 @@ class UserHooksTest extends TestCase { $this->assertNull($this->instance->setPassphrase($this->params)); } - public function testSetPassphraseResetUserMode() { + public function testSetPassphraseResetUserMode(): void { $params = ['uid' => 'user1', 'password' => 'password']; $this->invokePrivate($this->instance, 'passwordResetUsers', [[$params['uid'] => true]]); $this->sessionMock->expects($this->never())->method('getPrivateKey'); diff --git a/apps/encryption/tests/KeyManagerTest.php b/apps/encryption/tests/KeyManagerTest.php index b408c9e180b..a9919e8eab4 100644 --- a/apps/encryption/tests/KeyManagerTest.php +++ b/apps/encryption/tests/KeyManagerTest.php @@ -95,7 +95,7 @@ class KeyManagerTest extends TestCase { ); } - public function testDeleteShareKey() { + public function testDeleteShareKey(): void { $this->keyStorageMock->expects($this->any()) ->method('deleteFileKey') ->with($this->equalTo('/path'), $this->equalTo('keyId.shareKey')) @@ -106,7 +106,7 @@ class KeyManagerTest extends TestCase { ); } - public function testGetPrivateKey() { + public function testGetPrivateKey(): void { $this->keyStorageMock->expects($this->any()) ->method('getUserKey') ->with($this->equalTo($this->userId), $this->equalTo('privateKey')) @@ -118,7 +118,7 @@ class KeyManagerTest extends TestCase { ); } - public function testGetPublicKey() { + public function testGetPublicKey(): void { $this->keyStorageMock->expects($this->any()) ->method('getUserKey') ->with($this->equalTo($this->userId), $this->equalTo('publicKey')) @@ -130,7 +130,7 @@ class KeyManagerTest extends TestCase { ); } - public function testRecoveryKeyExists() { + public function testRecoveryKeyExists(): void { $this->keyStorageMock->expects($this->any()) ->method('getSystemUserKey') ->with($this->equalTo($this->systemKeyId . '.publicKey')) @@ -140,7 +140,7 @@ class KeyManagerTest extends TestCase { $this->assertTrue($this->instance->recoveryKeyExists()); } - public function testCheckRecoveryKeyPassword() { + public function testCheckRecoveryKeyPassword(): void { $this->keyStorageMock->expects($this->any()) ->method('getSystemUserKey') ->with($this->equalTo($this->systemKeyId . '.privateKey')) @@ -153,7 +153,7 @@ class KeyManagerTest extends TestCase { $this->assertTrue($this->instance->checkRecoveryPassword('pass')); } - public function testSetPublicKey() { + public function testSetPublicKey(): void { $this->keyStorageMock->expects($this->any()) ->method('setUserKey') ->with( @@ -168,7 +168,7 @@ class KeyManagerTest extends TestCase { ); } - public function testSetPrivateKey() { + public function testSetPrivateKey(): void { $this->keyStorageMock->expects($this->any()) ->method('setUserKey') ->with( @@ -186,7 +186,7 @@ class KeyManagerTest extends TestCase { /** * @dataProvider dataTestUserHasKeys */ - public function testUserHasKeys($key, $expected) { + public function testUserHasKeys($key, $expected): void { $this->keyStorageMock->expects($this->exactly(2)) ->method('getUserKey') ->with($this->equalTo($this->userId), $this->anything()) @@ -206,7 +206,7 @@ class KeyManagerTest extends TestCase { } - public function testUserHasKeysMissingPrivateKey() { + public function testUserHasKeysMissingPrivateKey(): void { $this->expectException(\OCA\Encryption\Exceptions\PrivateKeyMissingException::class); $this->keyStorageMock->expects($this->exactly(2)) @@ -222,7 +222,7 @@ class KeyManagerTest extends TestCase { } - public function testUserHasKeysMissingPublicKey() { + public function testUserHasKeysMissingPublicKey(): void { $this->expectException(\OCA\Encryption\Exceptions\PublicKeyMissingException::class); $this->keyStorageMock->expects($this->exactly(2)) @@ -242,7 +242,7 @@ class KeyManagerTest extends TestCase { * * @param bool $useMasterKey */ - public function testInit($useMasterKey) { + public function testInit($useMasterKey): void { /** @var \OCA\Encryption\KeyManager|\PHPUnit\Framework\MockObject\MockObject $instance */ $instance = $this->getMockBuilder(KeyManager::class) ->setConstructorArgs( @@ -297,7 +297,7 @@ class KeyManagerTest extends TestCase { } - public function testSetRecoveryKey() { + public function testSetRecoveryKey(): void { $this->keyStorageMock->expects($this->exactly(2)) ->method('setSystemUserKey') ->willReturn(true); @@ -313,7 +313,7 @@ class KeyManagerTest extends TestCase { ); } - public function testSetSystemPrivateKey() { + public function testSetSystemPrivateKey(): void { $this->keyStorageMock->expects($this->exactly(1)) ->method('setSystemUserKey') ->with($this->equalTo('keyId.privateKey'), $this->equalTo('key')) @@ -325,7 +325,7 @@ class KeyManagerTest extends TestCase { ); } - public function testGetSystemPrivateKey() { + public function testGetSystemPrivateKey(): void { $this->keyStorageMock->expects($this->exactly(1)) ->method('getSystemUserKey') ->with($this->equalTo('keyId.privateKey')) @@ -337,7 +337,7 @@ class KeyManagerTest extends TestCase { ); } - public function testGetEncryptedFileKey() { + public function testGetEncryptedFileKey(): void { $this->keyStorageMock->expects($this->once()) ->method('getFileKey') ->with('/', 'fileKey') @@ -375,7 +375,7 @@ class KeyManagerTest extends TestCase { * @param $privateKey * @param $expected */ - public function testGetFileKey($uid, $isMasterKeyEnabled, $privateKey, $encryptedFileKey, $expected) { + public function testGetFileKey($uid, $isMasterKeyEnabled, $privateKey, $encryptedFileKey, $expected): void { $path = '/foo.txt'; if ($isMasterKeyEnabled) { @@ -446,7 +446,7 @@ class KeyManagerTest extends TestCase { ); } - public function testDeletePrivateKey() { + public function testDeletePrivateKey(): void { $this->keyStorageMock->expects($this->once()) ->method('deleteUserKey') ->with('user1', 'privateKey') @@ -457,7 +457,7 @@ class KeyManagerTest extends TestCase { [$this->userId])); } - public function testDeleteAllFileKeys() { + public function testDeleteAllFileKeys(): void { $this->keyStorageMock->expects($this->once()) ->method('deleteAllFileKeys') ->willReturn(true); @@ -475,7 +475,7 @@ class KeyManagerTest extends TestCase { * @param string $uid * @param array $expectedKeys */ - public function testAddSystemKeys($accessList, $publicKeys, $uid, $expectedKeys) { + public function testAddSystemKeys($accessList, $publicKeys, $uid, $expectedKeys): void { $publicShareKeyId = 'publicShareKey'; $recoveryKeyId = 'recoveryKey'; @@ -521,11 +521,11 @@ class KeyManagerTest extends TestCase { ]; } - public function testGetMasterKeyId() { + public function testGetMasterKeyId(): void { $this->assertSame('systemKeyId', $this->instance->getMasterKeyId()); } - public function testGetPublicMasterKey() { + public function testGetPublicMasterKey(): void { $this->keyStorageMock->expects($this->once())->method('getSystemUserKey') ->with('systemKeyId.publicKey', \OCA\Encryption\Crypto\Encryption::ID) ->willReturn(true); @@ -535,7 +535,7 @@ class KeyManagerTest extends TestCase { ); } - public function testGetMasterKeyPassword() { + public function testGetMasterKeyPassword(): void { $this->configMock->expects($this->once())->method('getSystemValue')->with('secret') ->willReturn('password'); @@ -545,7 +545,7 @@ class KeyManagerTest extends TestCase { } - public function testGetMasterKeyPasswordException() { + public function testGetMasterKeyPasswordException(): void { $this->expectException(\Exception::class); $this->configMock->expects($this->once())->method('getSystemValue')->with('secret') @@ -559,7 +559,7 @@ class KeyManagerTest extends TestCase { * * @param $masterKey */ - public function testValidateMasterKey($masterKey) { + public function testValidateMasterKey($masterKey): void { /** @var \OCA\Encryption\KeyManager | \PHPUnit\Framework\MockObject\MockObject $instance */ $instance = $this->getMockBuilder(KeyManager::class) ->setConstructorArgs( @@ -607,7 +607,7 @@ class KeyManagerTest extends TestCase { $instance->validateMasterKey(); } - public function testValidateMasterKeyLocked() { + public function testValidateMasterKeyLocked(): void { /** @var \OCA\Encryption\KeyManager | \PHPUnit_Framework_MockObject_MockObject $instance */ $instance = $this->getMockBuilder(KeyManager::class) ->setConstructorArgs( @@ -650,7 +650,7 @@ class KeyManagerTest extends TestCase { ]; } - public function testGetVersionWithoutFileInfo() { + public function testGetVersionWithoutFileInfo(): void { $view = $this->getMockBuilder(View::class) ->disableOriginalConstructor()->getMock(); $view->expects($this->once()) @@ -662,7 +662,7 @@ class KeyManagerTest extends TestCase { $this->assertSame(0, $this->instance->getVersion('/admin/files/myfile.txt', $view)); } - public function testGetVersionWithFileInfo() { + public function testGetVersionWithFileInfo(): void { $view = $this->getMockBuilder(View::class) ->disableOriginalConstructor()->getMock(); $fileInfo = $this->getMockBuilder(FileInfo::class) @@ -679,7 +679,7 @@ class KeyManagerTest extends TestCase { $this->assertSame(1337, $this->instance->getVersion('/admin/files/myfile.txt', $view)); } - public function testSetVersionWithFileInfo() { + public function testSetVersionWithFileInfo(): void { $view = $this->getMockBuilder(View::class) ->disableOriginalConstructor()->getMock(); $cache = $this->getMockBuilder(ICache::class) @@ -709,7 +709,7 @@ class KeyManagerTest extends TestCase { $this->instance->setVersion('/admin/files/myfile.txt', 5, $view); } - public function testSetVersionWithoutFileInfo() { + public function testSetVersionWithoutFileInfo(): void { $view = $this->getMockBuilder(View::class) ->disableOriginalConstructor()->getMock(); $view->expects($this->once()) @@ -721,7 +721,7 @@ class KeyManagerTest extends TestCase { $this->instance->setVersion('/admin/files/myfile.txt', 5, $view); } - public function testBackupUserKeys() { + public function testBackupUserKeys(): void { $this->keyStorageMock->expects($this->once())->method('backupUserKeys') ->with('OC_DEFAULT_MODULE', 'test', 'user1'); $this->instance->backupUserKeys('test', 'user1'); diff --git a/apps/encryption/tests/RecoveryTest.php b/apps/encryption/tests/RecoveryTest.php index a4f4ff7fd02..4b28d408844 100644 --- a/apps/encryption/tests/RecoveryTest.php +++ b/apps/encryption/tests/RecoveryTest.php @@ -53,7 +53,7 @@ class RecoveryTest extends TestCase { */ private $instance; - public function testEnableAdminRecoverySuccessful() { + public function testEnableAdminRecoverySuccessful(): void { $this->keyManagerMock->expects($this->exactly(2)) ->method('recoveryKeyExists') ->willReturnOnConsecutiveCalls(false, true); @@ -80,7 +80,7 @@ class RecoveryTest extends TestCase { $this->assertTrue($this->instance->enableAdminRecovery('password')); } - public function testEnableAdminRecoveryCouldNotCheckPassword() { + public function testEnableAdminRecoveryCouldNotCheckPassword(): void { $this->keyManagerMock->expects($this->exactly(2)) ->method('recoveryKeyExists') ->willReturnOnConsecutiveCalls(false, true); @@ -107,7 +107,7 @@ class RecoveryTest extends TestCase { $this->assertFalse($this->instance->enableAdminRecovery('password')); } - public function testEnableAdminRecoveryCouldNotCreateKey() { + public function testEnableAdminRecoveryCouldNotCreateKey(): void { $this->keyManagerMock->expects($this->once()) ->method('recoveryKeyExists') ->willReturn(false); @@ -119,7 +119,7 @@ class RecoveryTest extends TestCase { $this->assertFalse($this->instance->enableAdminRecovery('password')); } - public function testChangeRecoveryKeyPasswordSuccessful() { + public function testChangeRecoveryKeyPasswordSuccessful(): void { $this->assertFalse($this->instance->changeRecoveryKeyPassword('password', 'passwordOld')); @@ -137,7 +137,7 @@ class RecoveryTest extends TestCase { 'passwordOld')); } - public function testChangeRecoveryKeyPasswordCouldNotDecryptPrivateRecoveryKey() { + public function testChangeRecoveryKeyPasswordCouldNotDecryptPrivateRecoveryKey(): void { $this->assertFalse($this->instance->changeRecoveryKeyPassword('password', 'passwordOld')); $this->keyManagerMock->expects($this->once()) @@ -150,7 +150,7 @@ class RecoveryTest extends TestCase { $this->assertFalse($this->instance->changeRecoveryKeyPassword('password', 'passwordOld')); } - public function testDisableAdminRecovery() { + public function testDisableAdminRecovery(): void { $this->keyManagerMock->expects($this->exactly(2)) ->method('checkRecoveryPassword') ->willReturnOnConsecutiveCalls(true, false); @@ -162,7 +162,7 @@ class RecoveryTest extends TestCase { $this->assertFalse($this->instance->disableAdminRecovery('password')); } - public function testIsRecoveryEnabledForUser() { + public function testIsRecoveryEnabledForUser(): void { $this->configMock->expects($this->exactly(2)) ->method('getUserValue') ->willReturnOnConsecutiveCalls('1', '0'); @@ -171,13 +171,13 @@ class RecoveryTest extends TestCase { $this->assertFalse($this->instance->isRecoveryEnabledForUser('admin')); } - public function testIsRecoveryKeyEnabled() { + public function testIsRecoveryKeyEnabled(): void { $this->assertFalse($this->instance->isRecoveryKeyEnabled()); self::$tempStorage['recoveryAdminEnabled'] = '1'; $this->assertTrue($this->instance->isRecoveryKeyEnabled()); } - public function testSetRecoveryFolderForUser() { + public function testSetRecoveryFolderForUser(): void { $this->viewMock->expects($this->exactly(2)) ->method('getDirectoryContent') ->willReturn([]); @@ -185,7 +185,7 @@ class RecoveryTest extends TestCase { $this->assertTrue($this->instance->setRecoveryForUser('1')); } - public function testRecoverUserFiles() { + public function testRecoverUserFiles(): void { $this->viewMock->expects($this->once()) ->method('getDirectoryContent') ->willReturn([]); @@ -197,7 +197,7 @@ class RecoveryTest extends TestCase { $this->addToAssertionCount(1); } - public function testRecoverFile() { + public function testRecoverFile(): void { $this->keyManagerMock->expects($this->once()) ->method('getEncryptedFileKey') ->willReturn(true); diff --git a/apps/encryption/tests/SessionTest.php b/apps/encryption/tests/SessionTest.php index 61e57f66611..10c699898fc 100644 --- a/apps/encryption/tests/SessionTest.php +++ b/apps/encryption/tests/SessionTest.php @@ -21,7 +21,7 @@ class SessionTest extends TestCase { private $sessionMock; - public function testThatGetPrivateKeyThrowsExceptionWhenNotSet() { + public function testThatGetPrivateKeyThrowsExceptionWhenNotSet(): void { $this->expectException(\OCA\Encryption\Exceptions\PrivateKeyMissingException::class); $this->expectExceptionMessage('Private Key missing for user: please try to log-out and log-in again'); @@ -31,7 +31,7 @@ class SessionTest extends TestCase { /** * @depends testThatGetPrivateKeyThrowsExceptionWhenNotSet */ - public function testSetAndGetPrivateKey() { + public function testSetAndGetPrivateKey(): void { $this->instance->setPrivateKey('dummyPrivateKey'); $this->assertEquals('dummyPrivateKey', $this->instance->getPrivateKey()); } @@ -39,7 +39,7 @@ class SessionTest extends TestCase { /** * @depends testSetAndGetPrivateKey */ - public function testIsPrivateKeySet() { + public function testIsPrivateKeySet(): void { $this->instance->setPrivateKey('dummyPrivateKey'); $this->assertTrue($this->instance->isPrivateKeySet()); @@ -50,21 +50,21 @@ class SessionTest extends TestCase { self::$tempStorage['privateKey'] = 'dummyPrivateKey'; } - public function testDecryptAllModeActivated() { + public function testDecryptAllModeActivated(): void { $this->instance->prepareDecryptAll('user1', 'usersKey'); $this->assertTrue($this->instance->decryptAllModeActivated()); $this->assertSame('user1', $this->instance->getDecryptAllUid()); $this->assertSame('usersKey', $this->instance->getDecryptAllKey()); } - public function testDecryptAllModeDeactivated() { + public function testDecryptAllModeDeactivated(): void { $this->assertFalse($this->instance->decryptAllModeActivated()); } /** * @expectExceptionMessage 'Please activate decrypt all mode first' */ - public function testGetDecryptAllUidException() { + public function testGetDecryptAllUidException(): void { $this->expectException(\Exception::class); $this->instance->getDecryptAllUid(); @@ -73,7 +73,7 @@ class SessionTest extends TestCase { /** * @expectExceptionMessage 'No uid found while in decrypt all mode' */ - public function testGetDecryptAllUidException2() { + public function testGetDecryptAllUidException2(): void { $this->expectException(\Exception::class); $this->instance->prepareDecryptAll(null, 'key'); @@ -83,7 +83,7 @@ class SessionTest extends TestCase { /** * @expectExceptionMessage 'Please activate decrypt all mode first' */ - public function testGetDecryptAllKeyException() { + public function testGetDecryptAllKeyException(): void { $this->expectException(\OCA\Encryption\Exceptions\PrivateKeyMissingException::class); $this->instance->getDecryptAllKey(); @@ -92,7 +92,7 @@ class SessionTest extends TestCase { /** * @expectExceptionMessage 'No key found while in decrypt all mode' */ - public function testGetDecryptAllKeyException2() { + public function testGetDecryptAllKeyException2(): void { $this->expectException(\OCA\Encryption\Exceptions\PrivateKeyMissingException::class); $this->instance->prepareDecryptAll('user', null); @@ -100,7 +100,7 @@ class SessionTest extends TestCase { } - public function testSetAndGetStatusWillSetAndReturn() { + public function testSetAndGetStatusWillSetAndReturn(): void { // Check if get status will return 0 if it has not been set before $this->assertEquals(0, $this->instance->getStatus()); @@ -120,7 +120,7 @@ class SessionTest extends TestCase { * @param int $status * @param bool $expected */ - public function testIsReady($status, $expected) { + public function testIsReady($status, $expected): void { /** @var Session | \PHPUnit\Framework\MockObject\MockObject $instance */ $instance = $this->getMockBuilder(Session::class) ->setConstructorArgs([$this->sessionMock]) @@ -167,7 +167,7 @@ class SessionTest extends TestCase { } - public function testClearWillRemoveValues() { + public function testClearWillRemoveValues(): void { $this->instance->setPrivateKey('privateKey'); $this->instance->setStatus('initStatus'); $this->instance->prepareDecryptAll('user', 'key'); diff --git a/apps/encryption/tests/Settings/AdminTest.php b/apps/encryption/tests/Settings/AdminTest.php index 80f7803badd..4ddaeb1b84d 100644 --- a/apps/encryption/tests/Settings/AdminTest.php +++ b/apps/encryption/tests/Settings/AdminTest.php @@ -51,7 +51,7 @@ class AdminTest extends TestCase { ); } - public function testGetForm() { + public function testGetForm(): void { $this->config ->method('getAppValue') ->will($this->returnCallback(function ($app, $key, $default) { @@ -73,11 +73,11 @@ class AdminTest extends TestCase { $this->assertEquals($expected, $this->admin->getForm()); } - public function testGetSection() { + public function testGetSection(): void { $this->assertSame('security', $this->admin->getSection()); } - public function testGetPriority() { + public function testGetPriority(): void { $this->assertSame(11, $this->admin->getPriority()); } } diff --git a/apps/encryption/tests/Users/SetupTest.php b/apps/encryption/tests/Users/SetupTest.php index 96d2357269e..92f24a0627c 100644 --- a/apps/encryption/tests/Users/SetupTest.php +++ b/apps/encryption/tests/Users/SetupTest.php @@ -42,7 +42,7 @@ class SetupTest extends TestCase { } - public function testSetupSystem() { + public function testSetupSystem(): void { $this->keyManagerMock->expects($this->once())->method('validateShareKey'); $this->keyManagerMock->expects($this->once())->method('validateMasterKey'); @@ -55,7 +55,7 @@ class SetupTest extends TestCase { * @param bool $hasKeys * @param bool $expected */ - public function testSetupUser($hasKeys, $expected) { + public function testSetupUser($hasKeys, $expected): void { $this->keyManagerMock->expects($this->once())->method('userHasKeys') ->with('uid')->willReturn($hasKeys); diff --git a/apps/encryption/tests/UtilTest.php b/apps/encryption/tests/UtilTest.php index 3bfc0efb516..6f2eec1ebf4 100644 --- a/apps/encryption/tests/UtilTest.php +++ b/apps/encryption/tests/UtilTest.php @@ -37,12 +37,12 @@ class UtilTest extends TestCase { /** @var Util */ private $instance; - public function testSetRecoveryForUser() { + public function testSetRecoveryForUser(): void { $this->instance->setRecoveryForUser('1'); $this->assertArrayHasKey('recoveryEnabled', self::$tempStorage); } - public function testIsRecoveryEnabledForUser() { + public function testIsRecoveryEnabledForUser(): void { $this->assertTrue($this->instance->isRecoveryEnabledForUser('admin')); // Assert recovery will return default value if not set @@ -50,7 +50,7 @@ class UtilTest extends TestCase { $this->assertEquals(0, $this->instance->isRecoveryEnabledForUser('admin')); } - public function testUserHasFiles() { + public function testUserHasFiles(): void { $this->filesMock->expects($this->once()) ->method('file_exists') ->willReturn(true); @@ -126,7 +126,7 @@ class UtilTest extends TestCase { * @param string $value * @param bool $expect */ - public function testIsMasterKeyEnabled($value, $expect) { + public function testIsMasterKeyEnabled($value, $expect): void { $this->configMock->expects($this->once())->method('getAppValue') ->with('encryption', 'useMasterKey', '1')->willReturn($value); $this->assertSame($expect, @@ -146,7 +146,7 @@ class UtilTest extends TestCase { * @param string $returnValue return value from getAppValue() * @param bool $expected */ - public function testShouldEncryptHomeStorage($returnValue, $expected) { + public function testShouldEncryptHomeStorage($returnValue, $expected): void { $this->configMock->expects($this->once())->method('getAppValue') ->with('encryption', 'encryptHomeStorage', '1') ->willReturn($returnValue); @@ -167,7 +167,7 @@ class UtilTest extends TestCase { * @param $value * @param $expected */ - public function testSetEncryptHomeStorage($value, $expected) { + public function testSetEncryptHomeStorage($value, $expected): void { $this->configMock->expects($this->once())->method('setAppValue') ->with('encryption', 'encryptHomeStorage', $expected); $this->instance->setEncryptHomeStorage($value); @@ -180,7 +180,7 @@ class UtilTest extends TestCase { ]; } - public function testGetStorage() { + public function testGetStorage(): void { $return = $this->getMockBuilder(Storage::class) ->disableOriginalConstructor() ->getMock(); diff --git a/apps/federatedfilesharing/tests/AddressHandlerTest.php b/apps/federatedfilesharing/tests/AddressHandlerTest.php index 3fb2a938a66..e235314e008 100644 --- a/apps/federatedfilesharing/tests/AddressHandlerTest.php +++ b/apps/federatedfilesharing/tests/AddressHandlerTest.php @@ -96,7 +96,7 @@ class AddressHandlerTest extends \Test\TestCase { * @param string $expectedUser * @param string $expectedUrl */ - public function testSplitUserRemote($remote, $expectedUser, $expectedUrl) { + public function testSplitUserRemote($remote, $expectedUser, $expectedUrl): void { $this->contactsManager->expects($this->any()) ->method('search') ->willReturn([]); @@ -129,7 +129,7 @@ class AddressHandlerTest extends \Test\TestCase { * * @param string $id */ - public function testSplitUserRemoteError($id) { + public function testSplitUserRemoteError($id): void { $this->expectException(\OCP\HintException::class); $this->addressHandler->splitUserRemote($id); @@ -144,7 +144,7 @@ class AddressHandlerTest extends \Test\TestCase { * @param string $server2 * @param bool $expected */ - public function testCompareAddresses($user1, $server1, $user2, $server2, $expected) { + public function testCompareAddresses($user1, $server1, $user2, $server2, $expected): void { $this->assertSame($expected, $this->addressHandler->compareAddresses($user1, $server1, $user2, $server2) ); @@ -176,7 +176,7 @@ class AddressHandlerTest extends \Test\TestCase { * @param string $url * @param string $expectedResult */ - public function testRemoveProtocolFromUrl($url, $expectedResult) { + public function testRemoveProtocolFromUrl($url, $expectedResult): void { $result = $this->addressHandler->removeProtocolFromUrl($url); $this->assertSame($expectedResult, $result); } @@ -195,7 +195,7 @@ class AddressHandlerTest extends \Test\TestCase { * @param string $url * @param bool $expectedResult */ - public function testUrlContainProtocol($url, $expectedResult) { + public function testUrlContainProtocol($url, $expectedResult): void { $result = $this->addressHandler->urlContainProtocol($url); $this->assertSame($expectedResult, $result); } diff --git a/apps/federatedfilesharing/tests/Controller/MountPublicLinkControllerTest.php b/apps/federatedfilesharing/tests/Controller/MountPublicLinkControllerTest.php index 61487689cde..6eb7ce30274 100644 --- a/apps/federatedfilesharing/tests/Controller/MountPublicLinkControllerTest.php +++ b/apps/federatedfilesharing/tests/Controller/MountPublicLinkControllerTest.php @@ -130,7 +130,7 @@ class MountPublicLinkControllerTest extends \Test\TestCase { $createSuccessful, $expectedReturnData, $permissions - ) { + ): void { $this->federatedShareProvider->expects($this->any()) ->method('isOutgoingServer2serverShareEnabled') ->willReturn($outgoingSharesAllowed); diff --git a/apps/federatedfilesharing/tests/Controller/RequestHandlerControllerTest.php b/apps/federatedfilesharing/tests/Controller/RequestHandlerControllerTest.php index dc128021b28..cce1ee8830a 100644 --- a/apps/federatedfilesharing/tests/Controller/RequestHandlerControllerTest.php +++ b/apps/federatedfilesharing/tests/Controller/RequestHandlerControllerTest.php @@ -130,7 +130,7 @@ class RequestHandlerControllerTest extends \Test\TestCase { ); } - public function testCreateShare() { + public function testCreateShare(): void { $this->cloudFederationFactory->expects($this->once())->method('getCloudFederationShare') ->with( $this->user2, @@ -160,7 +160,7 @@ class RequestHandlerControllerTest extends \Test\TestCase { $this->assertInstanceOf(DataResponse::class, $result); } - public function testDeclineShare() { + public function testDeclineShare(): void { $id = 42; $notification = [ @@ -183,7 +183,7 @@ class RequestHandlerControllerTest extends \Test\TestCase { } - public function testAcceptShare() { + public function testAcceptShare(): void { $id = 42; $notification = [ diff --git a/apps/federatedfilesharing/tests/FederatedShareProviderTest.php b/apps/federatedfilesharing/tests/FederatedShareProviderTest.php index 8f54207626f..5255a84b461 100644 --- a/apps/federatedfilesharing/tests/FederatedShareProviderTest.php +++ b/apps/federatedfilesharing/tests/FederatedShareProviderTest.php @@ -139,7 +139,7 @@ class FederatedShareProviderTest extends \Test\TestCase { /** * @dataProvider dataTestCreate */ - public function testCreate($expirationDate, $expectedDataDate) { + public function testCreate($expirationDate, $expectedDataDate): void { $share = $this->shareManager->newShare(); /** @var File|MockObject $node */ @@ -222,7 +222,7 @@ class FederatedShareProviderTest extends \Test\TestCase { $this->assertEquals($expirationDate, $share->getExpirationDate()); } - public function testCreateCouldNotFindServer() { + public function testCreateCouldNotFindServer(): void { $share = $this->shareManager->newShare(); $node = $this->getMockBuilder(File::class)->getMock(); @@ -283,7 +283,7 @@ class FederatedShareProviderTest extends \Test\TestCase { $this->assertFalse($data); } - public function testCreateException() { + public function testCreateException(): void { $share = $this->shareManager->newShare(); $node = $this->getMockBuilder(File::class)->getMock(); @@ -344,7 +344,7 @@ class FederatedShareProviderTest extends \Test\TestCase { $this->assertFalse($data); } - public function testCreateShareWithSelf() { + public function testCreateShareWithSelf(): void { $share = $this->shareManager->newShare(); $node = $this->getMockBuilder(File::class)->getMock(); @@ -387,7 +387,7 @@ class FederatedShareProviderTest extends \Test\TestCase { $this->assertFalse($data); } - public function testCreateAlreadyShared() { + public function testCreateAlreadyShared(): void { $share = $this->shareManager->newShare(); $node = $this->getMockBuilder(File::class)->getMock(); @@ -441,7 +441,7 @@ class FederatedShareProviderTest extends \Test\TestCase { /** * @dataProvider dataTestUpdate */ - public function testUpdate($owner, $sharedBy, $expirationDate) { + public function testUpdate($owner, $sharedBy, $expirationDate): void { $this->provider = $this->getMockBuilder('OCA\FederatedFileSharing\FederatedShareProvider') ->setConstructorArgs( [ @@ -525,7 +525,7 @@ class FederatedShareProviderTest extends \Test\TestCase { ]; } - public function testGetSharedBy() { + public function testGetSharedBy(): void { $node = $this->getMockBuilder(File::class)->getMock(); $node->method('getId')->willReturn(42); $node->method('getName')->willReturn('myFile'); @@ -571,7 +571,7 @@ class FederatedShareProviderTest extends \Test\TestCase { $this->assertEquals('sharedBy', $shares[0]->getSharedBy()); } - public function testGetSharedByWithNode() { + public function testGetSharedByWithNode(): void { $node = $this->getMockBuilder(File::class)->getMock(); $node->method('getId')->willReturn(42); $node->method('getName')->willReturn('myFile'); @@ -618,7 +618,7 @@ class FederatedShareProviderTest extends \Test\TestCase { $this->assertEquals(43, $shares[0]->getNodeId()); } - public function testGetSharedByWithReshares() { + public function testGetSharedByWithReshares(): void { $node = $this->getMockBuilder(File::class)->getMock(); $node->method('getId')->willReturn(42); $node->method('getName')->willReturn('myFile'); @@ -660,7 +660,7 @@ class FederatedShareProviderTest extends \Test\TestCase { $this->assertCount(2, $shares); } - public function testGetSharedByWithLimit() { + public function testGetSharedByWithLimit(): void { $node = $this->getMockBuilder(File::class)->getMock(); $node->method('getId')->willReturn(42); $node->method('getName')->willReturn('myFile'); @@ -730,7 +730,7 @@ class FederatedShareProviderTest extends \Test\TestCase { * @param string $deletedUser The user that is deleted * @param bool $rowDeleted Is the row deleted in this setup */ - public function testDeleteUser($owner, $initiator, $recipient, $deletedUser, $rowDeleted) { + public function testDeleteUser($owner, $initiator, $recipient, $deletedUser, $rowDeleted): void { $qb = $this->connection->getQueryBuilder(); $qb->insert('share') ->setValue('share_type', $qb->createNamedParameter(IShare::TYPE_REMOTE)) @@ -765,7 +765,7 @@ class FederatedShareProviderTest extends \Test\TestCase { * @param string $isEnabled * @param bool $expected */ - public function testIsOutgoingServer2serverShareEnabled($internalOnly, $isEnabled, $expected) { + public function testIsOutgoingServer2serverShareEnabled($internalOnly, $isEnabled, $expected): void { $this->gsConfig->expects($this->once())->method('onlyInternalFederation') ->willReturn($internalOnly); $this->config->expects($this->any())->method('getAppValue') @@ -792,7 +792,7 @@ class FederatedShareProviderTest extends \Test\TestCase { * @param string $isEnabled * @param bool $expected */ - public function testIsIncomingServer2serverShareEnabled($onlyInternal, $isEnabled, $expected) { + public function testIsIncomingServer2serverShareEnabled($onlyInternal, $isEnabled, $expected): void { $this->gsConfig->expects($this->once())->method('onlyInternalFederation') ->willReturn($onlyInternal); $this->config->expects($this->any())->method('getAppValue') @@ -819,7 +819,7 @@ class FederatedShareProviderTest extends \Test\TestCase { * @param string $isEnabled * @param bool $expected */ - public function testIsLookupServerQueriesEnabled($gsEnabled, $isEnabled, $expected) { + public function testIsLookupServerQueriesEnabled($gsEnabled, $isEnabled, $expected): void { $this->gsConfig->expects($this->once())->method('isGlobalScaleEnabled') ->willReturn($gsEnabled); $this->config->expects($this->any())->method('getAppValue') @@ -847,7 +847,7 @@ class FederatedShareProviderTest extends \Test\TestCase { * @param string $isEnabled * @param bool $expected */ - public function testIsLookupServerUploadEnabled($gsEnabled, $isEnabled, $expected) { + public function testIsLookupServerUploadEnabled($gsEnabled, $isEnabled, $expected): void { $this->gsConfig->expects($this->once())->method('isGlobalScaleEnabled') ->willReturn($gsEnabled); $this->config->expects($this->any())->method('getAppValue') @@ -868,7 +868,7 @@ class FederatedShareProviderTest extends \Test\TestCase { ]; } - public function testGetSharesInFolder() { + public function testGetSharesInFolder(): void { $userManager = \OC::$server->getUserManager(); $rootFolder = \OC::$server->getRootFolder(); @@ -922,7 +922,7 @@ class FederatedShareProviderTest extends \Test\TestCase { $u2->delete(); } - public function testGetAccessList() { + public function testGetAccessList(): void { $userManager = \OC::$server->getUserManager(); $rootFolder = \OC::$server->getRootFolder(); diff --git a/apps/federatedfilesharing/tests/NotificationsTest.php b/apps/federatedfilesharing/tests/NotificationsTest.php index d0f5283e7a9..868591cb4dd 100644 --- a/apps/federatedfilesharing/tests/NotificationsTest.php +++ b/apps/federatedfilesharing/tests/NotificationsTest.php @@ -102,7 +102,7 @@ class NotificationsTest extends \Test\TestCase { * @param array $httpRequestResult * @param bool $expected */ - public function testSendUpdateToRemote($try, $httpRequestResult, $expected) { + public function testSendUpdateToRemote($try, $httpRequestResult, $expected): void { $remote = 'http://remote'; $id = 42; $timestamp = 63576; diff --git a/apps/federatedfilesharing/tests/Settings/AdminTest.php b/apps/federatedfilesharing/tests/Settings/AdminTest.php index 29f15b0199d..031d19c2cb8 100644 --- a/apps/federatedfilesharing/tests/Settings/AdminTest.php +++ b/apps/federatedfilesharing/tests/Settings/AdminTest.php @@ -58,7 +58,7 @@ class AdminTest extends TestCase { * @dataProvider sharingStateProvider * @param bool $state */ - public function testGetForm($state) { + public function testGetForm($state): void { $this->federatedShareProvider ->expects($this->once()) ->method('isOutgoingServer2serverShareEnabled') @@ -112,11 +112,11 @@ class AdminTest extends TestCase { $this->assertEquals($expected, $this->admin->getForm()); } - public function testGetSection() { + public function testGetSection(): void { $this->assertSame('sharing', $this->admin->getSection()); } - public function testGetPriority() { + public function testGetPriority(): void { $this->assertSame(20, $this->admin->getPriority()); } } diff --git a/apps/federatedfilesharing/tests/TokenHandlerTest.php b/apps/federatedfilesharing/tests/TokenHandlerTest.php index f6b4a2fa9e9..9ed20779857 100644 --- a/apps/federatedfilesharing/tests/TokenHandlerTest.php +++ b/apps/federatedfilesharing/tests/TokenHandlerTest.php @@ -29,7 +29,7 @@ class TokenHandlerTest extends \Test\TestCase { $this->tokenHandler = new TokenHandler($this->secureRandom); } - public function testGenerateToken() { + public function testGenerateToken(): void { $this->secureRandom->expects($this->once())->method('generate') ->with( $this->expectedTokenLength, diff --git a/apps/federation/tests/BackgroundJob/GetSharedSecretTest.php b/apps/federation/tests/BackgroundJob/GetSharedSecretTest.php index bc3e971fad2..4fcb579d6f9 100644 --- a/apps/federation/tests/BackgroundJob/GetSharedSecretTest.php +++ b/apps/federation/tests/BackgroundJob/GetSharedSecretTest.php @@ -152,7 +152,7 @@ class GetSharedSecretTest extends TestCase { * * @param int $statusCode */ - public function testRun($statusCode) { + public function testRun($statusCode): void { $target = 'targetURL'; $source = 'sourceURL'; $token = 'token'; @@ -210,7 +210,7 @@ class GetSharedSecretTest extends TestCase { ]; } - public function testRunExpired() { + public function testRunExpired(): void { $target = 'targetURL'; $source = 'sourceURL'; $token = 'token'; @@ -240,7 +240,7 @@ class GetSharedSecretTest extends TestCase { $this->invokePrivate($this->getSharedSecret, 'run', [$argument]); } - public function testRunConnectionError() { + public function testRunConnectionError(): void { $target = 'targetURL'; $source = 'sourceURL'; $token = 'token'; diff --git a/apps/federation/tests/BackgroundJob/RequestSharedSecretTest.php b/apps/federation/tests/BackgroundJob/RequestSharedSecretTest.php index 7d67de38f5f..63b8324ad2e 100644 --- a/apps/federation/tests/BackgroundJob/RequestSharedSecretTest.php +++ b/apps/federation/tests/BackgroundJob/RequestSharedSecretTest.php @@ -87,7 +87,7 @@ class RequestSharedSecretTest extends TestCase { * @param bool $isTrustedServer * @param bool $retainBackgroundJob */ - public function testStart($isTrustedServer, $retainBackgroundJob) { + public function testStart($isTrustedServer, $retainBackgroundJob): void { /** @var RequestSharedSecret |MockObject $requestSharedSecret */ $requestSharedSecret = $this->getMockBuilder('OCA\Federation\BackgroundJob\RequestSharedSecret') ->setConstructorArgs( @@ -196,7 +196,7 @@ class RequestSharedSecretTest extends TestCase { ]; } - public function testRunExpired() { + public function testRunExpired(): void { $target = 'targetURL'; $source = 'sourceURL'; $token = 'token'; @@ -226,7 +226,7 @@ class RequestSharedSecretTest extends TestCase { $this->invokePrivate($this->requestSharedSecret, 'run', [$argument]); } - public function testRunConnectionError() { + public function testRunConnectionError(): void { $target = 'targetURL'; $source = 'sourceURL'; $token = 'token'; diff --git a/apps/federation/tests/DAV/FedAuthTest.php b/apps/federation/tests/DAV/FedAuthTest.php index 2d71137ae38..d059fff0481 100644 --- a/apps/federation/tests/DAV/FedAuthTest.php +++ b/apps/federation/tests/DAV/FedAuthTest.php @@ -20,7 +20,7 @@ class FedAuthTest extends TestCase { * @param string $user * @param string $password */ - public function testFedAuth($expected, $user, $password) { + public function testFedAuth($expected, $user, $password): void { /** @var DbHandler | \PHPUnit\Framework\MockObject\MockObject $db */ $db = $this->getMockBuilder('OCA\Federation\DbHandler')->disableOriginalConstructor()->getMock(); $db->method('auth')->willReturn(true); diff --git a/apps/federation/tests/DbHandlerTest.php b/apps/federation/tests/DbHandlerTest.php index df8cd36d8a8..aabbf1472e7 100644 --- a/apps/federation/tests/DbHandlerTest.php +++ b/apps/federation/tests/DbHandlerTest.php @@ -62,7 +62,7 @@ class DbHandlerTest extends TestCase { * @param string $expectedUrl the url we expect to be written to the db * @param string $expectedHash the hash value we expect to be written to the db */ - public function testAddServer($url, $expectedUrl, $expectedHash) { + public function testAddServer($url, $expectedUrl, $expectedHash): void { $id = $this->dbHandler->addServer($url); $query = $this->connection->getQueryBuilder()->select('*')->from($this->dbTable); @@ -85,7 +85,7 @@ class DbHandlerTest extends TestCase { ]; } - public function testRemove() { + public function testRemove(): void { $id1 = $this->dbHandler->addServer('server1'); $id2 = $this->dbHandler->addServer('server2'); @@ -112,7 +112,7 @@ class DbHandlerTest extends TestCase { } - public function testGetServerById() { + public function testGetServerById(): void { $this->dbHandler->addServer('server1'); $id = $this->dbHandler->addServer('server2'); @@ -120,7 +120,7 @@ class DbHandlerTest extends TestCase { $this->assertSame('server2', $result['url']); } - public function testGetAll() { + public function testGetAll(): void { $id1 = $this->dbHandler->addServer('server1'); $id2 = $this->dbHandler->addServer('server2'); @@ -139,7 +139,7 @@ class DbHandlerTest extends TestCase { * @param string $checkForServer * @param bool $expected */ - public function testServerExists($serverInTable, $checkForServer, $expected) { + public function testServerExists($serverInTable, $checkForServer, $expected): void { $this->dbHandler->addServer($serverInTable); $this->assertSame($expected, $this->dbHandler->serverExists($checkForServer) @@ -173,7 +173,7 @@ class DbHandlerTest extends TestCase { $this->assertSame('token', $result[0]['token']); } - public function testGetToken() { + public function testGetToken(): void { $this->dbHandler->addServer('server1'); $this->dbHandler->addToken('http://server1', 'token'); $this->assertSame('token', @@ -200,7 +200,7 @@ class DbHandlerTest extends TestCase { $this->assertSame('secret', $result[0]['shared_secret']); } - public function testGetSharedSecret() { + public function testGetSharedSecret(): void { $this->dbHandler->addServer('server1'); $this->dbHandler->addSharedSecret('http://server1', 'secret'); $this->assertSame('secret', @@ -208,7 +208,7 @@ class DbHandlerTest extends TestCase { ); } - public function testSetServerStatus() { + public function testSetServerStatus(): void { $this->dbHandler->addServer('server1'); $query = $this->connection->getQueryBuilder()->select('*')->from($this->dbTable); @@ -227,7 +227,7 @@ class DbHandlerTest extends TestCase { $this->assertSame(TrustedServers::STATUS_OK, (int)$result[0]['status']); } - public function testGetServerStatus() { + public function testGetServerStatus(): void { $this->dbHandler->addServer('server1'); $this->dbHandler->setServerStatus('http://server1', TrustedServers::STATUS_OK); $this->assertSame(TrustedServers::STATUS_OK, @@ -248,7 +248,7 @@ class DbHandlerTest extends TestCase { * @param string $url * @param string $expected */ - public function testHash($url, $expected) { + public function testHash($url, $expected): void { $this->assertSame($expected, $this->invokePrivate($this->dbHandler, 'hash', [$url]) ); @@ -269,7 +269,7 @@ class DbHandlerTest extends TestCase { * @param string $url * @param string $expected */ - public function testNormalizeUrl($url, $expected) { + public function testNormalizeUrl($url, $expected): void { $this->assertSame($expected, $this->invokePrivate($this->dbHandler, 'normalizeUrl', [$url]) ); @@ -288,7 +288,7 @@ class DbHandlerTest extends TestCase { /** * @dataProvider providesAuth */ - public function testAuth($expectedResult, $user, $password) { + public function testAuth($expectedResult, $user, $password): void { if ($expectedResult) { $this->dbHandler->addServer('url1'); $this->dbHandler->addSharedSecret('url1', $password); diff --git a/apps/federation/tests/Middleware/AddServerMiddlewareTest.php b/apps/federation/tests/Middleware/AddServerMiddlewareTest.php index 85b918a80f1..d5ee241a85a 100644 --- a/apps/federation/tests/Middleware/AddServerMiddlewareTest.php +++ b/apps/federation/tests/Middleware/AddServerMiddlewareTest.php @@ -49,7 +49,7 @@ class AddServerMiddlewareTest extends TestCase { * @param \Exception $exception * @param string $hint */ - public function testAfterException($exception, $hint) { + public function testAfterException($exception, $hint): void { $this->logger->expects($this->once())->method('error'); $this->l10n->expects($this->any())->method('t') diff --git a/apps/federation/tests/Settings/AdminTest.php b/apps/federation/tests/Settings/AdminTest.php index 3bbf4c4a9e7..3d58fae2d7b 100644 --- a/apps/federation/tests/Settings/AdminTest.php +++ b/apps/federation/tests/Settings/AdminTest.php @@ -26,7 +26,7 @@ class AdminTest extends TestCase { ); } - public function testGetForm() { + public function testGetForm(): void { $this->trustedServers ->expects($this->once()) ->method('getServers') @@ -39,11 +39,11 @@ class AdminTest extends TestCase { $this->assertEquals($expected, $this->admin->getForm()); } - public function testGetSection() { + public function testGetSection(): void { $this->assertSame('sharing', $this->admin->getSection()); } - public function testGetPriority() { + public function testGetPriority(): void { $this->assertSame(30, $this->admin->getPriority()); } } diff --git a/apps/federation/tests/SyncFederationAddressbooksTest.php b/apps/federation/tests/SyncFederationAddressbooksTest.php index 0f13dd0ec51..6d826741292 100644 --- a/apps/federation/tests/SyncFederationAddressbooksTest.php +++ b/apps/federation/tests/SyncFederationAddressbooksTest.php @@ -33,7 +33,7 @@ class SyncFederationAddressbooksTest extends \Test\TestCase { $this->logger = $this->createMock(LoggerInterface::class); } - public function testSync() { + public function testSync(): void { /** @var DbHandler | MockObject $dbHandler */ $dbHandler = $this->getMockBuilder('OCA\Federation\DbHandler') ->disableOriginalConstructor() @@ -63,7 +63,7 @@ class SyncFederationAddressbooksTest extends \Test\TestCase { $this->assertEquals('1', count($this->callBacks)); } - public function testException() { + public function testException(): void { /** @var DbHandler | MockObject $dbHandler */ $dbHandler = $this->getMockBuilder('OCA\Federation\DbHandler')-> disableOriginalConstructor()-> @@ -91,7 +91,7 @@ class SyncFederationAddressbooksTest extends \Test\TestCase { $this->assertEquals(2, count($this->callBacks)); } - public function testSuccessfulSyncWithoutChangesAfterFailure() { + public function testSuccessfulSyncWithoutChangesAfterFailure(): void { /** @var DbHandler | MockObject $dbHandler */ $dbHandler = $this->getMockBuilder('OCA\Federation\DbHandler') ->disableOriginalConstructor() diff --git a/apps/federation/tests/TrustedServersTest.php b/apps/federation/tests/TrustedServersTest.php index 93c66ea8831..67b59c87bdb 100644 --- a/apps/federation/tests/TrustedServersTest.php +++ b/apps/federation/tests/TrustedServersTest.php @@ -173,13 +173,13 @@ class TrustedServersTest extends TestCase { ); } - public function testSetServerStatus() { + public function testSetServerStatus(): void { $this->dbHandler->expects($this->once())->method('setServerStatus') ->with('url', 1); $this->trustedServers->setServerStatus('url', 1); } - public function testGetServerStatus() { + public function testGetServerStatus(): void { $this->dbHandler->expects($this->once())->method('getServerStatus') ->with('url')->willReturn(1); $this->assertSame( diff --git a/apps/files/tests/Activity/Filter/GenericTest.php b/apps/files/tests/Activity/Filter/GenericTest.php index 6f4dd594582..347bea0f643 100644 --- a/apps/files/tests/Activity/Filter/GenericTest.php +++ b/apps/files/tests/Activity/Filter/GenericTest.php @@ -28,7 +28,7 @@ class GenericTest extends TestCase { * @dataProvider dataFilters * @param string $filterClass */ - public function testImplementsInterface($filterClass) { + public function testImplementsInterface($filterClass): void { $filter = \OC::$server->query($filterClass); $this->assertInstanceOf(IFilter::class, $filter); } @@ -37,7 +37,7 @@ class GenericTest extends TestCase { * @dataProvider dataFilters * @param string $filterClass */ - public function testGetIdentifier($filterClass) { + public function testGetIdentifier($filterClass): void { /** @var IFilter $filter */ $filter = \OC::$server->query($filterClass); $this->assertIsString($filter->getIdentifier()); @@ -47,7 +47,7 @@ class GenericTest extends TestCase { * @dataProvider dataFilters * @param string $filterClass */ - public function testGetName($filterClass) { + public function testGetName($filterClass): void { /** @var IFilter $filter */ $filter = \OC::$server->query($filterClass); $this->assertIsString($filter->getName()); @@ -57,7 +57,7 @@ class GenericTest extends TestCase { * @dataProvider dataFilters * @param string $filterClass */ - public function testGetPriority($filterClass) { + public function testGetPriority($filterClass): void { /** @var IFilter $filter */ $filter = \OC::$server->query($filterClass); $priority = $filter->getPriority(); @@ -70,7 +70,7 @@ class GenericTest extends TestCase { * @dataProvider dataFilters * @param string $filterClass */ - public function testGetIcon($filterClass) { + public function testGetIcon($filterClass): void { /** @var IFilter $filter */ $filter = \OC::$server->query($filterClass); $this->assertIsString($filter->getIcon()); @@ -81,7 +81,7 @@ class GenericTest extends TestCase { * @dataProvider dataFilters * @param string $filterClass */ - public function testFilterTypes($filterClass) { + public function testFilterTypes($filterClass): void { /** @var IFilter $filter */ $filter = \OC::$server->query($filterClass); $this->assertIsArray($filter->filterTypes([])); @@ -91,7 +91,7 @@ class GenericTest extends TestCase { * @dataProvider dataFilters * @param string $filterClass */ - public function testAllowedApps($filterClass) { + public function testAllowedApps($filterClass): void { /** @var IFilter $filter */ $filter = \OC::$server->query($filterClass); $this->assertIsArray($filter->allowedApps()); diff --git a/apps/files/tests/Activity/ProviderTest.php b/apps/files/tests/Activity/ProviderTest.php index 1716ccfe100..73c726dac3c 100644 --- a/apps/files/tests/Activity/ProviderTest.php +++ b/apps/files/tests/Activity/ProviderTest.php @@ -104,7 +104,7 @@ class ProviderTest extends TestCase { * @param string $name * @param string $path */ - public function testGetFile($parameter, $eventId, $id, $name, $path) { + public function testGetFile($parameter, $eventId, $id, $name, $path): void { $provider = $this->getProvider(); if ($eventId !== null) { @@ -131,7 +131,7 @@ class ProviderTest extends TestCase { } - public function testGetFileThrows() { + public function testGetFileThrows(): void { $this->expectException(\InvalidArgumentException::class); $provider = $this->getProvider(); diff --git a/apps/files/tests/Activity/Setting/GenericTest.php b/apps/files/tests/Activity/Setting/GenericTest.php index c124106140a..1cce876cbcf 100644 --- a/apps/files/tests/Activity/Setting/GenericTest.php +++ b/apps/files/tests/Activity/Setting/GenericTest.php @@ -23,7 +23,7 @@ class GenericTest extends TestCase { * @dataProvider dataSettings * @param string $settingClass */ - public function testImplementsInterface($settingClass) { + public function testImplementsInterface($settingClass): void { $setting = \OC::$server->query($settingClass); $this->assertInstanceOf(ISetting::class, $setting); } @@ -32,7 +32,7 @@ class GenericTest extends TestCase { * @dataProvider dataSettings * @param string $settingClass */ - public function testGetIdentifier($settingClass) { + public function testGetIdentifier($settingClass): void { /** @var ISetting $setting */ $setting = \OC::$server->query($settingClass); $this->assertIsString($setting->getIdentifier()); @@ -42,7 +42,7 @@ class GenericTest extends TestCase { * @dataProvider dataSettings * @param string $settingClass */ - public function testGetName($settingClass) { + public function testGetName($settingClass): void { /** @var ISetting $setting */ $setting = \OC::$server->query($settingClass); $this->assertIsString($setting->getName()); @@ -52,7 +52,7 @@ class GenericTest extends TestCase { * @dataProvider dataSettings * @param string $settingClass */ - public function testGetPriority($settingClass) { + public function testGetPriority($settingClass): void { /** @var ISetting $setting */ $setting = \OC::$server->query($settingClass); $priority = $setting->getPriority(); @@ -65,7 +65,7 @@ class GenericTest extends TestCase { * @dataProvider dataSettings * @param string $settingClass */ - public function testCanChangeStream($settingClass) { + public function testCanChangeStream($settingClass): void { /** @var ISetting $setting */ $setting = \OC::$server->query($settingClass); $this->assertIsBool($setting->canChangeStream()); @@ -75,7 +75,7 @@ class GenericTest extends TestCase { * @dataProvider dataSettings * @param string $settingClass */ - public function testIsDefaultEnabledStream($settingClass) { + public function testIsDefaultEnabledStream($settingClass): void { /** @var ISetting $setting */ $setting = \OC::$server->query($settingClass); $this->assertIsBool($setting->isDefaultEnabledStream()); @@ -85,7 +85,7 @@ class GenericTest extends TestCase { * @dataProvider dataSettings * @param string $settingClass */ - public function testCanChangeMail($settingClass) { + public function testCanChangeMail($settingClass): void { /** @var ISetting $setting */ $setting = \OC::$server->query($settingClass); $this->assertIsBool($setting->canChangeMail()); @@ -95,7 +95,7 @@ class GenericTest extends TestCase { * @dataProvider dataSettings * @param string $settingClass */ - public function testIsDefaultEnabledMail($settingClass) { + public function testIsDefaultEnabledMail($settingClass): void { /** @var ISetting $setting */ $setting = \OC::$server->query($settingClass); $this->assertIsBool($setting->isDefaultEnabledMail()); diff --git a/apps/files/tests/BackgroundJob/DeleteOrphanedItemsJobTest.php b/apps/files/tests/BackgroundJob/DeleteOrphanedItemsJobTest.php index fb8ff9884af..1ce2d7bd8f7 100644 --- a/apps/files/tests/BackgroundJob/DeleteOrphanedItemsJobTest.php +++ b/apps/files/tests/BackgroundJob/DeleteOrphanedItemsJobTest.php @@ -51,7 +51,7 @@ class DeleteOrphanedItemsJobTest extends \Test\TestCase { /** * Test clearing orphaned system tag mappings */ - public function testClearSystemTagMappings() { + public function testClearSystemTagMappings(): void { $this->cleanMapping('systemtag_object_mapping'); $query = $this->connection->getQueryBuilder(); @@ -100,7 +100,7 @@ class DeleteOrphanedItemsJobTest extends \Test\TestCase { /** * Test clearing orphaned system tag mappings */ - public function testClearUserTagMappings() { + public function testClearUserTagMappings(): void { $this->cleanMapping('vcategory_to_object'); $query = $this->connection->getQueryBuilder(); @@ -149,7 +149,7 @@ class DeleteOrphanedItemsJobTest extends \Test\TestCase { /** * Test clearing orphaned system tag mappings */ - public function testClearComments() { + public function testClearComments(): void { $this->cleanMapping('comments'); $query = $this->connection->getQueryBuilder(); @@ -200,7 +200,7 @@ class DeleteOrphanedItemsJobTest extends \Test\TestCase { /** * Test clearing orphaned system tag mappings */ - public function testClearCommentReadMarks() { + public function testClearCommentReadMarks(): void { $this->cleanMapping('comments_read_markers'); $query = $this->connection->getQueryBuilder(); diff --git a/apps/files/tests/BackgroundJob/ScanFilesTest.php b/apps/files/tests/BackgroundJob/ScanFilesTest.php index e4ba8348d64..0fb5163143f 100644 --- a/apps/files/tests/BackgroundJob/ScanFilesTest.php +++ b/apps/files/tests/BackgroundJob/ScanFilesTest.php @@ -79,7 +79,7 @@ class ScanFilesTest extends TestCase { return $storage; } - public function testAllScanned() { + public function testAllScanned(): void { $this->setupStorage('foouser', '/foousers/files/foo'); $this->scanFiles->expects($this->never()) @@ -87,7 +87,7 @@ class ScanFilesTest extends TestCase { $this->runJob(); } - public function testUnscanned() { + public function testUnscanned(): void { $storage = $this->setupStorage('foouser', '/foousers/files/foo'); $storage->getCache()->put('foo', ['size' => -1]); diff --git a/apps/files/tests/Command/DeleteOrphanedFilesTest.php b/apps/files/tests/Command/DeleteOrphanedFilesTest.php index ed9a1866d26..1205e204ec4 100644 --- a/apps/files/tests/Command/DeleteOrphanedFilesTest.php +++ b/apps/files/tests/Command/DeleteOrphanedFilesTest.php @@ -82,7 +82,7 @@ class DeleteOrphanedFilesTest extends TestCase { /** * Test clearing orphaned files */ - public function testClearFiles() { + public function testClearFiles(): void { $input = $this->getMockBuilder(InputInterface::class) ->disableOriginalConstructor() ->getMock(); diff --git a/apps/files/tests/Controller/ApiControllerTest.php b/apps/files/tests/Controller/ApiControllerTest.php index f79a5c7bb64..ad2a6a15b2b 100644 --- a/apps/files/tests/Controller/ApiControllerTest.php +++ b/apps/files/tests/Controller/ApiControllerTest.php @@ -113,12 +113,12 @@ class ApiControllerTest extends TestCase { ); } - public function testUpdateFileTagsEmpty() { + public function testUpdateFileTagsEmpty(): void { $expected = new DataResponse([]); $this->assertEquals($expected, $this->apiController->updateFileTags('/path.txt')); } - public function testUpdateFileTagsWorking() { + public function testUpdateFileTagsWorking(): void { $this->tagService->expects($this->once()) ->method('updateFileTags') ->with('/path.txt', ['Tag1', 'Tag2']); @@ -132,7 +132,7 @@ class ApiControllerTest extends TestCase { $this->assertEquals($expected, $this->apiController->updateFileTags('/path.txt', ['Tag1', 'Tag2'])); } - public function testUpdateFileTagsNotFoundException() { + public function testUpdateFileTagsNotFoundException(): void { $this->tagService->expects($this->once()) ->method('updateFileTags') ->with('/path.txt', ['Tag1', 'Tag2']) @@ -142,7 +142,7 @@ class ApiControllerTest extends TestCase { $this->assertEquals($expected, $this->apiController->updateFileTags('/path.txt', ['Tag1', 'Tag2'])); } - public function testUpdateFileTagsStorageNotAvailableException() { + public function testUpdateFileTagsStorageNotAvailableException(): void { $this->tagService->expects($this->once()) ->method('updateFileTags') ->with('/path.txt', ['Tag1', 'Tag2']) @@ -152,7 +152,7 @@ class ApiControllerTest extends TestCase { $this->assertEquals($expected, $this->apiController->updateFileTags('/path.txt', ['Tag1', 'Tag2'])); } - public function testUpdateFileTagsStorageGenericException() { + public function testUpdateFileTagsStorageGenericException(): void { $this->tagService->expects($this->once()) ->method('updateFileTags') ->with('/path.txt', ['Tag1', 'Tag2']) @@ -162,7 +162,7 @@ class ApiControllerTest extends TestCase { $this->assertEquals($expected, $this->apiController->updateFileTags('/path.txt', ['Tag1', 'Tag2'])); } - public function testGetThumbnailInvalidSize() { + public function testGetThumbnailInvalidSize(): void { $this->userFolder->method('get') ->with($this->equalTo('')) ->willThrowException(new NotFoundException()); @@ -170,7 +170,7 @@ class ApiControllerTest extends TestCase { $this->assertEquals($expected, $this->apiController->getThumbnail(0, 0, '')); } - public function testGetThumbnailInvalidImage() { + public function testGetThumbnailInvalidImage(): void { $file = $this->createMock(File::class); $file->method('getId')->willReturn(123); $this->userFolder->method('get') @@ -184,7 +184,7 @@ class ApiControllerTest extends TestCase { $this->assertEquals($expected, $this->apiController->getThumbnail(10, 10, 'unknown.jpg')); } - public function testGetThumbnailInvalidPartFile() { + public function testGetThumbnailInvalidPartFile(): void { $file = $this->createMock(File::class); $file->method('getId')->willReturn(0); $this->userFolder->method('get') @@ -194,7 +194,7 @@ class ApiControllerTest extends TestCase { $this->assertEquals($expected, $this->apiController->getThumbnail(10, 10, 'unknown.jpg')); } - public function testGetThumbnail() { + public function testGetThumbnail(): void { $file = $this->createMock(File::class); $file->method('getId')->willReturn(123); $this->userFolder->method('get') @@ -214,7 +214,7 @@ class ApiControllerTest extends TestCase { $this->assertInstanceOf(Http\FileDisplayResponse::class, $ret); } - public function testShowHiddenFiles() { + public function testShowHiddenFiles(): void { $show = false; $this->config->expects($this->once()) @@ -227,7 +227,7 @@ class ApiControllerTest extends TestCase { $this->assertEquals($expected, $actual); } - public function testCropImagePreviews() { + public function testCropImagePreviews(): void { $crop = true; $this->config->expects($this->once()) diff --git a/apps/files/tests/Controller/ViewControllerTest.php b/apps/files/tests/Controller/ViewControllerTest.php index c1bc27d42b5..a6eba1f9eaf 100644 --- a/apps/files/tests/Controller/ViewControllerTest.php +++ b/apps/files/tests/Controller/ViewControllerTest.php @@ -97,7 +97,7 @@ class ViewControllerTest extends TestCase { ->getMock(); } - public function testIndexWithRegularBrowser() { + public function testIndexWithRegularBrowser(): void { $this->viewController ->expects($this->any()) ->method('getStorageInfo') @@ -145,7 +145,7 @@ class ViewControllerTest extends TestCase { $this->assertEquals($expected, $this->viewController->index('MyDir', 'MyView')); } - public function testShowFileRouteWithTrashedFile() { + public function testShowFileRouteWithTrashedFile(): void { $this->appManager->expects($this->once()) ->method('isEnabledForUser') ->with('files_trashbin') diff --git a/apps/files/tests/HelperTest.php b/apps/files/tests/HelperTest.php index 2bafb25dffa..fdcef8f7125 100644 --- a/apps/files/tests/HelperTest.php +++ b/apps/files/tests/HelperTest.php @@ -74,7 +74,7 @@ class HelperTest extends \Test\TestCase { /** * @dataProvider sortDataProvider */ - public function testSortByName(string $sort, bool $sortDescending, array $expectedOrder) { + public function testSortByName(string $sort, bool $sortDescending, array $expectedOrder): void { if (($sort === 'mtime') && (PHP_INT_SIZE < 8)) { $this->markTestSkipped('Skip mtime sorting on 32bit'); } @@ -90,7 +90,7 @@ class HelperTest extends \Test\TestCase { ); } - public function testPopulateTags() { + public function testPopulateTags(): void { $tagManager = $this->createMock(\OCP\ITagManager::class); $tagger = $this->createMock(\OCP\ITags::class); diff --git a/apps/files/tests/Service/TagServiceTest.php b/apps/files/tests/Service/TagServiceTest.php index 7a2084f21d8..7922c45a639 100644 --- a/apps/files/tests/Service/TagServiceTest.php +++ b/apps/files/tests/Service/TagServiceTest.php @@ -101,7 +101,7 @@ class TagServiceTest extends \Test\TestCase { } } - public function testUpdateFileTags() { + public function testUpdateFileTags(): void { $tag1 = 'tag1'; $tag2 = 'tag2'; @@ -142,7 +142,7 @@ class TagServiceTest extends \Test\TestCase { $subdir->delete(); } - public function testFavoriteActivity() { + public function testFavoriteActivity(): void { $subdir = $this->root->newFolder('subdir'); $file = $subdir->newFile('test.txt'); diff --git a/apps/files_external/tests/Auth/AuthMechanismTest.php b/apps/files_external/tests/Auth/AuthMechanismTest.php index 3297d93fe94..682d2e1326f 100644 --- a/apps/files_external/tests/Auth/AuthMechanismTest.php +++ b/apps/files_external/tests/Auth/AuthMechanismTest.php @@ -11,7 +11,7 @@ use OCA\Files_External\Lib\Backend\Backend; use OCA\Files_External\Lib\StorageConfig; class AuthMechanismTest extends \Test\TestCase { - public function testJsonSerialization() { + public function testJsonSerialization(): void { $mechanism = $this->getMockBuilder(AuthMechanism::class) ->setMethods(['jsonSerializeDefinition']) ->getMock(); @@ -38,7 +38,7 @@ class AuthMechanismTest extends \Test\TestCase { /** * @dataProvider validateStorageProvider */ - public function testValidateStorage($expectedSuccess, $scheme, $definitionSuccess) { + public function testValidateStorage($expectedSuccess, $scheme, $definitionSuccess): void { $mechanism = $this->getMockBuilder(AuthMechanism::class) ->setMethods(['validateStorageDefinition']) ->getMock(); diff --git a/apps/files_external/tests/Auth/Password/GlobalAuth.php b/apps/files_external/tests/Auth/Password/GlobalAuth.php index 85a2c1fb27c..9f7aa0ef03a 100644 --- a/apps/files_external/tests/Auth/Password/GlobalAuth.php +++ b/apps/files_external/tests/Auth/Password/GlobalAuth.php @@ -60,7 +60,7 @@ class GlobalAuthTest extends TestCase { return $storageConfig; } - public function testNoCredentials() { + public function testNoCredentials(): void { $this->credentialsManager->expects($this->once()) ->method('retrieve') ->willReturn(null); @@ -71,7 +71,7 @@ class GlobalAuthTest extends TestCase { $this->assertEquals([], $storage->getBackendOptions()); } - public function testSavedCredentials() { + public function testSavedCredentials(): void { $this->credentialsManager->expects($this->once()) ->method('retrieve') ->willReturn([ @@ -89,7 +89,7 @@ class GlobalAuthTest extends TestCase { } - public function testNoCredentialsPersonal() { + public function testNoCredentialsPersonal(): void { $this->expectException(\OCA\Files_External\Lib\InsufficientDataForMeaningfulAnswerException::class); $this->credentialsManager->expects($this->never()) diff --git a/apps/files_external/tests/Backend/BackendTest.php b/apps/files_external/tests/Backend/BackendTest.php index 771c053982c..26aa5ebe6af 100644 --- a/apps/files_external/tests/Backend/BackendTest.php +++ b/apps/files_external/tests/Backend/BackendTest.php @@ -10,7 +10,7 @@ use OCA\Files_External\Lib\Backend\Backend; use OCA\Files_External\Lib\StorageConfig; class BackendTest extends \Test\TestCase { - public function testJsonSerialization() { + public function testJsonSerialization(): void { $backend = $this->getMockBuilder(Backend::class) ->setMethods(['jsonSerializeDefinition']) ->getMock(); @@ -42,7 +42,7 @@ class BackendTest extends \Test\TestCase { /** * @dataProvider validateStorageProvider */ - public function testValidateStorage($expectedSuccess, $definitionSuccess) { + public function testValidateStorage($expectedSuccess, $definitionSuccess): void { $backend = $this->getMockBuilder(Backend::class) ->setMethods(['validateStorageDefinition']) ->getMock(); @@ -57,7 +57,7 @@ class BackendTest extends \Test\TestCase { $this->assertEquals($expectedSuccess, $backend->validateStorage($storageConfig)); } - public function testLegacyAuthMechanismCallback() { + public function testLegacyAuthMechanismCallback(): void { $backend = new Backend(); $backend->setLegacyAuthMechanismCallback(function (array $params) { if (isset($params['ping'])) { diff --git a/apps/files_external/tests/Backend/LegacyBackendTest.php b/apps/files_external/tests/Backend/LegacyBackendTest.php index 2d041e69f26..303700c6611 100644 --- a/apps/files_external/tests/Backend/LegacyBackendTest.php +++ b/apps/files_external/tests/Backend/LegacyBackendTest.php @@ -21,7 +21,7 @@ class LegacyBackendTest extends \Test\TestCase { ]; } - public function testConstructor() { + public function testConstructor(): void { $auth = $this->getMockBuilder('\OCA\Files_External\Lib\Auth\Builtin') ->disableOriginalConstructor() ->getMock(); @@ -77,7 +77,7 @@ class LegacyBackendTest extends \Test\TestCase { $this->assertEquals(DefinitionParameter::FLAG_OPTIONAL, $parameters['optionalpassword']->getFlags()); } - public function testNoDependencies() { + public function testNoDependencies(): void { $auth = $this->getMockBuilder('\OCA\Files_External\Lib\Auth\Builtin') ->disableOriginalConstructor() ->getMock(); diff --git a/apps/files_external/tests/Command/ApplicableTest.php b/apps/files_external/tests/Command/ApplicableTest.php index d4caadad343..223b02706e5 100644 --- a/apps/files_external/tests/Command/ApplicableTest.php +++ b/apps/files_external/tests/Command/ApplicableTest.php @@ -28,7 +28,7 @@ class ApplicableTest extends CommandTest { return new Applicable($storageService, $userManager, $groupManager); } - public function testListEmpty() { + public function testListEmpty(): void { $mount = $this->getMount(1, '', ''); $storageService = $this->getGlobalStorageService([$mount]); @@ -45,7 +45,7 @@ class ApplicableTest extends CommandTest { $this->assertEquals(['users' => [], 'groups' => []], $result); } - public function testList() { + public function testList(): void { $mount = $this->getMount(1, '', '', '', [], [], ['test', 'asd']); $storageService = $this->getGlobalStorageService([$mount]); @@ -62,7 +62,7 @@ class ApplicableTest extends CommandTest { $this->assertEquals(['users' => ['test', 'asd'], 'groups' => []], $result); } - public function testAddSingle() { + public function testAddSingle(): void { $mount = $this->getMount(1, '', '', '', [], [], []); $storageService = $this->getGlobalStorageService([$mount]); @@ -80,7 +80,7 @@ class ApplicableTest extends CommandTest { $this->assertEquals(['foo'], $mount->getApplicableUsers()); } - public function testAddDuplicate() { + public function testAddDuplicate(): void { $mount = $this->getMount(1, '', '', '', [], [], ['foo']); $storageService = $this->getGlobalStorageService([$mount]); @@ -98,7 +98,7 @@ class ApplicableTest extends CommandTest { $this->assertEquals(['foo', 'bar'], $mount->getApplicableUsers()); } - public function testRemoveSingle() { + public function testRemoveSingle(): void { $mount = $this->getMount(1, '', '', '', [], [], ['foo', 'bar']); $storageService = $this->getGlobalStorageService([$mount]); @@ -116,7 +116,7 @@ class ApplicableTest extends CommandTest { $this->assertEquals(['foo'], $mount->getApplicableUsers()); } - public function testRemoveNonExisting() { + public function testRemoveNonExisting(): void { $mount = $this->getMount(1, '', '', '', [], [], ['foo', 'bar']); $storageService = $this->getGlobalStorageService([$mount]); @@ -134,7 +134,7 @@ class ApplicableTest extends CommandTest { $this->assertEquals(['foo'], $mount->getApplicableUsers()); } - public function testRemoveAddRemove() { + public function testRemoveAddRemove(): void { $mount = $this->getMount(1, '', '', '', [], [], ['foo', 'bar']); $storageService = $this->getGlobalStorageService([$mount]); diff --git a/apps/files_external/tests/Command/ListCommandTest.php b/apps/files_external/tests/Command/ListCommandTest.php index 8375ba89f2a..bd4430b4116 100644 --- a/apps/files_external/tests/Command/ListCommandTest.php +++ b/apps/files_external/tests/Command/ListCommandTest.php @@ -39,7 +39,7 @@ class ListCommandTest extends CommandTest { return new ListCommand($globalService, $userService, $userSession, $userManager); } - public function testListAuthIdentifier() { + public function testListAuthIdentifier(): void { $l10n = $this->createMock(IL10N::class); $session = $this->createMock(ISession::class); $crypto = $this->createMock(ICrypto::class); diff --git a/apps/files_external/tests/Config/UserPlaceholderHandlerTest.php b/apps/files_external/tests/Config/UserPlaceholderHandlerTest.php index 767ae04fc79..b3c7db9306f 100644 --- a/apps/files_external/tests/Config/UserPlaceholderHandlerTest.php +++ b/apps/files_external/tests/Config/UserPlaceholderHandlerTest.php @@ -64,7 +64,7 @@ class UserPlaceholderHandlerTest extends \Test\TestCase { /** * @dataProvider optionProvider */ - public function testHandle($option, $expected) { + public function testHandle($option, $expected): void { $this->setUser(); $this->assertSame($expected, $this->handler->handle($option)); } @@ -72,7 +72,7 @@ class UserPlaceholderHandlerTest extends \Test\TestCase { /** * @dataProvider optionProvider */ - public function testHandleNoUser($option) { + public function testHandleNoUser($option): void { $this->shareManager->expects($this->once()) ->method('getShareByToken') ->willThrowException(new ShareNotFound()); diff --git a/apps/files_external/tests/Controller/AjaxControllerTest.php b/apps/files_external/tests/Controller/AjaxControllerTest.php index 4b2f973e9b0..dc9661732cc 100644 --- a/apps/files_external/tests/Controller/AjaxControllerTest.php +++ b/apps/files_external/tests/Controller/AjaxControllerTest.php @@ -52,7 +52,7 @@ class AjaxControllerTest extends TestCase { parent::setUp(); } - public function testGetSshKeys() { + public function testGetSshKeys(): void { $this->rsa ->expects($this->once()) ->method('createKey') @@ -73,7 +73,7 @@ class AjaxControllerTest extends TestCase { $this->assertEquals($expected, $this->ajaxController->getSshKeys()); } - public function testSaveGlobalCredentialsAsAdminForAnotherUser() { + public function testSaveGlobalCredentialsAsAdminForAnotherUser(): void { $user = $this->createMock(IUser::class); $user ->expects($this->once()) @@ -90,7 +90,7 @@ class AjaxControllerTest extends TestCase { $this->assertSame(false, $this->ajaxController->saveGlobalCredentials('UidOfTestUser', 'test', 'password')); } - public function testSaveGlobalCredentialsAsAdminForSelf() { + public function testSaveGlobalCredentialsAsAdminForSelf(): void { $user = $this->createMock(IUser::class); $user ->expects($this->once()) @@ -108,7 +108,7 @@ class AjaxControllerTest extends TestCase { $this->assertSame(true, $this->ajaxController->saveGlobalCredentials('MyAdminUid', 'test', 'password')); } - public function testSaveGlobalCredentialsAsNormalUserForSelf() { + public function testSaveGlobalCredentialsAsNormalUserForSelf(): void { $user = $this->createMock(IUser::class); $user ->method('getUID') @@ -123,7 +123,7 @@ class AjaxControllerTest extends TestCase { $this->assertSame(true, $this->ajaxController->saveGlobalCredentials('MyUserUid', 'test', 'password')); } - public function testSaveGlobalCredentialsAsNormalUserForAnotherUser() { + public function testSaveGlobalCredentialsAsNormalUserForAnotherUser(): void { $user = $this->createMock(IUser::class); $user ->method('getUID') diff --git a/apps/files_external/tests/Controller/GlobalStoragesControllerTest.php b/apps/files_external/tests/Controller/GlobalStoragesControllerTest.php index cc905a20ff4..4c318951d1b 100644 --- a/apps/files_external/tests/Controller/GlobalStoragesControllerTest.php +++ b/apps/files_external/tests/Controller/GlobalStoragesControllerTest.php @@ -53,7 +53,7 @@ class GlobalStoragesControllerTest extends StoragesControllerTest { ); } - public function testAddLocalStorageWhenDisabled() { + public function testAddLocalStorageWhenDisabled(): void { $this->controller = $this->createController(false); parent::testAddLocalStorageWhenDisabled(); } diff --git a/apps/files_external/tests/Controller/StoragesControllerTest.php b/apps/files_external/tests/Controller/StoragesControllerTest.php index 85f3ca81498..9e9595152ad 100644 --- a/apps/files_external/tests/Controller/StoragesControllerTest.php +++ b/apps/files_external/tests/Controller/StoragesControllerTest.php @@ -70,7 +70,7 @@ abstract class StoragesControllerTest extends \Test\TestCase { return $authMech; } - public function testAddStorage() { + public function testAddStorage(): void { $authMech = $this->getAuthMechMock(); $authMech->method('validateStorage') ->willReturn(true); @@ -111,7 +111,7 @@ abstract class StoragesControllerTest extends \Test\TestCase { $this->assertEquals($storageConfig->jsonSerialize(), $data); } - public function testAddLocalStorageWhenDisabled() { + public function testAddLocalStorageWhenDisabled(): void { $authMech = $this->getAuthMechMock(); $backend = $this->getBackendMock(); @@ -141,7 +141,7 @@ abstract class StoragesControllerTest extends \Test\TestCase { $this->assertEquals(Http::STATUS_FORBIDDEN, $response->getStatus()); } - public function testUpdateStorage() { + public function testUpdateStorage(): void { $authMech = $this->getAuthMechMock(); $authMech->method('validateStorage') ->willReturn(true); @@ -194,7 +194,7 @@ abstract class StoragesControllerTest extends \Test\TestCase { /** * @dataProvider mountPointNamesProvider */ - public function testAddOrUpdateStorageInvalidMountPoint($mountPoint) { + public function testAddOrUpdateStorageInvalidMountPoint($mountPoint): void { $storageConfig = new StorageConfig(1); $storageConfig->setMountPoint($mountPoint); $storageConfig->setBackend($this->getBackendMock()); @@ -237,7 +237,7 @@ abstract class StoragesControllerTest extends \Test\TestCase { $this->assertEquals(Http::STATUS_UNPROCESSABLE_ENTITY, $response->getStatus()); } - public function testAddOrUpdateStorageInvalidBackend() { + public function testAddOrUpdateStorageInvalidBackend(): void { $this->service->expects($this->exactly(2)) ->method('createStorage') ->will($this->throwException(new \InvalidArgumentException())); @@ -274,7 +274,7 @@ abstract class StoragesControllerTest extends \Test\TestCase { $this->assertEquals(Http::STATUS_UNPROCESSABLE_ENTITY, $response->getStatus()); } - public function testUpdateStorageNonExisting() { + public function testUpdateStorageNonExisting(): void { $authMech = $this->getAuthMechMock(); $authMech->method('validateStorage') ->willReturn(true); @@ -314,7 +314,7 @@ abstract class StoragesControllerTest extends \Test\TestCase { $this->assertEquals(Http::STATUS_NOT_FOUND, $response->getStatus()); } - public function testDeleteStorage() { + public function testDeleteStorage(): void { $this->service->expects($this->once()) ->method('removeStorage'); @@ -322,7 +322,7 @@ abstract class StoragesControllerTest extends \Test\TestCase { $this->assertEquals(Http::STATUS_NO_CONTENT, $response->getStatus()); } - public function testDeleteStorageNonExisting() { + public function testDeleteStorageNonExisting(): void { $this->service->expects($this->once()) ->method('removeStorage') ->will($this->throwException(new NotFoundException())); @@ -331,7 +331,7 @@ abstract class StoragesControllerTest extends \Test\TestCase { $this->assertEquals(Http::STATUS_NOT_FOUND, $response->getStatus()); } - public function testGetStorage() { + public function testGetStorage(): void { $backend = $this->getBackendMock(); $authMech = $this->getAuthMechMock(); $storageConfig = new StorageConfig(1); @@ -365,7 +365,7 @@ abstract class StoragesControllerTest extends \Test\TestCase { /** * @dataProvider validateStorageProvider */ - public function testValidateStorage($backendValidate, $authMechValidate, $expectSuccess) { + public function testValidateStorage($backendValidate, $authMechValidate, $expectSuccess): void { $backend = $this->getBackendMock(); $backend->method('validateStorage') ->willReturn($backendValidate); diff --git a/apps/files_external/tests/Controller/UserStoragesControllerTest.php b/apps/files_external/tests/Controller/UserStoragesControllerTest.php index 0ac2197f67c..c15ded48ea7 100644 --- a/apps/files_external/tests/Controller/UserStoragesControllerTest.php +++ b/apps/files_external/tests/Controller/UserStoragesControllerTest.php @@ -60,12 +60,12 @@ class UserStoragesControllerTest extends StoragesControllerTest { ); } - public function testAddLocalStorageWhenDisabled() { + public function testAddLocalStorageWhenDisabled(): void { $this->controller = $this->createController(false); parent::testAddLocalStorageWhenDisabled(); } - public function testAddOrUpdateStorageDisallowedBackend() { + public function testAddOrUpdateStorageDisallowedBackend(): void { $backend = $this->getBackendMock(); $backend->method('isVisibleFor') ->with(BackendService::VISIBILITY_PERSONAL) diff --git a/apps/files_external/tests/DefinitionParameterTest.php b/apps/files_external/tests/DefinitionParameterTest.php index f9d50e7a34c..0b1d11bbf0c 100644 --- a/apps/files_external/tests/DefinitionParameterTest.php +++ b/apps/files_external/tests/DefinitionParameterTest.php @@ -9,7 +9,7 @@ namespace OCA\Files_External\Tests; use OCA\Files_External\Lib\DefinitionParameter as Param; class DefinitionParameterTest extends \Test\TestCase { - public function testJsonSerialization() { + public function testJsonSerialization(): void { $param = new Param('foo', 'bar'); $this->assertEquals([ 'value' => 'bar', @@ -70,7 +70,7 @@ class DefinitionParameterTest extends \Test\TestCase { /** * @dataProvider validateValueProvider */ - public function testValidateValue($type, $flags, $value, $success, $expectedValue = null) { + public function testValidateValue($type, $flags, $value, $success, $expectedValue = null): void { $param = new Param('foo', 'bar'); $param->setType($type); $param->setFlags($flags); diff --git a/apps/files_external/tests/FrontendDefinitionTraitTest.php b/apps/files_external/tests/FrontendDefinitionTraitTest.php index e5dc0547d74..bc5d88ff3f0 100644 --- a/apps/files_external/tests/FrontendDefinitionTraitTest.php +++ b/apps/files_external/tests/FrontendDefinitionTraitTest.php @@ -10,7 +10,7 @@ use OCA\Files_External\Lib\DefinitionParameter; use OCA\Files_External\Lib\StorageConfig; class FrontendDefinitionTraitTest extends \Test\TestCase { - public function testJsonSerialization() { + public function testJsonSerialization(): void { $param = $this->getMockBuilder(DefinitionParameter::class) ->disableOriginalConstructor() ->getMock(); @@ -42,7 +42,7 @@ class FrontendDefinitionTraitTest extends \Test\TestCase { /** * @dataProvider validateStorageProvider */ - public function testValidateStorage($expectedSuccess, $params) { + public function testValidateStorage($expectedSuccess, $params): void { $backendParams = []; foreach ($params as $name => $valid) { $param = $this->getMockBuilder(DefinitionParameter::class) @@ -74,7 +74,7 @@ class FrontendDefinitionTraitTest extends \Test\TestCase { $this->assertEquals($expectedSuccess, $trait->validateStorageDefinition($storageConfig)); } - public function testValidateStorageSet() { + public function testValidateStorageSet(): void { $param = $this->getMockBuilder(DefinitionParameter::class) ->disableOriginalConstructor() ->getMock(); diff --git a/apps/files_external/tests/LegacyDependencyCheckPolyfillTest.php b/apps/files_external/tests/LegacyDependencyCheckPolyfillTest.php index 931421551eb..5fcfe1dd1e6 100644 --- a/apps/files_external/tests/LegacyDependencyCheckPolyfillTest.php +++ b/apps/files_external/tests/LegacyDependencyCheckPolyfillTest.php @@ -20,7 +20,7 @@ class LegacyDependencyCheckPolyfillTest extends \Test\TestCase { ]; } - public function testCheckDependencies() { + public function testCheckDependencies(): void { $trait = $this->getMockForTrait('\OCA\Files_External\Lib\LegacyDependencyCheckPolyfill'); $trait->expects($this->once()) ->method('getStorageClass') diff --git a/apps/files_external/tests/Listener/StorePasswordListenerTest.php b/apps/files_external/tests/Listener/StorePasswordListenerTest.php index a028e1ac0ef..ec278f84331 100644 --- a/apps/files_external/tests/Listener/StorePasswordListenerTest.php +++ b/apps/files_external/tests/Listener/StorePasswordListenerTest.php @@ -76,7 +76,7 @@ class StorePasswordListenerTest extends TestCase { $storePasswordListener->handle($event); } - public function testClassicLoginSameCredentials() { + public function testClassicLoginSameCredentials(): void { $this->getMockedCredentialManager( [ 'user' => 'test', @@ -87,7 +87,7 @@ class StorePasswordListenerTest extends TestCase { ); } - public function testClassicLoginNewPassword() { + public function testClassicLoginNewPassword(): void { $this->getMockedCredentialManager( [ 'user' => 'test', @@ -101,7 +101,7 @@ class StorePasswordListenerTest extends TestCase { ); } - public function testClassicLoginNewUser() { + public function testClassicLoginNewUser(): void { $this->getMockedCredentialManager( [ 'user' => 'test', @@ -115,7 +115,7 @@ class StorePasswordListenerTest extends TestCase { ); } - public function testSSOLogin() { + public function testSSOLogin(): void { $this->getMockedCredentialManager( [ 'user' => 'test', @@ -126,7 +126,7 @@ class StorePasswordListenerTest extends TestCase { ); } - public function testPasswordUpdated() { + public function testPasswordUpdated(): void { $this->getMockedCredentialManager( [ 'user' => 'test', @@ -140,7 +140,7 @@ class StorePasswordListenerTest extends TestCase { ); } - public function testUserLoginWithToken() { + public function testUserLoginWithToken(): void { $this->getMockedCredentialManager( null, new UserLoggedInEvent($this->mockedUser, 'test', 'password', true), @@ -148,7 +148,7 @@ class StorePasswordListenerTest extends TestCase { ); } - public function testNoInitialCredentials() { + public function testNoInitialCredentials(): void { $this->getMockedCredentialManager( false, new PasswordUpdatedEvent($this->mockedUser, 'test', 'password'), diff --git a/apps/files_external/tests/OwnCloudFunctionsTest.php b/apps/files_external/tests/OwnCloudFunctionsTest.php index 9efefe8e4dd..99cb0cf94de 100644 --- a/apps/files_external/tests/OwnCloudFunctionsTest.php +++ b/apps/files_external/tests/OwnCloudFunctionsTest.php @@ -86,7 +86,7 @@ class OwnCloudFunctionsTest extends \Test\TestCase { /** * @dataProvider configUrlProvider */ - public function testConfig($config, $expectedUri) { + public function testConfig($config, $expectedUri): void { $config['user'] = 'someuser'; $config['password'] = 'somepassword'; $instance = new \OCA\Files_External\Lib\Storage\OwnCloud($config); diff --git a/apps/files_external/tests/PersonalMountTest.php b/apps/files_external/tests/PersonalMountTest.php index aec0a8b6f75..2d8f41c3e50 100644 --- a/apps/files_external/tests/PersonalMountTest.php +++ b/apps/files_external/tests/PersonalMountTest.php @@ -13,7 +13,7 @@ use OCA\Files_External\Lib\StorageConfig; use Test\TestCase; class PersonalMountTest extends TestCase { - public function testFindByStorageId() { + public function testFindByStorageId(): void { $storageConfig = $this->createMock(StorageConfig::class); /** @var \OCA\Files_External\Service\UserStoragesService $storageService */ $storageService = $this->getMockBuilder('\OCA\Files_External\Service\UserStoragesService') diff --git a/apps/files_external/tests/Service/BackendServiceTest.php b/apps/files_external/tests/Service/BackendServiceTest.php index bda96550317..6d9754a5335 100644 --- a/apps/files_external/tests/Service/BackendServiceTest.php +++ b/apps/files_external/tests/Service/BackendServiceTest.php @@ -51,7 +51,7 @@ class BackendServiceTest extends \Test\TestCase { return $backend; } - public function testRegisterBackend() { + public function testRegisterBackend(): void { $service = new BackendService($this->config); $backend = $this->getBackendMock('\Foo\Bar'); @@ -79,7 +79,7 @@ class BackendServiceTest extends \Test\TestCase { $this->assertArrayNotHasKey('identifier_alias', $backends); } - public function testBackendProvider() { + public function testBackendProvider(): void { $service = new BackendService($this->config); $backend1 = $this->getBackendMock('\Foo\Bar'); @@ -98,7 +98,7 @@ class BackendServiceTest extends \Test\TestCase { $this->assertCount(2, $service->getBackends()); } - public function testAuthMechanismProvider() { + public function testAuthMechanismProvider(): void { $service = new BackendService($this->config); $backend1 = $this->getAuthMechanismMock('\Foo\Bar'); @@ -117,7 +117,7 @@ class BackendServiceTest extends \Test\TestCase { $this->assertCount(2, $service->getAuthMechanisms()); } - public function testMultipleBackendProviders() { + public function testMultipleBackendProviders(): void { $service = new BackendService($this->config); $backend1a = $this->getBackendMock('\Foo\Bar'); @@ -145,7 +145,7 @@ class BackendServiceTest extends \Test\TestCase { $this->assertCount(3, $service->getBackends()); } - public function testUserMountingBackends() { + public function testUserMountingBackends(): void { $this->config->expects($this->exactly(2)) ->method('getAppValue') ->willReturnMap([ @@ -176,7 +176,7 @@ class BackendServiceTest extends \Test\TestCase { $service->registerBackend($backendAlias); } - public function testGetAvailableBackends() { + public function testGetAvailableBackends(): void { $service = new BackendService($this->config); $backendAvailable = $this->getBackendMock('\Backend\Available'); @@ -217,7 +217,7 @@ class BackendServiceTest extends \Test\TestCase { /** * @dataProvider invalidConfigPlaceholderProvider */ - public function testRegisterConfigHandlerInvalid(array $placeholders) { + public function testRegisterConfigHandlerInvalid(array $placeholders): void { $this->expectException(\RuntimeException::class); $service = new BackendService($this->config); @@ -230,7 +230,7 @@ class BackendServiceTest extends \Test\TestCase { } } - public function testConfigHandlers() { + public function testConfigHandlers(): void { $service = new BackendService($this->config); $mock = $this->createMock(IConfigHandler::class); $mock->expects($this->exactly(3)) diff --git a/apps/files_external/tests/Service/DBConfigServiceTest.php b/apps/files_external/tests/Service/DBConfigServiceTest.php index 1c2cafc93f0..968c166a505 100644 --- a/apps/files_external/tests/Service/DBConfigServiceTest.php +++ b/apps/files_external/tests/Service/DBConfigServiceTest.php @@ -45,7 +45,7 @@ class DBConfigServiceTest extends TestCase { return $id; } - public function testAddSimpleMount() { + public function testAddSimpleMount(): void { $id = $this->addMount('/test', 'foo', 'bar', 100, DBConfigService::MOUNT_TYPE_ADMIN); $mount = $this->dbConfig->getMountById($id); @@ -59,7 +59,7 @@ class DBConfigServiceTest extends TestCase { $this->assertEquals([], $mount['options']); } - public function testAddApplicable() { + public function testAddApplicable(): void { $id = $this->addMount('/test', 'foo', 'bar', 100, DBConfigService::MOUNT_TYPE_ADMIN); $this->dbConfig->addApplicable($id, DBConfigService::APPLICABLE_TYPE_USER, 'test'); @@ -79,7 +79,7 @@ class DBConfigServiceTest extends TestCase { ], $mount['applicable']); } - public function testAddApplicableDouble() { + public function testAddApplicableDouble(): void { $id = $this->addMount('/test', 'foo', 'bar', 100, DBConfigService::MOUNT_TYPE_ADMIN); $this->dbConfig->addApplicable($id, DBConfigService::APPLICABLE_TYPE_USER, 'test'); $this->dbConfig->addApplicable($id, DBConfigService::APPLICABLE_TYPE_USER, 'test'); @@ -90,7 +90,7 @@ class DBConfigServiceTest extends TestCase { ], $mount['applicable']); } - public function testDeleteMount() { + public function testDeleteMount(): void { $id = $this->addMount('/test', 'foo', 'bar', 100, DBConfigService::MOUNT_TYPE_ADMIN); $this->dbConfig->removeMount($id); @@ -99,7 +99,7 @@ class DBConfigServiceTest extends TestCase { $this->assertEquals(null, $mount); } - public function testRemoveApplicable() { + public function testRemoveApplicable(): void { $id = $this->addMount('/test', 'foo', 'bar', 100, DBConfigService::MOUNT_TYPE_ADMIN); $this->dbConfig->addApplicable($id, DBConfigService::APPLICABLE_TYPE_USER, 'test'); $this->dbConfig->removeApplicable($id, DBConfigService::APPLICABLE_TYPE_USER, 'test'); @@ -108,7 +108,7 @@ class DBConfigServiceTest extends TestCase { $this->assertEquals([], $mount['applicable']); } - public function testRemoveApplicableGlobal() { + public function testRemoveApplicableGlobal(): void { $id = $this->addMount('/test', 'foo', 'bar', 100, DBConfigService::MOUNT_TYPE_ADMIN); $this->dbConfig->addApplicable($id, DBConfigService::APPLICABLE_TYPE_GLOBAL, null); $this->dbConfig->removeApplicable($id, DBConfigService::APPLICABLE_TYPE_GLOBAL, null); @@ -120,7 +120,7 @@ class DBConfigServiceTest extends TestCase { ], $mount['applicable']); } - public function testSetConfig() { + public function testSetConfig(): void { $id = $this->addMount('/test', 'foo', 'bar', 100, DBConfigService::MOUNT_TYPE_ADMIN); $this->dbConfig->setConfig($id, 'foo', 'bar'); @@ -133,7 +133,7 @@ class DBConfigServiceTest extends TestCase { $this->assertEquals(['foo' => 'bar', 'foo2' => 'bar2'], $mount['config']); } - public function testSetConfigOverwrite() { + public function testSetConfigOverwrite(): void { $id = $this->addMount('/test', 'foo', 'bar', 100, DBConfigService::MOUNT_TYPE_ADMIN); $this->dbConfig->setConfig($id, 'foo', 'bar'); $this->dbConfig->setConfig($id, 'asd', '1'); @@ -143,7 +143,7 @@ class DBConfigServiceTest extends TestCase { $this->assertEquals(['foo' => 'qwerty', 'asd' => '1'], $mount['config']); } - public function testSetOption() { + public function testSetOption(): void { $id = $this->addMount('/test', 'foo', 'bar', 100, DBConfigService::MOUNT_TYPE_ADMIN); $this->dbConfig->setOption($id, 'foo', 'bar'); @@ -156,7 +156,7 @@ class DBConfigServiceTest extends TestCase { $this->assertEquals(['foo' => 'bar', 'foo2' => 'bar2'], $mount['options']); } - public function testSetOptionOverwrite() { + public function testSetOptionOverwrite(): void { $id = $this->addMount('/test', 'foo', 'bar', 100, DBConfigService::MOUNT_TYPE_ADMIN); $this->dbConfig->setOption($id, 'foo', 'bar'); $this->dbConfig->setOption($id, 'asd', '1'); @@ -166,7 +166,7 @@ class DBConfigServiceTest extends TestCase { $this->assertEquals(['foo' => 'qwerty', 'asd' => '1'], $mount['options']); } - public function testGetMountsFor() { + public function testGetMountsFor(): void { $mounts = $this->dbConfig->getMountsFor(DBConfigService::APPLICABLE_TYPE_USER, 'test'); $this->assertEquals([], $mounts); @@ -179,7 +179,7 @@ class DBConfigServiceTest extends TestCase { $this->assertEquals([['type' => DBConfigService::APPLICABLE_TYPE_USER, 'value' => 'test', 'mount_id' => $id]], $mounts[0]['applicable']); } - public function testGetAdminMounts() { + public function testGetAdminMounts(): void { $id1 = $this->addMount('/test', 'foo', 'bar', 100, DBConfigService::MOUNT_TYPE_ADMIN); $this->addMount('/test2', 'foo2', 'bar2', 100, DBConfigService::MOUNT_TYPE_PERSONAL); @@ -188,7 +188,7 @@ class DBConfigServiceTest extends TestCase { $this->assertEquals($id1, $mounts[0]['mount_id']); } - public function testGetAdminMountsFor() { + public function testGetAdminMountsFor(): void { $id1 = $this->addMount('/test', 'foo', 'bar', 100, DBConfigService::MOUNT_TYPE_ADMIN); $this->addMount('/test2', 'foo2', 'bar2', 100, DBConfigService::MOUNT_TYPE_ADMIN); $id3 = $this->addMount('/test3', 'foo3', 'bar3', 100, DBConfigService::MOUNT_TYPE_PERSONAL); @@ -202,7 +202,7 @@ class DBConfigServiceTest extends TestCase { $this->assertEquals([['type' => DBConfigService::APPLICABLE_TYPE_USER, 'value' => 'test', 'mount_id' => $id1]], $mounts[0]['applicable']); } - public function testGetUserMountsFor() { + public function testGetUserMountsFor(): void { $id1 = $this->addMount('/test', 'foo', 'bar', 100, DBConfigService::MOUNT_TYPE_ADMIN); $this->addMount('/test2', 'foo2', 'bar2', 100, DBConfigService::MOUNT_TYPE_PERSONAL); $id3 = $this->addMount('/test3', 'foo3', 'bar3', 100, DBConfigService::MOUNT_TYPE_PERSONAL); @@ -216,7 +216,7 @@ class DBConfigServiceTest extends TestCase { $this->assertEquals([['type' => DBConfigService::APPLICABLE_TYPE_USER, 'value' => 'test', 'mount_id' => $id3]], $mounts[0]['applicable']); } - public function testGetAdminMountsForGlobal() { + public function testGetAdminMountsForGlobal(): void { $id1 = $this->addMount('/test', 'foo', 'bar', 100, DBConfigService::MOUNT_TYPE_ADMIN); $this->dbConfig->addApplicable($id1, DBConfigService::APPLICABLE_TYPE_GLOBAL, null); @@ -227,7 +227,7 @@ class DBConfigServiceTest extends TestCase { $this->assertEquals([['type' => DBConfigService::APPLICABLE_TYPE_GLOBAL, 'value' => null, 'mount_id' => $id1]], $mounts[0]['applicable']); } - public function testSetMountPoint() { + public function testSetMountPoint(): void { $id1 = $this->addMount('/test', 'foo', 'bar', 100, DBConfigService::MOUNT_TYPE_ADMIN); $id2 = $this->addMount('/foo', 'foo', 'bar', 100, DBConfigService::MOUNT_TYPE_ADMIN); @@ -241,7 +241,7 @@ class DBConfigServiceTest extends TestCase { $this->assertEquals('/foo', $mount['mount_point']); } - public function testSetAuthBackend() { + public function testSetAuthBackend(): void { $id1 = $this->addMount('/test', 'foo', 'bar', 100, DBConfigService::MOUNT_TYPE_ADMIN); $id2 = $this->addMount('/foo', 'foo', 'bar', 100, DBConfigService::MOUNT_TYPE_ADMIN); @@ -255,7 +255,7 @@ class DBConfigServiceTest extends TestCase { $this->assertEquals('bar', $mount['auth_backend']); } - public function testGetMountsForDuplicateByGroup() { + public function testGetMountsForDuplicateByGroup(): void { $id1 = $this->addMount('/test', 'foo', 'bar', 100, DBConfigService::MOUNT_TYPE_ADMIN); $this->dbConfig->addApplicable($id1, DBConfigService::APPLICABLE_TYPE_GROUP, 'group1'); @@ -266,7 +266,7 @@ class DBConfigServiceTest extends TestCase { $this->assertEquals($id1, $mounts[0]['mount_id']); } - public function testGetAllMounts() { + public function testGetAllMounts(): void { $id1 = $this->addMount('/test', 'foo', 'bar', 100, DBConfigService::MOUNT_TYPE_ADMIN); $id2 = $this->addMount('/test2', 'foo2', 'bar2', 100, DBConfigService::MOUNT_TYPE_PERSONAL); diff --git a/apps/files_external/tests/Service/GlobalStoragesServiceTest.php b/apps/files_external/tests/Service/GlobalStoragesServiceTest.php index 18fd9d174f2..0c9df2e858b 100644 --- a/apps/files_external/tests/Service/GlobalStoragesServiceTest.php +++ b/apps/files_external/tests/Service/GlobalStoragesServiceTest.php @@ -115,7 +115,7 @@ class GlobalStoragesServiceTest extends StoragesServiceTest { /** * @dataProvider storageDataProvider */ - public function testAddStorage($storageParams) { + public function testAddStorage($storageParams): void { $storage = $this->makeStorageConfig($storageParams); $newStorage = $this->service->addStorage($storage); @@ -139,7 +139,7 @@ class GlobalStoragesServiceTest extends StoragesServiceTest { /** * @dataProvider storageDataProvider */ - public function testUpdateStorage($updatedStorageParams) { + public function testUpdateStorage($updatedStorageParams): void { $updatedStorage = $this->makeStorageConfig($updatedStorageParams); $storage = $this->makeStorageConfig([ 'mountPoint' => 'mountpoint', @@ -281,7 +281,7 @@ class GlobalStoragesServiceTest extends StoragesServiceTest { /** * @dataProvider hooksAddStorageDataProvider */ - public function testHooksAddStorage($applicableUsers, $applicableGroups, $expectedCalls) { + public function testHooksAddStorage($applicableUsers, $applicableGroups, $expectedCalls): void { $storage = $this->makeTestStorageData(); $storage->setApplicableUsers($applicableUsers); $storage->setApplicableGroups($applicableGroups); @@ -424,7 +424,7 @@ class GlobalStoragesServiceTest extends StoragesServiceTest { $sourceApplicableGroups, $updatedApplicableUsers, $updatedApplicableGroups, - $expectedCalls) { + $expectedCalls): void { $storage = $this->makeTestStorageData(); $storage->setApplicableUsers($sourceApplicableUsers); $storage->setApplicableGroups($sourceApplicableGroups); @@ -452,7 +452,7 @@ class GlobalStoragesServiceTest extends StoragesServiceTest { } - public function testHooksRenameMountPoint() { + public function testHooksRenameMountPoint(): void { $storage = $this->makeTestStorageData(); $storage->setApplicableUsers(['user1', 'user2']); $storage->setApplicableGroups(['group1', 'group2']); @@ -581,7 +581,7 @@ class GlobalStoragesServiceTest extends StoragesServiceTest { public function testHooksDeleteStorage( $sourceApplicableUsers, $sourceApplicableGroups, - $expectedCalls) { + $expectedCalls): void { $storage = $this->makeTestStorageData(); $storage->setApplicableUsers($sourceApplicableUsers); $storage->setApplicableGroups($sourceApplicableGroups); diff --git a/apps/files_external/tests/Service/StoragesServiceTest.php b/apps/files_external/tests/Service/StoragesServiceTest.php index 0936912b221..40cba73a74f 100644 --- a/apps/files_external/tests/Service/StoragesServiceTest.php +++ b/apps/files_external/tests/Service/StoragesServiceTest.php @@ -248,7 +248,7 @@ abstract class StoragesServiceTest extends \Test\TestCase { $this->service->updateStorage($storage); } - public function testNonExistingStorage() { + public function testNonExistingStorage(): void { $this->expectException(\OCA\Files_External\NotFoundException::class); $this->ActualNonExistingStorageTest(); @@ -281,7 +281,7 @@ abstract class StoragesServiceTest extends \Test\TestCase { /** * @dataProvider deleteStorageDataProvider */ - public function testDeleteStorage($backendOptions, $rustyStorageId) { + public function testDeleteStorage($backendOptions, $rustyStorageId): void { $backend = $this->backendService->getBackend('identifier:\OCA\Files_External\Lib\Backend\DAV'); $authMechanism = $this->backendService->getAuthMechanism('identifier:\Auth\Mechanism'); $storage = new StorageConfig(255); @@ -352,13 +352,13 @@ abstract class StoragesServiceTest extends \Test\TestCase { $this->service->removeStorage(255); } - public function testDeleteUnexistingStorage() { + public function testDeleteUnexistingStorage(): void { $this->expectException(\OCA\Files_External\NotFoundException::class); $this->actualDeletedUnexistingStorageTest(); } - public function testCreateStorage() { + public function testCreateStorage(): void { $mountPoint = 'mount'; $backendIdentifier = 'identifier:\OCA\Files_External\Lib\Backend\SMB'; $authMechanismIdentifier = 'identifier:\Auth\Mechanism'; @@ -392,7 +392,7 @@ abstract class StoragesServiceTest extends \Test\TestCase { $this->assertEquals($priority, $storage->getPriority()); } - public function testCreateStorageInvalidClass() { + public function testCreateStorageInvalidClass(): void { $storage = $this->service->createStorage( 'mount', 'identifier:\OC\Not\A\Backend', @@ -402,7 +402,7 @@ abstract class StoragesServiceTest extends \Test\TestCase { $this->assertInstanceOf(InvalidBackend::class, $storage->getBackend()); } - public function testCreateStorageInvalidAuthMechanismClass() { + public function testCreateStorageInvalidAuthMechanismClass(): void { $storage = $this->service->createStorage( 'mount', 'identifier:\OCA\Files_External\Lib\Backend\SMB', @@ -412,7 +412,7 @@ abstract class StoragesServiceTest extends \Test\TestCase { $this->assertInstanceOf(InvalidAuth::class, $storage->getAuthMechanism()); } - public function testGetStoragesBackendNotVisible() { + public function testGetStoragesBackendNotVisible(): void { $backend = $this->backendService->getBackend('identifier:\OCA\Files_External\Lib\Backend\SMB'); $backend->expects($this->once()) ->method('isVisibleFor') @@ -435,7 +435,7 @@ abstract class StoragesServiceTest extends \Test\TestCase { $this->assertEmpty($this->service->getStorages()); } - public function testGetStoragesAuthMechanismNotVisible() { + public function testGetStoragesAuthMechanismNotVisible(): void { $backend = $this->backendService->getBackend('identifier:\OCA\Files_External\Lib\Backend\SMB'); $backend->method('isVisibleFor') ->with($this->service->getVisibilityType()) @@ -498,7 +498,7 @@ abstract class StoragesServiceTest extends \Test\TestCase { ); } - public function testUpdateStorageMountPoint() { + public function testUpdateStorageMountPoint(): void { $backend = $this->backendService->getBackend('identifier:\OCA\Files_External\Lib\Backend\SMB'); $authMechanism = $this->backendService->getAuthMechanism('identifier:\Auth\Mechanism'); diff --git a/apps/files_external/tests/Service/UserGlobalStoragesServiceTest.php b/apps/files_external/tests/Service/UserGlobalStoragesServiceTest.php index e08f3bd4d7d..992960a6ea1 100644 --- a/apps/files_external/tests/Service/UserGlobalStoragesServiceTest.php +++ b/apps/files_external/tests/Service/UserGlobalStoragesServiceTest.php @@ -108,7 +108,7 @@ class UserGlobalStoragesServiceTest extends GlobalStoragesServiceTest { /** * @dataProvider applicableStorageProvider */ - public function testGetStorageWithApplicable($applicableUsers, $applicableGroups, $isVisible) { + public function testGetStorageWithApplicable($applicableUsers, $applicableGroups, $isVisible): void { $backend = $this->backendService->getBackend('identifier:\OCA\Files_External\Lib\Backend\SMB'); $authMechanism = $this->backendService->getAuthMechanism('identifier:\Auth\Mechanism'); @@ -139,7 +139,7 @@ class UserGlobalStoragesServiceTest extends GlobalStoragesServiceTest { } - public function testAddStorage($storageParams = null) { + public function testAddStorage($storageParams = null): void { $this->expectException(\DomainException::class); $backend = $this->backendService->getBackend('identifier:\OCA\Files_External\Lib\Backend\SMB'); @@ -155,7 +155,7 @@ class UserGlobalStoragesServiceTest extends GlobalStoragesServiceTest { } - public function testUpdateStorage($storageParams = null) { + public function testUpdateStorage($storageParams = null): void { $this->expectException(\DomainException::class); $backend = $this->backendService->getBackend('identifier:\OCA\Files_External\Lib\Backend\SMB'); @@ -175,7 +175,7 @@ class UserGlobalStoragesServiceTest extends GlobalStoragesServiceTest { } - public function testNonExistingStorage() { + public function testNonExistingStorage(): void { $this->expectException(\DomainException::class); $this->ActualNonExistingStorageTest(); @@ -184,7 +184,7 @@ class UserGlobalStoragesServiceTest extends GlobalStoragesServiceTest { /** * @dataProvider deleteStorageDataProvider */ - public function testDeleteStorage($backendOptions, $rustyStorageId) { + public function testDeleteStorage($backendOptions, $rustyStorageId): void { $this->expectException(\DomainException::class); $backend = $this->backendService->getBackend('identifier:\OCA\Files_External\Lib\Backend\SMB'); @@ -203,7 +203,7 @@ class UserGlobalStoragesServiceTest extends GlobalStoragesServiceTest { } - public function testDeleteUnexistingStorage() { + public function testDeleteUnexistingStorage(): void { $this->expectException(\DomainException::class); $this->actualDeletedUnexistingStorageTest(); @@ -244,7 +244,7 @@ class UserGlobalStoragesServiceTest extends GlobalStoragesServiceTest { $priority1, $applicableUsers1, $applicableGroups1, $priority2, $applicableUsers2, $applicableGroups2, $expectedPrecedence - ) { + ): void { $backend = $this->backendService->getBackend('identifier:\OCA\Files_External\Lib\Backend\SMB'); $backend->method('isVisibleFor') ->willReturn(true); @@ -284,67 +284,67 @@ class UserGlobalStoragesServiceTest extends GlobalStoragesServiceTest { } } - public function testGetStoragesBackendNotVisible() { + public function testGetStoragesBackendNotVisible(): void { // we don't test this here $this->addToAssertionCount(1); } - public function testGetStoragesAuthMechanismNotVisible() { + public function testGetStoragesAuthMechanismNotVisible(): void { // we don't test this here $this->addToAssertionCount(1); } - public function testHooksAddStorage($a = null, $b = null, $c = null) { + public function testHooksAddStorage($a = null, $b = null, $c = null): void { // we don't test this here $this->addToAssertionCount(1); } - public function testHooksUpdateStorage($a = null, $b = null, $c = null, $d = null, $e = null) { + public function testHooksUpdateStorage($a = null, $b = null, $c = null, $d = null, $e = null): void { // we don't test this here $this->addToAssertionCount(1); } - public function testHooksRenameMountPoint() { + public function testHooksRenameMountPoint(): void { // we don't test this here $this->addToAssertionCount(1); } - public function testHooksDeleteStorage($a = null, $b = null, $c = null) { + public function testHooksDeleteStorage($a = null, $b = null, $c = null): void { // we don't test this here $this->addToAssertionCount(1); } - public function testLegacyConfigConversionApplicableAll() { + public function testLegacyConfigConversionApplicableAll(): void { // we don't test this here $this->addToAssertionCount(1); } - public function testLegacyConfigConversionApplicableUserAndGroup() { + public function testLegacyConfigConversionApplicableUserAndGroup(): void { // we don't test this here $this->addToAssertionCount(1); } - public function testReadLegacyConfigAndGenerateConfigId() { + public function testReadLegacyConfigAndGenerateConfigId(): void { // we don't test this here $this->addToAssertionCount(1); } - public function testReadLegacyConfigNoAuthMechanism() { + public function testReadLegacyConfigNoAuthMechanism(): void { // we don't test this here $this->addToAssertionCount(1); } - public function testReadLegacyConfigClass() { + public function testReadLegacyConfigClass(): void { // we don't test this here $this->addToAssertionCount(1); } - public function testReadEmptyMountPoint() { + public function testReadEmptyMountPoint(): void { // we don't test this here $this->addToAssertionCount(1); } - public function testUpdateStorageMountPoint() { + public function testUpdateStorageMountPoint(): void { // we don't test this here $this->addToAssertionCount(1); } diff --git a/apps/files_external/tests/Service/UserStoragesServiceTest.php b/apps/files_external/tests/Service/UserStoragesServiceTest.php index 370b34245c2..cb7abfaf725 100644 --- a/apps/files_external/tests/Service/UserStoragesServiceTest.php +++ b/apps/files_external/tests/Service/UserStoragesServiceTest.php @@ -65,7 +65,7 @@ class UserStoragesServiceTest extends StoragesServiceTest { ]); } - public function testAddStorage() { + public function testAddStorage(): void { $storage = $this->makeTestStorageData(); $newStorage = $this->service->addStorage($storage); @@ -93,7 +93,7 @@ class UserStoragesServiceTest extends StoragesServiceTest { $this->assertEquals($id + 1, $nextStorage->getId()); } - public function testUpdateStorage() { + public function testUpdateStorage(): void { $storage = $this->makeStorageConfig([ 'mountPoint' => 'mountpoint', 'backendIdentifier' => 'identifier:\OCA\Files_External\Lib\Backend\SMB', @@ -128,7 +128,7 @@ class UserStoragesServiceTest extends StoragesServiceTest { /** * @dataProvider deleteStorageDataProvider */ - public function testDeleteStorage($backendOptions, $rustyStorageId) { + public function testDeleteStorage($backendOptions, $rustyStorageId): void { parent::testDeleteStorage($backendOptions, $rustyStorageId); // hook called once for user (first one was during test creation) @@ -141,7 +141,7 @@ class UserStoragesServiceTest extends StoragesServiceTest { ); } - public function testHooksRenameMountPoint() { + public function testHooksRenameMountPoint(): void { $storage = $this->makeTestStorageData(); $storage = $this->service->addStorage($storage); @@ -170,7 +170,7 @@ class UserStoragesServiceTest extends StoragesServiceTest { } - public function testGetAdminStorage() { + public function testGetAdminStorage(): void { $this->expectException(\OCA\Files_External\NotFoundException::class); $backend = $this->backendService->getBackend('identifier:\OCA\Files_External\Lib\Backend\SMB'); diff --git a/apps/files_external/tests/Settings/AdminTest.php b/apps/files_external/tests/Settings/AdminTest.php index 1d584814da8..602e0124950 100644 --- a/apps/files_external/tests/Settings/AdminTest.php +++ b/apps/files_external/tests/Settings/AdminTest.php @@ -40,7 +40,7 @@ class AdminTest extends TestCase { ); } - public function testGetForm() { + public function testGetForm(): void { $this->encryptionManager ->expects($this->once()) ->method('isEnabled') @@ -85,11 +85,11 @@ class AdminTest extends TestCase { $this->assertEquals($expected, $this->admin->getForm()); } - public function testGetSection() { + public function testGetSection(): void { $this->assertSame('externalstorages', $this->admin->getSection()); } - public function testGetPriority() { + public function testGetPriority(): void { $this->assertSame(40, $this->admin->getPriority()); } } diff --git a/apps/files_external/tests/Settings/SectionTest.php b/apps/files_external/tests/Settings/SectionTest.php index e9f47cab19d..9154106ff8a 100644 --- a/apps/files_external/tests/Settings/SectionTest.php +++ b/apps/files_external/tests/Settings/SectionTest.php @@ -29,11 +29,11 @@ class SectionTest extends TestCase { ); } - public function testGetID() { + public function testGetID(): void { $this->assertSame('externalstorages', $this->section->getID()); } - public function testGetName() { + public function testGetName(): void { $this->l ->expects($this->once()) ->method('t') @@ -43,7 +43,7 @@ class SectionTest extends TestCase { $this->assertSame('External storage', $this->section->getName()); } - public function testGetPriority() { + public function testGetPriority(): void { $this->assertSame(10, $this->section->getPriority()); } } diff --git a/apps/files_external/tests/Storage/Amazons3MultiPartTest.php b/apps/files_external/tests/Storage/Amazons3MultiPartTest.php index 3db468b0fa0..1ac18406d24 100644 --- a/apps/files_external/tests/Storage/Amazons3MultiPartTest.php +++ b/apps/files_external/tests/Storage/Amazons3MultiPartTest.php @@ -40,11 +40,11 @@ class Amazons3MultiPartTest extends \Test\Files\Storage\Storage { parent::tearDown(); } - public function testStat() { + public function testStat(): void { $this->markTestSkipped('S3 doesn\'t update the parents folder mtime'); } - public function testHashInFileName() { + public function testHashInFileName(): void { $this->markTestSkipped('Localstack has a bug with hashes in filename'); } } diff --git a/apps/files_external/tests/Storage/Amazons3Test.php b/apps/files_external/tests/Storage/Amazons3Test.php index bffe98c3f4d..fd7fd9225c9 100644 --- a/apps/files_external/tests/Storage/Amazons3Test.php +++ b/apps/files_external/tests/Storage/Amazons3Test.php @@ -38,11 +38,11 @@ class Amazons3Test extends \Test\Files\Storage\Storage { parent::tearDown(); } - public function testStat() { + public function testStat(): void { $this->markTestSkipped('S3 doesn\'t update the parents folder mtime'); } - public function testHashInFileName() { + public function testHashInFileName(): void { $this->markTestSkipped('Localstack has a bug with hashes in filename'); } } diff --git a/apps/files_external/tests/Storage/FtpTest.php b/apps/files_external/tests/Storage/FtpTest.php index 24f7c511e93..c6a1d8f77ba 100644 --- a/apps/files_external/tests/Storage/FtpTest.php +++ b/apps/files_external/tests/Storage/FtpTest.php @@ -55,7 +55,7 @@ class FtpTest extends \Test\Files\Storage\Storage { /** * mtime for folders is only with a minute resolution */ - public function testStat() { + public function testStat(): void { $textFile = \OC::$SERVERROOT . '/tests/data/lorem.txt'; $ctimeStart = time(); $this->instance->file_put_contents('/lorem.txt', file_get_contents($textFile)); diff --git a/apps/files_external/tests/Storage/SFTP_KeyTest.php b/apps/files_external/tests/Storage/SFTP_KeyTest.php index c1aaf0b13a3..9be3cb7d3e8 100644 --- a/apps/files_external/tests/Storage/SFTP_KeyTest.php +++ b/apps/files_external/tests/Storage/SFTP_KeyTest.php @@ -41,39 +41,39 @@ class SFTP_KeyTest extends \Test\Files\Storage\Storage { } - public function testInvalidAddressShouldThrowException() { + public function testInvalidAddressShouldThrowException(): void { $this->expectException(\InvalidArgumentException::class); // I'd use example.com for this, but someone decided to break the spec and make it resolve $this->instance->assertHostAddressValid('notarealaddress...'); } - public function testValidAddressShouldPass() { + public function testValidAddressShouldPass(): void { $this->assertTrue($this->instance->assertHostAddressValid('localhost')); } - public function testNegativePortNumberShouldThrowException() { + public function testNegativePortNumberShouldThrowException(): void { $this->expectException(\InvalidArgumentException::class); $this->instance->assertPortNumberValid('-1'); } - public function testNonNumericalPortNumberShouldThrowException() { + public function testNonNumericalPortNumberShouldThrowException(): void { $this->expectException(\InvalidArgumentException::class); $this->instance->assertPortNumberValid('a'); } - public function testHighPortNumberShouldThrowException() { + public function testHighPortNumberShouldThrowException(): void { $this->expectException(\InvalidArgumentException::class); $this->instance->assertPortNumberValid('65536'); } - public function testValidPortNumberShouldPass() { + public function testValidPortNumberShouldPass(): void { $this->assertTrue($this->instance->assertPortNumberValid('22222')); } } diff --git a/apps/files_external/tests/Storage/SftpTest.php b/apps/files_external/tests/Storage/SftpTest.php index ce7d7461ba8..cc29486f426 100644 --- a/apps/files_external/tests/Storage/SftpTest.php +++ b/apps/files_external/tests/Storage/SftpTest.php @@ -47,7 +47,7 @@ class SftpTest extends \Test\Files\Storage\Storage { /** * @dataProvider configProvider */ - public function testStorageId($config, $expectedStorageId) { + public function testStorageId($config, $expectedStorageId): void { $instance = new SFTP($config); $this->assertEquals($expectedStorageId, $instance->getId()); } diff --git a/apps/files_external/tests/Storage/SmbTest.php b/apps/files_external/tests/Storage/SmbTest.php index 437ef9a1cdf..d5a83905112 100644 --- a/apps/files_external/tests/Storage/SmbTest.php +++ b/apps/files_external/tests/Storage/SmbTest.php @@ -54,14 +54,14 @@ class SmbTest extends \Test\Files\Storage\Storage { return [['folder']]; } - public function testRenameWithSpaces() { + public function testRenameWithSpaces(): void { $this->instance->mkdir('with spaces'); $result = $this->instance->rename('with spaces', 'foo bar'); $this->assertTrue($result); $this->assertTrue($this->instance->is_dir('foo bar')); } - public function testStorageId() { + public function testStorageId(): void { $this->instance = new SMB([ 'host' => 'testhost', 'user' => 'testuser', @@ -73,7 +73,7 @@ class SmbTest extends \Test\Files\Storage\Storage { $this->instance = null; } - public function testNotifyGetChanges() { + public function testNotifyGetChanges(): void { $lastError = null; for ($i = 0; $i < 5; $i++) { try { @@ -130,7 +130,7 @@ class SmbTest extends \Test\Files\Storage\Storage { } } - public function testNotifyListen() { + public function testNotifyListen(): void { $notifyHandler = $this->instance->notify(''); usleep(100 * 1000); //give time for the notify to start $this->instance->file_put_contents('/newfile.txt', 'test content'); @@ -153,7 +153,7 @@ class SmbTest extends \Test\Files\Storage\Storage { } } - public function testRenameRoot() { + public function testRenameRoot(): void { // root can't be renamed $this->assertFalse($this->instance->rename('', 'foo1')); @@ -162,12 +162,12 @@ class SmbTest extends \Test\Files\Storage\Storage { $this->instance->rmdir('foo2'); } - public function testUnlinkRoot() { + public function testUnlinkRoot(): void { // root can't be deleted $this->assertFalse($this->instance->unlink('')); } - public function testRmdirRoot() { + public function testRmdirRoot(): void { // root can't be deleted $this->assertFalse($this->instance->rmdir('')); } diff --git a/apps/files_external/tests/Storage/SwiftTest.php b/apps/files_external/tests/Storage/SwiftTest.php index 53ca499e4eb..c21c8c6f506 100644 --- a/apps/files_external/tests/Storage/SwiftTest.php +++ b/apps/files_external/tests/Storage/SwiftTest.php @@ -53,7 +53,7 @@ class SwiftTest extends \Test\Files\Storage\Storage { parent::tearDown(); } - public function testStat() { + public function testStat(): void { $this->markTestSkipped('Swift doesn\'t update the parents folder mtime'); } } diff --git a/apps/files_external/tests/Storage/WebdavTest.php b/apps/files_external/tests/Storage/WebdavTest.php index a063ddebb0d..872f1b5d0e2 100644 --- a/apps/files_external/tests/Storage/WebdavTest.php +++ b/apps/files_external/tests/Storage/WebdavTest.php @@ -41,7 +41,7 @@ class WebdavTest extends \Test\Files\Storage\Storage { parent::tearDown(); } - public function testMimetypeFallback() { + public function testMimetypeFallback(): void { $this->instance->file_put_contents('foo.bar', 'asd'); /** @var Detection $mimeDetector */ diff --git a/apps/files_external/tests/StorageConfigTest.php b/apps/files_external/tests/StorageConfigTest.php index fbbd9de94be..b67d69a3ce7 100644 --- a/apps/files_external/tests/StorageConfigTest.php +++ b/apps/files_external/tests/StorageConfigTest.php @@ -12,7 +12,7 @@ use OCA\Files_External\Lib\DefinitionParameter; use OCA\Files_External\Lib\StorageConfig; class StorageConfigTest extends \Test\TestCase { - public function testJsonSerialization() { + public function testJsonSerialization(): void { $backend = $this->getMockBuilder(Backend::class) ->disableOriginalConstructor() ->getMock(); diff --git a/apps/files_sharing/tests/ApiTest.php b/apps/files_sharing/tests/ApiTest.php index 9b95ac78770..fe0739cfcde 100644 --- a/apps/files_sharing/tests/ApiTest.php +++ b/apps/files_sharing/tests/ApiTest.php @@ -125,7 +125,7 @@ class ApiTest extends TestCase { ); } - public function testCreateShareUserFile() { + public function testCreateShareUserFile(): void { $this->setUp(); // for some reasons phpunit refuses to do this for us only for this test $ocs = $this->createOCS(self::TEST_FILES_SHARING_API_USER1); $result = $ocs->createShare($this->filename, \OCP\Constants::PERMISSION_ALL, IShare::TYPE_USER, self::TEST_FILES_SHARING_API_USER2); @@ -143,7 +143,7 @@ class ApiTest extends TestCase { $ocs->cleanup(); } - public function testCreateShareUserFolder() { + public function testCreateShareUserFolder(): void { $ocs = $this->createOCS(self::TEST_FILES_SHARING_API_USER1); $result = $ocs->createShare($this->folder, \OCP\Constants::PERMISSION_ALL, IShare::TYPE_USER, self::TEST_FILES_SHARING_API_USER2); $ocs->cleanup(); @@ -160,7 +160,7 @@ class ApiTest extends TestCase { } - public function testCreateShareGroupFile() { + public function testCreateShareGroupFile(): void { $ocs = $this->createOCS(self::TEST_FILES_SHARING_API_USER1); $result = $ocs->createShare($this->filename, \OCP\Constants::PERMISSION_ALL, IShare::TYPE_GROUP, self::TEST_FILES_SHARING_API_GROUP1); $ocs->cleanup(); @@ -176,7 +176,7 @@ class ApiTest extends TestCase { $ocs->cleanup(); } - public function testCreateShareGroupFolder() { + public function testCreateShareGroupFolder(): void { $ocs = $this->createOCS(self::TEST_FILES_SHARING_API_USER1); $result = $ocs->createShare($this->folder, \OCP\Constants::PERMISSION_ALL, IShare::TYPE_GROUP, self::TEST_FILES_SHARING_API_GROUP1); $ocs->cleanup(); @@ -195,7 +195,7 @@ class ApiTest extends TestCase { /** * @group RoutingWeirdness */ - public function testCreateShareLink() { + public function testCreateShareLink(): void { $ocs = $this->createOCS(self::TEST_FILES_SHARING_API_USER1); $result = $ocs->createShare($this->folder, \OCP\Constants::PERMISSION_ALL, IShare::TYPE_LINK); $ocs->cleanup(); @@ -220,7 +220,7 @@ class ApiTest extends TestCase { /** * @group RoutingWeirdness */ - public function testCreateShareLinkPublicUpload() { + public function testCreateShareLinkPublicUpload(): void { $ocs = $this->createOCS(self::TEST_FILES_SHARING_API_USER1); $result = $ocs->createShare($this->folder, \OCP\Constants::PERMISSION_ALL, IShare::TYPE_LINK, null, 'true'); $ocs->cleanup(); @@ -248,7 +248,7 @@ class ApiTest extends TestCase { $ocs->cleanup(); } - public function testEnforceLinkPassword() { + public function testEnforceLinkPassword(): void { $password = md5(time()); $config = \OC::$server->getConfig(); $config->setAppValue('core', 'shareapi_enforce_links_password', 'yes'); @@ -302,7 +302,7 @@ class ApiTest extends TestCase { /** * @medium */ - public function testSharePermissions() { + public function testSharePermissions(): void { // sharing file to a user should work if shareapi_exclude_groups is set // to no \OC::$server->getConfig()->setAppValue('core', 'shareapi_exclude_groups', 'no'); @@ -353,7 +353,7 @@ class ApiTest extends TestCase { /** * @medium */ - public function testGetAllShares() { + public function testGetAllShares(): void { $node = $this->userFolder->get($this->filename); $share = $this->shareManager->newShare(); @@ -374,7 +374,7 @@ class ApiTest extends TestCase { $this->shareManager->deleteShare($share); } - public function testGetAllSharesWithMe() { + public function testGetAllSharesWithMe(): void { $this->loginAsUser(self::TEST_FILES_SHARING_API_USER2); $this->logout(); @@ -414,7 +414,7 @@ class ApiTest extends TestCase { * @medium * @group RoutingWeirdness */ - public function testPublicLinkUrl() { + public function testPublicLinkUrl(): void { $ocs = $this->createOCS(self::TEST_FILES_SHARING_API_USER1); $result = $ocs->createShare($this->folder, \OCP\Constants::PERMISSION_ALL, IShare::TYPE_LINK); $ocs->cleanup(); @@ -463,7 +463,7 @@ class ApiTest extends TestCase { * @depends testCreateShareUserFile * @depends testCreateShareLink */ - public function testGetShareFromSource() { + public function testGetShareFromSource(): void { $node = $this->userFolder->get($this->filename); $share = $this->shareManager->newShare(); $share->setNode($node) @@ -496,7 +496,7 @@ class ApiTest extends TestCase { * @depends testCreateShareUserFile * @depends testCreateShareLink */ - public function testGetShareFromSourceWithReshares() { + public function testGetShareFromSourceWithReshares(): void { $node = $this->userFolder->get($this->filename); $share1 = $this->shareManager->newShare(); $share1->setNode($node) @@ -537,7 +537,7 @@ class ApiTest extends TestCase { * @medium * @depends testCreateShareUserFile */ - public function testGetShareFromId() { + public function testGetShareFromId(): void { $node = $this->userFolder->get($this->filename); $share1 = $this->shareManager->newShare(); $share1->setNode($node) @@ -561,7 +561,7 @@ class ApiTest extends TestCase { /** * @medium */ - public function testGetShareFromFolder() { + public function testGetShareFromFolder(): void { $node1 = $this->userFolder->get($this->filename); $share1 = $this->shareManager->newShare(); $share1->setNode($node1) @@ -591,7 +591,7 @@ class ApiTest extends TestCase { $this->shareManager->deleteShare($share2); } - public function testGetShareFromFolderWithFile() { + public function testGetShareFromFolderWithFile(): void { $node1 = $this->userFolder->get($this->filename); $share1 = $this->shareManager->newShare(); $share1->setNode($node1) @@ -617,7 +617,7 @@ class ApiTest extends TestCase { * share a folder, than reshare a file within the shared folder and check if we construct the correct path * @medium */ - public function testGetShareFromFolderReshares() { + public function testGetShareFromFolderReshares(): void { $node1 = $this->userFolder->get($this->folder); $share1 = $this->shareManager->newShare(); $share1->setNode($node1) @@ -677,7 +677,7 @@ class ApiTest extends TestCase { * reshare a sub folder and check if we get the correct path * @medium */ - public function testGetShareFromSubFolderReShares() { + public function testGetShareFromSubFolderReShares(): void { $node1 = $this->userFolder->get($this->folder . $this->subfolder); $share1 = $this->shareManager->newShare(); $share1->setNode($node1) @@ -796,7 +796,7 @@ class ApiTest extends TestCase { * test multiple shared folder if the path gets constructed correctly * @medium */ - public function testGetShareMultipleSharedFolder() { + public function testGetShareMultipleSharedFolder(): void { $this->setUp(); $node1 = $this->userFolder->get($this->folder . $this->subfolder); $share1 = $this->shareManager->newShare(); @@ -861,7 +861,7 @@ class ApiTest extends TestCase { * test re-re-share of folder if the path gets constructed correctly * @medium */ - public function testGetShareFromFileReReShares() { + public function testGetShareFromFileReReShares(): void { $node1 = $this->userFolder->get($this->folder . $this->subfolder); $share1 = $this->shareManager->newShare(); $share1->setNode($node1) @@ -916,7 +916,7 @@ class ApiTest extends TestCase { /** * @medium */ - public function testGetShareFromUnknownId() { + public function testGetShareFromUnknownId(): void { $ocs = $this->createOCS(self::TEST_FILES_SHARING_API_USER3); try { $ocs->getShare(0); @@ -932,7 +932,7 @@ class ApiTest extends TestCase { * @depends testCreateShareUserFile * @depends testCreateShareLink */ - public function testUpdateShare() { + public function testUpdateShare(): void { $password = md5(time()); $node1 = $this->userFolder->get($this->filename); @@ -992,7 +992,7 @@ class ApiTest extends TestCase { /** * @medium */ - public function testUpdateShareUpload() { + public function testUpdateShareUpload(): void { $node1 = $this->userFolder->get($this->folder); $share1 = $this->shareManager->newShare(); $share1->setNode($node1) @@ -1023,7 +1023,7 @@ class ApiTest extends TestCase { /** * @medium */ - public function testUpdateShareExpireDate() { + public function testUpdateShareExpireDate(): void { $node1 = $this->userFolder->get($this->folder); $share1 = $this->shareManager->newShare(); $share1->setNode($node1) @@ -1096,7 +1096,7 @@ class ApiTest extends TestCase { * @medium * @depends testCreateShareUserFile */ - public function testDeleteShare() { + public function testDeleteShare(): void { $node1 = $this->userFolder->get($this->filename); $share1 = $this->shareManager->newShare(); $share1->setNode($node1) @@ -1128,7 +1128,7 @@ class ApiTest extends TestCase { /** * test unshare of a reshared file */ - public function testDeleteReshare() { + public function testDeleteReshare(): void { $node1 = $this->userFolder->get($this->folder); $share1 = $this->shareManager->newShare(); $share1->setNode($node1) @@ -1163,7 +1163,7 @@ class ApiTest extends TestCase { /** * share a folder which contains a share mount point, should be forbidden */ - public function testShareFolderWithAMountPoint() { + public function testShareFolderWithAMountPoint(): void { // user 1 shares a folder with user2 self::loginHelper(self::TEST_FILES_SHARING_API_USER1); @@ -1230,7 +1230,7 @@ class ApiTest extends TestCase { /** * Tests mounting a folder that is an external storage mount point. */ - public function testShareStorageMountPoint() { + public function testShareStorageMountPoint(): void { $tempStorage = new \OC\Files\Storage\Temporary([]); $tempStorage->file_put_contents('test.txt', 'abcdef'); $tempStorage->getScanner()->scan(''); @@ -1286,7 +1286,7 @@ class ApiTest extends TestCase { * @dataProvider datesProvider * @group RoutingWeirdness */ - public function testPublicLinkExpireDate($date, $valid) { + public function testPublicLinkExpireDate($date, $valid): void { $ocs = $this->createOCS(self::TEST_FILES_SHARING_API_USER1); try { @@ -1318,7 +1318,7 @@ class ApiTest extends TestCase { /** * @group RoutingWeirdness */ - public function testCreatePublicLinkExpireDateValid() { + public function testCreatePublicLinkExpireDateValid(): void { $config = \OC::$server->getConfig(); // enforce expire date, by default 7 days after the file was shared @@ -1350,7 +1350,7 @@ class ApiTest extends TestCase { $config->setAppValue('core', 'shareapi_enforce_expire_date', 'no'); } - public function testCreatePublicLinkExpireDateInvalidFuture() { + public function testCreatePublicLinkExpireDateInvalidFuture(): void { $config = \OC::$server->getConfig(); // enforce expire date, by default 7 days after the file was shared @@ -1400,7 +1400,7 @@ class ApiTest extends TestCase { * test for no invisible shares * See: https://github.com/owncloud/core/issues/22295 */ - public function testInvisibleSharesUser() { + public function testInvisibleSharesUser(): void { // simulate a post request $ocs = $this->createOCS(self::TEST_FILES_SHARING_API_USER1); $result = $ocs->createShare($this->folder, \OCP\Constants::PERMISSION_ALL, IShare::TYPE_USER, self::TEST_FILES_SHARING_API_USER2); @@ -1432,7 +1432,7 @@ class ApiTest extends TestCase { * test for no invisible shares * See: https://github.com/owncloud/core/issues/22295 */ - public function testInvisibleSharesGroup() { + public function testInvisibleSharesGroup(): void { // simulate a post request $ocs = $this->createOCS(self::TEST_FILES_SHARING_API_USER1); $result = $ocs->createShare($this->folder, \OCP\Constants::PERMISSION_ALL, IShare::TYPE_GROUP, self::TEST_FILES_SHARING_API_GROUP1); diff --git a/apps/files_sharing/tests/CacheTest.php b/apps/files_sharing/tests/CacheTest.php index 9f4a4b9e2ea..4db3adf34a6 100644 --- a/apps/files_sharing/tests/CacheTest.php +++ b/apps/files_sharing/tests/CacheTest.php @@ -188,7 +188,7 @@ class CacheTest extends TestCase { * we cannot use a dataProvider because that would cause the stray hook detection to remove the hooks * that were added in setUpBeforeClass. */ - public function testSearch() { + public function testSearch(): void { foreach ($this->searchDataProvider() as $data) { [$pattern, $expectedFiles] = $data; @@ -200,7 +200,7 @@ class CacheTest extends TestCase { /** * Test searching by mime type */ - public function testSearchByMime() { + public function testSearchByMime(): void { $results = $this->sharedStorage->getCache()->searchByMime('text'); $check = [ [ @@ -219,7 +219,7 @@ class CacheTest extends TestCase { $this->verifyFiles($check, $results); } - public function testGetFolderContentsInRoot() { + public function testGetFolderContentsInRoot(): void { $results = $this->user2View->getDirectoryContent('/'); $results = (array_filter($results, function ($file) { return $file->getName() !== 'welcome.txt'; @@ -249,7 +249,7 @@ class CacheTest extends TestCase { ); } - public function testGetFolderContentsInSubdir() { + public function testGetFolderContentsInSubdir(): void { $results = $this->user2View->getDirectoryContent('/shareddir'); $this->verifyFiles( @@ -287,7 +287,7 @@ class CacheTest extends TestCase { * * https://github.com/nextcloud/server/issues/39879 */ - public function testShareRenameOriginalFileInRecentResults() { + public function testShareRenameOriginalFileInRecentResults(): void { self::loginHelper(self::TEST_FILES_SHARING_API_USER1); $rootFolder = \OC::$server->getUserFolder(self::TEST_FILES_SHARING_API_USER1); @@ -316,7 +316,7 @@ class CacheTest extends TestCase { }, $recents)); } - public function testGetFolderContentsWhenSubSubdirShared() { + public function testGetFolderContentsWhenSubSubdirShared(): void { self::loginHelper(self::TEST_FILES_SHARING_API_USER1); $rootFolder = \OC::$server->getUserFolder(self::TEST_FILES_SHARING_API_USER1); @@ -400,7 +400,7 @@ class CacheTest extends TestCase { } } - public function testGetPathByIdDirectShare() { + public function testGetPathByIdDirectShare(): void { self::loginHelper(self::TEST_FILES_SHARING_API_USER1); \OC\Files\Filesystem::file_put_contents('test.txt', 'foo'); $info = \OC\Files\Filesystem::getFileInfo('test.txt'); @@ -430,7 +430,7 @@ class CacheTest extends TestCase { $this->assertEquals('', $sharedCache->getPathById($info->getId())); } - public function testGetPathByIdShareSubFolder() { + public function testGetPathByIdShareSubFolder(): void { self::loginHelper(self::TEST_FILES_SHARING_API_USER1); \OC\Files\Filesystem::mkdir('foo'); \OC\Files\Filesystem::mkdir('foo/bar'); @@ -463,7 +463,7 @@ class CacheTest extends TestCase { $this->assertEquals('bar/test.txt', $sharedCache->getPathById($fileInfo->getId())); } - public function testNumericStorageId() { + public function testNumericStorageId(): void { self::loginHelper(self::TEST_FILES_SHARING_API_USER1); \OC\Files\Filesystem::mkdir('foo'); @@ -490,7 +490,7 @@ class CacheTest extends TestCase { $this->assertEquals($sourceStorage->getCache()->getNumericStorageId(), $sharedStorage->getCache()->getNumericStorageId()); } - public function testShareJailedStorage() { + public function testShareJailedStorage(): void { $sourceStorage = new Temporary(); $sourceStorage->mkdir('jail'); $sourceStorage->mkdir('jail/sub'); @@ -529,7 +529,7 @@ class CacheTest extends TestCase { $this->assertTrue($sourceStorage->getCache()->inCache('jail/sub/bar.txt')); } - public function testSearchShareJailedStorage() { + public function testSearchShareJailedStorage(): void { $sourceStorage = new Temporary(); $sourceStorage->mkdir('jail'); $sourceStorage->mkdir('jail/sub'); diff --git a/apps/files_sharing/tests/CapabilitiesTest.php b/apps/files_sharing/tests/CapabilitiesTest.php index 69911100f56..c188cbfdfcc 100644 --- a/apps/files_sharing/tests/CapabilitiesTest.php +++ b/apps/files_sharing/tests/CapabilitiesTest.php @@ -81,7 +81,7 @@ class CapabilitiesTest extends \Test\TestCase { return $result; } - public function testEnabledSharingAPI() { + public function testEnabledSharingAPI(): void { $map = [ ['core', 'shareapi_enabled', 'yes', 'yes'], ]; @@ -92,7 +92,7 @@ class CapabilitiesTest extends \Test\TestCase { $this->assertArrayHasKey('resharing', $result); } - public function testDisabledSharingAPI() { + public function testDisabledSharingAPI(): void { $map = [ ['core', 'shareapi_enabled', 'yes', 'no'], ]; @@ -103,7 +103,7 @@ class CapabilitiesTest extends \Test\TestCase { $this->assertFalse($result['resharing']); } - public function testNoLinkSharing() { + public function testNoLinkSharing(): void { $map = [ ['core', 'shareapi_enabled', 'yes', 'yes'], ['core', 'shareapi_allow_links', 'yes', 'no'], @@ -113,7 +113,7 @@ class CapabilitiesTest extends \Test\TestCase { $this->assertFalse($result['public']['enabled']); } - public function testOnlyLinkSharing() { + public function testOnlyLinkSharing(): void { $map = [ ['core', 'shareapi_enabled', 'yes', 'yes'], ['core', 'shareapi_allow_links', 'yes', 'yes'], @@ -124,7 +124,7 @@ class CapabilitiesTest extends \Test\TestCase { $this->assertTrue($result['public']['enabled']); } - public function testLinkPassword() { + public function testLinkPassword(): void { $map = [ ['core', 'shareapi_enabled', 'yes', 'yes'], ['core', 'shareapi_allow_links', 'yes', 'yes'], @@ -137,7 +137,7 @@ class CapabilitiesTest extends \Test\TestCase { $this->assertTrue($result['public']['password']['enforced']); } - public function testLinkNoPassword() { + public function testLinkNoPassword(): void { $map = [ ['core', 'shareapi_enabled', 'yes', 'yes'], ['core', 'shareapi_allow_links', 'yes', 'yes'], @@ -150,7 +150,7 @@ class CapabilitiesTest extends \Test\TestCase { $this->assertFalse($result['public']['password']['enforced']); } - public function testLinkNoExpireDate() { + public function testLinkNoExpireDate(): void { $map = [ ['core', 'shareapi_enabled', 'yes', 'yes'], ['core', 'shareapi_allow_links', 'yes', 'yes'], @@ -163,7 +163,7 @@ class CapabilitiesTest extends \Test\TestCase { $this->assertFalse($result['public']['expire_date']['enabled']); } - public function testLinkExpireDate() { + public function testLinkExpireDate(): void { $map = [ ['core', 'shareapi_enabled', 'yes', 'yes'], ['core', 'shareapi_allow_links', 'yes', 'yes'], @@ -180,7 +180,7 @@ class CapabilitiesTest extends \Test\TestCase { $this->assertFalse($result['public']['expire_date']['enforced']); } - public function testLinkExpireDateEnforced() { + public function testLinkExpireDateEnforced(): void { $map = [ ['core', 'shareapi_enabled', 'yes', 'yes'], ['core', 'shareapi_allow_links', 'yes', 'yes'], @@ -194,7 +194,7 @@ class CapabilitiesTest extends \Test\TestCase { $this->assertTrue($result['public']['expire_date']['enforced']); } - public function testLinkSendMail() { + public function testLinkSendMail(): void { $map = [ ['core', 'shareapi_enabled', 'yes', 'yes'], ['core', 'shareapi_allow_links', 'yes', 'yes'], @@ -205,7 +205,7 @@ class CapabilitiesTest extends \Test\TestCase { $this->assertTrue($result['public']['send_mail']); } - public function testLinkNoSendMail() { + public function testLinkNoSendMail(): void { $map = [ ['core', 'shareapi_enabled', 'yes', 'yes'], ['core', 'shareapi_allow_links', 'yes', 'yes'], @@ -216,7 +216,7 @@ class CapabilitiesTest extends \Test\TestCase { $this->assertFalse($result['public']['send_mail']); } - public function testResharing() { + public function testResharing(): void { $map = [ ['core', 'shareapi_enabled', 'yes', 'yes'], ['core', 'shareapi_allow_resharing', 'yes', 'yes'], @@ -226,7 +226,7 @@ class CapabilitiesTest extends \Test\TestCase { $this->assertTrue($result['resharing']); } - public function testNoResharing() { + public function testNoResharing(): void { $map = [ ['core', 'shareapi_enabled', 'yes', 'yes'], ['core', 'shareapi_allow_resharing', 'yes', 'no'], @@ -236,7 +236,7 @@ class CapabilitiesTest extends \Test\TestCase { $this->assertFalse($result['resharing']); } - public function testLinkPublicUpload() { + public function testLinkPublicUpload(): void { $map = [ ['core', 'shareapi_enabled', 'yes', 'yes'], ['core', 'shareapi_allow_links', 'yes', 'yes'], @@ -248,7 +248,7 @@ class CapabilitiesTest extends \Test\TestCase { $this->assertTrue($result['public']['upload_files_drop']); } - public function testLinkNoPublicUpload() { + public function testLinkNoPublicUpload(): void { $map = [ ['core', 'shareapi_enabled', 'yes', 'yes'], ['core', 'shareapi_allow_links', 'yes', 'yes'], @@ -260,7 +260,7 @@ class CapabilitiesTest extends \Test\TestCase { $this->assertFalse($result['public']['upload_files_drop']); } - public function testNoGroupSharing() { + public function testNoGroupSharing(): void { $map = [ ['core', 'shareapi_enabled', 'yes', 'yes'], ['core', 'shareapi_allow_group_sharing', 'yes', 'no'], @@ -269,7 +269,7 @@ class CapabilitiesTest extends \Test\TestCase { $this->assertFalse($result['group_sharing']); } - public function testGroupSharing() { + public function testGroupSharing(): void { $map = [ ['core', 'shareapi_enabled', 'yes', 'yes'], ['core', 'shareapi_allow_group_sharing', 'yes', 'yes'], @@ -278,7 +278,7 @@ class CapabilitiesTest extends \Test\TestCase { $this->assertTrue($result['group_sharing']); } - public function testFederatedSharingIncoming() { + public function testFederatedSharingIncoming(): void { $map = [ ['files_sharing', 'incoming_server2server_share_enabled', 'yes', 'yes'], ]; @@ -287,7 +287,7 @@ class CapabilitiesTest extends \Test\TestCase { $this->assertTrue($result['federation']['incoming']); } - public function testFederatedSharingNoIncoming() { + public function testFederatedSharingNoIncoming(): void { $map = [ ['files_sharing', 'incoming_server2server_share_enabled', 'yes', 'no'], ]; @@ -296,7 +296,7 @@ class CapabilitiesTest extends \Test\TestCase { $this->assertFalse($result['federation']['incoming']); } - public function testFederatedSharingOutgoing() { + public function testFederatedSharingOutgoing(): void { $map = [ ['files_sharing', 'outgoing_server2server_share_enabled', 'yes', 'yes'], ]; @@ -305,7 +305,7 @@ class CapabilitiesTest extends \Test\TestCase { $this->assertTrue($result['federation']['outgoing']); } - public function testFederatedSharingNoOutgoing() { + public function testFederatedSharingNoOutgoing(): void { $map = [ ['files_sharing', 'outgoing_server2server_share_enabled', 'yes', 'no'], ]; @@ -314,7 +314,7 @@ class CapabilitiesTest extends \Test\TestCase { $this->assertFalse($result['federation']['outgoing']); } - public function testFederatedSharingExpirationDate() { + public function testFederatedSharingExpirationDate(): void { $result = $this->getResults([]); $this->assertArrayHasKey('federation', $result); $this->assertEquals(['enabled' => true], $result['federation']['expire_date']); diff --git a/apps/files_sharing/tests/Collaboration/ShareRecipientSorterTest.php b/apps/files_sharing/tests/Collaboration/ShareRecipientSorterTest.php index 309bb84d6df..83dde42f37b 100644 --- a/apps/files_sharing/tests/Collaboration/ShareRecipientSorterTest.php +++ b/apps/files_sharing/tests/Collaboration/ShareRecipientSorterTest.php @@ -38,7 +38,7 @@ class ShareRecipientSorterTest extends TestCase { * @dataProvider sortDataProvider * @param $data */ - public function testSort($data) { + public function testSort($data): void { $node = $this->createMock(Node::class); /** @var Folder|\PHPUnit\Framework\MockObject\MockObject $folder */ @@ -79,7 +79,7 @@ class ShareRecipientSorterTest extends TestCase { $this->assertEquals($data['expected'], $workArray); } - public function testSortNoNodes() { + public function testSortNoNodes(): void { /** @var Folder|\PHPUnit\Framework\MockObject\MockObject $folder */ $folder = $this->createMock(Folder::class); $this->rootFolder->expects($this->any()) diff --git a/apps/files_sharing/tests/Command/CleanupRemoteStoragesTest.php b/apps/files_sharing/tests/Command/CleanupRemoteStoragesTest.php index 803ee1d02c9..05b412a60b6 100644 --- a/apps/files_sharing/tests/Command/CleanupRemoteStoragesTest.php +++ b/apps/files_sharing/tests/Command/CleanupRemoteStoragesTest.php @@ -163,7 +163,7 @@ class CleanupRemoteStoragesTest extends TestCase { /** * Test cleanup of orphaned storages */ - public function testCleanup() { + public function testCleanup(): void { $input = $this->getMockBuilder(InputInterface::class) ->disableOriginalConstructor() ->getMock(); diff --git a/apps/files_sharing/tests/Controller/ExternalShareControllerTest.php b/apps/files_sharing/tests/Controller/ExternalShareControllerTest.php index 3b4173ba7fa..eac37a3f3a5 100644 --- a/apps/files_sharing/tests/Controller/ExternalShareControllerTest.php +++ b/apps/files_sharing/tests/Controller/ExternalShareControllerTest.php @@ -53,7 +53,7 @@ class ExternalShareControllerTest extends \Test\TestCase { ); } - public function testIndex() { + public function testIndex(): void { $this->externalManager ->expects($this->once()) ->method('getOpenShares') @@ -62,7 +62,7 @@ class ExternalShareControllerTest extends \Test\TestCase { $this->assertEquals(new JSONResponse(['MyDummyArray']), $this->getExternalShareController()->index()); } - public function testCreate() { + public function testCreate(): void { $this->externalManager ->expects($this->once()) ->method('acceptShare') @@ -71,7 +71,7 @@ class ExternalShareControllerTest extends \Test\TestCase { $this->assertEquals(new JSONResponse(), $this->getExternalShareController()->create(4)); } - public function testDestroy() { + public function testDestroy(): void { $this->externalManager ->expects($this->once()) ->method('declineShare') @@ -80,7 +80,7 @@ class ExternalShareControllerTest extends \Test\TestCase { $this->assertEquals(new JSONResponse(), $this->getExternalShareController()->destroy(4)); } - public function testRemoteWithValidHttps() { + public function testRemoteWithValidHttps(): void { $client = $this->createMock(IClient::class); $response = $this->createMock(IResponse::class); $response @@ -103,7 +103,7 @@ class ExternalShareControllerTest extends \Test\TestCase { $this->assertEquals(new DataResponse('https'), $this->getExternalShareController()->testRemote('nextcloud.com')); } - public function testRemoteWithWorkingHttp() { + public function testRemoteWithWorkingHttp(): void { $client = $this->createMock(IClient::class); $response = $this->createMock(IResponse::class); $client @@ -127,7 +127,7 @@ class ExternalShareControllerTest extends \Test\TestCase { $this->assertEquals(new DataResponse('http'), $this->getExternalShareController()->testRemote('nextcloud.com')); } - public function testRemoteWithInvalidRemote() { + public function testRemoteWithInvalidRemote(): void { $client = $this->createMock(IClient::class); $response = $this->createMock(IResponse::class); $client @@ -158,7 +158,7 @@ class ExternalShareControllerTest extends \Test\TestCase { * @dataProvider dataRemoteWithInvalidRemoteURLs * @param string $remote */ - public function testRemoteWithInvalidRemoteURLs(string $remote) { + public function testRemoteWithInvalidRemoteURLs(string $remote): void { $this->clientService ->expects($this->never()) ->method('newClient'); diff --git a/apps/files_sharing/tests/Controller/PublicPreviewControllerTest.php b/apps/files_sharing/tests/Controller/PublicPreviewControllerTest.php index d1e542cc5d9..700406c97ba 100644 --- a/apps/files_sharing/tests/Controller/PublicPreviewControllerTest.php +++ b/apps/files_sharing/tests/Controller/PublicPreviewControllerTest.php @@ -57,28 +57,28 @@ class PublicPreviewControllerTest extends TestCase { ); } - public function testInvalidToken() { + public function testInvalidToken(): void { $res = $this->controller->getPreview('', 'file', 10, 10, ''); $expected = new DataResponse([], Http::STATUS_BAD_REQUEST); $this->assertEquals($expected, $res); } - public function testInvalidWidth() { + public function testInvalidWidth(): void { $res = $this->controller->getPreview('token', 'file', 0); $expected = new DataResponse([], Http::STATUS_BAD_REQUEST); $this->assertEquals($expected, $res); } - public function testInvalidHeight() { + public function testInvalidHeight(): void { $res = $this->controller->getPreview('token', 'file', 10, 0); $expected = new DataResponse([], Http::STATUS_BAD_REQUEST); $this->assertEquals($expected, $res); } - public function testInvalidShare() { + public function testInvalidShare(): void { $this->shareManager->method('getShareByToken') ->with($this->equalTo('token')) ->willThrowException(new ShareNotFound()); @@ -89,7 +89,7 @@ class PublicPreviewControllerTest extends TestCase { $this->assertEquals($expected, $res); } - public function testShareNotAccessable() { + public function testShareNotAccessable(): void { $share = $this->createMock(IShare::class); $this->shareManager->method('getShareByToken') ->with($this->equalTo('token')) @@ -104,7 +104,7 @@ class PublicPreviewControllerTest extends TestCase { $this->assertEquals($expected, $res); } - public function testPreviewFile() { + public function testPreviewFile(): void { $share = $this->createMock(IShare::class); $this->shareManager->method('getShareByToken') ->with($this->equalTo('token')) @@ -133,7 +133,7 @@ class PublicPreviewControllerTest extends TestCase { $this->assertEquals($expected, $res); } - public function testPreviewFolderInvalidFile() { + public function testPreviewFolderInvalidFile(): void { $share = $this->createMock(IShare::class); $this->shareManager->method('getShareByToken') ->with($this->equalTo('token')) @@ -156,7 +156,7 @@ class PublicPreviewControllerTest extends TestCase { } - public function testPreviewFolderValidFile() { + public function testPreviewFolderValidFile(): void { $share = $this->createMock(IShare::class); $this->shareManager->method('getShareByToken') ->with($this->equalTo('token')) diff --git a/apps/files_sharing/tests/Controller/ShareAPIControllerTest.php b/apps/files_sharing/tests/Controller/ShareAPIControllerTest.php index fd1c60ff842..f28302b4ccd 100644 --- a/apps/files_sharing/tests/Controller/ShareAPIControllerTest.php +++ b/apps/files_sharing/tests/Controller/ShareAPIControllerTest.php @@ -174,7 +174,7 @@ class ShareAPIControllerTest extends TestCase { return [$shareAttributes, \json_encode($formattedShareAttributes)]; } - public function testDeleteShareShareNotFound() { + public function testDeleteShareShareNotFound(): void { $this->expectException(\OCP\AppFramework\OCS\OCSNotFoundException::class); $this->expectExceptionMessage('Wrong share ID, share does not exist'); @@ -194,7 +194,7 @@ class ShareAPIControllerTest extends TestCase { $this->ocs->deleteShare(42); } - public function testDeleteShare() { + public function testDeleteShare(): void { $node = $this->getMockBuilder(File::class)->getMock(); $share = $this->newShare(); @@ -222,7 +222,7 @@ class ShareAPIControllerTest extends TestCase { } - public function testDeleteShareLocked() { + public function testDeleteShareLocked(): void { $this->expectException(\OCP\AppFramework\OCS\OCSNotFoundException::class); $this->expectExceptionMessage('Could not delete share'); @@ -256,7 +256,7 @@ class ShareAPIControllerTest extends TestCase { /** * You can always remove a share that was shared with you */ - public function testDeleteShareWithMe() { + public function testDeleteShareWithMe(): void { $node = $this->getMockBuilder(File::class)->getMock(); $share = $this->newShare(); @@ -288,7 +288,7 @@ class ShareAPIControllerTest extends TestCase { /** * You can always delete a share you own */ - public function testDeleteShareOwner() { + public function testDeleteShareOwner(): void { $node = $this->getMockBuilder(File::class)->getMock(); $share = $this->newShare(); @@ -320,7 +320,7 @@ class ShareAPIControllerTest extends TestCase { * You can always delete a share when you own * the file path it belong to */ - public function testDeleteShareFileOwner() { + public function testDeleteShareFileOwner(): void { $node = $this->getMockBuilder(File::class)->getMock(); $node->method('getId')->willReturn(1); @@ -353,7 +353,7 @@ class ShareAPIControllerTest extends TestCase { * You can remove (the mountpoint, not the share) * a share if you're in the group the share is shared with */ - public function testDeleteSharedWithMyGroup() { + public function testDeleteSharedWithMyGroup(): void { $node = $this->getMockBuilder(File::class)->getMock(); $node->method('getId')->willReturn(1); @@ -413,7 +413,7 @@ class ShareAPIControllerTest extends TestCase { * You cannot remove a share if you're not * in the group the share is shared with */ - public function testDeleteSharedWithGroupIDontBelongTo() { + public function testDeleteSharedWithGroupIDontBelongTo(): void { $this->expectException(\OCP\AppFramework\OCS\OCSNotFoundException::class); $this->expectExceptionMessage('Wrong share ID, share does not exist'); @@ -730,7 +730,7 @@ class ShareAPIControllerTest extends TestCase { /** * @dataProvider dataGetShare */ - public function testGetShare(\OCP\Share\IShare $share, array $result) { + public function testGetShare(\OCP\Share\IShare $share, array $result): void { /** @var ShareAPIController|\PHPUnit\Framework\MockObject\MockObject $ocs */ $ocs = $this->getMockBuilder(ShareAPIController::class) ->setConstructorArgs([ @@ -819,7 +819,7 @@ class ShareAPIControllerTest extends TestCase { } - public function testGetShareInvalidNode() { + public function testGetShareInvalidNode(): void { $this->expectException(\OCP\AppFramework\OCS\OCSNotFoundException::class); $this->expectExceptionMessage('Wrong share ID, share does not exist'); @@ -1364,7 +1364,7 @@ class ShareAPIControllerTest extends TestCase { /** * @dataProvider dataGetShares */ - public function testGetShares(array $getSharesParameters, array $shares, array $extraShareTypes, array $expected) { + public function testGetShares(array $getSharesParameters, array $shares, array $extraShareTypes, array $expected): void { /** @var \OCA\Files_Sharing\Controller\ShareAPIController $ocs */ $ocs = $this->getMockBuilder(ShareAPIController::class) ->setConstructorArgs([ @@ -1445,7 +1445,7 @@ class ShareAPIControllerTest extends TestCase { $this->assertEquals($expected, $result->getData()); } - public function testCanAccessShare() { + public function testCanAccessShare(): void { $share = $this->getMockBuilder(IShare::class)->getMock(); $share->method('getShareOwner')->willReturn($this->currentUser); $this->assertTrue($this->invokePrivate($this->ocs, 'canAccessShare', [$share])); @@ -1556,7 +1556,7 @@ class ShareAPIControllerTest extends TestCase { * @param bool helperAvailable * @param bool canAccessShareByHelper */ - public function testCanAccessRoomShare(bool $expected, \OCP\Share\IShare $share, bool $helperAvailable, bool $canAccessShareByHelper) { + public function testCanAccessRoomShare(bool $expected, \OCP\Share\IShare $share, bool $helperAvailable, bool $canAccessShareByHelper): void { $userFolder = $this->getMockBuilder(Folder::class)->getMock(); $this->rootFolder->method('getUserFolder') ->with($this->currentUser) @@ -1591,7 +1591,7 @@ class ShareAPIControllerTest extends TestCase { } - public function testCreateShareNoPath() { + public function testCreateShareNoPath(): void { $this->expectException(\OCP\AppFramework\OCS\OCSNotFoundException::class); $this->expectExceptionMessage('Please specify a file or folder path'); @@ -1599,7 +1599,7 @@ class ShareAPIControllerTest extends TestCase { } - public function testCreateShareInvalidPath() { + public function testCreateShareInvalidPath(): void { $this->expectException(\OCP\AppFramework\OCS\OCSNotFoundException::class); $this->expectExceptionMessage('Wrong path, file/folder does not exist'); @@ -1618,7 +1618,7 @@ class ShareAPIControllerTest extends TestCase { } - public function testCreateShareInvalidPermissions() { + public function testCreateShareInvalidPermissions(): void { $this->expectException(\OCP\AppFramework\OCS\OCSNotFoundException::class); $this->expectExceptionMessage('Invalid permissions'); @@ -1647,7 +1647,7 @@ class ShareAPIControllerTest extends TestCase { } - public function testCreateShareUserNoShareWith() { + public function testCreateShareUserNoShareWith(): void { $this->expectException(\OCP\AppFramework\OCS\OCSNotFoundException::class); $this->expectExceptionMessage('Please specify a valid account to share with'); @@ -1675,7 +1675,7 @@ class ShareAPIControllerTest extends TestCase { } - public function testCreateShareUserNoValidShareWith() { + public function testCreateShareUserNoValidShareWith(): void { $this->expectException(\OCP\AppFramework\OCS\OCSNotFoundException::class); $this->expectExceptionMessage('Please specify a valid account to share with'); @@ -1704,7 +1704,7 @@ class ShareAPIControllerTest extends TestCase { $this->ocs->createShare('valid-path', \OCP\Constants::PERMISSION_ALL, IShare::TYPE_USER, 'invalidUser'); } - public function testCreateShareUser() { + public function testCreateShareUser(): void { $share = $this->newShare(); $this->shareManager->method('newShare')->willReturn($share); @@ -1773,7 +1773,7 @@ class ShareAPIControllerTest extends TestCase { } - public function testCreateShareGroupNoValidShareWith() { + public function testCreateShareGroupNoValidShareWith(): void { $this->expectException(\OCP\AppFramework\OCS\OCSNotFoundException::class); $this->expectExceptionMessage('Please specify a valid group'); @@ -1802,7 +1802,7 @@ class ShareAPIControllerTest extends TestCase { $this->ocs->createShare('valid-path', \OCP\Constants::PERMISSION_ALL, IShare::TYPE_GROUP, 'invalidGroup'); } - public function testCreateShareGroup() { + public function testCreateShareGroup(): void { $share = $this->newShare(); $this->shareManager->method('newShare')->willReturn($share); @@ -1880,7 +1880,7 @@ class ShareAPIControllerTest extends TestCase { } - public function testCreateShareGroupNotAllowed() { + public function testCreateShareGroupNotAllowed(): void { $this->expectException(\OCP\AppFramework\OCS\OCSNotFoundException::class); $this->expectExceptionMessage('Group sharing is disabled by the administrator'); @@ -1910,7 +1910,7 @@ class ShareAPIControllerTest extends TestCase { } - public function testCreateShareLinkNoLinksAllowed() { + public function testCreateShareLinkNoLinksAllowed(): void { $this->expectException(\OCP\AppFramework\OCS\OCSNotFoundException::class); $this->expectExceptionMessage('Public link sharing is disabled by the administrator'); @@ -1941,7 +1941,7 @@ class ShareAPIControllerTest extends TestCase { } - public function testCreateShareLinkNoPublicUpload() { + public function testCreateShareLinkNoPublicUpload(): void { $this->expectException(\OCP\AppFramework\OCS\OCSForbiddenException::class); $this->expectExceptionMessage('Public upload disabled by the administrator'); @@ -1966,7 +1966,7 @@ class ShareAPIControllerTest extends TestCase { } - public function testCreateShareLinkPublicUploadFile() { + public function testCreateShareLinkPublicUploadFile(): void { $this->expectException(\OCP\AppFramework\OCS\OCSNotFoundException::class); $this->expectExceptionMessage('Public upload is only possible for publicly shared folders'); @@ -1991,7 +1991,7 @@ class ShareAPIControllerTest extends TestCase { $this->ocs->createShare('valid-path', \OCP\Constants::PERMISSION_ALL, IShare::TYPE_LINK, null, 'true'); } - public function testCreateShareLinkPublicUploadFolder() { + public function testCreateShareLinkPublicUploadFolder(): void { $ocs = $this->mockFormatShare(); $path = $this->getMockBuilder(Folder::class)->getMock(); @@ -2030,7 +2030,7 @@ class ShareAPIControllerTest extends TestCase { $this->assertEquals($expected->getData(), $result->getData()); } - public function testCreateShareLinkPassword() { + public function testCreateShareLinkPassword(): void { $ocs = $this->mockFormatShare(); $path = $this->getMockBuilder(Folder::class)->getMock(); @@ -2069,7 +2069,7 @@ class ShareAPIControllerTest extends TestCase { $this->assertEquals($expected->getData(), $result->getData()); } - public function testCreateShareLinkSendPasswordByTalk() { + public function testCreateShareLinkSendPasswordByTalk(): void { $ocs = $this->mockFormatShare(); $path = $this->getMockBuilder(Folder::class)->getMock(); @@ -2112,7 +2112,7 @@ class ShareAPIControllerTest extends TestCase { } - public function testCreateShareLinkSendPasswordByTalkWithTalkDisabled() { + public function testCreateShareLinkSendPasswordByTalkWithTalkDisabled(): void { $this->expectException(\OCP\AppFramework\OCS\OCSForbiddenException::class); $this->expectExceptionMessage('Sharing valid-path sending the password by Nextcloud Talk failed because Nextcloud Talk is not enabled'); @@ -2144,7 +2144,7 @@ class ShareAPIControllerTest extends TestCase { $ocs->createShare('valid-path', \OCP\Constants::PERMISSION_ALL, IShare::TYPE_LINK, null, 'false', 'password', 'true', ''); } - public function testCreateShareValidExpireDate() { + public function testCreateShareValidExpireDate(): void { $ocs = $this->mockFormatShare(); $this->request @@ -2197,7 +2197,7 @@ class ShareAPIControllerTest extends TestCase { } - public function testCreateShareInvalidExpireDate() { + public function testCreateShareInvalidExpireDate(): void { $this->expectException(\OCP\AppFramework\OCS\OCSNotFoundException::class); $this->expectExceptionMessage('Invalid date, date format must be YYYY-MM-DD'); @@ -2224,7 +2224,7 @@ class ShareAPIControllerTest extends TestCase { $ocs->createShare('valid-path', \OCP\Constants::PERMISSION_ALL, IShare::TYPE_LINK, null, 'false', '', null, 'a1b2d3'); } - public function testCreateShareRemote() { + public function testCreateShareRemote(): void { $share = $this->newShare(); $this->shareManager->method('newShare')->willReturn($share); @@ -2294,7 +2294,7 @@ class ShareAPIControllerTest extends TestCase { $this->assertEquals($expected->getData(), $result->getData()); } - public function testCreateShareRemoteGroup() { + public function testCreateShareRemoteGroup(): void { $share = $this->newShare(); $this->shareManager->method('newShare')->willReturn($share); @@ -2364,7 +2364,7 @@ class ShareAPIControllerTest extends TestCase { $this->assertEquals($expected->getData(), $result->getData()); } - public function testCreateShareRoom() { + public function testCreateShareRoom(): void { $ocs = $this->mockFormatShare(); $share = $this->newShare(); @@ -2439,7 +2439,7 @@ class ShareAPIControllerTest extends TestCase { } - public function testCreateShareRoomHelperNotAvailable() { + public function testCreateShareRoomHelperNotAvailable(): void { $this->expectException(\OCP\AppFramework\OCS\OCSForbiddenException::class); $this->expectExceptionMessage('Sharing valid-path failed because the back end does not support room shares'); @@ -2476,7 +2476,7 @@ class ShareAPIControllerTest extends TestCase { } - public function testCreateShareRoomHelperThrowException() { + public function testCreateShareRoomHelperThrowException(): void { $this->expectException(\OCP\AppFramework\OCS\OCSNotFoundException::class); $this->expectExceptionMessage('Exception thrown by the helper'); @@ -2537,7 +2537,7 @@ class ShareAPIControllerTest extends TestCase { * Test for https://github.com/owncloud/core/issues/22587 * TODO: Remove once proper solution is in place */ - public function testCreateReshareOfFederatedMountNoDeletePermissions() { + public function testCreateReshareOfFederatedMountNoDeletePermissions(): void { $share = \OC::$server->getShareManager()->newShare(); $this->shareManager->method('newShare')->willReturn($share); @@ -2605,7 +2605,7 @@ class ShareAPIControllerTest extends TestCase { } - public function testUpdateShareCantAccess() { + public function testUpdateShareCantAccess(): void { $this->expectException(\OCP\AppFramework\OCS\OCSNotFoundException::class); $this->expectExceptionMessage('Wrong share ID, share does not exist'); @@ -2631,7 +2631,7 @@ class ShareAPIControllerTest extends TestCase { } - public function testUpdateNoParametersLink() { + public function testUpdateNoParametersLink(): void { $this->expectException(\OCP\AppFramework\OCS\OCSBadRequestException::class); $this->expectExceptionMessage('Wrong or no update parameter given'); @@ -2652,7 +2652,7 @@ class ShareAPIControllerTest extends TestCase { } - public function testUpdateNoParametersOther() { + public function testUpdateNoParametersOther(): void { $this->expectException(\OCP\AppFramework\OCS\OCSBadRequestException::class); $this->expectExceptionMessage('Wrong or no update parameter given'); @@ -2672,7 +2672,7 @@ class ShareAPIControllerTest extends TestCase { $this->ocs->updateShare(42); } - public function testUpdateLinkShareClear() { + public function testUpdateLinkShareClear(): void { $ocs = $this->mockFormatShare(); [$userFolder, $node] = $this->getNonSharedUserFolder(); @@ -2733,7 +2733,7 @@ class ShareAPIControllerTest extends TestCase { $this->assertEquals($expected->getData(), $result->getData()); } - public function testUpdateLinkShareSet() { + public function testUpdateLinkShareSet(): void { $ocs = $this->mockFormatShare(); [$userFolder, $folder] = $this->getNonSharedUserFolder(); @@ -2790,7 +2790,7 @@ class ShareAPIControllerTest extends TestCase { /** * @dataProvider publicUploadParamsProvider */ - public function testUpdateLinkShareEnablePublicUpload($permissions, $publicUpload, $expireDate, $password) { + public function testUpdateLinkShareEnablePublicUpload($permissions, $publicUpload, $expireDate, $password): void { $ocs = $this->mockFormatShare(); [$userFolder, $folder] = $this->getNonSharedUserFolder(); @@ -2851,7 +2851,7 @@ class ShareAPIControllerTest extends TestCase { /** * @dataProvider publicLinkValidPermissionsProvider */ - public function testUpdateLinkShareSetCRUDPermissions($permissions) { + public function testUpdateLinkShareSetCRUDPermissions($permissions): void { $ocs = $this->mockFormatShare(); [$userFolder, $folder] = $this->getNonSharedUserFolder(); @@ -2906,7 +2906,7 @@ class ShareAPIControllerTest extends TestCase { /** * @dataProvider publicLinkInvalidPermissionsProvider1 */ - public function testUpdateLinkShareSetInvalidCRUDPermissions1($permissions) { + public function testUpdateLinkShareSetInvalidCRUDPermissions1($permissions): void { $this->expectException(\OCP\AppFramework\OCS\OCSBadRequestException::class); $this->expectExceptionMessage('Share must at least have READ or CREATE permissions'); @@ -2923,14 +2923,14 @@ class ShareAPIControllerTest extends TestCase { /** * @dataProvider publicLinkInvalidPermissionsProvider2 */ - public function testUpdateLinkShareSetInvalidCRUDPermissions2($permissions) { + public function testUpdateLinkShareSetInvalidCRUDPermissions2($permissions): void { $this->expectException(\OCP\AppFramework\OCS\OCSBadRequestException::class); $this->expectExceptionMessage('Share must have READ permission if UPDATE or DELETE permission is set'); $this->testUpdateLinkShareSetCRUDPermissions($permissions); } - public function testUpdateLinkShareInvalidDate() { + public function testUpdateLinkShareInvalidDate(): void { $this->expectException(\OCP\AppFramework\OCS\OCSBadRequestException::class); $this->expectExceptionMessage('Invalid date. Format must be YYYY-MM-DD'); @@ -2977,7 +2977,7 @@ class ShareAPIControllerTest extends TestCase { /** * @dataProvider publicUploadParamsProvider */ - public function testUpdateLinkSharePublicUploadNotAllowed($permissions, $publicUpload, $expireDate, $password) { + public function testUpdateLinkSharePublicUploadNotAllowed($permissions, $publicUpload, $expireDate, $password): void { $this->expectException(\OCP\AppFramework\OCS\OCSForbiddenException::class); $this->expectExceptionMessage('Public upload disabled by the administrator'); @@ -3005,7 +3005,7 @@ class ShareAPIControllerTest extends TestCase { } - public function testUpdateLinkSharePublicUploadOnFile() { + public function testUpdateLinkSharePublicUploadOnFile(): void { $this->expectException(\OCP\AppFramework\OCS\OCSBadRequestException::class); $this->expectExceptionMessage('Public upload is only possible for publicly shared folders'); @@ -3086,7 +3086,7 @@ class ShareAPIControllerTest extends TestCase { $this->assertEquals($expected->getData(), $result->getData()); } - public function testUpdateLinkShareSendPasswordByTalkDoesNotChangeOther() { + public function testUpdateLinkShareSendPasswordByTalkDoesNotChangeOther(): void { $ocs = $this->mockFormatShare(); $date = new \DateTime('2000-01-01'); @@ -3141,7 +3141,7 @@ class ShareAPIControllerTest extends TestCase { } - public function testUpdateLinkShareSendPasswordByTalkWithTalkDisabledDoesNotChangeOther() { + public function testUpdateLinkShareSendPasswordByTalkWithTalkDisabledDoesNotChangeOther(): void { $this->expectException(\OCP\AppFramework\OCS\OCSForbiddenException::class); $this->expectExceptionMessage('"Sending the password by Nextcloud Talk" for sharing a file or folder failed because Nextcloud Talk is not enabled.'); @@ -3184,7 +3184,7 @@ class ShareAPIControllerTest extends TestCase { $ocs->updateShare(42, null, null, 'true', null, null, null, null, null); } - public function testUpdateLinkShareDoNotSendPasswordByTalkDoesNotChangeOther() { + public function testUpdateLinkShareDoNotSendPasswordByTalkDoesNotChangeOther(): void { $ocs = $this->mockFormatShare(); $date = new \DateTime('2000-01-01'); @@ -3238,7 +3238,7 @@ class ShareAPIControllerTest extends TestCase { $this->assertEquals($expected->getData(), $result->getData()); } - public function testUpdateLinkShareDoNotSendPasswordByTalkWithTalkDisabledDoesNotChangeOther() { + public function testUpdateLinkShareDoNotSendPasswordByTalkWithTalkDisabledDoesNotChangeOther(): void { $ocs = $this->mockFormatShare(); $date = new \DateTime('2000-01-01'); @@ -3308,7 +3308,7 @@ class ShareAPIControllerTest extends TestCase { $this->assertEquals($expected->getData(), $result->getData()); } - public function testUpdateLinkShareExpireDateDoesNotChangeOther() { + public function testUpdateLinkShareExpireDateDoesNotChangeOther(): void { $ocs = $this->mockFormatShare(); [$userFolder, $node] = $this->getNonSharedUserFolder(); @@ -3370,7 +3370,7 @@ class ShareAPIControllerTest extends TestCase { $this->assertEquals($expected->getData(), $result->getData()); } - public function testUpdateLinkSharePublicUploadDoesNotChangeOther() { + public function testUpdateLinkSharePublicUploadDoesNotChangeOther(): void { $ocs = $this->mockFormatShare(); $date = new \DateTime('2000-01-01'); @@ -3431,7 +3431,7 @@ class ShareAPIControllerTest extends TestCase { $this->assertEquals($expected->getData(), $result->getData()); } - public function testUpdateLinkSharePermissions() { + public function testUpdateLinkSharePermissions(): void { $ocs = $this->mockFormatShare(); $date = new \DateTime('2000-01-01'); @@ -3491,7 +3491,7 @@ class ShareAPIControllerTest extends TestCase { $this->assertEquals($expected->getData(), $result->getData()); } - public function testUpdateLinkSharePermissionsShare() { + public function testUpdateLinkSharePermissionsShare(): void { $ocs = $this->mockFormatShare(); $date = new \DateTime('2000-01-01'); @@ -3551,7 +3551,7 @@ class ShareAPIControllerTest extends TestCase { $this->assertEquals($expected->getData(), $result->getData()); } - public function testUpdateOtherPermissions() { + public function testUpdateOtherPermissions(): void { $ocs = $this->mockFormatShare(); [$userFolder, $file] = $this->getNonSharedUserFolder(); @@ -3597,7 +3597,7 @@ class ShareAPIControllerTest extends TestCase { $this->assertEquals($expected->getData(), $result->getData()); } - public function testUpdateShareCannotIncreasePermissions() { + public function testUpdateShareCannotIncreasePermissions(): void { $ocs = $this->mockFormatShare(); [$userFolder, $folder] = $this->getNonSharedUserFolder(); @@ -3669,7 +3669,7 @@ class ShareAPIControllerTest extends TestCase { } } - public function testUpdateShareCanIncreasePermissionsIfOwner() { + public function testUpdateShareCanIncreasePermissionsIfOwner(): void { $ocs = $this->mockFormatShare(); [$userFolder, $folder] = $this->getNonSharedUserFolder(); @@ -4665,7 +4665,7 @@ class ShareAPIControllerTest extends TestCase { * @param array $users * @param $exception */ - public function testFormatShare(array $expects, \OCP\Share\IShare $share, array $users, $exception) { + public function testFormatShare(array $expects, \OCP\Share\IShare $share, array $users, $exception): void { $this->userManager->method('get')->willReturnMap($users); $recipientGroup = $this->createMock(IGroup::class); @@ -4882,7 +4882,7 @@ class ShareAPIControllerTest extends TestCase { * @param bool $helperAvailable * @param array $formatShareByHelper */ - public function testFormatRoomShare(array $expects, \OCP\Share\IShare $share, bool $helperAvailable, array $formatShareByHelper) { + public function testFormatRoomShare(array $expects, \OCP\Share\IShare $share, bool $helperAvailable, array $formatShareByHelper): void { $this->rootFolder->method('getUserFolder') ->with($this->currentUser) ->willReturnSelf(); diff --git a/apps/files_sharing/tests/Controller/ShareControllerTest.php b/apps/files_sharing/tests/Controller/ShareControllerTest.php index 09b02be5f66..cfe9d935f7f 100644 --- a/apps/files_sharing/tests/Controller/ShareControllerTest.php +++ b/apps/files_sharing/tests/Controller/ShareControllerTest.php @@ -165,7 +165,7 @@ class ShareControllerTest extends \Test\TestCase { parent::tearDown(); } - public function testShowShareInvalidToken() { + public function testShowShareInvalidToken(): void { $this->shareController->setToken('invalidtoken'); $this->shareManager @@ -180,7 +180,7 @@ class ShareControllerTest extends \Test\TestCase { $this->shareController->showShare(); } - public function testShowShareNotAuthenticated() { + public function testShowShareNotAuthenticated(): void { $this->shareController->setToken('validtoken'); $share = \OC::$server->getShareManager()->newShare(); @@ -199,7 +199,7 @@ class ShareControllerTest extends \Test\TestCase { } - public function testShowShare() { + public function testShowShare(): void { $note = 'personal note'; $filename = 'file1.txt'; @@ -347,7 +347,7 @@ class ShareControllerTest extends \Test\TestCase { $this->assertEquals($expectedResponse, $response); } - public function testShowFileDropShare() { + public function testShowFileDropShare(): void { $filename = 'folder1'; $this->shareController->setToken('token'); @@ -484,7 +484,7 @@ class ShareControllerTest extends \Test\TestCase { $this->assertEquals($expectedResponse, $response); } - public function testShowShareWithPrivateName() { + public function testShowShareWithPrivateName(): void { $note = 'personal note'; $filename = 'file1.txt'; @@ -614,7 +614,7 @@ class ShareControllerTest extends \Test\TestCase { } - public function testShowShareInvalid() { + public function testShowShareInvalid(): void { $this->expectException(\OCP\Files\NotFoundException::class); $filename = 'file1.txt'; @@ -664,7 +664,7 @@ class ShareControllerTest extends \Test\TestCase { $this->shareController->showShare(); } - public function testDownloadShareWithCreateOnlyShare() { + public function testDownloadShareWithCreateOnlyShare(): void { $share = $this->getMockBuilder(IShare::class)->getMock(); $share->method('getPassword')->willReturn('password'); $share @@ -684,7 +684,7 @@ class ShareControllerTest extends \Test\TestCase { $this->assertEquals($expectedResponse, $response); } - public function testDisabledOwner() { + public function testDisabledOwner(): void { $this->shareController->setToken('token'); $owner = $this->getMockBuilder(IUser::class)->getMock(); @@ -725,7 +725,7 @@ class ShareControllerTest extends \Test\TestCase { $this->shareController->showShare(); } - public function testDisabledInitiator() { + public function testDisabledInitiator(): void { $this->shareController->setToken('token'); $owner = $this->getMockBuilder(IUser::class)->getMock(); diff --git a/apps/files_sharing/tests/Controller/ShareInfoControllerTest.php b/apps/files_sharing/tests/Controller/ShareInfoControllerTest.php index 59d7afc28d6..f2df74fd01b 100644 --- a/apps/files_sharing/tests/Controller/ShareInfoControllerTest.php +++ b/apps/files_sharing/tests/Controller/ShareInfoControllerTest.php @@ -41,7 +41,7 @@ class ShareInfoControllerTest extends TestCase { ->getMock(); } - public function testNoShare() { + public function testNoShare(): void { $this->shareManager->method('getShareByToken') ->with('token') ->willThrowException(new ShareNotFound()); @@ -51,7 +51,7 @@ class ShareInfoControllerTest extends TestCase { $this->assertEquals($expected, $this->controller->info('token')); } - public function testWrongPassword() { + public function testWrongPassword(): void { $share = $this->createMock(IShare::class); $share->method('getPassword') ->willReturn('sharePass'); @@ -68,7 +68,7 @@ class ShareInfoControllerTest extends TestCase { $this->assertEquals($expected, $this->controller->info('token', 'pass')); } - public function testNoReadPermissions() { + public function testNoReadPermissions(): void { $share = $this->createMock(IShare::class); $share->method('getPassword') ->willReturn('sharePass'); @@ -107,7 +107,7 @@ class ShareInfoControllerTest extends TestCase { return $file; } - public function testInfoFile() { + public function testInfoFile(): void { $file = $this->prepareFile(); $share = $this->createMock(IShare::class); @@ -139,7 +139,7 @@ class ShareInfoControllerTest extends TestCase { $this->assertEquals($expected, $this->controller->info('token', 'pass')); } - public function testInfoFileRO() { + public function testInfoFileRO(): void { $file = $this->prepareFile(); $share = $this->createMock(IShare::class); @@ -221,7 +221,7 @@ class ShareInfoControllerTest extends TestCase { return $root; } - public function testInfoFolder() { + public function testInfoFolder(): void { $file = $this->prepareFolder(); $share = $this->createMock(IShare::class); diff --git a/apps/files_sharing/tests/Controller/ShareesAPIControllerTest.php b/apps/files_sharing/tests/Controller/ShareesAPIControllerTest.php index f787607f5a8..bf02e8114df 100644 --- a/apps/files_sharing/tests/Controller/ShareesAPIControllerTest.php +++ b/apps/files_sharing/tests/Controller/ShareesAPIControllerTest.php @@ -223,7 +223,7 @@ class ShareesAPIControllerTest extends TestCase { bool $shareWithGroupOnly, bool $shareeEnumeration, bool $allowGroupSharing, - ) { + ): void { $search = $getData['search'] ?? ''; $itemType = $getData['itemType'] ?? 'irrelevant'; $page = $getData['page'] ?? 1; @@ -333,7 +333,7 @@ class ShareesAPIControllerTest extends TestCase { * @param array $getData * @param string $message */ - public function testSearchInvalid($getData, $message) { + public function testSearchInvalid($getData, $message): void { $page = $getData['page'] ?? 1; $perPage = $getData['perPage'] ?? 200; @@ -391,11 +391,11 @@ class ShareesAPIControllerTest extends TestCase { * @param string $itemType * @param bool $expected */ - public function testIsRemoteSharingAllowed($itemType, $expected) { + public function testIsRemoteSharingAllowed($itemType, $expected): void { $this->assertSame($expected, $this->invokePrivate($this->sharees, 'isRemoteSharingAllowed', [$itemType])); } - public function testSearchSharingDisabled() { + public function testSearchSharingDisabled(): void { $this->shareManager->expects($this->once()) ->method('sharingDisabledForUser') ->with($this->uid) @@ -412,7 +412,7 @@ class ShareesAPIControllerTest extends TestCase { $this->assertInstanceOf(DataResponse::class, $this->sharees->search('', null, 1, 10, [], false)); } - public function testSearchNoItemType() { + public function testSearchNoItemType(): void { $this->expectException(\OCP\AppFramework\OCS\OCSBadRequestException::class); $this->expectExceptionMessage('Missing itemType'); @@ -434,7 +434,7 @@ class ShareesAPIControllerTest extends TestCase { * @param array $params * @param array $expected */ - public function testGetPaginationLink($page, $scriptName, $params, $expected) { + public function testGetPaginationLink($page, $scriptName, $params, $expected): void { $this->request->expects($this->once()) ->method('getScriptName') ->willReturn($scriptName); @@ -455,7 +455,7 @@ class ShareesAPIControllerTest extends TestCase { * @param string $scriptName * @param bool $expected */ - public function testIsV2($scriptName, $expected) { + public function testIsV2($scriptName, $expected): void { $this->request->expects($this->once()) ->method('getScriptName') ->willReturn($scriptName); diff --git a/apps/files_sharing/tests/DeleteOrphanedSharesJobTest.php b/apps/files_sharing/tests/DeleteOrphanedSharesJobTest.php index 20365ebb842..e0d2d67d45f 100644 --- a/apps/files_sharing/tests/DeleteOrphanedSharesJobTest.php +++ b/apps/files_sharing/tests/DeleteOrphanedSharesJobTest.php @@ -107,7 +107,7 @@ class DeleteOrphanedSharesJobTest extends \Test\TestCase { /** * Test clearing orphaned shares */ - public function testClearShares() { + public function testClearShares(): void { $this->loginAsUser($this->user1); $user1Folder = \OC::$server->getUserFolder($this->user1); diff --git a/apps/files_sharing/tests/EtagPropagationTest.php b/apps/files_sharing/tests/EtagPropagationTest.php index 3f9ddfc413d..5a65b1b5389 100644 --- a/apps/files_sharing/tests/EtagPropagationTest.php +++ b/apps/files_sharing/tests/EtagPropagationTest.php @@ -171,7 +171,7 @@ class EtagPropagationTest extends PropagationTestCase { } } - public function testOwnerWritesToShare() { + public function testOwnerWritesToShare(): void { $this->loginAsUser(self::TEST_FILES_SHARING_API_USER1); Filesystem::file_put_contents('/sub1/sub2/folder/asd.txt', 'bar'); $this->assertEtagsNotChanged([self::TEST_FILES_SHARING_API_USER4]); @@ -181,7 +181,7 @@ class EtagPropagationTest extends PropagationTestCase { $this->assertAllUnchanged(); } - public function testOwnerWritesToSingleFileShare() { + public function testOwnerWritesToSingleFileShare(): void { $this->loginAsUser(self::TEST_FILES_SHARING_API_USER1); Filesystem::file_put_contents('/foo.txt', 'longer_bar'); $t = (int)Filesystem::filemtime('/foo.txt') - 1; @@ -192,7 +192,7 @@ class EtagPropagationTest extends PropagationTestCase { $this->assertAllUnchanged(); } - public function testOwnerWritesToShareWithReshare() { + public function testOwnerWritesToShareWithReshare(): void { $this->loginAsUser(self::TEST_FILES_SHARING_API_USER1); Filesystem::file_put_contents('/sub1/sub2/folder/inside/bar.txt', 'bar'); $this->assertEtagsForFoldersChanged([self::TEST_FILES_SHARING_API_USER1, self::TEST_FILES_SHARING_API_USER2, @@ -201,7 +201,7 @@ class EtagPropagationTest extends PropagationTestCase { $this->assertAllUnchanged(); } - public function testOwnerRenameInShare() { + public function testOwnerRenameInShare(): void { $this->loginAsUser(self::TEST_FILES_SHARING_API_USER1); $this->assertEtagsNotChanged([self::TEST_FILES_SHARING_API_USER4]); Filesystem::rename('/sub1/sub2/folder/file.txt', '/sub1/sub2/folder/renamed.txt'); @@ -211,7 +211,7 @@ class EtagPropagationTest extends PropagationTestCase { $this->assertAllUnchanged(); } - public function testOwnerRenameInReShare() { + public function testOwnerRenameInReShare(): void { $this->loginAsUser(self::TEST_FILES_SHARING_API_USER1); Filesystem::rename('/sub1/sub2/folder/inside/file.txt', '/sub1/sub2/folder/inside/renamed.txt'); $this->assertEtagsForFoldersChanged([self::TEST_FILES_SHARING_API_USER1, self::TEST_FILES_SHARING_API_USER2, @@ -220,7 +220,7 @@ class EtagPropagationTest extends PropagationTestCase { $this->assertAllUnchanged(); } - public function testOwnerRenameIntoReShare() { + public function testOwnerRenameIntoReShare(): void { $this->loginAsUser(self::TEST_FILES_SHARING_API_USER1); Filesystem::rename('/sub1/sub2/folder/file.txt', '/sub1/sub2/folder/inside/renamed.txt'); $this->assertEtagsForFoldersChanged([self::TEST_FILES_SHARING_API_USER1, self::TEST_FILES_SHARING_API_USER2, @@ -229,7 +229,7 @@ class EtagPropagationTest extends PropagationTestCase { $this->assertAllUnchanged(); } - public function testOwnerRenameOutOfReShare() { + public function testOwnerRenameOutOfReShare(): void { $this->loginAsUser(self::TEST_FILES_SHARING_API_USER1); Filesystem::rename('/sub1/sub2/folder/inside/file.txt', '/sub1/sub2/folder/renamed.txt'); $this->assertEtagsForFoldersChanged([self::TEST_FILES_SHARING_API_USER1, self::TEST_FILES_SHARING_API_USER2, @@ -238,7 +238,7 @@ class EtagPropagationTest extends PropagationTestCase { $this->assertAllUnchanged(); } - public function testOwnerDeleteInShare() { + public function testOwnerDeleteInShare(): void { $this->loginAsUser(self::TEST_FILES_SHARING_API_USER1); Filesystem::unlink('/sub1/sub2/folder/file.txt'); $this->assertEtagsNotChanged([self::TEST_FILES_SHARING_API_USER4]); @@ -248,7 +248,7 @@ class EtagPropagationTest extends PropagationTestCase { $this->assertAllUnchanged(); } - public function testOwnerDeleteInReShare() { + public function testOwnerDeleteInReShare(): void { $this->loginAsUser(self::TEST_FILES_SHARING_API_USER1); Filesystem::unlink('/sub1/sub2/folder/inside/file.txt'); $this->assertEtagsForFoldersChanged([self::TEST_FILES_SHARING_API_USER1, self::TEST_FILES_SHARING_API_USER2, @@ -257,7 +257,7 @@ class EtagPropagationTest extends PropagationTestCase { $this->assertAllUnchanged(); } - public function testOwnerUnshares() { + public function testOwnerUnshares(): void { $this->loginAsUser(self::TEST_FILES_SHARING_API_USER1); $folderInfo = $this->rootView->getFileInfo('/' . self::TEST_FILES_SHARING_API_USER1 . '/files/sub1/sub2/folder'); $this->assertInstanceOf('\OC\Files\FileInfo', $folderInfo); @@ -280,7 +280,7 @@ class EtagPropagationTest extends PropagationTestCase { $this->assertAllUnchanged(); } - public function testOwnerUnsharesFlatReshares() { + public function testOwnerUnsharesFlatReshares(): void { $this->loginAsUser(self::TEST_FILES_SHARING_API_USER1); $folderInfo = $this->rootView->getFileInfo('/' . self::TEST_FILES_SHARING_API_USER1 . '/files/sub1/sub2/folder/inside'); $this->assertInstanceOf('\OC\Files\FileInfo', $folderInfo); @@ -301,7 +301,7 @@ class EtagPropagationTest extends PropagationTestCase { $this->assertAllUnchanged(); } - public function testRecipientUnsharesFromSelf() { + public function testRecipientUnsharesFromSelf(): void { $this->loginAsUser(self::TEST_FILES_SHARING_API_USER2); $ls = $this->rootView->getDirectoryContent('/' . self::TEST_FILES_SHARING_API_USER2 . '/files/sub1/sub2/'); $this->assertTrue( @@ -315,7 +315,7 @@ class EtagPropagationTest extends PropagationTestCase { $this->assertAllUnchanged(); } - public function testRecipientWritesToShare() { + public function testRecipientWritesToShare(): void { $this->loginAsUser(self::TEST_FILES_SHARING_API_USER2); Filesystem::file_put_contents('/sub1/sub2/folder/asd.txt', 'bar'); $this->assertEtagsNotChanged([self::TEST_FILES_SHARING_API_USER4]); @@ -328,7 +328,7 @@ class EtagPropagationTest extends PropagationTestCase { $this->assertAllUnchanged(); } - public function testRecipientWritesToReshare() { + public function testRecipientWritesToReshare(): void { $this->loginAsUser(self::TEST_FILES_SHARING_API_USER2); Filesystem::file_put_contents('/sub1/sub2/folder/inside/asd.txt', 'bar'); $this->assertEtagsForFoldersChanged([self::TEST_FILES_SHARING_API_USER1, self::TEST_FILES_SHARING_API_USER2, @@ -337,7 +337,7 @@ class EtagPropagationTest extends PropagationTestCase { $this->assertAllUnchanged(); } - public function testRecipientWritesToOtherRecipientsReshare() { + public function testRecipientWritesToOtherRecipientsReshare(): void { $this->loginAsUser(self::TEST_FILES_SHARING_API_USER3); Filesystem::file_put_contents('/sub1/sub2/folder/inside/asd.txt', 'bar'); $this->assertEtagsForFoldersChanged([self::TEST_FILES_SHARING_API_USER1, self::TEST_FILES_SHARING_API_USER2, @@ -346,7 +346,7 @@ class EtagPropagationTest extends PropagationTestCase { $this->assertAllUnchanged(); } - public function testRecipientRenameInShare() { + public function testRecipientRenameInShare(): void { $this->loginAsUser(self::TEST_FILES_SHARING_API_USER2); Filesystem::rename('/sub1/sub2/folder/file.txt', '/sub1/sub2/folder/renamed.txt'); $this->assertEtagsNotChanged([self::TEST_FILES_SHARING_API_USER4]); @@ -356,7 +356,7 @@ class EtagPropagationTest extends PropagationTestCase { $this->assertAllUnchanged(); } - public function testRecipientRenameInReShare() { + public function testRecipientRenameInReShare(): void { $this->loginAsUser(self::TEST_FILES_SHARING_API_USER2); Filesystem::rename('/sub1/sub2/folder/inside/file.txt', '/sub1/sub2/folder/inside/renamed.txt'); $this->assertEtagsForFoldersChanged([self::TEST_FILES_SHARING_API_USER1, self::TEST_FILES_SHARING_API_USER2, @@ -365,7 +365,7 @@ class EtagPropagationTest extends PropagationTestCase { $this->assertAllUnchanged(); } - public function testRecipientRenameResharedFolder() { + public function testRecipientRenameResharedFolder(): void { $this->loginAsUser(self::TEST_FILES_SHARING_API_USER2); Filesystem::rename('/directReshare', '/sub1/directReshare'); $this->assertEtagsNotChanged([self::TEST_FILES_SHARING_API_USER1, self::TEST_FILES_SHARING_API_USER3, self::TEST_FILES_SHARING_API_USER4]); @@ -376,7 +376,7 @@ class EtagPropagationTest extends PropagationTestCase { $this->assertAllUnchanged(); } - public function testRecipientDeleteInShare() { + public function testRecipientDeleteInShare(): void { $this->loginAsUser(self::TEST_FILES_SHARING_API_USER2); Filesystem::unlink('/sub1/sub2/folder/file.txt'); $this->assertEtagsNotChanged([self::TEST_FILES_SHARING_API_USER4]); @@ -386,7 +386,7 @@ class EtagPropagationTest extends PropagationTestCase { $this->assertAllUnchanged(); } - public function testRecipientDeleteInReShare() { + public function testRecipientDeleteInReShare(): void { $this->loginAsUser(self::TEST_FILES_SHARING_API_USER2); Filesystem::unlink('/sub1/sub2/folder/inside/file.txt'); $this->assertEtagsForFoldersChanged([self::TEST_FILES_SHARING_API_USER1, self::TEST_FILES_SHARING_API_USER2, @@ -395,7 +395,7 @@ class EtagPropagationTest extends PropagationTestCase { $this->assertAllUnchanged(); } - public function testReshareRecipientWritesToReshare() { + public function testReshareRecipientWritesToReshare(): void { $this->loginAsUser(self::TEST_FILES_SHARING_API_USER4); Filesystem::file_put_contents('/sub1/sub2/inside/asd.txt', 'bar'); $this->assertEtagsForFoldersChanged([self::TEST_FILES_SHARING_API_USER1, self::TEST_FILES_SHARING_API_USER2, @@ -404,7 +404,7 @@ class EtagPropagationTest extends PropagationTestCase { $this->assertAllUnchanged(); } - public function testReshareRecipientRenameInReShare() { + public function testReshareRecipientRenameInReShare(): void { $this->loginAsUser(self::TEST_FILES_SHARING_API_USER4); Filesystem::rename('/sub1/sub2/inside/file.txt', '/sub1/sub2/inside/renamed.txt'); $this->assertEtagsForFoldersChanged([self::TEST_FILES_SHARING_API_USER1, self::TEST_FILES_SHARING_API_USER2, @@ -413,7 +413,7 @@ class EtagPropagationTest extends PropagationTestCase { $this->assertAllUnchanged(); } - public function testReshareRecipientDeleteInReShare() { + public function testReshareRecipientDeleteInReShare(): void { $this->loginAsUser(self::TEST_FILES_SHARING_API_USER4); Filesystem::unlink('/sub1/sub2/inside/file.txt'); $this->assertEtagsForFoldersChanged([self::TEST_FILES_SHARING_API_USER1, self::TEST_FILES_SHARING_API_USER2, @@ -422,7 +422,7 @@ class EtagPropagationTest extends PropagationTestCase { $this->assertAllUnchanged(); } - public function testRecipientUploadInDirectReshare() { + public function testRecipientUploadInDirectReshare(): void { $this->loginAsUser(self::TEST_FILES_SHARING_API_USER2); Filesystem::file_put_contents('/directReshare/test.txt', 'sad'); $this->assertEtagsNotChanged([self::TEST_FILES_SHARING_API_USER3]); @@ -431,7 +431,7 @@ class EtagPropagationTest extends PropagationTestCase { $this->assertAllUnchanged(); } - public function testEtagChangeOnPermissionsChange() { + public function testEtagChangeOnPermissionsChange(): void { $userFolder = $this->rootFolder->getUserFolder(self::TEST_FILES_SHARING_API_USER1); $node = $userFolder->get('/sub1/sub2/folder'); diff --git a/apps/files_sharing/tests/ExpireSharesJobTest.php b/apps/files_sharing/tests/ExpireSharesJobTest.php index e6383d12ded..cf7be7b20a0 100644 --- a/apps/files_sharing/tests/ExpireSharesJobTest.php +++ b/apps/files_sharing/tests/ExpireSharesJobTest.php @@ -107,7 +107,7 @@ class ExpireSharesJobTest extends \Test\TestCase { * @param bool $addInterval If true add to the current time if false subtract * @param bool $shouldExpire Should this share be expired */ - public function testExpireLinkShare($addExpiration, $interval, $addInterval, $shouldExpire) { + public function testExpireLinkShare($addExpiration, $interval, $addInterval, $shouldExpire): void { $this->loginAsUser($this->user1); $user1Folder = \OC::$server->getUserFolder($this->user1); @@ -164,7 +164,7 @@ class ExpireSharesJobTest extends \Test\TestCase { } } - public function testDoNotExpireOtherShares() { + public function testDoNotExpireOtherShares(): void { $this->loginAsUser($this->user1); $user1Folder = \OC::$server->getUserFolder($this->user1); diff --git a/apps/files_sharing/tests/External/CacheTest.php b/apps/files_sharing/tests/External/CacheTest.php index 6259fc98e1f..2fb99e15715 100644 --- a/apps/files_sharing/tests/External/CacheTest.php +++ b/apps/files_sharing/tests/External/CacheTest.php @@ -91,7 +91,7 @@ class CacheTest extends TestCase { parent::tearDown(); } - public function testGetInjectsOwnerDisplayName() { + public function testGetInjectsOwnerDisplayName(): void { $info = $this->cache->get('test.txt'); $this->assertEquals( $this->remoteUser . '@example.com/owncloud', @@ -99,12 +99,12 @@ class CacheTest extends TestCase { ); } - public function testGetReturnsFalseIfNotFound() { + public function testGetReturnsFalseIfNotFound(): void { $info = $this->cache->get('unexisting-entry.txt'); $this->assertFalse($info); } - public function testGetFolderPopulatesOwner() { + public function testGetFolderPopulatesOwner(): void { $dirId = $this->cache->put( 'subdir', [ diff --git a/apps/files_sharing/tests/External/ManagerTest.php b/apps/files_sharing/tests/External/ManagerTest.php index 0687d567453..7302fd307f2 100644 --- a/apps/files_sharing/tests/External/ManagerTest.php +++ b/apps/files_sharing/tests/External/ManagerTest.php @@ -181,7 +181,7 @@ class ManagerTest extends TestCase { $this->mountManager->addMount(new MountPoint(Temporary::class, '', [])); } - public function testAddUserShare() { + public function testAddUserShare(): void { $this->doTestAddShare([ 'remote' => 'http://localhost', 'token' => 'token1', @@ -195,7 +195,7 @@ class ManagerTest extends TestCase { ], false); } - public function testAddGroupShare() { + public function testAddGroupShare(): void { $this->doTestAddShare([ 'remote' => 'http://localhost', 'token' => 'token1', @@ -474,7 +474,7 @@ class ManagerTest extends TestCase { return [$shareData, $groupShare]; } - public function testAcceptOriginalGroupShare() { + public function testAcceptOriginalGroupShare(): void { [$shareData, $groupShare] = $this->createTestGroupShare(); $this->assertTrue($this->manager->acceptShare($groupShare['id'])); $this->verifyAcceptedGroupShare($shareData); @@ -484,7 +484,7 @@ class ManagerTest extends TestCase { $this->verifyAcceptedGroupShare($shareData); } - public function testAcceptGroupShareAgainThroughGroupShare() { + public function testAcceptGroupShareAgainThroughGroupShare(): void { [$shareData, $groupShare] = $this->createTestGroupShare(); $this->assertTrue($this->manager->acceptShare($groupShare['id'])); $this->verifyAcceptedGroupShare($shareData); @@ -506,7 +506,7 @@ class ManagerTest extends TestCase { $this->verifyAcceptedGroupShare($shareData, '/SharedFolder'); } - public function testAcceptGroupShareAgainThroughSubShare() { + public function testAcceptGroupShareAgainThroughSubShare(): void { [$shareData, $groupShare] = $this->createTestGroupShare(); $this->assertTrue($this->manager->acceptShare($groupShare['id'])); $this->verifyAcceptedGroupShare($shareData); @@ -528,7 +528,7 @@ class ManagerTest extends TestCase { $this->verifyAcceptedGroupShare($shareData); } - public function testDeclineOriginalGroupShare() { + public function testDeclineOriginalGroupShare(): void { [$shareData, $groupShare] = $this->createTestGroupShare(); $this->assertTrue($this->manager->declineShare($groupShare['id'])); $this->verifyDeclinedGroupShare($shareData); @@ -538,7 +538,7 @@ class ManagerTest extends TestCase { $this->verifyDeclinedGroupShare($shareData); } - public function testDeclineGroupShareAgainThroughGroupShare() { + public function testDeclineGroupShareAgainThroughGroupShare(): void { [$shareData, $groupShare] = $this->createTestGroupShare(); $this->assertTrue($this->manager->acceptShare($groupShare['id'])); $this->verifyAcceptedGroupShare($shareData); @@ -552,7 +552,7 @@ class ManagerTest extends TestCase { $this->verifyDeclinedGroupShare($shareData, '/SharedFolder'); } - public function testDeclineGroupShareAgainThroughSubshare() { + public function testDeclineGroupShareAgainThroughSubshare(): void { [$shareData, $groupShare] = $this->createTestGroupShare(); $this->assertTrue($this->manager->acceptShare($groupShare['id'])); $this->verifyAcceptedGroupShare($shareData); @@ -570,7 +570,7 @@ class ManagerTest extends TestCase { $this->verifyDeclinedGroupShare($shareData, '/SharedFolder'); } - public function testDeclineGroupShareAgainThroughMountPoint() { + public function testDeclineGroupShareAgainThroughMountPoint(): void { [$shareData, $groupShare] = $this->createTestGroupShare(); $this->assertTrue($this->manager->acceptShare($groupShare['id'])); $this->verifyAcceptedGroupShare($shareData); @@ -583,7 +583,7 @@ class ManagerTest extends TestCase { $this->assertFalse($this->manager->removeShare($this->uid . '/files/' . $shareData['name'])); } - public function testDeclineThenAcceptGroupShareAgainThroughGroupShare() { + public function testDeclineThenAcceptGroupShareAgainThroughGroupShare(): void { [$shareData, $groupShare] = $this->createTestGroupShare(); // decline, this creates a declined sub-share $this->assertTrue($this->manager->declineShare($groupShare['id'])); @@ -601,7 +601,7 @@ class ManagerTest extends TestCase { $this->verifyAcceptedGroupShare($shareData, '/SharedFolder'); } - public function testDeclineThenAcceptGroupShareAgainThroughSubShare() { + public function testDeclineThenAcceptGroupShareAgainThroughSubShare(): void { [$shareData, $groupShare] = $this->createTestGroupShare(); // decline, this creates a declined sub-share $this->assertTrue($this->manager->declineShare($groupShare['id'])); @@ -619,7 +619,7 @@ class ManagerTest extends TestCase { $this->verifyAcceptedGroupShare($shareData); } - public function testDeleteUserShares() { + public function testDeleteUserShares(): void { // user 1 shares $shareData = $this->createTestUserShare($this->uid); @@ -666,7 +666,7 @@ class ManagerTest extends TestCase { $this->assertEquals($user2Shares[1]['user'], 'user2'); } - public function testDeleteGroupShares() { + public function testDeleteGroupShares(): void { $shareData = $this->createTestUserShare($this->uid); [$shareData, $groupShare] = $this->createTestGroupShare(); diff --git a/apps/files_sharing/tests/External/ScannerTest.php b/apps/files_sharing/tests/External/ScannerTest.php index c828fd59a08..7daa5f229d2 100644 --- a/apps/files_sharing/tests/External/ScannerTest.php +++ b/apps/files_sharing/tests/External/ScannerTest.php @@ -35,7 +35,7 @@ class ScannerTest extends TestCase { $this->scanner = new Scanner($this->storage); } - public function testScan() { + public function testScan(): void { $this->storage->expects($this->any()) ->method('getShareInfo') ->willReturn(['status' => 'success', 'data' => []]); @@ -47,7 +47,7 @@ class ScannerTest extends TestCase { $this->addToAssertionCount(1); } - public function testScanFile() { + public function testScanFile(): void { // FIXME add real tests, we are currently only checking for // Declaration of OCA\Files_Sharing\External\Scanner::*() should be // compatible with OC\Files\Cache\Scanner::*() diff --git a/apps/files_sharing/tests/ExternalStorageTest.php b/apps/files_sharing/tests/ExternalStorageTest.php index 4d807526f0d..56a1f320030 100644 --- a/apps/files_sharing/tests/ExternalStorageTest.php +++ b/apps/files_sharing/tests/ExternalStorageTest.php @@ -89,12 +89,12 @@ class ExternalStorageTest extends \Test\TestCase { /** * @dataProvider optionsProvider */ - public function testStorageMountOptions($inputUri, $baseUri) { + public function testStorageMountOptions($inputUri, $baseUri): void { $storage = $this->getTestStorage($inputUri); $this->assertEquals($baseUri, $storage->getBaseUri()); } - public function testIfTestReturnsTheValue() { + public function testIfTestReturnsTheValue(): void { $result = $this->getTestStorage('https://remoteserver')->test(); $this->assertSame(true, $result); } diff --git a/apps/files_sharing/tests/GroupEtagPropagationTest.php b/apps/files_sharing/tests/GroupEtagPropagationTest.php index 280b091b5f7..9b2b63b0181 100644 --- a/apps/files_sharing/tests/GroupEtagPropagationTest.php +++ b/apps/files_sharing/tests/GroupEtagPropagationTest.php @@ -89,7 +89,7 @@ class GroupEtagPropagationTest extends PropagationTestCase { } } - public function testGroupReShareRecipientWrites() { + public function testGroupReShareRecipientWrites(): void { $this->loginAsUser(self::TEST_FILES_SHARING_API_USER3); Filesystem::file_put_contents('/test/sub/file.txt', 'asd'); @@ -99,7 +99,7 @@ class GroupEtagPropagationTest extends PropagationTestCase { $this->assertAllUnchanged(); } - public function testGroupReShareSubFolderRecipientWrites() { + public function testGroupReShareSubFolderRecipientWrites(): void { $this->loginAsUser(self::TEST_FILES_SHARING_API_USER4); Filesystem::file_put_contents('/sub/file.txt', 'asd'); @@ -109,7 +109,7 @@ class GroupEtagPropagationTest extends PropagationTestCase { $this->assertAllUnchanged(); } - public function testRecipientUnsharesFromSelf() { + public function testRecipientUnsharesFromSelf(): void { $this->loginAsUser(self::TEST_FILES_SHARING_API_USER2); $this->assertTrue( $this->rootView->unlink('/' . self::TEST_FILES_SHARING_API_USER2 . '/files/test') @@ -119,7 +119,7 @@ class GroupEtagPropagationTest extends PropagationTestCase { $this->assertAllUnchanged(); } - public function testRecipientUnsharesFromSelfUniqueGroupShare() { + public function testRecipientUnsharesFromSelfUniqueGroupShare(): void { $this->loginAsUser(self::TEST_FILES_SHARING_API_USER2); // rename to create an extra entry in the share table $this->rootView->rename('/' . self::TEST_FILES_SHARING_API_USER2 . '/files/test', '/' . self::TEST_FILES_SHARING_API_USER2 . '/files/test_renamed'); diff --git a/apps/files_sharing/tests/HelperTest.php b/apps/files_sharing/tests/HelperTest.php index cc5c0d27e60..d72afc4d4aa 100644 --- a/apps/files_sharing/tests/HelperTest.php +++ b/apps/files_sharing/tests/HelperTest.php @@ -16,7 +16,7 @@ class HelperTest extends TestCase { /** * test set and get share folder */ - public function testSetGetShareFolder() { + public function testSetGetShareFolder(): void { $this->assertSame('/', \OCA\Files_Sharing\Helper::getShareFolder()); \OCA\Files_Sharing\Helper::setShareFolder('/Shared/Folder'); diff --git a/apps/files_sharing/tests/LockingTest.php b/apps/files_sharing/tests/LockingTest.php index 0ca204ef215..c69cf99f185 100644 --- a/apps/files_sharing/tests/LockingTest.php +++ b/apps/files_sharing/tests/LockingTest.php @@ -61,7 +61,7 @@ class LockingTest extends TestCase { } - public function testLockAsRecipient() { + public function testLockAsRecipient(): void { $this->expectException(\OCP\Lock\LockedException::class); $this->loginAsUser($this->ownerUid); @@ -73,7 +73,7 @@ class LockingTest extends TestCase { Filesystem::rename('/foo', '/asd'); } - public function testUnLockAsRecipient() { + public function testUnLockAsRecipient(): void { $this->loginAsUser($this->ownerUid); Filesystem::initMountPoints($this->recipientUid); @@ -84,7 +84,7 @@ class LockingTest extends TestCase { $this->assertTrue(Filesystem::rename('/foo', '/asd')); } - public function testChangeLock() { + public function testChangeLock(): void { Filesystem::initMountPoints($this->recipientUid); $recipientView = new View('/' . $this->recipientUid . '/files'); $recipientView->lockFile('bar.txt', ILockingProvider::LOCK_SHARED); diff --git a/apps/files_sharing/tests/Middleware/OCSShareAPIMiddlewareTest.php b/apps/files_sharing/tests/Middleware/OCSShareAPIMiddlewareTest.php index b5c7e1ce890..30bae45f520 100644 --- a/apps/files_sharing/tests/Middleware/OCSShareAPIMiddlewareTest.php +++ b/apps/files_sharing/tests/Middleware/OCSShareAPIMiddlewareTest.php @@ -78,7 +78,7 @@ class OCSShareAPIMiddlewareTest extends \Test\TestCase { * @param bool $enabled * @param bool $exception */ - public function testBeforeController(Controller $controller, $enabled, $exception) { + public function testBeforeController(Controller $controller, $enabled, $exception): void { $this->shareManager->method('shareApiEnabled')->willReturn($enabled); try { @@ -109,7 +109,7 @@ class OCSShareAPIMiddlewareTest extends \Test\TestCase { * @param Controller $controller * @param bool $called */ - public function testAfterController(Controller $controller) { + public function testAfterController(Controller $controller): void { if ($controller instanceof ShareAPIController) { $controller->expects($this->once())->method('cleanup'); } diff --git a/apps/files_sharing/tests/Middleware/ShareInfoMiddlewareTest.php b/apps/files_sharing/tests/Middleware/ShareInfoMiddlewareTest.php index 5ba21255a8d..88fa56a9bcb 100644 --- a/apps/files_sharing/tests/Middleware/ShareInfoMiddlewareTest.php +++ b/apps/files_sharing/tests/Middleware/ShareInfoMiddlewareTest.php @@ -29,14 +29,14 @@ class ShareInfoMiddlewareTest extends TestCase { $this->middleware = new ShareInfoMiddleware($this->shareManager); } - public function testBeforeControllerNoShareInfo() { + public function testBeforeControllerNoShareInfo(): void { $this->shareManager->expects($this->never()) ->method($this->anything()); $this->middleware->beforeController($this->createMock(ShareInfoMiddlewareTestController::class), 'foo'); } - public function testBeforeControllerShareInfoNoS2s() { + public function testBeforeControllerShareInfoNoS2s(): void { $this->shareManager->expects($this->once()) ->method('outgoingServer2ServerSharesAllowed') ->willReturn(false); @@ -45,7 +45,7 @@ class ShareInfoMiddlewareTest extends TestCase { $this->middleware->beforeController($this->createMock(ShareInfoController::class), 'foo'); } - public function testBeforeControllerShareInfo() { + public function testBeforeControllerShareInfo(): void { $this->shareManager->expects($this->once()) ->method('outgoingServer2ServerSharesAllowed') ->willReturn(true); @@ -53,7 +53,7 @@ class ShareInfoMiddlewareTest extends TestCase { $this->middleware->beforeController($this->createMock(ShareInfoController::class), 'foo'); } - public function testAfterExceptionNoShareInfo() { + public function testAfterExceptionNoShareInfo(): void { $exeption = new \Exception(); try { @@ -65,7 +65,7 @@ class ShareInfoMiddlewareTest extends TestCase { } - public function testAfterExceptionNoS2S() { + public function testAfterExceptionNoS2S(): void { $exeption = new \Exception(); try { @@ -76,7 +76,7 @@ class ShareInfoMiddlewareTest extends TestCase { } } - public function testAfterExceptionS2S() { + public function testAfterExceptionS2S(): void { $expected = new JSONResponse([], Http::STATUS_NOT_FOUND); $this->assertEquals( @@ -85,7 +85,7 @@ class ShareInfoMiddlewareTest extends TestCase { ); } - public function testAfterControllerNoShareInfo() { + public function testAfterControllerNoShareInfo(): void { $response = $this->createMock(Http\Response::class); $this->assertEquals( @@ -94,7 +94,7 @@ class ShareInfoMiddlewareTest extends TestCase { ); } - public function testAfterControllerNoJSON() { + public function testAfterControllerNoJSON(): void { $response = $this->createMock(Http\Response::class); $this->assertEquals( @@ -103,7 +103,7 @@ class ShareInfoMiddlewareTest extends TestCase { ); } - public function testAfterControllerJSONok() { + public function testAfterControllerJSONok(): void { $data = ['foo' => 'bar']; $response = new JSONResponse($data); @@ -118,7 +118,7 @@ class ShareInfoMiddlewareTest extends TestCase { ); } - public function testAfterControllerJSONerror() { + public function testAfterControllerJSONerror(): void { $data = ['foo' => 'bar']; $response = new JSONResponse($data, Http::STATUS_FORBIDDEN); diff --git a/apps/files_sharing/tests/Middleware/SharingCheckMiddlewareTest.php b/apps/files_sharing/tests/Middleware/SharingCheckMiddlewareTest.php index 580295a26ec..99fcb4eaea0 100644 --- a/apps/files_sharing/tests/Middleware/SharingCheckMiddlewareTest.php +++ b/apps/files_sharing/tests/Middleware/SharingCheckMiddlewareTest.php @@ -59,7 +59,7 @@ class SharingCheckMiddlewareTest extends \Test\TestCase { $this->request); } - public function testIsSharingEnabledWithAppEnabled() { + public function testIsSharingEnabledWithAppEnabled(): void { $this->appManager ->expects($this->once()) ->method('isEnabledForUser') @@ -69,7 +69,7 @@ class SharingCheckMiddlewareTest extends \Test\TestCase { $this->assertTrue(self::invokePrivate($this->sharingCheckMiddleware, 'isSharingEnabled')); } - public function testIsSharingEnabledWithAppDisabled() { + public function testIsSharingEnabledWithAppDisabled(): void { $this->appManager ->expects($this->once()) ->method('isEnabledForUser') @@ -117,7 +117,7 @@ class SharingCheckMiddlewareTest extends \Test\TestCase { /** * @dataProvider externalSharesChecksDataProvider */ - public function testExternalSharesChecks($annotations, $config, $expectedResult) { + public function testExternalSharesChecks($annotations, $config, $expectedResult): void { $this->reflector ->expects($this->atLeastOnce()) ->method('hasAnnotation') @@ -133,7 +133,7 @@ class SharingCheckMiddlewareTest extends \Test\TestCase { /** * @dataProvider externalSharesChecksDataProvider */ - public function testBeforeControllerWithExternalShareControllerWithSharingEnabled($annotations, $config, $noException) { + public function testBeforeControllerWithExternalShareControllerWithSharingEnabled($annotations, $config, $noException): void { $this->appManager ->expects($this->once()) ->method('isEnabledForUser') @@ -162,7 +162,7 @@ class SharingCheckMiddlewareTest extends \Test\TestCase { $this->assertNotEquals($noException, $exceptionThrown); } - public function testBeforeControllerWithShareControllerWithSharingEnabled() { + public function testBeforeControllerWithShareControllerWithSharingEnabled(): void { $share = $this->createMock(IShare::class); $this->appManager @@ -177,7 +177,7 @@ class SharingCheckMiddlewareTest extends \Test\TestCase { } - public function testBeforeControllerWithSharingDisabled() { + public function testBeforeControllerWithSharingDisabled(): void { $this->expectException(\OCP\Files\NotFoundException::class); $this->expectExceptionMessage('Sharing is disabled.'); @@ -191,18 +191,18 @@ class SharingCheckMiddlewareTest extends \Test\TestCase { } - public function testAfterExceptionWithRegularException() { + public function testAfterExceptionWithRegularException(): void { $this->expectException(\Exception::class); $this->expectExceptionMessage('My Exception message'); $this->sharingCheckMiddleware->afterException($this->controllerMock, 'myMethod', new \Exception('My Exception message')); } - public function testAfterExceptionWithNotFoundException() { + public function testAfterExceptionWithNotFoundException(): void { $this->assertEquals(new NotFoundResponse(), $this->sharingCheckMiddleware->afterException($this->controllerMock, 'myMethod', new NotFoundException('My Exception message'))); } - public function testAfterExceptionWithS2SException() { + public function testAfterExceptionWithS2SException(): void { $this->assertEquals(new JSONResponse('My Exception message', 405), $this->sharingCheckMiddleware->afterException($this->controllerMock, 'myMethod', new S2SException('My Exception message'))); } } diff --git a/apps/files_sharing/tests/Migration/SetPasswordColumnTest.php b/apps/files_sharing/tests/Migration/SetPasswordColumnTest.php index eb377412a2e..e15914f6ba1 100644 --- a/apps/files_sharing/tests/Migration/SetPasswordColumnTest.php +++ b/apps/files_sharing/tests/Migration/SetPasswordColumnTest.php @@ -50,7 +50,7 @@ class SetPasswordColumnTest extends TestCase { $query->delete($this->table)->execute(); } - public function testAddPasswordColumn() { + public function testAddPasswordColumn(): void { $this->config->expects($this->once()) ->method('getAppValue') ->with('files_sharing', 'installed_version', '0.0.0') diff --git a/apps/files_sharing/tests/MountProviderTest.php b/apps/files_sharing/tests/MountProviderTest.php index f565d2e3656..2dc5365ae2b 100644 --- a/apps/files_sharing/tests/MountProviderTest.php +++ b/apps/files_sharing/tests/MountProviderTest.php @@ -113,7 +113,7 @@ class MountProviderTest extends \Test\TestCase { * - shares that were opted out of (permissions === 0) * - shares with a group in which the owner is already in */ - public function testExcludeShares() { + public function testExcludeShares(): void { $rootFolder = $this->createMock(IRootFolder::class); $userManager = $this->createMock(IUserManager::class); $attr1 = []; @@ -346,7 +346,7 @@ class MountProviderTest extends \Test\TestCase { * @param array $groupShares array of group share specs * @param array $expectedShares array of expected supershare specs */ - public function testMergeShares($userShares, $groupShares, $expectedShares, $moveFails = false) { + public function testMergeShares($userShares, $groupShares, $expectedShares, $moveFails = false): void { $rootFolder = $this->createMock(IRootFolder::class); $userManager = $this->createMock(IUserManager::class); diff --git a/apps/files_sharing/tests/ShareTest.php b/apps/files_sharing/tests/ShareTest.php index a1580c97fcf..651341a5607 100644 --- a/apps/files_sharing/tests/ShareTest.php +++ b/apps/files_sharing/tests/ShareTest.php @@ -48,7 +48,7 @@ class ShareTest extends TestCase { parent::tearDown(); } - public function testUnshareFromSelf() { + public function testUnshareFromSelf(): void { $groupManager = \OC::$server->getGroupManager(); $userManager = \OC::$server->getUserManager(); @@ -108,7 +108,7 @@ class ShareTest extends TestCase { } } - public function testShareWithDifferentShareFolder() { + public function testShareWithDifferentShareFolder(): void { $fileinfo = $this->view->getFileInfo($this->filename); $folderinfo = $this->view->getFileInfo($this->folder); @@ -139,7 +139,7 @@ class ShareTest extends TestCase { \OC::$server->getConfig()->deleteSystemValue('share_folder'); } - public function testShareWithGroupUniqueName() { + public function testShareWithGroupUniqueName(): void { $this->markTestSkipped('TODO: Disable because fails on drone'); $this->loginHelper(self::TEST_FILES_SHARING_API_USER1); @@ -182,7 +182,7 @@ class ShareTest extends TestCase { * shared files should never have delete permissions * @dataProvider dataProviderTestFileSharePermissions */ - public function testFileSharePermissions($permission, $expectedvalid) { + public function testFileSharePermissions($permission, $expectedvalid): void { $pass = true; try { $this->share( @@ -215,7 +215,7 @@ class ShareTest extends TestCase { ]; } - public function testFileOwner() { + public function testFileOwner(): void { $this->share( IShare::TYPE_USER, $this->filename, diff --git a/apps/files_sharing/tests/SharedMountTest.php b/apps/files_sharing/tests/SharedMountTest.php index c8d42460b8b..82c0770440d 100644 --- a/apps/files_sharing/tests/SharedMountTest.php +++ b/apps/files_sharing/tests/SharedMountTest.php @@ -65,7 +65,7 @@ class SharedMountTest extends TestCase { /** * test if the mount point moves up if the parent folder no longer exists */ - public function testShareMountLoseParentFolder() { + public function testShareMountLoseParentFolder(): void { // share to user $share = $this->share( @@ -97,7 +97,7 @@ class SharedMountTest extends TestCase { /** * @medium */ - public function testDeleteParentOfMountPoint() { + public function testDeleteParentOfMountPoint(): void { // share to user $share = $this->share( IShare::TYPE_USER, @@ -137,7 +137,7 @@ class SharedMountTest extends TestCase { $this->view->unlink($this->folder); } - public function testMoveSharedFile() { + public function testMoveSharedFile(): void { $share = $this->share( IShare::TYPE_USER, $this->filename, @@ -171,7 +171,7 @@ class SharedMountTest extends TestCase { * share file with a group if a user renames the file the filename should not change * for the other users */ - public function testMoveGroupShare() { + public function testMoveGroupShare(): void { $testGroup = $this->groupManager->createGroup('testGroup'); $user1 = $this->userManager->get(self::TEST_FILES_SHARING_API_USER1); $user2 = $this->userManager->get(self::TEST_FILES_SHARING_API_USER2); @@ -223,7 +223,7 @@ class SharedMountTest extends TestCase { * @param string $expectedResult * @param bool $exception if a exception is expected */ - public function testStripUserFilesPath($path, $expectedResult, $exception) { + public function testStripUserFilesPath($path, $expectedResult, $exception): void { $testClass = new DummyTestClassSharedMount(null, null); try { $result = $testClass->stripUserFilesPathDummy($path); @@ -252,7 +252,7 @@ class SharedMountTest extends TestCase { * If the permissions on a group share are upgraded be sure to still respect * removed shares by a member of that group */ - public function testPermissionUpgradeOnUserDeletedGroupShare() { + public function testPermissionUpgradeOnUserDeletedGroupShare(): void { $testGroup = $this->groupManager->createGroup('testGroup'); $user1 = $this->userManager->get(self::TEST_FILES_SHARING_API_USER1); $user2 = $this->userManager->get(self::TEST_FILES_SHARING_API_USER2); @@ -314,7 +314,7 @@ class SharedMountTest extends TestCase { /** * test if the mount point gets renamed if a folder exists at the target */ - public function testShareMountOverFolder() { + public function testShareMountOverFolder(): void { self::loginHelper(self::TEST_FILES_SHARING_API_USER2); $this->view2->mkdir('bar'); @@ -349,7 +349,7 @@ class SharedMountTest extends TestCase { /** * test if the mount point gets renamed if another share exists at the target */ - public function testShareMountOverShare() { + public function testShareMountOverShare(): void { // create a shared cache $caches = []; $cacheFactory = $this->createMock(ICacheFactory::class); diff --git a/apps/files_sharing/tests/SharedStorageTest.php b/apps/files_sharing/tests/SharedStorageTest.php index 521167f1d88..5f907ad8de3 100644 --- a/apps/files_sharing/tests/SharedStorageTest.php +++ b/apps/files_sharing/tests/SharedStorageTest.php @@ -56,7 +56,7 @@ class SharedStorageTest extends TestCase { * * @medium */ - public function testParentOfMountPointIsGone() { + public function testParentOfMountPointIsGone(): void { // share to user $share = $this->share( @@ -101,7 +101,7 @@ class SharedStorageTest extends TestCase { /** * @medium */ - public function testRenamePartFile() { + public function testRenamePartFile(): void { // share to user $share = $this->share( @@ -139,7 +139,7 @@ class SharedStorageTest extends TestCase { $this->shareManager->deleteShare($share); } - public function testFilesize() { + public function testFilesize(): void { $folderSize = $this->view->filesize($this->folder); $file1Size = $this->view->filesize($this->folder . $this->filename); $file2Size = $this->view->filesize($this->filename); @@ -173,7 +173,7 @@ class SharedStorageTest extends TestCase { $this->shareManager->deleteShare($share2); } - public function testGetPermissions() { + public function testGetPermissions(): void { $share = $this->share( IShare::TYPE_USER, $this->folder, @@ -203,7 +203,7 @@ class SharedStorageTest extends TestCase { $this->shareManager->deleteShare($share); } - public function testFopenWithReadOnlyPermission() { + public function testFopenWithReadOnlyPermission(): void { $this->view->file_put_contents($this->folder . '/existing.txt', 'foo'); $share = $this->share( @@ -235,7 +235,7 @@ class SharedStorageTest extends TestCase { $this->shareManager->deleteShare($share); } - public function testFopenWithCreateOnlyPermission() { + public function testFopenWithCreateOnlyPermission(): void { $this->view->file_put_contents($this->folder . '/existing.txt', 'foo'); $fileinfoFolder = $this->view->getFileInfo($this->folder); @@ -282,7 +282,7 @@ class SharedStorageTest extends TestCase { $this->shareManager->deleteShare($share); } - public function testFopenWithUpdateOnlyPermission() { + public function testFopenWithUpdateOnlyPermission(): void { $this->view->file_put_contents($this->folder . '/existing.txt', 'foo'); $share = $this->share( @@ -328,7 +328,7 @@ class SharedStorageTest extends TestCase { $this->shareManager->deleteShare($share); } - public function testFopenWithDeleteOnlyPermission() { + public function testFopenWithDeleteOnlyPermission(): void { $this->view->file_put_contents($this->folder . '/existing.txt', 'foo'); $share = $this->share( @@ -360,7 +360,7 @@ class SharedStorageTest extends TestCase { $this->shareManager->deleteShare($share); } - public function testMountSharesOtherUser() { + public function testMountSharesOtherUser(): void { $rootView = new \OC\Files\View(''); self::loginHelper(self::TEST_FILES_SHARING_API_USER1); @@ -401,7 +401,7 @@ class SharedStorageTest extends TestCase { $this->shareManager->deleteShare($share2); } - public function testCopyFromStorage() { + public function testCopyFromStorage(): void { self::loginHelper(self::TEST_FILES_SHARING_API_USER1); $share = $this->share( @@ -434,7 +434,7 @@ class SharedStorageTest extends TestCase { $this->shareManager->deleteShare($share); } - public function testMoveFromStorage() { + public function testMoveFromStorage(): void { self::loginHelper(self::TEST_FILES_SHARING_API_USER1); $share = $this->share( @@ -467,7 +467,7 @@ class SharedStorageTest extends TestCase { $this->shareManager->deleteShare($share); } - public function testNameConflict() { + public function testNameConflict(): void { self::loginHelper(self::TEST_FILES_SHARING_API_USER1); $view1 = new \OC\Files\View('/' . self::TEST_FILES_SHARING_API_USER1 . '/files'); $view1->mkdir('foo'); @@ -518,7 +518,7 @@ class SharedStorageTest extends TestCase { $this->shareManager->deleteShare($share2); } - public function testOwnerPermissions() { + public function testOwnerPermissions(): void { self::loginHelper(self::TEST_FILES_SHARING_API_USER1); $share = $this->share( @@ -545,7 +545,7 @@ class SharedStorageTest extends TestCase { $this->shareManager->deleteShare($share); } - public function testInitWithNonExistingUser() { + public function testInitWithNonExistingUser(): void { $share = $this->createMock(IShare::class); $share->method('getShareOwner')->willReturn('unexist'); $ownerView = $this->createMock(View::class); @@ -561,7 +561,7 @@ class SharedStorageTest extends TestCase { $this->assertInstanceOf(\OC\Files\Cache\FailedCache::class, $storage->getCache()); } - public function testInitWithNotFoundSource() { + public function testInitWithNotFoundSource(): void { $share = $this->createMock(IShare::class); $share->method('getShareOwner')->willReturn(self::TEST_FILES_SHARING_API_USER1); $share->method('getNodeId')->willReturn(1); diff --git a/apps/files_sharing/tests/SizePropagationTest.php b/apps/files_sharing/tests/SizePropagationTest.php index 1112cb03425..de830c508cd 100644 --- a/apps/files_sharing/tests/SizePropagationTest.php +++ b/apps/files_sharing/tests/SizePropagationTest.php @@ -28,7 +28,7 @@ class SizePropagationTest extends TestCase { return new View('/' . $name . '/files'); } - public function testSizePropagationWhenOwnerChangesFile() { + public function testSizePropagationWhenOwnerChangesFile(): void { $recipientView = $this->setupUser(self::TEST_FILES_SHARING_API_USER1); $ownerView = $this->setupUser(self::TEST_FILES_SHARING_API_USER2); @@ -63,7 +63,7 @@ class SizePropagationTest extends TestCase { $this->assertEquals($ownerRootInfo->getSize() + 3, $newOwnerRootInfo->getSize()); } - public function testSizePropagationWhenRecipientChangesFile() { + public function testSizePropagationWhenRecipientChangesFile(): void { $recipientView = $this->setupUser(self::TEST_FILES_SHARING_API_USER1); $ownerView = $this->setupUser(self::TEST_FILES_SHARING_API_USER2); diff --git a/apps/files_sharing/tests/UnshareChildrenTest.php b/apps/files_sharing/tests/UnshareChildrenTest.php index 70445635e38..e95c1c68ecb 100644 --- a/apps/files_sharing/tests/UnshareChildrenTest.php +++ b/apps/files_sharing/tests/UnshareChildrenTest.php @@ -54,7 +54,7 @@ class UnshareChildrenTest extends TestCase { /** * @medium */ - public function testUnshareChildren() { + public function testUnshareChildren(): void { $fileInfo2 = \OC\Files\Filesystem::getFileInfo($this->folder); $this->share( diff --git a/apps/files_sharing/tests/UpdaterTest.php b/apps/files_sharing/tests/UpdaterTest.php index aeefbac5934..9d26ff873a5 100644 --- a/apps/files_sharing/tests/UpdaterTest.php +++ b/apps/files_sharing/tests/UpdaterTest.php @@ -50,7 +50,7 @@ class UpdaterTest extends TestCase { * points should be unshared before the folder gets deleted so * that the mount point doesn't end up at the trash bin */ - public function testDeleteParentFolder() { + public function testDeleteParentFolder(): void { $status = \OC::$server->getAppManager()->isEnabledForUser('files_trashbin'); (new \OC_App())->enable('files_trashbin'); @@ -128,7 +128,7 @@ class UpdaterTest extends TestCase { * * @param string $shareFolder share folder to use */ - public function testShareFile($shareFolder) { + public function testShareFile($shareFolder): void { $config = \OC::$server->getConfig(); $oldShareFolder = $config->getSystemValue('share_folder'); $config->setSystemValue('share_folder', $shareFolder); @@ -178,7 +178,7 @@ class UpdaterTest extends TestCase { /** * if a folder gets renamed all children mount points should be renamed too */ - public function testRename() { + public function testRename(): void { $fileinfo = \OC\Files\Filesystem::getFileInfo($this->folder); $share = $this->share( @@ -225,7 +225,7 @@ class UpdaterTest extends TestCase { * |-subfolder2 * |-file2.txt --> shared with user3 */ - public function testMovedIntoShareChangeOwner() { + public function testMovedIntoShareChangeOwner(): void { $this->markTestSkipped('Skipped because this is failing with S3 as primary as file id are change when moved.'); // user1 creates folder1 diff --git a/apps/files_sharing/tests/WatcherTest.php b/apps/files_sharing/tests/WatcherTest.php index c116f542fba..012acdcd691 100644 --- a/apps/files_sharing/tests/WatcherTest.php +++ b/apps/files_sharing/tests/WatcherTest.php @@ -87,7 +87,7 @@ class WatcherTest extends TestCase { * Tests that writing a file using the shared storage will propagate the file * size to the owner's parent folders. */ - public function testFolderSizePropagationToOwnerStorage() { + public function testFolderSizePropagationToOwnerStorage(): void { $initialSizes = self::getOwnerDirSizes('files/container/shareddir'); $textData = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'; @@ -117,7 +117,7 @@ class WatcherTest extends TestCase { * Tests that writing a file using the shared storage will propagate the file * size to the owner's parent folders. */ - public function testSubFolderSizePropagationToOwnerStorage() { + public function testSubFolderSizePropagationToOwnerStorage(): void { $initialSizes = self::getOwnerDirSizes('files/container/shareddir/subdir'); $textData = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'; diff --git a/apps/files_trashbin/tests/CapabilitiesTest.php b/apps/files_trashbin/tests/CapabilitiesTest.php index f5d3bdd9a9b..a2a17ca349e 100644 --- a/apps/files_trashbin/tests/CapabilitiesTest.php +++ b/apps/files_trashbin/tests/CapabilitiesTest.php @@ -18,7 +18,7 @@ class CapabilitiesTest extends TestCase { $this->capabilities = new Capabilities(); } - public function testGetCapabilities() { + public function testGetCapabilities(): void { $capabilities = [ 'files' => [ 'undelete' => true diff --git a/apps/files_trashbin/tests/Command/CleanUpTest.php b/apps/files_trashbin/tests/Command/CleanUpTest.php index 3ab11ba96aa..49ae103ea30 100644 --- a/apps/files_trashbin/tests/Command/CleanUpTest.php +++ b/apps/files_trashbin/tests/Command/CleanUpTest.php @@ -82,7 +82,7 @@ class CleanUpTest extends TestCase { * @dataProvider dataTestRemoveDeletedFiles * @param boolean $nodeExists */ - public function testRemoveDeletedFiles(bool $nodeExists) { + public function testRemoveDeletedFiles(bool $nodeExists): void { $this->initTable(); $this->rootFolder ->method('nodeExists') @@ -137,7 +137,7 @@ class CleanUpTest extends TestCase { /** * test remove deleted files from users given as parameter */ - public function testExecuteDeleteListOfUsers() { + public function testExecuteDeleteListOfUsers(): void { $userIds = ['user1', 'user2', 'user3']; $instance = $this->getMockBuilder('OCA\Files_Trashbin\Command\CleanUp') ->setMethods(['removeDeletedFiles']) @@ -168,7 +168,7 @@ class CleanUpTest extends TestCase { /** * test remove deleted files of all users */ - public function testExecuteAllUsers() { + public function testExecuteAllUsers(): void { $userIds = []; $backendUsers = ['user1', 'user2']; $instance = $this->getMockBuilder('OCA\Files_Trashbin\Command\CleanUp') @@ -200,7 +200,7 @@ class CleanUpTest extends TestCase { $this->invokePrivate($instance, 'execute', [$inputInterface, $outputInterface]); } - public function testExecuteNoUsersAndNoAllUsers() { + public function testExecuteNoUsersAndNoAllUsers(): void { $inputInterface = $this->createMock(InputInterface::class); $inputInterface->method('getArgument') ->with('user_id') @@ -218,7 +218,7 @@ class CleanUpTest extends TestCase { $this->invokePrivate($this->cleanup, 'execute', [$inputInterface, $outputInterface]); } - public function testExecuteUsersAndAllUsers() { + public function testExecuteUsersAndAllUsers(): void { $inputInterface = $this->createMock(InputInterface::class); $inputInterface->method('getArgument') ->with('user_id') diff --git a/apps/files_trashbin/tests/Command/ExpireTest.php b/apps/files_trashbin/tests/Command/ExpireTest.php index 5a7f857adbe..4402e07bbb0 100644 --- a/apps/files_trashbin/tests/Command/ExpireTest.php +++ b/apps/files_trashbin/tests/Command/ExpireTest.php @@ -17,7 +17,7 @@ use Test\TestCase; * @package OCA\Files_Trashbin\Tests\Command */ class ExpireTest extends TestCase { - public function testExpireNonExistingUser() { + public function testExpireNonExistingUser(): void { $command = new Expire('test'); $command->handle(); diff --git a/apps/files_trashbin/tests/Controller/PreviewControllerTest.php b/apps/files_trashbin/tests/Controller/PreviewControllerTest.php index f834b324f2b..1076870bb9f 100644 --- a/apps/files_trashbin/tests/Controller/PreviewControllerTest.php +++ b/apps/files_trashbin/tests/Controller/PreviewControllerTest.php @@ -78,21 +78,21 @@ class PreviewControllerTest extends TestCase { ); } - public function testInvalidWidth() { + public function testInvalidWidth(): void { $res = $this->controller->getPreview(42, 0); $expected = new DataResponse([], Http::STATUS_BAD_REQUEST); $this->assertEquals($expected, $res); } - public function testInvalidHeight() { + public function testInvalidHeight(): void { $res = $this->controller->getPreview(42, 10, 0); $expected = new DataResponse([], Http::STATUS_BAD_REQUEST); $this->assertEquals($expected, $res); } - public function testValidPreview() { + public function testValidPreview(): void { $userFolder = $this->createMock(Folder::class); $userRoot = $this->createMock(Folder::class); $trash = $this->createMock(Folder::class); @@ -145,7 +145,7 @@ class PreviewControllerTest extends TestCase { $this->assertEquals($expected, $res); } - public function testTrashFileNotFound() { + public function testTrashFileNotFound(): void { $userFolder = $this->createMock(Folder::class); $userRoot = $this->createMock(Folder::class); $trash = $this->createMock(Folder::class); @@ -169,7 +169,7 @@ class PreviewControllerTest extends TestCase { $this->assertEquals($expected, $res); } - public function testTrashFolder() { + public function testTrashFolder(): void { $userFolder = $this->createMock(Folder::class); $userRoot = $this->createMock(Folder::class); $trash = $this->createMock(Folder::class); diff --git a/apps/files_trashbin/tests/ExpirationTest.php b/apps/files_trashbin/tests/ExpirationTest.php index bf4e1ef2ad9..7f026c16806 100644 --- a/apps/files_trashbin/tests/ExpirationTest.php +++ b/apps/files_trashbin/tests/ExpirationTest.php @@ -89,7 +89,7 @@ class ExpirationTest extends \Test\TestCase { * @param bool $quotaExceeded * @param string $expectedResult */ - public function testExpiration($retentionObligation, $timeNow, $timestamp, $quotaExceeded, $expectedResult) { + public function testExpiration($retentionObligation, $timeNow, $timestamp, $quotaExceeded, $expectedResult): void { $mockedConfig = $this->getMockedConfig($retentionObligation); $mockedTimeFactory = $this->getMockedTimeFactory($timeNow); @@ -120,7 +120,7 @@ class ExpirationTest extends \Test\TestCase { * @param string $configValue * @param int $expectedMaxAgeTimestamp */ - public function testGetMaxAgeAsTimestamp($configValue, $expectedMaxAgeTimestamp) { + public function testGetMaxAgeAsTimestamp($configValue, $expectedMaxAgeTimestamp): void { $mockedConfig = $this->getMockedConfig($configValue); $mockedTimeFactory = $this->getMockedTimeFactory( self::FAKE_TIME_NOW diff --git a/apps/files_trashbin/tests/StorageTest.php b/apps/files_trashbin/tests/StorageTest.php index 76c9829cf9c..37dfe84fc60 100644 --- a/apps/files_trashbin/tests/StorageTest.php +++ b/apps/files_trashbin/tests/StorageTest.php @@ -110,7 +110,7 @@ class StorageTest extends \Test\TestCase { /** * Test that deleting a file puts it into the trashbin. */ - public function testSingleStorageDeleteFile() { + public function testSingleStorageDeleteFile(): void { $this->assertTrue($this->userView->file_exists('test.txt')); $this->userView->unlink('test.txt'); [$storage,] = $this->userView->resolvePath('test.txt'); @@ -127,7 +127,7 @@ class StorageTest extends \Test\TestCase { /** * Test that deleting a folder puts it into the trashbin. */ - public function testSingleStorageDeleteFolder() { + public function testSingleStorageDeleteFolder(): void { $this->assertTrue($this->userView->file_exists('folder/inside.txt')); $this->userView->rmdir('folder'); [$storage,] = $this->userView->resolvePath('folder/inside.txt'); @@ -149,7 +149,7 @@ class StorageTest extends \Test\TestCase { /** * Test that deleting a file with a long filename puts it into the trashbin. */ - public function testSingleStorageDeleteLongFilename() { + public function testSingleStorageDeleteLongFilename(): void { $truncatedFilename = 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.txt'; $this->assertTrue($this->userView->file_exists(static::LONG_FILENAME)); @@ -168,7 +168,7 @@ class StorageTest extends \Test\TestCase { /** * Test that deleting a file with the max filename length puts it into the trashbin. */ - public function testSingleStorageDeleteMaxLengthFilename() { + public function testSingleStorageDeleteMaxLengthFilename(): void { $truncatedFilename = 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.txt'; $this->assertTrue($this->userView->file_exists(static::MAX_FILENAME)); @@ -190,7 +190,7 @@ class StorageTest extends \Test\TestCase { * the trashbin folder is in the root storage while the mounted one * isn't. */ - public function testCrossStorageDeleteFile() { + public function testCrossStorageDeleteFile(): void { $storage2 = new Temporary([]); \OC\Files\Filesystem::mount($storage2, [], $this->user . '/files/substorage'); @@ -216,7 +216,7 @@ class StorageTest extends \Test\TestCase { * the trashbin folder is in the root storage while the mounted one * isn't. */ - public function testCrossStorageDeleteFolder() { + public function testCrossStorageDeleteFolder(): void { $storage2 = new Temporary([]); \OC\Files\Filesystem::mount($storage2, [], $this->user . '/files/substorage'); @@ -245,7 +245,7 @@ class StorageTest extends \Test\TestCase { /** * Test that deleted versions properly land in the trashbin. */ - public function testDeleteVersionsOfFile() { + public function testDeleteVersionsOfFile(): void { // trigger a version (multiple would not work because of the expire logic) $this->userView->file_put_contents('test.txt', 'v1'); @@ -272,7 +272,7 @@ class StorageTest extends \Test\TestCase { /** * Test that deleted versions properly land in the trashbin. */ - public function testDeleteVersionsOfFolder() { + public function testDeleteVersionsOfFolder(): void { // trigger a version (multiple would not work because of the expire logic) $this->userView->file_put_contents('folder/inside.txt', 'v1'); @@ -305,7 +305,7 @@ class StorageTest extends \Test\TestCase { /** * Test that deleted versions properly land in the trashbin when deleting as share recipient. */ - public function testDeleteVersionsOfFileAsRecipient() { + public function testDeleteVersionsOfFileAsRecipient(): void { $this->userView->mkdir('share'); // trigger a version (multiple would not work because of the expire logic) $this->userView->file_put_contents('share/test.txt', 'v1'); @@ -356,7 +356,7 @@ class StorageTest extends \Test\TestCase { /** * Test that deleted versions properly land in the trashbin when deleting as share recipient. */ - public function testDeleteVersionsOfFolderAsRecipient() { + public function testDeleteVersionsOfFolderAsRecipient(): void { $this->userView->mkdir('share'); $this->userView->mkdir('share/folder'); // trigger a version (multiple would not work because of the expire logic) @@ -423,7 +423,7 @@ class StorageTest extends \Test\TestCase { * storages. This is because rename() between storages would call * unlink() which should NOT trigger the version deletion logic. */ - public function testKeepFileAndVersionsWhenMovingFileBetweenStorages() { + public function testKeepFileAndVersionsWhenMovingFileBetweenStorages(): void { $storage2 = new Temporary([]); \OC\Files\Filesystem::mount($storage2, [], $this->user . '/files/substorage'); @@ -462,7 +462,7 @@ class StorageTest extends \Test\TestCase { * storages. This is because rename() between storages would call * unlink() which should NOT trigger the version deletion logic. */ - public function testKeepFileAndVersionsWhenMovingFolderBetweenStorages() { + public function testKeepFileAndVersionsWhenMovingFolderBetweenStorages(): void { $storage2 = new Temporary([]); \OC\Files\Filesystem::mount($storage2, [], $this->user . '/files/substorage'); @@ -499,7 +499,7 @@ class StorageTest extends \Test\TestCase { /** * Delete should fail if the source file can't be deleted. */ - public function testSingleStorageDeleteFileFail() { + public function testSingleStorageDeleteFileFail(): void { /** * @var \OC\Files\Storage\Temporary | \PHPUnit\Framework\MockObject\MockObject $storage */ @@ -536,7 +536,7 @@ class StorageTest extends \Test\TestCase { /** * Delete should fail if the source folder can't be deleted. */ - public function testSingleStorageDeleteFolderFail() { + public function testSingleStorageDeleteFolderFail(): void { /** * @var \OC\Files\Storage\Temporary | \PHPUnit\Framework\MockObject\MockObject $storage */ @@ -570,7 +570,7 @@ class StorageTest extends \Test\TestCase { /** * @dataProvider dataTestShouldMoveToTrash */ - public function testShouldMoveToTrash($mountPoint, $path, $userExists, $appDisablesTrash, $expected) { + public function testShouldMoveToTrash($mountPoint, $path, $userExists, $appDisablesTrash, $expected): void { $fileID = 1; $cache = $this->createMock(ICache::class); $cache->expects($this->any())->method('getId')->willReturn($fileID); @@ -628,7 +628,7 @@ class StorageTest extends \Test\TestCase { /** * Test that deleting a file doesn't error when nobody is logged in */ - public function testSingleStorageDeleteFileLoggedOut() { + public function testSingleStorageDeleteFileLoggedOut(): void { $this->logout(); if (!$this->userView->file_exists('test.txt')) { @@ -639,7 +639,7 @@ class StorageTest extends \Test\TestCase { } } - public function testTrashbinCollision() { + public function testTrashbinCollision(): void { $this->userView->file_put_contents('test.txt', 'foo'); $this->userView->file_put_contents('folder/test.txt', 'bar'); @@ -671,7 +671,7 @@ class StorageTest extends \Test\TestCase { $this->assertEquals('bar', $this->rootView->file_get_contents($this->user . '/files_trashbin/files/test.txt.d1001')); } - public function testMoveFromStoragePreserveFileId() { + public function testMoveFromStoragePreserveFileId(): void { if (!$this->userView->getMount('')->getStorage()->instanceOfStorage(Local::class)) { $this->markTestSkipped('Skipping on non-local users storage'); } diff --git a/apps/files_trashbin/tests/TrashbinTest.php b/apps/files_trashbin/tests/TrashbinTest.php index 528dd86820f..11501891c77 100644 --- a/apps/files_trashbin/tests/TrashbinTest.php +++ b/apps/files_trashbin/tests/TrashbinTest.php @@ -146,7 +146,7 @@ class TrashbinTest extends \Test\TestCase { /** * test expiration of files older then the max storage time defined for the trash */ - public function testExpireOldFiles() { + public function testExpireOldFiles(): void { /** @var \OCP\AppFramework\Utility\ITimeFactory $time */ $time = \OC::$server->query(\OCP\AppFramework\Utility\ITimeFactory::class); @@ -198,7 +198,7 @@ class TrashbinTest extends \Test\TestCase { * the owner of the file and the one from the user who deleted the file get expired * correctly */ - public function testExpireOldFilesShared() { + public function testExpireOldFilesShared(): void { $currentTime = time(); $folder = 'trashTest-' . $currentTime . '/'; $expiredDate = $currentTime - 3 * 24 * 60 * 60; @@ -316,7 +316,7 @@ class TrashbinTest extends \Test\TestCase { * test expiration of old files in the trash bin until the max size * of the trash bin is met again */ - public function testExpireOldFilesUtilLimitsAreMet() { + public function testExpireOldFilesUtilLimitsAreMet(): void { // create some files \OC\Files\Filesystem::file_put_contents('file1.txt', 'file1'); @@ -349,7 +349,7 @@ class TrashbinTest extends \Test\TestCase { /** * Test restoring a file */ - public function testRestoreFileInRoot() { + public function testRestoreFileInRoot(): void { $userFolder = \OC::$server->getUserFolder(); $file = $userFolder->newFile('file1.txt'); $file->putContent('foo'); @@ -381,7 +381,7 @@ class TrashbinTest extends \Test\TestCase { /** * Test restoring a file in subfolder */ - public function testRestoreFileInSubfolder() { + public function testRestoreFileInSubfolder(): void { $userFolder = \OC::$server->getUserFolder(); $folder = $userFolder->newFolder('folder'); $file = $folder->newFile('file1.txt'); @@ -414,7 +414,7 @@ class TrashbinTest extends \Test\TestCase { /** * Test restoring a folder */ - public function testRestoreFolder() { + public function testRestoreFolder(): void { $userFolder = \OC::$server->getUserFolder(); $folder = $userFolder->newFolder('folder'); $file = $folder->newFile('file1.txt'); @@ -447,7 +447,7 @@ class TrashbinTest extends \Test\TestCase { /** * Test restoring a file from inside a trashed folder */ - public function testRestoreFileFromTrashedSubfolder() { + public function testRestoreFileFromTrashedSubfolder(): void { $userFolder = \OC::$server->getUserFolder(); $folder = $userFolder->newFolder('folder'); $file = $folder->newFile('file1.txt'); @@ -481,7 +481,7 @@ class TrashbinTest extends \Test\TestCase { * Test restoring a file whenever the source folder was removed. * The file should then land in the root. */ - public function testRestoreFileWithMissingSourceFolder() { + public function testRestoreFileWithMissingSourceFolder(): void { $userFolder = \OC::$server->getUserFolder(); $folder = $userFolder->newFolder('folder'); $file = $folder->newFile('file1.txt'); @@ -518,7 +518,7 @@ class TrashbinTest extends \Test\TestCase { * Test restoring a file in the root folder whenever there is another file * with the same name in the root folder */ - public function testRestoreFileDoesNotOverwriteExistingInRoot() { + public function testRestoreFileDoesNotOverwriteExistingInRoot(): void { $userFolder = \OC::$server->getUserFolder(); $file = $userFolder->newFile('file1.txt'); $file->putContent('foo'); @@ -558,7 +558,7 @@ class TrashbinTest extends \Test\TestCase { * Test restoring a file whenever there is another file * with the same name in the source folder */ - public function testRestoreFileDoesNotOverwriteExistingInSubfolder() { + public function testRestoreFileDoesNotOverwriteExistingInSubfolder(): void { $userFolder = \OC::$server->getUserFolder(); $folder = $userFolder->newFolder('folder'); $file = $folder->newFile('file1.txt'); @@ -598,7 +598,7 @@ class TrashbinTest extends \Test\TestCase { /** * Test restoring a non-existing file from trashbin, returns false */ - public function testRestoreUnexistingFile() { + public function testRestoreUnexistingFile(): void { $this->assertFalse( OCA\Files_Trashbin\Trashbin::restore( 'unexist.txt.d123456', @@ -612,7 +612,7 @@ class TrashbinTest extends \Test\TestCase { * Test restoring a file into a read-only folder, will restore * the file to root instead */ - public function testRestoreFileIntoReadOnlySourceFolder() { + public function testRestoreFileIntoReadOnlySourceFolder(): void { $userFolder = \OC::$server->getUserFolder(); $folder = $userFolder->newFolder('folder'); $file = $folder->newFile('file1.txt'); diff --git a/apps/files_versions/tests/Command/CleanupTest.php b/apps/files_versions/tests/Command/CleanupTest.php index cd397e4a098..021a47ed08d 100644 --- a/apps/files_versions/tests/Command/CleanupTest.php +++ b/apps/files_versions/tests/Command/CleanupTest.php @@ -52,7 +52,7 @@ class CleanupTest extends TestCase { * @dataProvider dataTestDeleteVersions * @param boolean $nodeExists */ - public function testDeleteVersions($nodeExists) { + public function testDeleteVersions($nodeExists): void { $this->rootFolder->expects($this->once()) ->method('nodeExists') ->with('/testUser/files_versions') @@ -102,7 +102,7 @@ class CleanupTest extends TestCase { /** * test delete versions from users given as parameter */ - public function testExecuteDeleteListOfUsers() { + public function testExecuteDeleteListOfUsers(): void { $userIds = ['user1', 'user2', 'user3']; $instance = $this->getMockBuilder('OCA\Files_Versions\Command\CleanUp') @@ -133,7 +133,7 @@ class CleanupTest extends TestCase { /** * test delete versions of all users */ - public function testExecuteAllUsers() { + public function testExecuteAllUsers(): void { $userIds = []; $backendUsers = ['user1', 'user2']; diff --git a/apps/files_versions/tests/Command/ExpireTest.php b/apps/files_versions/tests/Command/ExpireTest.php index ac1fc4ada7f..11f4eb2e2be 100644 --- a/apps/files_versions/tests/Command/ExpireTest.php +++ b/apps/files_versions/tests/Command/ExpireTest.php @@ -17,7 +17,7 @@ use Test\TestCase; * @package OCA\Files_Versions\Tests\Command */ class ExpireTest extends TestCase { - public function testExpireNonExistingUser() { + public function testExpireNonExistingUser(): void { $command = new Expire($this->getUniqueID('test'), ''); $command->handle(); diff --git a/apps/files_versions/tests/Controller/PreviewControllerTest.php b/apps/files_versions/tests/Controller/PreviewControllerTest.php index 1673a212f89..9899836bb88 100644 --- a/apps/files_versions/tests/Controller/PreviewControllerTest.php +++ b/apps/files_versions/tests/Controller/PreviewControllerTest.php @@ -71,35 +71,35 @@ class PreviewControllerTest extends TestCase { ); } - public function testInvalidFile() { + public function testInvalidFile(): void { $res = $this->controller->getPreview(''); $expected = new DataResponse([], Http::STATUS_BAD_REQUEST); $this->assertEquals($expected, $res); } - public function testInvalidWidth() { + public function testInvalidWidth(): void { $res = $this->controller->getPreview('file', 0); $expected = new DataResponse([], Http::STATUS_BAD_REQUEST); $this->assertEquals($expected, $res); } - public function testInvalidHeight() { + public function testInvalidHeight(): void { $res = $this->controller->getPreview('file', 10, 0); $expected = new DataResponse([], Http::STATUS_BAD_REQUEST); $this->assertEquals($expected, $res); } - public function testInvalidVersion() { + public function testInvalidVersion(): void { $res = $this->controller->getPreview('file', 10, 0); $expected = new DataResponse([], Http::STATUS_BAD_REQUEST); $this->assertEquals($expected, $res); } - public function testValidPreview() { + public function testValidPreview(): void { $userFolder = $this->createMock(Folder::class); $userRoot = $this->createMock(Folder::class); @@ -136,7 +136,7 @@ class PreviewControllerTest extends TestCase { $this->assertEquals($expected, $res); } - public function testVersionNotFound() { + public function testVersionNotFound(): void { $userFolder = $this->createMock(Folder::class); $userRoot = $this->createMock(Folder::class); diff --git a/apps/files_versions/tests/ExpirationTest.php b/apps/files_versions/tests/ExpirationTest.php index a998d3a3e9a..ac8af7c093a 100644 --- a/apps/files_versions/tests/ExpirationTest.php +++ b/apps/files_versions/tests/ExpirationTest.php @@ -88,7 +88,7 @@ class ExpirationTest extends \Test\TestCase { * @param bool $quotaExceeded * @param string $expectedResult */ - public function testExpiration($retentionObligation, $timeNow, $timestamp, $quotaExceeded, $expectedResult) { + public function testExpiration($retentionObligation, $timeNow, $timestamp, $quotaExceeded, $expectedResult): void { $mockedConfig = $this->getMockedConfig($retentionObligation); $mockedTimeFactory = $this->getMockedTimeFactory($timeNow); $mockedLogger = $this->createMock(LoggerInterface::class); diff --git a/apps/files_versions/tests/StorageTest.php b/apps/files_versions/tests/StorageTest.php index ead125e905c..e085729eddd 100644 --- a/apps/files_versions/tests/StorageTest.php +++ b/apps/files_versions/tests/StorageTest.php @@ -55,7 +55,7 @@ class StorageTest extends TestCase { $file->touch($mtime); } - public function testExpireMaxAge() { + public function testExpireMaxAge(): void { $this->userFolder->newFolder('folder1'); $this->userFolder->newFolder('folder1/sub1'); $this->userFolder->newFolder('folder2'); diff --git a/apps/files_versions/tests/VersioningTest.php b/apps/files_versions/tests/VersioningTest.php index 4b6820750a2..3200b5f784b 100644 --- a/apps/files_versions/tests/VersioningTest.php +++ b/apps/files_versions/tests/VersioningTest.php @@ -123,7 +123,7 @@ class VersioningTest extends \Test\TestCase { * test expire logic * @dataProvider versionsProvider */ - public function testGetExpireList($versions, $sizeOfAllDeletedFiles) { + public function testGetExpireList($versions, $sizeOfAllDeletedFiles): void { // last interval end at 2592000 $startTime = 5000000; @@ -269,7 +269,7 @@ class VersioningTest extends \Test\TestCase { ]; } - public function testRename() { + public function testRename(): void { \OC\Files\Filesystem::file_put_contents('test.txt', 'test file'); $t1 = time(); @@ -298,7 +298,7 @@ class VersioningTest extends \Test\TestCase { $this->assertTrue($this->rootView->file_exists($v2Renamed), 'version 2 of renamed file exists'); } - public function testRenameInSharedFolder() { + public function testRenameInSharedFolder(): void { \OC\Files\Filesystem::mkdir('folder1'); \OC\Files\Filesystem::mkdir('folder1/folder2'); \OC\Files\Filesystem::file_put_contents('folder1/test.txt', 'test file'); @@ -348,7 +348,7 @@ class VersioningTest extends \Test\TestCase { \OC::$server->getShareManager()->deleteShare($share); } - public function testMoveFolder() { + public function testMoveFolder(): void { \OC\Files\Filesystem::mkdir('folder1'); \OC\Files\Filesystem::mkdir('folder2'); \OC\Files\Filesystem::file_put_contents('folder1/test.txt', 'test file'); @@ -381,7 +381,7 @@ class VersioningTest extends \Test\TestCase { } - public function testMoveFileIntoSharedFolderAsRecipient() { + public function testMoveFileIntoSharedFolderAsRecipient(): void { \OC\Files\Filesystem::mkdir('folder1'); $fileInfo = \OC\Files\Filesystem::getFileInfo('folder1'); @@ -431,7 +431,7 @@ class VersioningTest extends \Test\TestCase { \OC::$server->getShareManager()->deleteShare($share); } - public function testMoveFolderIntoSharedFolderAsRecipient() { + public function testMoveFolderIntoSharedFolderAsRecipient(): void { \OC\Files\Filesystem::mkdir('folder1'); $node = \OC::$server->getUserFolder(self::TEST_VERSIONS_USER)->get('folder1'); @@ -482,7 +482,7 @@ class VersioningTest extends \Test\TestCase { \OC::$server->getShareManager()->deleteShare($share); } - public function testRenameSharedFile() { + public function testRenameSharedFile(): void { \OC\Files\Filesystem::file_put_contents('test.txt', 'test file'); $t1 = time(); @@ -531,7 +531,7 @@ class VersioningTest extends \Test\TestCase { \OC::$server->getShareManager()->deleteShare($share); } - public function testCopy() { + public function testCopy(): void { \OC\Files\Filesystem::file_put_contents('test.txt', 'test file'); $t1 = time(); @@ -564,7 +564,7 @@ class VersioningTest extends \Test\TestCase { * test if we find all versions and if the versions array contain * the correct 'path' and 'name' */ - public function testGetVersions() { + public function testGetVersions(): void { $t1 = time(); // second version is two weeks older, this way we make sure that no // version will be expired @@ -597,7 +597,7 @@ class VersioningTest extends \Test\TestCase { * test if we find all versions and if the versions array contain * the correct 'path' and 'name' */ - public function testGetVersionsEmptyFile() { + public function testGetVersionsEmptyFile(): void { // execute copy hook of versions app $versions = \OCA\Files_Versions\Storage::getVersions(self::TEST_VERSIONS_USER, ''); $this->assertCount(0, $versions); @@ -606,7 +606,7 @@ class VersioningTest extends \Test\TestCase { $this->assertCount(0, $versions); } - public function testExpireNonexistingFile() { + public function testExpireNonexistingFile(): void { $this->logout(); // needed to have a FS setup (the background job does this) \OC_Util::setupFS(self::TEST_VERSIONS_USER); @@ -615,7 +615,7 @@ class VersioningTest extends \Test\TestCase { } - public function testExpireNonexistingUser() { + public function testExpireNonexistingUser(): void { $this->expectException(\OC\User\NoUserException::class); $this->logout(); @@ -626,19 +626,19 @@ class VersioningTest extends \Test\TestCase { $this->assertFalse(\OCA\Files_Versions\Storage::expire('test.txt', 'unexist')); } - public function testRestoreSameStorage() { + public function testRestoreSameStorage(): void { \OC\Files\Filesystem::mkdir('sub'); $this->doTestRestore(); } - public function testRestoreCrossStorage() { + public function testRestoreCrossStorage(): void { $storage2 = new Temporary([]); \OC\Files\Filesystem::mount($storage2, [], self::TEST_VERSIONS_USER . '/files/sub'); $this->doTestRestore(); } - public function testRestoreNoPermission() { + public function testRestoreNoPermission(): void { $this->loginAsUser(self::TEST_VERSIONS_USER); $userHome = \OC::$server->getUserFolder(self::TEST_VERSIONS_USER); @@ -673,7 +673,7 @@ class VersioningTest extends \Test\TestCase { $this->assertEquals('test file', $file->getContent(), 'File content has not changed'); } - public function testRestoreMovedShare() { + public function testRestoreMovedShare(): void { $this->markTestSkipped('Unreliable test'); $this->loginAsUser(self::TEST_VERSIONS_USER); @@ -864,7 +864,7 @@ class VersioningTest extends \Test\TestCase { /** * Test whether versions are created when overwriting as owner */ - public function testStoreVersionAsOwner() { + public function testStoreVersionAsOwner(): void { $this->loginAsUser(self::TEST_VERSIONS_USER); $this->createAndCheckVersions( @@ -876,7 +876,7 @@ class VersioningTest extends \Test\TestCase { /** * Test whether versions are created when overwriting as share recipient */ - public function testStoreVersionAsRecipient() { + public function testStoreVersionAsRecipient(): void { $this->loginAsUser(self::TEST_VERSIONS_USER); \OC\Files\Filesystem::mkdir('folder'); @@ -909,7 +909,7 @@ class VersioningTest extends \Test\TestCase { * is logged in. File modification must still be able to find * the owner and create versions. */ - public function testStoreVersionAsAnonymous() { + public function testStoreVersionAsAnonymous(): void { $this->logout(); // note: public link upload does this, diff --git a/apps/files_versions/tests/Versions/VersionManagerTest.php b/apps/files_versions/tests/Versions/VersionManagerTest.php index d621d67a6de..a50781b899d 100644 --- a/apps/files_versions/tests/Versions/VersionManagerTest.php +++ b/apps/files_versions/tests/Versions/VersionManagerTest.php @@ -29,7 +29,7 @@ class VersionManagerTest extends TestCase { ->getMock(); } - public function testGetBackendSingle() { + public function testGetBackendSingle(): void { $manager = new VersionManager(); $backend = $this->getBackend(); $manager->registerBackend(IStorage::class, $backend); @@ -37,7 +37,7 @@ class VersionManagerTest extends TestCase { $this->assertEquals($backend, $manager->getBackendForStorage($this->getStorage(Local::class))); } - public function testGetBackendMoreSpecific() { + public function testGetBackendMoreSpecific(): void { $manager = new VersionManager(); $backend1 = $this->getBackend(); $backend2 = $this->getBackend(); @@ -47,7 +47,7 @@ class VersionManagerTest extends TestCase { $this->assertEquals($backend2, $manager->getBackendForStorage($this->getStorage(Local::class))); } - public function testGetBackendNoUse() { + public function testGetBackendNoUse(): void { $manager = new VersionManager(); $backend1 = $this->getBackend(); $backend2 = $this->getBackend(false); @@ -57,7 +57,7 @@ class VersionManagerTest extends TestCase { $this->assertEquals($backend1, $manager->getBackendForStorage($this->getStorage(Local::class))); } - public function testGetBackendMultiple() { + public function testGetBackendMultiple(): void { $manager = new VersionManager(); $backend1 = $this->getBackend(); $backend2 = $this->getBackend(false); diff --git a/apps/oauth2/tests/Controller/LoginRedirectorControllerTest.php b/apps/oauth2/tests/Controller/LoginRedirectorControllerTest.php index eb8e47a102f..30806854574 100644 --- a/apps/oauth2/tests/Controller/LoginRedirectorControllerTest.php +++ b/apps/oauth2/tests/Controller/LoginRedirectorControllerTest.php @@ -53,7 +53,7 @@ class LoginRedirectorControllerTest extends TestCase { ); } - public function testAuthorize() { + public function testAuthorize(): void { $client = new Client(); $client->setClientIdentifier('MyClientIdentifier'); $this->clientMapper @@ -80,7 +80,7 @@ class LoginRedirectorControllerTest extends TestCase { $this->assertEquals($expected, $this->loginRedirectorController->authorize('MyClientId', 'MyState', 'code')); } - public function testAuthorizeWrongResponseType() { + public function testAuthorizeWrongResponseType(): void { $client = new Client(); $client->setClientIdentifier('MyClientIdentifier'); $client->setRedirectUri('http://foo.bar'); @@ -98,7 +98,7 @@ class LoginRedirectorControllerTest extends TestCase { $this->assertEquals($expected, $this->loginRedirectorController->authorize('MyClientId', 'MyState', 'wrongcode')); } - public function testClientNotFound() { + public function testClientNotFound(): void { $clientNotFound = new ClientNotFoundException('could not find client test123', 0); $this->clientMapper ->expects($this->once()) diff --git a/apps/oauth2/tests/Controller/OauthApiControllerTest.php b/apps/oauth2/tests/Controller/OauthApiControllerTest.php index 803bdce16b1..fa8c90843e6 100644 --- a/apps/oauth2/tests/Controller/OauthApiControllerTest.php +++ b/apps/oauth2/tests/Controller/OauthApiControllerTest.php @@ -84,7 +84,7 @@ class OauthApiControllerTest extends TestCase { ); } - public function testGetTokenInvalidGrantType() { + public function testGetTokenInvalidGrantType(): void { $expected = new JSONResponse([ 'error' => 'invalid_grant', ], Http::STATUS_BAD_REQUEST); @@ -93,7 +93,7 @@ class OauthApiControllerTest extends TestCase { $this->assertEquals($expected, $this->oauthApiController->getToken('foo', null, null, null, null)); } - public function testGetTokenInvalidCode() { + public function testGetTokenInvalidCode(): void { $expected = new JSONResponse([ 'error' => 'invalid_request', ], Http::STATUS_BAD_REQUEST); @@ -106,7 +106,7 @@ class OauthApiControllerTest extends TestCase { $this->assertEquals($expected, $this->oauthApiController->getToken('authorization_code', 'invalidcode', null, null, null)); } - public function testGetTokenExpiredCode() { + public function testGetTokenExpiredCode(): void { $codeCreatedAt = 100; $expiredSince = 123; @@ -131,7 +131,7 @@ class OauthApiControllerTest extends TestCase { $this->assertEquals($expected, $this->oauthApiController->getToken('authorization_code', 'validcode', null, null, null)); } - public function testGetTokenWithCodeForActiveToken() { + public function testGetTokenWithCodeForActiveToken(): void { // if a token has already delivered oauth tokens, // it should not be possible to get a new oauth token from a valid authorization code $codeCreatedAt = 100; @@ -158,7 +158,7 @@ class OauthApiControllerTest extends TestCase { $this->assertEquals($expected, $this->oauthApiController->getToken('authorization_code', 'validcode', null, null, null)); } - public function testGetTokenClientDoesNotExist() { + public function testGetTokenClientDoesNotExist(): void { // In this test, the token's authorization code is valid and has not expired // and we check what happens when the associated Oauth client does not exist $codeCreatedAt = 100; @@ -189,7 +189,7 @@ class OauthApiControllerTest extends TestCase { $this->assertEquals($expected, $this->oauthApiController->getToken('authorization_code', 'validcode', null, null, null)); } - public function testRefreshTokenInvalidRefreshToken() { + public function testRefreshTokenInvalidRefreshToken(): void { $expected = new JSONResponse([ 'error' => 'invalid_request', ], Http::STATUS_BAD_REQUEST); @@ -202,7 +202,7 @@ class OauthApiControllerTest extends TestCase { $this->assertEquals($expected, $this->oauthApiController->getToken('refresh_token', null, 'invalidrefresh', null, null)); } - public function testRefreshTokenClientDoesNotExist() { + public function testRefreshTokenClientDoesNotExist(): void { $expected = new JSONResponse([ 'error' => 'invalid_request', ], Http::STATUS_BAD_REQUEST); @@ -236,7 +236,7 @@ class OauthApiControllerTest extends TestCase { * @param string $clientId * @param string $clientSecret */ - public function testRefreshTokenInvalidClient($clientId, $clientSecret) { + public function testRefreshTokenInvalidClient($clientId, $clientSecret): void { $expected = new JSONResponse([ 'error' => 'invalid_client', ], Http::STATUS_BAD_REQUEST); @@ -270,7 +270,7 @@ class OauthApiControllerTest extends TestCase { $this->assertEquals($expected, $this->oauthApiController->getToken('refresh_token', null, 'validrefresh', $clientId, $clientSecret)); } - public function testRefreshTokenInvalidAppToken() { + public function testRefreshTokenInvalidAppToken(): void { $expected = new JSONResponse([ 'error' => 'invalid_request', ], Http::STATUS_BAD_REQUEST); @@ -313,7 +313,7 @@ class OauthApiControllerTest extends TestCase { $this->assertEquals($expected, $this->oauthApiController->getToken('refresh_token', null, 'validrefresh', 'clientId', 'clientSecret')); } - public function testRefreshTokenValidAppToken() { + public function testRefreshTokenValidAppToken(): void { $accessToken = new AccessToken(); $accessToken->setClientId(42); $accessToken->setTokenId(1337); @@ -409,7 +409,7 @@ class OauthApiControllerTest extends TestCase { $this->assertEquals($expected, $this->oauthApiController->getToken('refresh_token', null, 'validrefresh', 'clientId', 'clientSecret')); } - public function testRefreshTokenValidAppTokenBasicAuth() { + public function testRefreshTokenValidAppTokenBasicAuth(): void { $accessToken = new AccessToken(); $accessToken->setClientId(42); $accessToken->setTokenId(1337); @@ -508,7 +508,7 @@ class OauthApiControllerTest extends TestCase { $this->assertEquals($expected, $this->oauthApiController->getToken('refresh_token', null, 'validrefresh', null, null)); } - public function testRefreshTokenExpiredAppToken() { + public function testRefreshTokenExpiredAppToken(): void { $accessToken = new AccessToken(); $accessToken->setClientId(42); $accessToken->setTokenId(1337); diff --git a/apps/oauth2/tests/Controller/SettingsControllerTest.php b/apps/oauth2/tests/Controller/SettingsControllerTest.php index 1f93a272ee7..0ea23439b89 100644 --- a/apps/oauth2/tests/Controller/SettingsControllerTest.php +++ b/apps/oauth2/tests/Controller/SettingsControllerTest.php @@ -70,7 +70,7 @@ class SettingsControllerTest extends TestCase { } - public function testAddClient() { + public function testAddClient(): void { $this->secureRandom ->expects($this->exactly(2)) ->method('generate') @@ -117,7 +117,7 @@ class SettingsControllerTest extends TestCase { ], $data); } - public function testDeleteClient() { + public function testDeleteClient(): void { $userManager = \OC::$server->getUserManager(); // count other users in the db before adding our own @@ -177,7 +177,7 @@ class SettingsControllerTest extends TestCase { $user1->delete(); } - public function testInvalidRedirectUri() { + public function testInvalidRedirectUri(): void { $result = $this->settingsController->addClient('test', 'invalidurl'); $this->assertEquals(Http::STATUS_BAD_REQUEST, $result->getStatus()); diff --git a/apps/oauth2/tests/Db/AccessTokenMapperTest.php b/apps/oauth2/tests/Db/AccessTokenMapperTest.php index a248c1e0d38..5bb069248f3 100644 --- a/apps/oauth2/tests/Db/AccessTokenMapperTest.php +++ b/apps/oauth2/tests/Db/AccessTokenMapperTest.php @@ -22,7 +22,7 @@ class AccessTokenMapperTest extends TestCase { $this->accessTokenMapper = new AccessTokenMapper(\OC::$server->getDatabaseConnection(), \OC::$server->get(ITimeFactory::class)); } - public function testGetByCode() { + public function testGetByCode(): void { $this->accessTokenMapper->deleteByClientId(1234); $token = new AccessToken(); $token->setClientId(1234); @@ -38,7 +38,7 @@ class AccessTokenMapperTest extends TestCase { } - public function testDeleteByClientId() { + public function testDeleteByClientId(): void { $this->expectException(\OCA\OAuth2\Exceptions\AccessTokenNotFoundException::class); $this->accessTokenMapper->deleteByClientId(1234); diff --git a/apps/oauth2/tests/Db/ClientMapperTest.php b/apps/oauth2/tests/Db/ClientMapperTest.php index 3d8b25acbef..8c00c2e0a21 100644 --- a/apps/oauth2/tests/Db/ClientMapperTest.php +++ b/apps/oauth2/tests/Db/ClientMapperTest.php @@ -28,7 +28,7 @@ class ClientMapperTest extends TestCase { parent::tearDown(); } - public function testGetByIdentifier() { + public function testGetByIdentifier(): void { $client = new Client(); $client->setClientIdentifier('MyAwesomeClientIdentifier'); $client->setName('Client Name'); @@ -39,13 +39,13 @@ class ClientMapperTest extends TestCase { $this->assertEquals($client, $this->clientMapper->getByIdentifier('MyAwesomeClientIdentifier')); } - public function testGetByIdentifierNotExisting() { + public function testGetByIdentifierNotExisting(): void { $this->expectException(\OCA\OAuth2\Exceptions\ClientNotFoundException::class); $this->clientMapper->getByIdentifier('MyTotallyNotExistingClient'); } - public function testGetByUid() { + public function testGetByUid(): void { $client = new Client(); $client->setClientIdentifier('MyNewClient'); $client->setName('Client Name'); @@ -56,13 +56,13 @@ class ClientMapperTest extends TestCase { $this->assertEquals($client, $this->clientMapper->getByUid($client->getId())); } - public function testGetByUidNotExisting() { + public function testGetByUidNotExisting(): void { $this->expectException(\OCA\OAuth2\Exceptions\ClientNotFoundException::class); $this->clientMapper->getByUid(1234); } - public function testGetClients() { + public function testGetClients(): void { $this->assertSame('array', gettype($this->clientMapper->getClients())); } diff --git a/apps/oauth2/tests/Settings/AdminTest.php b/apps/oauth2/tests/Settings/AdminTest.php index 9cbefb74671..ca9100669df 100644 --- a/apps/oauth2/tests/Settings/AdminTest.php +++ b/apps/oauth2/tests/Settings/AdminTest.php @@ -39,7 +39,7 @@ class AdminTest extends TestCase { ); } - public function testGetForm() { + public function testGetForm(): void { $expected = new TemplateResponse( 'oauth2', 'admin', @@ -49,11 +49,11 @@ class AdminTest extends TestCase { $this->assertEquals($expected, $this->admin->getForm()); } - public function testGetSection() { + public function testGetSection(): void { $this->assertSame('security', $this->admin->getSection()); } - public function testGetPriority() { + public function testGetPriority(): void { $this->assertSame(100, $this->admin->getPriority()); } } diff --git a/apps/provisioning_api/tests/CapabilitiesTest.php b/apps/provisioning_api/tests/CapabilitiesTest.php index 8b4215063b7..e3c14f37ed7 100644 --- a/apps/provisioning_api/tests/CapabilitiesTest.php +++ b/apps/provisioning_api/tests/CapabilitiesTest.php @@ -52,7 +52,7 @@ class CapabilitiesTest extends TestCase { /** * @dataProvider getCapabilitiesProvider */ - public function testGetCapabilities($federationAppEnabled, $federatedFileSharingAppEnabled, $lookupServerEnabled, $expectedFederatedScopeEnabled, $expectedPublishedScopeEnabled) { + public function testGetCapabilities($federationAppEnabled, $federatedFileSharingAppEnabled, $lookupServerEnabled, $expectedFederatedScopeEnabled, $expectedPublishedScopeEnabled): void { $this->appManager->expects($this->any()) ->method('isEnabledForUser') ->will($this->returnValueMap([ diff --git a/apps/provisioning_api/tests/Controller/AppConfigControllerTest.php b/apps/provisioning_api/tests/Controller/AppConfigControllerTest.php index 23a1f2ee195..f878b6b73d0 100644 --- a/apps/provisioning_api/tests/Controller/AppConfigControllerTest.php +++ b/apps/provisioning_api/tests/Controller/AppConfigControllerTest.php @@ -83,7 +83,7 @@ class AppConfigControllerTest extends TestCase { } } - public function testGetApps() { + public function testGetApps(): void { $this->appConfig->expects($this->once()) ->method('getApps') ->willReturn(['apps']); @@ -108,7 +108,7 @@ class AppConfigControllerTest extends TestCase { * @param \Exception|null $throws * @param int $status */ - public function testGetKeys($app, $keys, $throws, $status) { + public function testGetKeys($app, $keys, $throws, $status): void { $api = $this->getInstance(['verifyAppId']); if ($throws instanceof \Exception) { $api->expects($this->once()) @@ -155,7 +155,7 @@ class AppConfigControllerTest extends TestCase { * @param \Exception|null $throws * @param int $status */ - public function testGetValue($app, $key, $default, $return, $throws, $status) { + public function testGetValue($app, $key, $default, $return, $throws, $status): void { $api = $this->getInstance(['verifyAppId']); if ($throws instanceof \Exception) { $api->expects($this->once()) @@ -207,7 +207,7 @@ class AppConfigControllerTest extends TestCase { * @param \Exception|null $keyThrows * @param int|\Throwable $status */ - public function testSetValue($app, $key, $value, $appThrows, $keyThrows, $status, int|\Throwable $type = IAppConfig::VALUE_MIXED) { + public function testSetValue($app, $key, $value, $appThrows, $keyThrows, $status, int|\Throwable $type = IAppConfig::VALUE_MIXED): void { $adminUser = $this->createMock(IUser::class); $adminUser->expects($this->once()) ->method('getUid') @@ -312,7 +312,7 @@ class AppConfigControllerTest extends TestCase { * @param \Exception|null $keyThrows * @param int $status */ - public function testDeleteValue($app, $key, $appThrows, $keyThrows, $status) { + public function testDeleteValue($app, $key, $appThrows, $keyThrows, $status): void { $api = $this->getInstance(['verifyAppId', 'verifyConfigKey']); if ($appThrows instanceof \Exception) { $api->expects($this->once()) @@ -360,7 +360,7 @@ class AppConfigControllerTest extends TestCase { } } - public function testVerifyAppId() { + public function testVerifyAppId(): void { $api = $this->getInstance(); $this->invokePrivate($api, 'verifyAppId', ['activity']); $this->addToAssertionCount(1); @@ -379,7 +379,7 @@ class AppConfigControllerTest extends TestCase { * @dataProvider dataVerifyAppIdThrows * @param string $app */ - public function testVerifyAppIdThrows($app) { + public function testVerifyAppIdThrows($app): void { $this->expectException(\InvalidArgumentException::class); $api = $this->getInstance(); @@ -401,7 +401,7 @@ class AppConfigControllerTest extends TestCase { * @param string $key * @param string $value */ - public function testVerifyConfigKey($app, $key, $value) { + public function testVerifyConfigKey($app, $key, $value): void { $api = $this->getInstance(); $this->invokePrivate($api, 'verifyConfigKey', [$app, $key, $value]); $this->addToAssertionCount(1); @@ -427,7 +427,7 @@ class AppConfigControllerTest extends TestCase { * @param string $key * @param string $value */ - public function testVerifyConfigKeyThrows($app, $key, $value) { + public function testVerifyConfigKeyThrows($app, $key, $value): void { $this->expectException(\InvalidArgumentException::class); $api = $this->getInstance(); diff --git a/apps/provisioning_api/tests/Controller/AppsControllerTest.php b/apps/provisioning_api/tests/Controller/AppsControllerTest.php index b59433b365f..9c815a52178 100644 --- a/apps/provisioning_api/tests/Controller/AppsControllerTest.php +++ b/apps/provisioning_api/tests/Controller/AppsControllerTest.php @@ -49,21 +49,21 @@ class AppsControllerTest extends \OCA\Provisioning_API\Tests\TestCase { $this->userSession->setUser(null); } - public function testGetAppInfo() { + public function testGetAppInfo(): void { $result = $this->api->getAppInfo('provisioning_api'); $expected = $this->appManager->getAppInfo('provisioning_api'); $this->assertEquals($expected, $result->getData()); } - public function testGetAppInfoOnBadAppID() { + public function testGetAppInfoOnBadAppID(): void { $this->expectException(\OCP\AppFramework\OCS\OCSException::class); $this->expectExceptionCode(998); $this->api->getAppInfo('not_provisioning_api'); } - public function testGetApps() { + public function testGetApps(): void { $user = $this->generateUsers(); $this->groupManager->get('admin')->addUser($user); $this->userSession->setUser($user); @@ -74,13 +74,13 @@ class AppsControllerTest extends \OCA\Provisioning_API\Tests\TestCase { $this->assertEquals(count((new \OC_App())->listAllApps()), count($data['apps'])); } - public function testGetAppsEnabled() { + public function testGetAppsEnabled(): void { $result = $this->api->getApps('enabled'); $data = $result->getData(); $this->assertEquals(count(\OC_App::getEnabledApps()), count($data['apps'])); } - public function testGetAppsDisabled() { + public function testGetAppsDisabled(): void { $result = $this->api->getApps('disabled'); $data = $result->getData(); $apps = (new \OC_App)->listAllApps(); @@ -93,7 +93,7 @@ class AppsControllerTest extends \OCA\Provisioning_API\Tests\TestCase { } - public function testGetAppsInvalidFilter() { + public function testGetAppsInvalidFilter(): void { $this->expectException(\OCP\AppFramework\OCS\OCSException::class); $this->expectExceptionCode(101); diff --git a/apps/provisioning_api/tests/Controller/GroupsControllerTest.php b/apps/provisioning_api/tests/Controller/GroupsControllerTest.php index f0f38bcac9b..8bbc8a29c29 100644 --- a/apps/provisioning_api/tests/Controller/GroupsControllerTest.php +++ b/apps/provisioning_api/tests/Controller/GroupsControllerTest.php @@ -175,7 +175,7 @@ class GroupsControllerTest extends \Test\TestCase { * @param int|null $limit * @param int|null $offset */ - public function testGetGroups($search, $limit, $offset) { + public function testGetGroups($search, $limit, $offset): void { $groups = [$this->createGroup('group1'), $this->createGroup('group2')]; $search = $search === null ? '' : $search; @@ -197,7 +197,7 @@ class GroupsControllerTest extends \Test\TestCase { * @param int|null $limit * @param int|null $offset */ - public function testGetGroupsDetails($search, $limit, $offset) { + public function testGetGroupsDetails($search, $limit, $offset): void { $groups = [$this->createGroup('group1'), $this->createGroup('group2')]; $search = $search === null ? '' : $search; @@ -229,7 +229,7 @@ class GroupsControllerTest extends \Test\TestCase { ]], $result->getData()); } - public function testGetGroupAsSubadmin() { + public function testGetGroupAsSubadmin(): void { $group = $this->createGroup('group'); $this->asSubAdminOfGroup($group); @@ -254,7 +254,7 @@ class GroupsControllerTest extends \Test\TestCase { } - public function testGetGroupAsIrrelevantSubadmin() { + public function testGetGroupAsIrrelevantSubadmin(): void { $this->expectException(\OCP\AppFramework\OCS\OCSException::class); $this->expectExceptionCode(403); @@ -274,7 +274,7 @@ class GroupsControllerTest extends \Test\TestCase { $this->api->getGroup('group'); } - public function testGetGroupAsAdmin() { + public function testGetGroupAsAdmin(): void { $group = $this->createGroup('group'); $this->asAdmin(); @@ -299,7 +299,7 @@ class GroupsControllerTest extends \Test\TestCase { } - public function testGetGroupNonExisting() { + public function testGetGroupNonExisting(): void { $this->expectException(\OCP\AppFramework\OCS\OCSException::class); $this->expectExceptionMessage('The requested group could not be found'); $this->expectExceptionCode(404); @@ -310,7 +310,7 @@ class GroupsControllerTest extends \Test\TestCase { } - public function testGetSubAdminsOfGroupsNotExists() { + public function testGetSubAdminsOfGroupsNotExists(): void { $this->expectException(\OCP\AppFramework\OCS\OCSException::class); $this->expectExceptionMessage('Group does not exist'); $this->expectExceptionCode(101); @@ -318,7 +318,7 @@ class GroupsControllerTest extends \Test\TestCase { $this->api->getSubAdminsOfGroup('NonExistingGroup'); } - public function testGetSubAdminsOfGroup() { + public function testGetSubAdminsOfGroup(): void { $group = $this->createGroup('GroupWithSubAdmins'); $this->groupManager ->method('get') @@ -338,7 +338,7 @@ class GroupsControllerTest extends \Test\TestCase { $this->assertEquals(['SubAdmin1', 'SubAdmin2'], $result->getData()); } - public function testGetSubAdminsOfGroupEmptyList() { + public function testGetSubAdminsOfGroupEmptyList(): void { $group = $this->createGroup('GroupWithOutSubAdmins'); $this->groupManager ->method('get') @@ -357,7 +357,7 @@ class GroupsControllerTest extends \Test\TestCase { } - public function testAddGroupEmptyGroup() { + public function testAddGroupEmptyGroup(): void { $this->expectException(\OCP\AppFramework\OCS\OCSException::class); $this->expectExceptionMessage('Invalid group name'); $this->expectExceptionCode(101); @@ -366,7 +366,7 @@ class GroupsControllerTest extends \Test\TestCase { } - public function testAddGroupExistingGroup() { + public function testAddGroupExistingGroup(): void { $this->expectException(\OCP\AppFramework\OCS\OCSException::class); $this->expectExceptionCode(102); @@ -378,7 +378,7 @@ class GroupsControllerTest extends \Test\TestCase { $this->api->addGroup('ExistingGroup'); } - public function testAddGroup() { + public function testAddGroup(): void { $this->groupManager ->method('groupExists') ->with('NewGroup') @@ -394,7 +394,7 @@ class GroupsControllerTest extends \Test\TestCase { $this->api->addGroup('NewGroup'); } - public function testAddGroupWithSpecialChar() { + public function testAddGroupWithSpecialChar(): void { $this->groupManager ->method('groupExists') ->with('Iñtërnâtiônà lizætiøn') @@ -411,7 +411,7 @@ class GroupsControllerTest extends \Test\TestCase { } - public function testDeleteGroupNonExisting() { + public function testDeleteGroupNonExisting(): void { $this->expectException(\OCP\AppFramework\OCS\OCSException::class); $this->expectExceptionCode(101); @@ -419,7 +419,7 @@ class GroupsControllerTest extends \Test\TestCase { } - public function testDeleteAdminGroup() { + public function testDeleteAdminGroup(): void { $this->expectException(\OCP\AppFramework\OCS\OCSException::class); $this->expectExceptionCode(102); @@ -431,7 +431,7 @@ class GroupsControllerTest extends \Test\TestCase { $this->api->deleteGroup('admin'); } - public function testDeleteGroup() { + public function testDeleteGroup(): void { $this->groupManager ->method('groupExists') ->with('ExistingGroup') @@ -450,7 +450,7 @@ class GroupsControllerTest extends \Test\TestCase { $this->api->deleteGroup('ExistingGroup'); } - public function testDeleteGroupEncoding() { + public function testDeleteGroupEncoding(): void { $this->groupManager ->method('groupExists') ->with('ExistingGroup A/B') @@ -469,7 +469,7 @@ class GroupsControllerTest extends \Test\TestCase { $this->api->deleteGroup(urlencode('ExistingGroup A/B')); } - public function testGetGroupUsersDetails() { + public function testGetGroupUsersDetails(): void { $gid = 'ncg1'; $this->asAdmin(); @@ -514,7 +514,7 @@ class GroupsControllerTest extends \Test\TestCase { $this->api->getGroupUsersDetails($gid); } - public function testGetGroupUsersDetailsEncoded() { + public function testGetGroupUsersDetailsEncoded(): void { $gid = 'Department A/B C/D'; $this->asAdmin(); diff --git a/apps/provisioning_api/tests/Controller/UsersControllerTest.php b/apps/provisioning_api/tests/Controller/UsersControllerTest.php index d2b0a3a4c38..0f82fc53ba6 100644 --- a/apps/provisioning_api/tests/Controller/UsersControllerTest.php +++ b/apps/provisioning_api/tests/Controller/UsersControllerTest.php @@ -122,7 +122,7 @@ class UsersControllerTest extends TestCase { ->getMock(); } - public function testGetUsersAsAdmin() { + public function testGetUsersAsAdmin(): void { $loggedInUser = $this->getMockBuilder(IUser::class) ->disableOriginalConstructor() ->getMock(); @@ -154,7 +154,7 @@ class UsersControllerTest extends TestCase { $this->assertEquals($expected, $this->api->getUsers('MyCustomSearch')->getData()); } - public function testGetUsersAsSubAdmin() { + public function testGetUsersAsSubAdmin(): void { $loggedInUser = $this->getMockBuilder(IUser::class) ->disableOriginalConstructor() ->getMock(); @@ -215,7 +215,7 @@ class UsersControllerTest extends TestCase { } - public function testAddUserAlreadyExisting() { + public function testAddUserAlreadyExisting(): void { $this->expectException(\OCP\AppFramework\OCS\OCSException::class); $this->expectExceptionCode(102); @@ -249,7 +249,7 @@ class UsersControllerTest extends TestCase { } - public function testAddUserNonExistingGroup() { + public function testAddUserNonExistingGroup(): void { $this->expectException(\OCP\AppFramework\OCS\OCSException::class); $this->expectExceptionMessage('Group NonExistingGroup does not exist'); $this->expectExceptionCode(104); @@ -285,7 +285,7 @@ class UsersControllerTest extends TestCase { } - public function testAddUserExistingGroupNonExistingGroup() { + public function testAddUserExistingGroupNonExistingGroup(): void { $this->expectException(\OCP\AppFramework\OCS\OCSException::class); $this->expectExceptionMessage('Group NonExistingGroup does not exist'); $this->expectExceptionCode(104); @@ -326,7 +326,7 @@ class UsersControllerTest extends TestCase { $this->api->addUser('NewUser', 'pass', '', '', ['ExistingGroup', 'NonExistingGroup']); } - public function testAddUserSuccessful() { + public function testAddUserSuccessful(): void { $this->userManager ->expects($this->once()) ->method('userExists') @@ -363,7 +363,7 @@ class UsersControllerTest extends TestCase { )); } - public function testAddUserSuccessfulWithDisplayName() { + public function testAddUserSuccessfulWithDisplayName(): void { /** * @var UserController */ @@ -429,7 +429,7 @@ class UsersControllerTest extends TestCase { )); } - public function testAddUserSuccessfulGenerateUserID() { + public function testAddUserSuccessfulGenerateUserID(): void { $this->config ->expects($this->any()) ->method('getAppValue') @@ -481,7 +481,7 @@ class UsersControllerTest extends TestCase { )); } - public function testAddUserSuccessfulGeneratePassword() { + public function testAddUserSuccessfulGeneratePassword(): void { $this->userManager ->expects($this->once()) ->method('userExists') @@ -526,7 +526,7 @@ class UsersControllerTest extends TestCase { } - public function testAddUserFailedToGenerateUserID() { + public function testAddUserFailedToGenerateUserID(): void { $this->expectException(\OCP\AppFramework\OCS\OCSException::class); $this->expectExceptionMessage('Could not create non-existing user ID'); $this->expectExceptionCode(111); @@ -569,7 +569,7 @@ class UsersControllerTest extends TestCase { } - public function testAddUserEmailRequired() { + public function testAddUserEmailRequired(): void { $this->expectException(\OCP\AppFramework\OCS\OCSException::class); $this->expectExceptionMessage('Required email address was not provided'); $this->expectExceptionCode(110); @@ -614,7 +614,7 @@ class UsersControllerTest extends TestCase { )); } - public function testAddUserExistingGroup() { + public function testAddUserExistingGroup(): void { $this->userManager ->expects($this->once()) ->method('userExists') @@ -676,7 +676,7 @@ class UsersControllerTest extends TestCase { } - public function testAddUserUnsuccessful() { + public function testAddUserUnsuccessful(): void { $this->expectException(\OCP\AppFramework\OCS\OCSException::class); $this->expectExceptionMessage('Bad request'); $this->expectExceptionCode(101); @@ -723,7 +723,7 @@ class UsersControllerTest extends TestCase { } - public function testAddUserAsSubAdminNoGroup() { + public function testAddUserAsSubAdminNoGroup(): void { $this->expectException(\OCP\AppFramework\OCS\OCSException::class); $this->expectExceptionMessage('No group specified (required for sub-admins)'); $this->expectExceptionCode(106); @@ -756,7 +756,7 @@ class UsersControllerTest extends TestCase { } - public function testAddUserAsSubAdminValidGroupNotSubAdmin() { + public function testAddUserAsSubAdminValidGroupNotSubAdmin(): void { $this->expectException(\OCP\AppFramework\OCS\OCSException::class); $this->expectExceptionMessage('Insufficient privileges for group ExistingGroup'); $this->expectExceptionCode(105); @@ -804,7 +804,7 @@ class UsersControllerTest extends TestCase { $this->api->addUser('NewUser', 'PasswordOfTheNewUser', '', '', ['ExistingGroup'])->getData(); } - public function testAddUserAsSubAdminExistingGroups() { + public function testAddUserAsSubAdminExistingGroups(): void { $this->userManager ->expects($this->once()) ->method('userExists') @@ -899,7 +899,7 @@ class UsersControllerTest extends TestCase { } - public function testGetUserTargetDoesNotExist() { + public function testGetUserTargetDoesNotExist(): void { $this->expectException(\OCP\AppFramework\OCS\OCSException::class); $this->expectExceptionMessage('User does not exist'); $this->expectExceptionCode(404); @@ -919,7 +919,7 @@ class UsersControllerTest extends TestCase { $this->api->getUser('UserToGet'); } - public function testGetUserDataAsAdmin() { + public function testGetUserDataAsAdmin(): void { $group0 = $this->createMock(IGroup::class); $group1 = $this->createMock(IGroup::class); $group2 = $this->createMock(IGroup::class); @@ -1072,7 +1072,7 @@ class UsersControllerTest extends TestCase { $this->assertEquals($expected, $this->invokePrivate($this->api, 'getUserData', ['UID'])); } - public function testGetUserDataAsSubAdminAndUserIsAccessible() { + public function testGetUserDataAsSubAdminAndUserIsAccessible(): void { $loggedInUser = $this->getMockBuilder(IUser::class) ->disableOriginalConstructor() ->getMock(); @@ -1215,7 +1215,7 @@ class UsersControllerTest extends TestCase { - public function testGetUserDataAsSubAdminAndUserIsNotAccessible() { + public function testGetUserDataAsSubAdminAndUserIsNotAccessible(): void { $this->expectException(\OCP\AppFramework\OCS\OCSException::class); $this->expectExceptionCode(998); @@ -1258,7 +1258,7 @@ class UsersControllerTest extends TestCase { $this->invokePrivate($this->api, 'getUser', ['UserToGet']); } - public function testGetUserDataAsSubAdminSelfLookup() { + public function testGetUserDataAsSubAdminSelfLookup(): void { $loggedInUser = $this->getMockBuilder(IUser::class) ->disableOriginalConstructor() ->getMock(); @@ -1412,7 +1412,7 @@ class UsersControllerTest extends TestCase { * @param int $status * @param array $expected */ - public function testSearchByPhoneNumbers(string $location, array $search, int $status, ?array $searchUsers, ?array $userMatches, array $expected) { + public function testSearchByPhoneNumbers(string $location, array $search, int $status, ?array $searchUsers, ?array $userMatches, array $expected): void { $knownTo = 'knownTo'; $user = $this->createMock(IUser::class); $user->method('getUID') @@ -1448,7 +1448,7 @@ class UsersControllerTest extends TestCase { self::assertEquals($expected, $response->getData()); } - public function testEditUserRegularUserSelfEditChangeDisplayName() { + public function testEditUserRegularUserSelfEditChangeDisplayName(): void { $loggedInUser = $this->getMockBuilder(IUser::class) ->disableOriginalConstructor() ->getMock(); @@ -1485,7 +1485,7 @@ class UsersControllerTest extends TestCase { $this->assertEquals([], $this->api->editUser('UserToEdit', 'display', 'NewDisplayName')->getData()); } - public function testEditUserRegularUserSelfEditChangeEmailValid() { + public function testEditUserRegularUserSelfEditChangeEmailValid(): void { $loggedInUser = $this->getMockBuilder(IUser::class) ->disableOriginalConstructor() ->getMock(); @@ -1680,7 +1680,7 @@ class UsersControllerTest extends TestCase { $this->api->editUser('UserToEdit', 'additional_mail', 'demo1@nextcloud.com')->getData(); } - public function testEditUserRegularUserSelfEditChangeEmailInvalid() { + public function testEditUserRegularUserSelfEditChangeEmailInvalid(): void { $this->expectException(\OCP\AppFramework\OCS\OCSException::class); $this->expectExceptionCode(102); @@ -1735,7 +1735,7 @@ class UsersControllerTest extends TestCase { /** * @dataProvider selfEditChangePropertyProvider */ - public function testEditUserRegularUserSelfEditChangeProperty($propertyName, $oldValue, $newValue) { + public function testEditUserRegularUserSelfEditChangeProperty($propertyName, $oldValue, $newValue): void { $loggedInUser = $this->getMockBuilder(IUser::class) ->disableOriginalConstructor() ->getMock(); @@ -1812,7 +1812,7 @@ class UsersControllerTest extends TestCase { /** * @dataProvider selfEditChangePropertyProvider */ - public function testEditUserRegularUserSelfEditChangePropertyScope($propertyName, $oldScope, $newScope) { + public function testEditUserRegularUserSelfEditChangePropertyScope($propertyName, $oldScope, $newScope): void { $loggedInUser = $this->getMockBuilder(IUser::class) ->disableOriginalConstructor() ->getMock(); @@ -1868,7 +1868,7 @@ class UsersControllerTest extends TestCase { $this->assertEquals([], $this->api->editUser('UserToEdit', $propertyName . 'Scope', $newScope)->getData()); } - public function testEditUserRegularUserSelfEditChangePassword() { + public function testEditUserRegularUserSelfEditChangePassword(): void { $loggedInUser = $this->getMockBuilder(IUser::class) ->disableOriginalConstructor() ->getMock(); @@ -1912,7 +1912,7 @@ class UsersControllerTest extends TestCase { - public function testEditUserRegularUserSelfEditChangeQuota() { + public function testEditUserRegularUserSelfEditChangeQuota(): void { $this->expectException(\OCP\AppFramework\OCS\OCSException::class); $this->expectExceptionCode(103); @@ -1949,7 +1949,7 @@ class UsersControllerTest extends TestCase { $this->api->editUser('UserToEdit', 'quota', 'NewQuota'); } - public function testEditUserAdminUserSelfEditChangeValidQuota() { + public function testEditUserAdminUserSelfEditChangeValidQuota(): void { $this->config ->expects($this->once()) ->method('getAppValue') @@ -1998,7 +1998,7 @@ class UsersControllerTest extends TestCase { - public function testEditUserAdminUserSelfEditChangeInvalidQuota() { + public function testEditUserAdminUserSelfEditChangeInvalidQuota(): void { $this->expectException(\OCP\AppFramework\OCS\OCSException::class); $this->expectExceptionMessage('Invalid quota value: ABC'); $this->expectExceptionCode(102); @@ -2037,7 +2037,7 @@ class UsersControllerTest extends TestCase { $this->api->editUser('UserToEdit', 'quota', 'ABC'); } - public function testEditUserAdminUserEditChangeValidQuota() { + public function testEditUserAdminUserEditChangeValidQuota(): void { $this->config ->expects($this->once()) ->method('getAppValue') @@ -2091,7 +2091,7 @@ class UsersControllerTest extends TestCase { $this->assertEquals([], $this->api->editUser('UserToEdit', 'quota', '3042824')->getData()); } - public function testEditUserSelfEditChangeLanguage() { + public function testEditUserSelfEditChangeLanguage(): void { $this->l10nFactory->expects($this->once()) ->method('findAvailableLanguages') ->willReturn(['en', 'de', 'sv']); @@ -2149,7 +2149,7 @@ class UsersControllerTest extends TestCase { /** * @dataProvider dataEditUserSelfEditChangeLanguageButForced */ - public function testEditUserSelfEditChangeLanguageButForced($forced) { + public function testEditUserSelfEditChangeLanguageButForced($forced): void { $this->expectException(\OCP\AppFramework\OCS\OCSException::class); $this->config->expects($this->any()) @@ -2195,7 +2195,7 @@ class UsersControllerTest extends TestCase { $this->assertEquals([], $this->api->editUser('UserToEdit', 'language', 'de')->getData()); } - public function testEditUserAdminEditChangeLanguage() { + public function testEditUserAdminEditChangeLanguage(): void { $this->l10nFactory->expects($this->once()) ->method('findAvailableLanguages') ->willReturn(['en', 'de', 'sv']); @@ -2245,7 +2245,7 @@ class UsersControllerTest extends TestCase { /** * @dataProvider dataEditUserSelfEditChangeLanguageButForced */ - public function testEditUserAdminEditChangeLanguageInvalidLanguage() { + public function testEditUserAdminEditChangeLanguageInvalidLanguage(): void { $this->expectException(\OCP\AppFramework\OCS\OCSException::class); @@ -2294,7 +2294,7 @@ class UsersControllerTest extends TestCase { $this->assertEquals([], $this->api->editUser('UserToEdit', 'language', 'ru')->getData()); } - public function testEditUserSubadminUserAccessible() { + public function testEditUserSubadminUserAccessible(): void { $this->config ->expects($this->once()) ->method('getAppValue') @@ -2349,7 +2349,7 @@ class UsersControllerTest extends TestCase { } - public function testEditUserSubadminUserInaccessible() { + public function testEditUserSubadminUserInaccessible(): void { $this->expectException(\OCP\AppFramework\OCS\OCSException::class); $this->expectExceptionCode(998); @@ -2389,7 +2389,7 @@ class UsersControllerTest extends TestCase { } - public function testDeleteUserNotExistingUser() { + public function testDeleteUserNotExistingUser(): void { $this->expectException(\OCP\AppFramework\OCS\OCSException::class); $this->expectExceptionCode(998); @@ -2412,7 +2412,7 @@ class UsersControllerTest extends TestCase { } - public function testDeleteUserSelf() { + public function testDeleteUserSelf(): void { $this->expectException(\OCP\AppFramework\OCS\OCSException::class); $this->expectExceptionCode(101); @@ -2439,7 +2439,7 @@ class UsersControllerTest extends TestCase { $this->api->deleteUser('UserToDelete'); } - public function testDeleteSuccessfulUserAsAdmin() { + public function testDeleteSuccessfulUserAsAdmin(): void { $loggedInUser = $this->getMockBuilder(IUser::class)->disableOriginalConstructor()->getMock(); $loggedInUser ->expects($this->any()) @@ -2473,7 +2473,7 @@ class UsersControllerTest extends TestCase { } - public function testDeleteUnsuccessfulUserAsAdmin() { + public function testDeleteUnsuccessfulUserAsAdmin(): void { $this->expectException(\OCP\AppFramework\OCS\OCSException::class); $this->expectExceptionCode(101); @@ -2509,7 +2509,7 @@ class UsersControllerTest extends TestCase { $this->api->deleteUser('UserToDelete'); } - public function testDeleteSuccessfulUserAsSubadmin() { + public function testDeleteSuccessfulUserAsSubadmin(): void { $loggedInUser = $this->getMockBuilder(IUser::class)->disableOriginalConstructor()->getMock(); $loggedInUser ->expects($this->any()) @@ -2554,7 +2554,7 @@ class UsersControllerTest extends TestCase { } - public function testDeleteUnsuccessfulUserAsSubadmin() { + public function testDeleteUnsuccessfulUserAsSubadmin(): void { $this->expectException(\OCP\AppFramework\OCS\OCSException::class); $this->expectExceptionCode(101); @@ -2602,7 +2602,7 @@ class UsersControllerTest extends TestCase { } - public function testDeleteUserAsSubAdminAndUserIsNotAccessible() { + public function testDeleteUserAsSubAdminAndUserIsNotAccessible(): void { $this->expectException(\OCP\AppFramework\OCS\OCSException::class); $this->expectExceptionCode(998); @@ -2646,7 +2646,7 @@ class UsersControllerTest extends TestCase { } - public function testGetUsersGroupsTargetUserNotExisting() { + public function testGetUsersGroupsTargetUserNotExisting(): void { $this->expectException(\OCP\AppFramework\OCS\OCSException::class); $this->expectExceptionCode(998); @@ -2659,7 +2659,7 @@ class UsersControllerTest extends TestCase { $this->api->getUsersGroups('UserToLookup'); } - public function testGetUsersGroupsSelfTargetted() { + public function testGetUsersGroupsSelfTargetted(): void { $loggedInUser = $this->getMockBuilder(IUser::class)->disableOriginalConstructor()->getMock(); $loggedInUser ->expects($this->exactly(3)) @@ -2688,7 +2688,7 @@ class UsersControllerTest extends TestCase { $this->assertEquals(['groups' => ['DummyValue']], $this->api->getUsersGroups('UserToLookup')->getData()); } - public function testGetUsersGroupsForAdminUser() { + public function testGetUsersGroupsForAdminUser(): void { $loggedInUser = $this->getMockBuilder(IUser::class)->disableOriginalConstructor()->getMock(); $loggedInUser ->expects($this->exactly(3)) @@ -2722,7 +2722,7 @@ class UsersControllerTest extends TestCase { $this->assertEquals(['groups' => ['DummyValue']], $this->api->getUsersGroups('UserToLookup')->getData()); } - public function testGetUsersGroupsForSubAdminUserAndUserIsAccessible() { + public function testGetUsersGroupsForSubAdminUserAndUserIsAccessible(): void { $loggedInUser = $this->getMockBuilder(IUser::class)->disableOriginalConstructor()->getMock(); $loggedInUser ->expects($this->exactly(3)) @@ -2783,7 +2783,7 @@ class UsersControllerTest extends TestCase { } - public function testGetUsersGroupsForSubAdminUserAndUserIsInaccessible() { + public function testGetUsersGroupsForSubAdminUserAndUserIsInaccessible(): void { $this->expectException(\OCP\AppFramework\OCS\OCSException::class); $this->expectExceptionCode(998); @@ -2832,7 +2832,7 @@ class UsersControllerTest extends TestCase { } - public function testAddToGroupWithTargetGroupNotExisting() { + public function testAddToGroupWithTargetGroupNotExisting(): void { $this->expectException(\OCP\AppFramework\OCS\OCSException::class); $this->expectExceptionCode(102); @@ -2845,7 +2845,7 @@ class UsersControllerTest extends TestCase { } - public function testAddToGroupWithNoGroupSpecified() { + public function testAddToGroupWithNoGroupSpecified(): void { $this->expectException(\OCP\AppFramework\OCS\OCSException::class); $this->expectExceptionCode(101); @@ -2853,7 +2853,7 @@ class UsersControllerTest extends TestCase { } - public function testAddToGroupWithTargetUserNotExisting() { + public function testAddToGroupWithTargetUserNotExisting(): void { $this->expectException(\OCP\AppFramework\OCS\OCSException::class); $this->expectExceptionCode(103); @@ -2867,7 +2867,7 @@ class UsersControllerTest extends TestCase { } - public function testAddToGroupNoSubadmin() { + public function testAddToGroupNoSubadmin(): void { $this->expectException(\OCP\AppFramework\OCS\OCSException::class); $this->expectExceptionCode(104); @@ -2914,7 +2914,7 @@ class UsersControllerTest extends TestCase { $this->api->addToGroup('TargetUser', 'GroupToAddTo'); } - public function testAddToGroupSuccessAsSubadmin() { + public function testAddToGroupSuccessAsSubadmin(): void { $targetUser = $this->createMock(IUser::class); $loggedInUser = $this->createMock(IUser::class); $loggedInUser->expects($this->exactly(2)) @@ -2958,7 +2958,7 @@ class UsersControllerTest extends TestCase { $this->assertEquals(new DataResponse(), $this->api->addToGroup('TargetUser', 'GroupToAddTo')); } - public function testAddToGroupSuccessAsAdmin() { + public function testAddToGroupSuccessAsAdmin(): void { $targetUser = $this->createMock(IUser::class); $loggedInUser = $this->createMock(IUser::class); $loggedInUser->expects($this->exactly(2)) @@ -3001,7 +3001,7 @@ class UsersControllerTest extends TestCase { } - public function testRemoveFromGroupWithNoTargetGroup() { + public function testRemoveFromGroupWithNoTargetGroup(): void { $this->expectException(\OCP\AppFramework\OCS\OCSException::class); $this->expectExceptionCode(101); @@ -3015,7 +3015,7 @@ class UsersControllerTest extends TestCase { } - public function testRemoveFromGroupWithEmptyTargetGroup() { + public function testRemoveFromGroupWithEmptyTargetGroup(): void { $this->expectException(\OCP\AppFramework\OCS\OCSException::class); $this->expectExceptionCode(101); @@ -3029,7 +3029,7 @@ class UsersControllerTest extends TestCase { } - public function testRemoveFromGroupWithNotExistingTargetGroup() { + public function testRemoveFromGroupWithNotExistingTargetGroup(): void { $this->expectException(\OCP\AppFramework\OCS\OCSException::class); $this->expectExceptionCode(102); @@ -3048,7 +3048,7 @@ class UsersControllerTest extends TestCase { } - public function testRemoveFromGroupWithNotExistingTargetUser() { + public function testRemoveFromGroupWithNotExistingTargetUser(): void { $this->expectException(\OCP\AppFramework\OCS\OCSException::class); $this->expectExceptionCode(103); @@ -3073,7 +3073,7 @@ class UsersControllerTest extends TestCase { } - public function testRemoveFromGroupWithoutPermission() { + public function testRemoveFromGroupWithoutPermission(): void { $this->expectException(\OCP\AppFramework\OCS\OCSException::class); $this->expectExceptionCode(104); @@ -3114,7 +3114,7 @@ class UsersControllerTest extends TestCase { } - public function testRemoveFromGroupAsAdminFromAdmin() { + public function testRemoveFromGroupAsAdminFromAdmin(): void { $this->expectException(\OCP\AppFramework\OCS\OCSException::class); $this->expectExceptionMessage('Cannot remove yourself from the admin group'); $this->expectExceptionCode(105); @@ -3164,7 +3164,7 @@ class UsersControllerTest extends TestCase { } - public function testRemoveFromGroupAsSubAdminFromSubAdmin() { + public function testRemoveFromGroupAsSubAdminFromSubAdmin(): void { $this->expectException(\OCP\AppFramework\OCS\OCSException::class); $this->expectExceptionMessage('Cannot remove yourself from this group as you are a sub-admin'); $this->expectExceptionCode(105); @@ -3219,7 +3219,7 @@ class UsersControllerTest extends TestCase { } - public function testRemoveFromGroupAsSubAdminFromLastSubAdminGroup() { + public function testRemoveFromGroupAsSubAdminFromLastSubAdminGroup(): void { $this->expectException(\OCP\AppFramework\OCS\OCSException::class); $this->expectExceptionMessage('Not viable to remove user from the last group you are sub-admin of'); $this->expectExceptionCode(105); @@ -3280,7 +3280,7 @@ class UsersControllerTest extends TestCase { $this->api->removeFromGroup('AnotherUser', 'subadmin'); } - public function testRemoveFromGroupSuccessful() { + public function testRemoveFromGroupSuccessful(): void { $loggedInUser = $this->getMockBuilder(IUser::class)->disableOriginalConstructor()->getMock(); $loggedInUser ->expects($this->any()) @@ -3322,7 +3322,7 @@ class UsersControllerTest extends TestCase { } - public function testAddSubAdminWithNotExistingTargetUser() { + public function testAddSubAdminWithNotExistingTargetUser(): void { $this->expectException(\OCP\AppFramework\OCS\OCSException::class); $this->expectExceptionMessage('User does not exist'); $this->expectExceptionCode(101); @@ -3337,7 +3337,7 @@ class UsersControllerTest extends TestCase { } - public function testAddSubAdminWithNotExistingTargetGroup() { + public function testAddSubAdminWithNotExistingTargetGroup(): void { $this->expectException(\OCP\AppFramework\OCS\OCSException::class); $this->expectExceptionMessage('Group does not exist'); $this->expectExceptionCode(102); @@ -3359,7 +3359,7 @@ class UsersControllerTest extends TestCase { } - public function testAddSubAdminToAdminGroup() { + public function testAddSubAdminToAdminGroup(): void { $this->expectException(\OCP\AppFramework\OCS\OCSException::class); $this->expectExceptionMessage('Cannot create sub-admins for admin group'); $this->expectExceptionCode(103); @@ -3384,7 +3384,7 @@ class UsersControllerTest extends TestCase { $this->api->addSubAdmin('ExistingUser', 'ADmiN'); } - public function testAddSubAdminTwice() { + public function testAddSubAdminTwice(): void { $targetUser = $this->getMockBuilder(IUser::class)->disableOriginalConstructor()->getMock(); $targetGroup = $this->getMockBuilder('\OCP\IGroup')->disableOriginalConstructor()->getMock(); $this->userManager @@ -3412,7 +3412,7 @@ class UsersControllerTest extends TestCase { $this->assertEquals([], $this->api->addSubAdmin('ExistingUser', 'TargetGroup')->getData()); } - public function testAddSubAdminSuccessful() { + public function testAddSubAdminSuccessful(): void { $targetUser = $this->getMockBuilder(IUser::class)->disableOriginalConstructor()->getMock(); $targetGroup = $this->getMockBuilder('\OCP\IGroup')->disableOriginalConstructor()->getMock(); $this->userManager @@ -3445,7 +3445,7 @@ class UsersControllerTest extends TestCase { } - public function testRemoveSubAdminNotExistingTargetUser() { + public function testRemoveSubAdminNotExistingTargetUser(): void { $this->expectException(\OCP\AppFramework\OCS\OCSException::class); $this->expectExceptionMessage('User does not exist'); $this->expectExceptionCode(101); @@ -3460,7 +3460,7 @@ class UsersControllerTest extends TestCase { } - public function testRemoveSubAdminNotExistingTargetGroup() { + public function testRemoveSubAdminNotExistingTargetGroup(): void { $this->expectException(\OCP\AppFramework\OCS\OCSException::class); $this->expectExceptionMessage('Group does not exist'); $this->expectExceptionCode(101); @@ -3482,7 +3482,7 @@ class UsersControllerTest extends TestCase { - public function testRemoveSubAdminFromNotASubadmin() { + public function testRemoveSubAdminFromNotASubadmin(): void { $this->expectException(\OCP\AppFramework\OCS\OCSException::class); $this->expectExceptionMessage('User is not a sub-admin of this group'); $this->expectExceptionCode(102); @@ -3514,7 +3514,7 @@ class UsersControllerTest extends TestCase { $this->api->removeSubAdmin('ExistingUser', 'GroupToDeleteFrom'); } - public function testRemoveSubAdminSuccessful() { + public function testRemoveSubAdminSuccessful(): void { $targetUser = $this->getMockBuilder(IUser::class)->disableOriginalConstructor()->getMock(); $targetGroup = $this->getMockBuilder('\OCP\IGroup')->disableOriginalConstructor()->getMock(); $this->userManager @@ -3547,7 +3547,7 @@ class UsersControllerTest extends TestCase { } - public function testGetUserSubAdminGroupsNotExistingTargetUser() { + public function testGetUserSubAdminGroupsNotExistingTargetUser(): void { $this->expectException(\OCP\AppFramework\OCS\OCSException::class); $this->expectExceptionMessage('User does not exist'); $this->expectExceptionCode(404); @@ -3561,7 +3561,7 @@ class UsersControllerTest extends TestCase { $this->api->getUserSubAdminGroups('RequestedUser'); } - public function testGetUserSubAdminGroupsWithGroups() { + public function testGetUserSubAdminGroupsWithGroups(): void { $targetUser = $this->getMockBuilder(IUser::class)->disableOriginalConstructor()->getMock(); $targetGroup = $this->getMockBuilder('\OCP\IGroup')->disableOriginalConstructor()->getMock(); $targetGroup @@ -3588,7 +3588,7 @@ class UsersControllerTest extends TestCase { $this->assertEquals(['TargetGroup'], $this->api->getUserSubAdminGroups('RequestedUser')->getData()); } - public function testEnableUser() { + public function testEnableUser(): void { $targetUser = $this->getMockBuilder(IUser::class)->disableOriginalConstructor()->getMock(); $targetUser->expects($this->once()) ->method('setEnabled') @@ -3615,7 +3615,7 @@ class UsersControllerTest extends TestCase { $this->assertEquals([], $this->api->enableUser('RequestedUser')->getData()); } - public function testDisableUser() { + public function testDisableUser(): void { $targetUser = $this->getMockBuilder(IUser::class)->disableOriginalConstructor()->getMock(); $targetUser->expects($this->once()) ->method('setEnabled') @@ -3642,7 +3642,7 @@ class UsersControllerTest extends TestCase { $this->assertEquals([], $this->api->disableUser('RequestedUser')->getData()); } - public function testGetCurrentUserLoggedIn() { + public function testGetCurrentUserLoggedIn(): void { $user = $this->createMock(IUser::class); $user->expects($this->once())->method('getUID')->willReturn('UID'); @@ -3717,7 +3717,7 @@ class UsersControllerTest extends TestCase { } - public function testGetCurrentUserNotLoggedIn() { + public function testGetCurrentUserNotLoggedIn(): void { $this->expectException(\OCP\AppFramework\OCS\OCSException::class); @@ -3727,7 +3727,7 @@ class UsersControllerTest extends TestCase { $this->api->getCurrentUser(); } - public function testGetUser() { + public function testGetUser(): void { $loggedInUser = $this->createMock(IUser::class); $loggedInUser ->method('getUID') @@ -3792,7 +3792,7 @@ class UsersControllerTest extends TestCase { } - public function testResendWelcomeMessageWithNotExistingTargetUser() { + public function testResendWelcomeMessageWithNotExistingTargetUser(): void { $this->expectException(\OCP\AppFramework\OCS\OCSException::class); $this->expectExceptionCode(998); @@ -3806,7 +3806,7 @@ class UsersControllerTest extends TestCase { } - public function testResendWelcomeMessageAsSubAdminAndUserIsNotAccessible() { + public function testResendWelcomeMessageAsSubAdminAndUserIsNotAccessible(): void { $this->expectException(\OCP\AppFramework\OCS\OCSException::class); $this->expectExceptionCode(998); @@ -3851,7 +3851,7 @@ class UsersControllerTest extends TestCase { } - public function testResendWelcomeMessageNoEmail() { + public function testResendWelcomeMessageNoEmail(): void { $this->expectException(\OCP\AppFramework\OCS\OCSException::class); $this->expectExceptionMessage('Email address not available'); $this->expectExceptionCode(101); @@ -3896,7 +3896,7 @@ class UsersControllerTest extends TestCase { } - public function testResendWelcomeMessageNullEmail() { + public function testResendWelcomeMessageNullEmail(): void { $this->expectException(\OCP\AppFramework\OCS\OCSException::class); $this->expectExceptionMessage('Email address not available'); $this->expectExceptionCode(101); @@ -3940,7 +3940,7 @@ class UsersControllerTest extends TestCase { $this->api->resendWelcomeMessage('UserToGet'); } - public function testResendWelcomeMessageSuccess() { + public function testResendWelcomeMessageSuccess(): void { $loggedInUser = $this->getMockBuilder(IUser::class) ->disableOriginalConstructor() ->getMock(); @@ -3991,7 +3991,7 @@ class UsersControllerTest extends TestCase { $this->api->resendWelcomeMessage('UserToGet'); } - public function testResendWelcomeMessageSuccessWithFallbackLanguage() { + public function testResendWelcomeMessageSuccessWithFallbackLanguage(): void { $loggedInUser = $this->getMockBuilder(IUser::class) ->disableOriginalConstructor() ->getMock(); @@ -4043,7 +4043,7 @@ class UsersControllerTest extends TestCase { } - public function testResendWelcomeMessageFailed() { + public function testResendWelcomeMessageFailed(): void { $this->expectException(\OCP\AppFramework\OCS\OCSException::class); $this->expectExceptionMessage('Sending email failed'); $this->expectExceptionCode(102); @@ -4155,7 +4155,7 @@ class UsersControllerTest extends TestCase { * @param string $userBackend * @param array $expected */ - public function testGetEditableFields(bool $allowedToChangeDisplayName, string $userBackend, array $expected) { + public function testGetEditableFields(bool $allowedToChangeDisplayName, string $userBackend, array $expected): void { $this->config ->method('getSystemValue') ->with( diff --git a/apps/provisioning_api/tests/Middleware/ProvisioningApiMiddlewareTest.php b/apps/provisioning_api/tests/Middleware/ProvisioningApiMiddlewareTest.php index df3ae0bd358..d097febb04f 100644 --- a/apps/provisioning_api/tests/Middleware/ProvisioningApiMiddlewareTest.php +++ b/apps/provisioning_api/tests/Middleware/ProvisioningApiMiddlewareTest.php @@ -51,7 +51,7 @@ class ProvisioningApiMiddlewareTest extends TestCase { * @param bool $isSubAdmin * @param bool $shouldThrowException */ - public function testBeforeController($subadminRequired, $isAdmin, $isSubAdmin, $hasSettingAuthorizationAnnotation, $shouldThrowException) { + public function testBeforeController($subadminRequired, $isAdmin, $isSubAdmin, $hasSettingAuthorizationAnnotation, $shouldThrowException): void { $middleware = new ProvisioningApiMiddleware( $this->reflector, $isAdmin, @@ -93,7 +93,7 @@ class ProvisioningApiMiddlewareTest extends TestCase { * @param \Exception $e * @param bool $forwared */ - public function testAfterException(\Exception $exception, $forwared) { + public function testAfterException(\Exception $exception, $forwared): void { $middleware = new ProvisioningApiMiddleware( $this->reflector, false, diff --git a/apps/settings/tests/Activity/SecurityFilterTest.php b/apps/settings/tests/Activity/SecurityFilterTest.php index 637c717da02..f3f94df3d21 100644 --- a/apps/settings/tests/Activity/SecurityFilterTest.php +++ b/apps/settings/tests/Activity/SecurityFilterTest.php @@ -31,15 +31,15 @@ class SecurityFilterTest extends TestCase { $this->filter = new SecurityFilter($this->urlGenerator, $this->l10n); } - public function testAllowedApps() { + public function testAllowedApps(): void { $this->assertEquals([], $this->filter->allowedApps()); } - public function testFilterTypes() { + public function testFilterTypes(): void { $this->assertEquals(['security'], $this->filter->filterTypes(['comments', 'security'])); } - public function testGetIcon() { + public function testGetIcon(): void { $this->urlGenerator->expects($this->once()) ->method('imagePath') ->with('core', 'actions/password.svg') @@ -51,11 +51,11 @@ class SecurityFilterTest extends TestCase { $this->assertEquals('abs/path/to/icon.svg', $this->filter->getIcon()); } - public function testGetIdentifier() { + public function testGetIdentifier(): void { $this->assertEquals('security', $this->filter->getIdentifier()); } - public function testGetName() { + public function testGetName(): void { $this->l10n->expects($this->once()) ->method('t') ->with('Security') @@ -63,7 +63,7 @@ class SecurityFilterTest extends TestCase { $this->assertEquals('translated', $this->filter->getName()); } - public function testGetPriority() { + public function testGetPriority(): void { $this->assertEquals(30, $this->filter->getPriority()); } } diff --git a/apps/settings/tests/Activity/SecurityProviderTest.php b/apps/settings/tests/Activity/SecurityProviderTest.php index 9d10b1e596e..b00c62281cc 100644 --- a/apps/settings/tests/Activity/SecurityProviderTest.php +++ b/apps/settings/tests/Activity/SecurityProviderTest.php @@ -39,7 +39,7 @@ class SecurityProviderTest extends TestCase { $this->provider = new SecurityProvider($this->l10n, $this->urlGenerator, $this->activityManager); } - public function testParseUnrelated() { + public function testParseUnrelated(): void { $lang = 'ru'; $event = $this->createMock(IEvent::class); $event->expects($this->once()) @@ -60,7 +60,7 @@ class SecurityProviderTest extends TestCase { /** * @dataProvider subjectData */ - public function testParse($subject) { + public function testParse($subject): void { $lang = 'ru'; $event = $this->createMock(IEvent::class); $l = $this->createMock(IL10N::class); @@ -96,7 +96,7 @@ class SecurityProviderTest extends TestCase { $this->provider->parse($lang, $event); } - public function testParseInvalidSubject() { + public function testParseInvalidSubject(): void { $lang = 'ru'; $l = $this->createMock(IL10N::class); $event = $this->createMock(IEvent::class); diff --git a/apps/settings/tests/Activity/SecuritySettingTest.php b/apps/settings/tests/Activity/SecuritySettingTest.php index dd28d757e72..1b2b0e3361c 100644 --- a/apps/settings/tests/Activity/SecuritySettingTest.php +++ b/apps/settings/tests/Activity/SecuritySettingTest.php @@ -23,19 +23,19 @@ class SecuritySettingTest extends TestCase { $this->setting = new SecuritySetting($this->l10n); } - public function testCanChangeMail() { + public function testCanChangeMail(): void { $this->assertFalse($this->setting->canChangeMail()); } - public function testCanChangeStream() { + public function testCanChangeStream(): void { $this->assertFalse($this->setting->canChangeStream()); } - public function testGetIdentifier() { + public function testGetIdentifier(): void { $this->assertEquals('security', $this->setting->getIdentifier()); } - public function testGetName() { + public function testGetName(): void { $this->l10n->expects($this->once()) ->method('t') ->with('Security') @@ -43,11 +43,11 @@ class SecuritySettingTest extends TestCase { $this->assertEquals('Sicherheit', $this->setting->getName()); } - public function testGetPriority() { + public function testGetPriority(): void { $this->assertEquals(30, $this->setting->getPriority()); } - public function testIsDefaultEnabled() { + public function testIsDefaultEnabled(): void { $this->assertTrue($this->setting->isDefaultEnabledMail()); $this->assertTrue($this->setting->isDefaultEnabledStream()); } diff --git a/apps/settings/tests/AppInfo/ApplicationTest.php b/apps/settings/tests/AppInfo/ApplicationTest.php index 60c37e42015..677efdc64bf 100644 --- a/apps/settings/tests/AppInfo/ApplicationTest.php +++ b/apps/settings/tests/AppInfo/ApplicationTest.php @@ -38,7 +38,7 @@ class ApplicationTest extends TestCase { $this->container = $this->app->getContainer(); } - public function testContainerAppName() { + public function testContainerAppName(): void { $this->app = new Application(); $this->assertEquals('settings', $this->container->getAppName()); } @@ -62,7 +62,7 @@ class ApplicationTest extends TestCase { * @param string $service * @param string $expected */ - public function testContainerQuery($service, $expected) { + public function testContainerQuery($service, $expected): void { $this->assertTrue($this->container->query($service) instanceof $expected); } } diff --git a/apps/settings/tests/Controller/AdminSettingsControllerTest.php b/apps/settings/tests/Controller/AdminSettingsControllerTest.php index 578348a3031..60ba5e0750e 100644 --- a/apps/settings/tests/Controller/AdminSettingsControllerTest.php +++ b/apps/settings/tests/Controller/AdminSettingsControllerTest.php @@ -87,7 +87,7 @@ class AdminSettingsControllerTest extends TestCase { parent::tearDown(); } - public function testIndex() { + public function testIndex(): void { $user = $this->createMock(IUser::class); $this->userSession ->method('getUser') diff --git a/apps/settings/tests/Controller/AppSettingsControllerTest.php b/apps/settings/tests/Controller/AppSettingsControllerTest.php index 71d263ac935..c219ee2fc9f 100644 --- a/apps/settings/tests/Controller/AppSettingsControllerTest.php +++ b/apps/settings/tests/Controller/AppSettingsControllerTest.php @@ -116,7 +116,7 @@ class AppSettingsControllerTest extends TestCase { ); } - public function testListCategories() { + public function testListCategories(): void { $this->installer->expects($this->any()) ->method('isUpdateAvailable') ->willReturn(false); @@ -171,7 +171,7 @@ class AppSettingsControllerTest extends TestCase { $this->assertEquals($expected, $this->appSettingsController->listCategories()); } - public function testViewApps() { + public function testViewApps(): void { $this->bundleFetcher->expects($this->once())->method('getBundles')->willReturn([]); $this->installer->expects($this->any()) ->method('isUpdateAvailable') @@ -204,7 +204,7 @@ class AppSettingsControllerTest extends TestCase { $this->assertEquals($expected, $this->appSettingsController->viewApps()); } - public function testViewAppsAppstoreNotEnabled() { + public function testViewAppsAppstoreNotEnabled(): void { $this->installer->expects($this->any()) ->method('isUpdateAvailable') ->willReturn(false); diff --git a/apps/settings/tests/Controller/AuthSettingsControllerTest.php b/apps/settings/tests/Controller/AuthSettingsControllerTest.php index a054d5e306c..13213992d94 100644 --- a/apps/settings/tests/Controller/AuthSettingsControllerTest.php +++ b/apps/settings/tests/Controller/AuthSettingsControllerTest.php @@ -74,7 +74,7 @@ class AuthSettingsControllerTest extends TestCase { ); } - public function testCreate() { + public function testCreate(): void { $name = 'Nexus 4'; $sessionToken = $this->createMock(IToken::class); $deviceToken = $this->createMock(IToken::class); @@ -123,7 +123,7 @@ class AuthSettingsControllerTest extends TestCase { $this->assertEquals($expected, $response->getData()); } - public function testCreateSessionNotAvailable() { + public function testCreateSessionNotAvailable(): void { $name = 'personal phone'; $this->session->expects($this->once()) @@ -136,7 +136,7 @@ class AuthSettingsControllerTest extends TestCase { $this->assertEquals($expected, $this->controller->create($name)); } - public function testCreateInvalidToken() { + public function testCreateInvalidToken(): void { $name = 'Company IPhone'; $this->session->expects($this->once()) @@ -153,7 +153,7 @@ class AuthSettingsControllerTest extends TestCase { $this->assertEquals($expected, $this->controller->create($name)); } - public function testDestroy() { + public function testDestroy(): void { $tokenId = 124; $token = $this->createMock(PublicKeyToken::class); @@ -175,7 +175,7 @@ class AuthSettingsControllerTest extends TestCase { $this->assertEquals([], $this->controller->destroy($tokenId)); } - public function testDestroyExpired() { + public function testDestroyExpired(): void { $tokenId = 124; $token = $this->createMock(PublicKeyToken::class); @@ -199,7 +199,7 @@ class AuthSettingsControllerTest extends TestCase { $this->assertSame([], $this->controller->destroy($tokenId)); } - public function testDestroyWrongUser() { + public function testDestroyWrongUser(): void { $tokenId = 124; $token = $this->createMock(PublicKeyToken::class); @@ -331,7 +331,7 @@ class AuthSettingsControllerTest extends TestCase { $this->assertSame([], $this->controller->update($tokenId, [IToken::SCOPE_FILESYSTEM => true], 'App password')); } - public function testUpdateExpired() { + public function testUpdateExpired(): void { $tokenId = 42; $token = $this->createMock(PublicKeyToken::class); @@ -351,7 +351,7 @@ class AuthSettingsControllerTest extends TestCase { $this->assertSame([], $this->controller->update($tokenId, [IToken::SCOPE_FILESYSTEM => true], 'App password')); } - public function testUpdateTokenWrongUser() { + public function testUpdateTokenWrongUser(): void { $tokenId = 42; $token = $this->createMock(PublicKeyToken::class); @@ -371,7 +371,7 @@ class AuthSettingsControllerTest extends TestCase { $this->assertSame(\OCP\AppFramework\Http::STATUS_NOT_FOUND, $response->getStatus()); } - public function testUpdateTokenNonExisting() { + public function testUpdateTokenNonExisting(): void { $this->tokenProvider->expects($this->once()) ->method('getTokenById') ->with($this->equalTo(42)) diff --git a/apps/settings/tests/Controller/CheckSetupControllerTest.php b/apps/settings/tests/Controller/CheckSetupControllerTest.php index fde13cfee31..27f7aa1b696 100644 --- a/apps/settings/tests/Controller/CheckSetupControllerTest.php +++ b/apps/settings/tests/Controller/CheckSetupControllerTest.php @@ -84,7 +84,7 @@ class CheckSetupControllerTest extends TestCase { ])->getMock(); } - public function testCheck() { + public function testCheck(): void { $this->config->expects($this->any()) ->method('getAppValue') ->willReturnMap([ @@ -142,7 +142,7 @@ class CheckSetupControllerTest extends TestCase { $this->assertEquals($expected, $this->checkSetupController->check()); } - public function testRescanFailedIntegrityCheck() { + public function testRescanFailedIntegrityCheck(): void { $this->checker ->expects($this->once()) ->method('runInstanceVerification'); @@ -156,7 +156,7 @@ class CheckSetupControllerTest extends TestCase { $this->assertEquals($expected, $this->checkSetupController->rescanFailedIntegrityCheck()); } - public function testGetFailedIntegrityCheckDisabled() { + public function testGetFailedIntegrityCheckDisabled(): void { $this->checker ->expects($this->once()) ->method('isCodeCheckEnforced') @@ -167,7 +167,7 @@ class CheckSetupControllerTest extends TestCase { } - public function testGetFailedIntegrityCheckFilesWithNoErrorsFound() { + public function testGetFailedIntegrityCheckFilesWithNoErrorsFound(): void { $this->checker ->expects($this->once()) ->method('isCodeCheckEnforced') @@ -187,7 +187,7 @@ class CheckSetupControllerTest extends TestCase { $this->assertEquals($expected, $this->checkSetupController->getFailedIntegrityCheckFiles()); } - public function testGetFailedIntegrityCheckFilesWithSomeErrorsFound() { + public function testGetFailedIntegrityCheckFilesWithSomeErrorsFound(): void { $this->checker ->expects($this->once()) ->method('isCodeCheckEnforced') diff --git a/apps/settings/tests/Controller/DelegationControllerTest.php b/apps/settings/tests/Controller/DelegationControllerTest.php index 2d03e316ce9..5994ddf298d 100644 --- a/apps/settings/tests/Controller/DelegationControllerTest.php +++ b/apps/settings/tests/Controller/DelegationControllerTest.php @@ -32,7 +32,7 @@ class DelegationControllerTest extends TestCase { ); } - public function testSaveSettings() { + public function testSaveSettings(): void { $setting = 'MySecretSetting'; $oldGroups = []; $oldGroups[] = AuthorizedGroup::fromParams(['groupId' => 'hello', 'class' => $setting]); diff --git a/apps/settings/tests/Controller/MailSettingsControllerTest.php b/apps/settings/tests/Controller/MailSettingsControllerTest.php index 52642884d23..d4d1e319a8e 100644 --- a/apps/settings/tests/Controller/MailSettingsControllerTest.php +++ b/apps/settings/tests/Controller/MailSettingsControllerTest.php @@ -58,7 +58,7 @@ class MailSettingsControllerTest extends \Test\TestCase { ); } - public function testSetMailSettings() { + public function testSetMailSettings(): void { $this->config->expects($this->exactly(2)) ->method('setSystemValues') ->withConsecutive( @@ -113,7 +113,7 @@ class MailSettingsControllerTest extends \Test\TestCase { $this->assertSame(Http::STATUS_OK, $response->getStatus()); } - public function testStoreCredentials() { + public function testStoreCredentials(): void { $this->config ->expects($this->once()) ->method('setSystemValues') @@ -126,7 +126,7 @@ class MailSettingsControllerTest extends \Test\TestCase { $this->assertSame(Http::STATUS_OK, $response->getStatus()); } - public function testSendTestMail() { + public function testSendTestMail(): void { $user = $this->createMock(User::class); $user->expects($this->any()) ->method('getUID') diff --git a/apps/settings/tests/Controller/TwoFactorSettingsControllerTest.php b/apps/settings/tests/Controller/TwoFactorSettingsControllerTest.php index 91b532b05f8..c34b2907dfd 100644 --- a/apps/settings/tests/Controller/TwoFactorSettingsControllerTest.php +++ b/apps/settings/tests/Controller/TwoFactorSettingsControllerTest.php @@ -37,7 +37,7 @@ class TwoFactorSettingsControllerTest extends TestCase { ); } - public function testIndex() { + public function testIndex(): void { $state = new EnforcementState(true); $this->mandatoryTwoFactor->expects($this->once()) ->method('getState') @@ -49,7 +49,7 @@ class TwoFactorSettingsControllerTest extends TestCase { $this->assertEquals($expected, $resp); } - public function testUpdate() { + public function testUpdate(): void { $state = new EnforcementState(true); $this->mandatoryTwoFactor->expects($this->once()) ->method('setState') diff --git a/apps/settings/tests/Controller/UsersControllerTest.php b/apps/settings/tests/Controller/UsersControllerTest.php index e1407cb1b55..db346ab89f2 100644 --- a/apps/settings/tests/Controller/UsersControllerTest.php +++ b/apps/settings/tests/Controller/UsersControllerTest.php @@ -249,7 +249,7 @@ class UsersControllerTest extends \Test\TestCase { * @param bool $validEmail * @param $expectedStatus */ - public function testSetUserSettings($email, $validEmail, $expectedStatus) { + public function testSetUserSettings($email, $validEmail, $expectedStatus): void { $controller = $this->getController(false, ['saveUserSettings']); $user = $this->createMock(IUser::class); $user->method('getUID')->willReturn('johndoe'); @@ -303,7 +303,7 @@ class UsersControllerTest extends \Test\TestCase { ]; } - public function testSetUserSettingsWhenUserDisplayNameChangeNotAllowed() { + public function testSetUserSettingsWhenUserDisplayNameChangeNotAllowed(): void { $controller = $this->getController(false, ['saveUserSettings']); $avatarScope = IAccountManager::SCOPE_PUBLISHED; @@ -401,7 +401,7 @@ class UsersControllerTest extends \Test\TestCase { ); } - public function testSetUserSettingsWhenFederatedFilesharingNotEnabled() { + public function testSetUserSettingsWhenFederatedFilesharingNotEnabled(): void { $controller = $this->getController(false, ['saveUserSettings']); $user = $this->createMock(IUser::class); $user->method('getUID')->willReturn('johndoe'); @@ -488,7 +488,7 @@ class UsersControllerTest extends \Test\TestCase { * @param string $property * @param string $propertyValue */ - public function testSetUserSettingsSubset($property, $propertyValue) { + public function testSetUserSettingsSubset($property, $propertyValue): void { $controller = $this->getController(false, ['saveUserSettings']); $user = $this->createMock(IUser::class); $user->method('getUID')->willReturn('johndoe'); @@ -619,7 +619,7 @@ class UsersControllerTest extends \Test\TestCase { public function testSaveUserSettings($data, $oldEmailAddress, $oldDisplayName - ) { + ): void { $controller = $this->getController(); $user = $this->createMock(IUser::class); @@ -742,7 +742,7 @@ class UsersControllerTest extends \Test\TestCase { string $oldDisplayName, bool $setDisplayNameResult, bool $canChangeEmail - ) { + ): void { $this->expectException(ForbiddenException::class); $controller = $this->getController(); @@ -826,7 +826,7 @@ class UsersControllerTest extends \Test\TestCase { * * @dataProvider dataTestGetVerificationCode */ - public function testGetVerificationCode($account, $type, $dataBefore, $expectedData, $onlyVerificationCode) { + public function testGetVerificationCode($account, $type, $dataBefore, $expectedData, $onlyVerificationCode): void { $message = 'Use my Federated Cloud ID to share with me: user@nextcloud.com'; $signature = 'theSignature'; @@ -912,7 +912,7 @@ class UsersControllerTest extends \Test\TestCase { /** * test get verification code in case no valid user was given */ - public function testGetVerificationCodeInvalidUser() { + public function testGetVerificationCodeInvalidUser(): void { $controller = $this->getController(); $this->userSession->expects($this->once())->method('getUser')->willReturn(null); $result = $controller->getVerificationCode('account', false); @@ -931,7 +931,7 @@ class UsersControllerTest extends \Test\TestCase { public function testCanAdminChangeUserPasswords($encryptionEnabled, $encryptionModuleLoaded, $masterKeyEnabled, - $expected) { + $expected): void { $controller = $this->getController(); $this->encryptionManager->expects($this->any()) diff --git a/apps/settings/tests/Mailer/NewUserMailHelperTest.php b/apps/settings/tests/Mailer/NewUserMailHelperTest.php index 2f9f7bcba7b..579ab2cdbb0 100644 --- a/apps/settings/tests/Mailer/NewUserMailHelperTest.php +++ b/apps/settings/tests/Mailer/NewUserMailHelperTest.php @@ -102,7 +102,7 @@ class NewUserMailHelperTest extends TestCase { ); } - public function testGenerateTemplateWithPasswordResetToken() { + public function testGenerateTemplateWithPasswordResetToken(): void { $this->secureRandom ->expects($this->once()) ->method('generate') @@ -357,7 +357,7 @@ EOF; $this->assertSame('OC\Mail\EMailTemplate', get_class($result)); } - public function testGenerateTemplateWithoutPasswordResetToken() { + public function testGenerateTemplateWithoutPasswordResetToken(): void { $this->urlGenerator ->expects($this->any()) ->method('getAbsoluteURL') @@ -593,7 +593,7 @@ EOF; $this->assertSame('OC\Mail\EMailTemplate', get_class($result)); } - public function testGenerateTemplateWithoutUserId() { + public function testGenerateTemplateWithoutUserId(): void { $this->urlGenerator ->expects($this->any()) ->method('getAbsoluteURL') @@ -816,7 +816,7 @@ EOF; $this->assertSame('OC\Mail\EMailTemplate', get_class($result)); } - public function testSendMail() { + public function testSendMail(): void { /** @var IUser|\PHPUnit\Framework\MockObject\MockObject $user */ $user = $this->createMock(IUser::class); $user diff --git a/apps/settings/tests/Middleware/SubadminMiddlewareTest.php b/apps/settings/tests/Middleware/SubadminMiddlewareTest.php index 1a832c528bf..c4672a06d49 100644 --- a/apps/settings/tests/Middleware/SubadminMiddlewareTest.php +++ b/apps/settings/tests/Middleware/SubadminMiddlewareTest.php @@ -44,7 +44,7 @@ class SubadminMiddlewareTest extends \Test\TestCase { } - public function testBeforeControllerAsUserWithExemption() { + public function testBeforeControllerAsUserWithExemption(): void { $this->expectException(\OC\AppFramework\Middleware\Security\Exceptions\NotAdminException::class); $this->reflector @@ -58,7 +58,7 @@ class SubadminMiddlewareTest extends \Test\TestCase { } - public function testBeforeControllerAsUserWithoutExemption() { + public function testBeforeControllerAsUserWithoutExemption(): void { $this->reflector ->expects($this->once()) ->method('hasAnnotation') @@ -67,7 +67,7 @@ class SubadminMiddlewareTest extends \Test\TestCase { $this->subadminMiddleware->beforeController($this->controller, 'foo'); } - public function testBeforeControllerAsSubAdminWithoutExemption() { + public function testBeforeControllerAsSubAdminWithoutExemption(): void { $this->reflector ->expects($this->exactly(2)) ->method('hasAnnotation') @@ -78,7 +78,7 @@ class SubadminMiddlewareTest extends \Test\TestCase { $this->subadminMiddlewareAsSubAdmin->beforeController($this->controller, 'foo'); } - public function testBeforeControllerAsSubAdminWithExemption() { + public function testBeforeControllerAsSubAdminWithExemption(): void { $this->reflector ->expects($this->once()) ->method('hasAnnotation') @@ -87,14 +87,14 @@ class SubadminMiddlewareTest extends \Test\TestCase { $this->subadminMiddlewareAsSubAdmin->beforeController($this->controller, 'foo'); } - public function testAfterNotAdminException() { + public function testAfterNotAdminException(): void { $expectedResponse = new TemplateResponse('core', '403', [], 'guest'); $expectedResponse->setStatus(403); $this->assertEquals($expectedResponse, $this->subadminMiddleware->afterException($this->controller, 'foo', new NotAdminException(''))); } - public function testAfterRegularException() { + public function testAfterRegularException(): void { $this->expectException(\Exception::class); $expectedResponse = new TemplateResponse('core', '403', [], 'guest'); diff --git a/apps/settings/tests/Settings/Admin/MailTest.php b/apps/settings/tests/Settings/Admin/MailTest.php index cab0596ad44..021dbac241b 100644 --- a/apps/settings/tests/Settings/Admin/MailTest.php +++ b/apps/settings/tests/Settings/Admin/MailTest.php @@ -30,7 +30,7 @@ class MailTest extends TestCase { ); } - public function testGetForm() { + public function testGetForm(): void { $this->config ->expects($this->any()) ->method('getSystemValue') @@ -69,11 +69,11 @@ class MailTest extends TestCase { $this->assertEquals($expected, $this->admin->getForm()); } - public function testGetSection() { + public function testGetSection(): void { $this->assertSame('server', $this->admin->getSection()); } - public function testGetPriority() { + public function testGetPriority(): void { $this->assertSame(10, $this->admin->getPriority()); } } diff --git a/apps/settings/tests/Settings/Admin/SecurityTest.php b/apps/settings/tests/Settings/Admin/SecurityTest.php index 4af8ad496ce..95b5e988397 100644 --- a/apps/settings/tests/Settings/Admin/SecurityTest.php +++ b/apps/settings/tests/Settings/Admin/SecurityTest.php @@ -57,7 +57,7 @@ class SecurityTest extends TestCase { * @dataProvider encryptionSettingsProvider * @param bool $enabled */ - public function testGetFormWithOnlyOneBackend($enabled) { + public function testGetFormWithOnlyOneBackend($enabled): void { $this->manager ->expects($this->once()) ->method('isEnabled') @@ -87,7 +87,7 @@ class SecurityTest extends TestCase { * @dataProvider encryptionSettingsProvider * @param bool $enabled */ - public function testGetFormWithMultipleBackends($enabled) { + public function testGetFormWithMultipleBackends($enabled): void { $this->manager ->expects($this->once()) ->method('isEnabled') @@ -113,11 +113,11 @@ class SecurityTest extends TestCase { $this->assertEquals($expected, $this->admin->getForm()); } - public function testGetSection() { + public function testGetSection(): void { $this->assertSame('security', $this->admin->getSection()); } - public function testGetPriority() { + public function testGetPriority(): void { $this->assertSame(10, $this->admin->getPriority()); } } diff --git a/apps/settings/tests/Settings/Personal/Security/AuthtokensTest.php b/apps/settings/tests/Settings/Personal/Security/AuthtokensTest.php index d2cd10e34d3..44641ee98b3 100644 --- a/apps/settings/tests/Settings/Personal/Security/AuthtokensTest.php +++ b/apps/settings/tests/Settings/Personal/Security/AuthtokensTest.php @@ -57,7 +57,7 @@ class AuthtokensTest extends TestCase { ); } - public function testGetForm() { + public function testGetForm(): void { $token1 = new PublicKeyToken(); $token1->setId(100); $token2 = new PublicKeyToken(); diff --git a/apps/settings/tests/Settings/Personal/Security/PasswordTest.php b/apps/settings/tests/Settings/Personal/Security/PasswordTest.php index 4ed7583339e..62f2c998943 100644 --- a/apps/settings/tests/Settings/Personal/Security/PasswordTest.php +++ b/apps/settings/tests/Settings/Personal/Security/PasswordTest.php @@ -38,7 +38,7 @@ class PasswordTest extends TestCase { ); } - public function testGetForm() { + public function testGetForm(): void { $user = $this->createMock(IUser::class); $this->userManager->expects($this->once()) ->method('get') diff --git a/apps/settings/tests/SetupChecks/AppDirsWithDifferentOwnerTest.php b/apps/settings/tests/SetupChecks/AppDirsWithDifferentOwnerTest.php index 24fd28c5e9f..db3141e3a26 100644 --- a/apps/settings/tests/SetupChecks/AppDirsWithDifferentOwnerTest.php +++ b/apps/settings/tests/SetupChecks/AppDirsWithDifferentOwnerTest.php @@ -46,7 +46,7 @@ class AppDirsWithDifferentOwnerTest extends TestCase { * * @return void */ - public function testAppDirectoryOwnersOk() { + public function testAppDirectoryOwnersOk(): void { $tempDir = tempnam(sys_get_temp_dir(), 'apps') . 'dir'; mkdir($tempDir); mkdir($tempDir . DIRECTORY_SEPARATOR . 'app1'); @@ -73,7 +73,7 @@ class AppDirsWithDifferentOwnerTest extends TestCase { * * @return void */ - public function testAppDirectoryOwnersNotWritable() { + public function testAppDirectoryOwnersNotWritable(): void { $tempDir = tempnam(sys_get_temp_dir(), 'apps') . 'dir'; \OC::$APPSROOTS = [ [ diff --git a/apps/sharebymail/tests/CapabilitiesTest.php b/apps/sharebymail/tests/CapabilitiesTest.php index 3d8aca1a537..d38618650b3 100644 --- a/apps/sharebymail/tests/CapabilitiesTest.php +++ b/apps/sharebymail/tests/CapabilitiesTest.php @@ -34,7 +34,7 @@ class CapabilitiesTest extends TestCase { $this->capabilities = new Capabilities($this->manager, $this->settingsManager, $this->appManager); } - public function testGetCapabilities() { + public function testGetCapabilities(): void { $this->manager->method('shareApiAllowLinks') ->willReturn(true); $this->manager->method('shareApiLinkEnforcePassword') diff --git a/apps/sharebymail/tests/ShareByMailProviderTest.php b/apps/sharebymail/tests/ShareByMailProviderTest.php index cad8dc49e34..c01f5b47632 100644 --- a/apps/sharebymail/tests/ShareByMailProviderTest.php +++ b/apps/sharebymail/tests/ShareByMailProviderTest.php @@ -148,7 +148,7 @@ class ShareByMailProviderTest extends TestCase { parent::tearDown(); } - public function testCreate() { + public function testCreate(): void { $expectedShare = $this->createMock(IShare::class); $share = $this->getMockBuilder(IShare::class)->getMock(); @@ -177,7 +177,7 @@ class ShareByMailProviderTest extends TestCase { $this->assertSame($expectedShare, $instance->create($share)); } - public function testCreateSendPasswordByMailWithoutEnforcedPasswordProtection() { + public function testCreateSendPasswordByMailWithoutEnforcedPasswordProtection(): void { $expectedShare = $this->createMock(IShare::class); $node = $this->getMockBuilder(File::class)->getMock(); @@ -219,7 +219,7 @@ class ShareByMailProviderTest extends TestCase { $instance->sendMailNotification($share); } - public function testCreateSendPasswordByMailWithPasswordAndWithoutEnforcedPasswordProtectionWithPermanentPassword() { + public function testCreateSendPasswordByMailWithPasswordAndWithoutEnforcedPasswordProtectionWithPermanentPassword(): void { $expectedShare = $this->createMock(IShare::class); $node = $this->getMockBuilder(File::class)->getMock(); @@ -265,7 +265,7 @@ class ShareByMailProviderTest extends TestCase { $instance->sendMailNotification($share); } - public function testCreateSendPasswordByMailWithPasswordAndWithoutEnforcedPasswordProtectionWithoutPermanentPassword() { + public function testCreateSendPasswordByMailWithPasswordAndWithoutEnforcedPasswordProtectionWithoutPermanentPassword(): void { $expectedShare = $this->createMock(IShare::class); $node = $this->getMockBuilder(File::class)->getMock(); @@ -318,7 +318,7 @@ class ShareByMailProviderTest extends TestCase { $instance->sendMailNotification($share); } - public function testCreateSendPasswordByMailWithEnforcedPasswordProtectionWithPermanentPassword() { + public function testCreateSendPasswordByMailWithEnforcedPasswordProtectionWithPermanentPassword(): void { $expectedShare = $this->createMock(IShare::class); $node = $this->getMockBuilder(File::class)->getMock(); @@ -399,7 +399,7 @@ class ShareByMailProviderTest extends TestCase { $instance->sendMailNotification($share); } - public function testCreateSendPasswordByMailWithPasswordAndWithEnforcedPasswordProtectionWithPermanentPassword() { + public function testCreateSendPasswordByMailWithPasswordAndWithEnforcedPasswordProtectionWithPermanentPassword(): void { $expectedShare = $this->createMock(IShare::class); $node = $this->getMockBuilder(File::class)->getMock(); @@ -473,7 +473,7 @@ class ShareByMailProviderTest extends TestCase { $instance->sendMailNotification($share); } - public function testCreateSendPasswordByTalkWithEnforcedPasswordProtectionWithPermanentPassword() { + public function testCreateSendPasswordByTalkWithEnforcedPasswordProtectionWithPermanentPassword(): void { $expectedShare = $this->createMock(IShare::class); // The owner of the share. @@ -617,7 +617,7 @@ class ShareByMailProviderTest extends TestCase { $instance->sendMailNotification($share); } - public function testCreateFailed() { + public function testCreateFailed(): void { $this->expectException(\Exception::class); $this->share->expects($this->once())->method('getSharedWith')->willReturn('user1'); @@ -637,7 +637,7 @@ class ShareByMailProviderTest extends TestCase { ); } - public function testCreateMailShare() { + public function testCreateMailShare(): void { $this->share->expects($this->any())->method('getToken')->willReturn('token'); $this->share->expects($this->once())->method('setToken')->with('token'); $this->share->expects($this->any())->method('getSharedBy')->willReturn('validby@valid.com'); @@ -662,7 +662,7 @@ class ShareByMailProviderTest extends TestCase { ); } - public function testGenerateToken() { + public function testGenerateToken(): void { $instance = $this->getInstance(); $this->secureRandom->expects($this->once())->method('generate')->willReturn('token'); @@ -672,7 +672,7 @@ class ShareByMailProviderTest extends TestCase { ); } - public function testAddShareToDB() { + public function testAddShareToDB(): void { $itemSource = 11; $itemType = 'file'; $shareWith = 'user@server.com'; @@ -735,7 +735,7 @@ class ShareByMailProviderTest extends TestCase { $this->assertSame($expiration->getTimestamp(), \DateTime::createFromFormat('Y-m-d H:i:s', $result[0]['expiration'])->getTimestamp()); } - public function testUpdate() { + public function testUpdate(): void { $itemSource = 11; $itemType = 'file'; $shareWith = 'user@server.com'; @@ -803,7 +803,7 @@ class ShareByMailProviderTest extends TestCase { * @param string newSendPasswordByTalk * @param bool sendMail */ - public function testUpdateSendPassword($plainTextPassword, string $originalPassword, string $newPassword, $originalSendPasswordByTalk, $newSendPasswordByTalk, bool $sendMail) { + public function testUpdateSendPassword($plainTextPassword, string $originalPassword, string $newPassword, $originalSendPasswordByTalk, $newSendPasswordByTalk, bool $sendMail): void { $node = $this->createMock(File::class); $node->expects($this->any())->method('getName')->willReturn('filename'); @@ -844,7 +844,7 @@ class ShareByMailProviderTest extends TestCase { ); } - public function testDelete() { + public function testDelete(): void { $instance = $this->getInstance(['removeShareFromTable', 'createShareActivity']); $this->share->expects($this->once())->method('getId')->willReturn(42); $instance->expects($this->once())->method('removeShareFromTable')->with(42); @@ -852,7 +852,7 @@ class ShareByMailProviderTest extends TestCase { $instance->delete($this->share); } - public function testGetShareById() { + public function testGetShareById(): void { $instance = $this->getInstance(['createShareObject']); $itemSource = 11; @@ -882,7 +882,7 @@ class ShareByMailProviderTest extends TestCase { } - public function testGetShareByIdFailed() { + public function testGetShareByIdFailed(): void { $this->expectException(\OCP\Share\Exceptions\ShareNotFound::class); $instance = $this->getInstance(['createShareObject']); @@ -900,7 +900,7 @@ class ShareByMailProviderTest extends TestCase { $instance->getShareById($id + 1); } - public function testGetShareByPath() { + public function testGetShareByPath(): void { $itemSource = 11; $itemType = 'file'; $shareWith = 'user@server.com'; @@ -935,7 +935,7 @@ class ShareByMailProviderTest extends TestCase { $this->assertInstanceOf('OCP\Share\IShare', $result[0]); } - public function testGetShareByToken() { + public function testGetShareByToken(): void { $itemSource = 11; $itemType = 'file'; $shareWith = 'user@server.com'; @@ -965,7 +965,7 @@ class ShareByMailProviderTest extends TestCase { } - public function testGetShareByTokenFailed() { + public function testGetShareByTokenFailed(): void { $this->expectException(\OCP\Share\Exceptions\ShareNotFound::class); @@ -989,7 +989,7 @@ class ShareByMailProviderTest extends TestCase { ); } - public function testRemoveShareFromTable() { + public function testRemoveShareFromTable(): void { $itemSource = 11; $itemType = 'file'; $shareWith = 'user@server.com'; @@ -1027,7 +1027,7 @@ class ShareByMailProviderTest extends TestCase { $this->assertEmpty($after); } - public function testUserDeleted() { + public function testUserDeleted(): void { $itemSource = 11; $itemType = 'file'; $shareWith = 'user@server.com'; @@ -1066,7 +1066,7 @@ class ShareByMailProviderTest extends TestCase { $this->assertSame($id, (int)$after[0]['id']); } - public function testGetRawShare() { + public function testGetRawShare(): void { $itemSource = 11; $itemType = 'file'; $shareWith = 'user@server.com'; @@ -1092,7 +1092,7 @@ class ShareByMailProviderTest extends TestCase { } - public function testGetRawShareFailed() { + public function testGetRawShareFailed(): void { $this->expectException(\OCP\Share\Exceptions\ShareNotFound::class); $itemSource = 11; @@ -1137,7 +1137,7 @@ class ShareByMailProviderTest extends TestCase { return (int)$id; } - public function testGetSharesInFolder() { + public function testGetSharesInFolder(): void { $userManager = \OC::$server->getUserManager(); $rootFolder = \OC::$server->getRootFolder(); @@ -1184,7 +1184,7 @@ class ShareByMailProviderTest extends TestCase { $u2->delete(); } - public function testGetAccessList() { + public function testGetAccessList(): void { $userManager = \OC::$server->getUserManager(); $rootFolder = \OC::$server->getRootFolder(); @@ -1252,7 +1252,7 @@ class ShareByMailProviderTest extends TestCase { $u2->delete(); } - public function testSendMailNotificationWithSameUserAndUserEmail() { + public function testSendMailNotificationWithSameUserAndUserEmail(): void { $provider = $this->getInstance(); $user = $this->createMock(IUser::class); $this->settingsManager->expects($this->any())->method('replyToInitiator')->willReturn(true); @@ -1365,7 +1365,7 @@ class ShareByMailProviderTest extends TestCase { ); } - public function testSendMailNotificationWithSameUserAndUserEmailAndNote() { + public function testSendMailNotificationWithSameUserAndUserEmailAndNote(): void { $provider = $this->getInstance(); $user = $this->createMock(IUser::class); $this->settingsManager->expects($this->any())->method('replyToInitiator')->willReturn(true); @@ -1491,7 +1491,7 @@ class ShareByMailProviderTest extends TestCase { ); } - public function testSendMailNotificationWithSameUserAndUserEmailAndExpiration() { + public function testSendMailNotificationWithSameUserAndUserEmailAndExpiration(): void { $provider = $this->getInstance(); $user = $this->createMock(IUser::class); $this->settingsManager->expects($this->any())->method('replyToInitiator')->willReturn(true); @@ -1623,7 +1623,7 @@ class ShareByMailProviderTest extends TestCase { ); } - public function testSendMailNotificationWithDifferentUserAndNoUserEmail() { + public function testSendMailNotificationWithDifferentUserAndNoUserEmail(): void { $provider = $this->getInstance(); $initiatorUser = $this->createMock(IUser::class); $this->settingsManager->expects($this->any())->method('replyToInitiator')->willReturn(true); @@ -1727,7 +1727,7 @@ class ShareByMailProviderTest extends TestCase { ); } - public function testSendMailNotificationWithSameUserAndUserEmailAndReplyToDesactivate() { + public function testSendMailNotificationWithSameUserAndUserEmailAndReplyToDesactivate(): void { $provider = $this->getInstance(); $user = $this->createMock(IUser::class); $this->settingsManager->expects($this->any())->method('replyToInitiator')->willReturn(false); @@ -1835,7 +1835,7 @@ class ShareByMailProviderTest extends TestCase { ); } - public function testSendMailNotificationWithDifferentUserAndNoUserEmailAndReplyToDesactivate() { + public function testSendMailNotificationWithDifferentUserAndNoUserEmailAndReplyToDesactivate(): void { $provider = $this->getInstance(); $initiatorUser = $this->createMock(IUser::class); $this->settingsManager->expects($this->any())->method('replyToInitiator')->willReturn(false); diff --git a/apps/systemtags/tests/Activity/SettingTest.php b/apps/systemtags/tests/Activity/SettingTest.php index 91aef57aeef..7ef46705e02 100644 --- a/apps/systemtags/tests/Activity/SettingTest.php +++ b/apps/systemtags/tests/Activity/SettingTest.php @@ -22,11 +22,11 @@ class SettingTest extends TestCase { $this->setting = new Setting($this->l); } - public function testGetIdentifier() { + public function testGetIdentifier(): void { $this->assertSame('systemtags', $this->setting->getIdentifier()); } - public function testGetName() { + public function testGetName(): void { $this->l ->expects($this->once()) ->method('t') @@ -36,23 +36,23 @@ class SettingTest extends TestCase { $this->assertSame('<strong>System tags</strong> for a file have been modified', $this->setting->getName()); } - public function testGetPriority() { + public function testGetPriority(): void { $this->assertSame(50, $this->setting->getPriority()); } - public function testCanChangeStream() { + public function testCanChangeStream(): void { $this->assertSame(true, $this->setting->canChangeStream()); } - public function testIsDefaultEnabledStream() { + public function testIsDefaultEnabledStream(): void { $this->assertSame(true, $this->setting->isDefaultEnabledStream()); } - public function testCanChangeMail() { + public function testCanChangeMail(): void { $this->assertSame(true, $this->setting->canChangeMail()); } - public function testIsDefaultEnabledMail() { + public function testIsDefaultEnabledMail(): void { $this->assertSame(false, $this->setting->isDefaultEnabledMail()); } } diff --git a/apps/systemtags/tests/Settings/AdminTest.php b/apps/systemtags/tests/Settings/AdminTest.php index b18019484ef..78f19475fae 100644 --- a/apps/systemtags/tests/Settings/AdminTest.php +++ b/apps/systemtags/tests/Settings/AdminTest.php @@ -19,16 +19,16 @@ class AdminTest extends TestCase { $this->admin = new Admin(); } - public function testGetForm() { + public function testGetForm(): void { $expected = new TemplateResponse('systemtags', 'admin', [], ''); $this->assertEquals($expected, $this->admin->getForm()); } - public function testGetSection() { + public function testGetSection(): void { $this->assertSame('server', $this->admin->getSection()); } - public function testGetPriority() { + public function testGetPriority(): void { $this->assertSame(70, $this->admin->getPriority()); } } diff --git a/apps/theming/tests/CapabilitiesTest.php b/apps/theming/tests/CapabilitiesTest.php index 5accb30b6a1..277dd5b6a7a 100644 --- a/apps/theming/tests/CapabilitiesTest.php +++ b/apps/theming/tests/CapabilitiesTest.php @@ -143,7 +143,7 @@ class CapabilitiesTest extends TestCase { * @param bool $backgroundThemed * @param string[] $expected */ - public function testGetCapabilities($name, $url, $slogan, $color, $textColor, $logo, $background, $backgroundColor, $backgroundTextColor, $baseUrl, $backgroundThemed, array $expected) { + public function testGetCapabilities($name, $url, $slogan, $color, $textColor, $logo, $background, $backgroundColor, $backgroundTextColor, $baseUrl, $backgroundThemed, array $expected): void { $this->config->expects($this->once()) ->method('getAppValue') ->willReturn($background); diff --git a/apps/theming/tests/Controller/IconControllerTest.php b/apps/theming/tests/Controller/IconControllerTest.php index e0159c03082..18fa7de1cc8 100644 --- a/apps/theming/tests/Controller/IconControllerTest.php +++ b/apps/theming/tests/Controller/IconControllerTest.php @@ -80,7 +80,7 @@ class IconControllerTest extends TestCase { return new SimpleFile($icon); } - public function testGetThemedIcon() { + public function testGetThemedIcon(): void { $file = $this->iconFileMock('icon-core-filetypes_folder.svg', 'filecontent'); $this->imageManager->expects($this->once()) ->method('getCachedImage') @@ -91,7 +91,7 @@ class IconControllerTest extends TestCase { $this->assertEquals($expected, $this->iconController->getThemedIcon('core', 'filetypes/folder.svg')); } - public function testGetFaviconDefault() { + public function testGetFaviconDefault(): void { if (!extension_loaded('imagick')) { $this->markTestSkipped('Imagemagick is required for dynamic icon generation.'); } @@ -123,7 +123,7 @@ class IconControllerTest extends TestCase { $this->assertEquals($expected, $this->iconController->getFavicon()); } - public function testGetFaviconFail() { + public function testGetFaviconFail(): void { $this->imageManager->expects($this->once()) ->method('getImage') ->with('favicon', false) @@ -141,7 +141,7 @@ class IconControllerTest extends TestCase { $this->assertEquals($expected, $this->iconController->getFavicon()); } - public function testGetTouchIconDefault() { + public function testGetTouchIconDefault(): void { if (!extension_loaded('imagick')) { $this->markTestSkipped('Imagemagick is required for dynamic icon generation.'); } @@ -173,7 +173,7 @@ class IconControllerTest extends TestCase { $this->assertEquals($expected, $this->iconController->getTouchIcon()); } - public function testGetTouchIconFail() { + public function testGetTouchIconFail(): void { $this->imageManager->expects($this->once()) ->method('getImage') ->with('favicon') diff --git a/apps/theming/tests/Controller/ThemingControllerTest.php b/apps/theming/tests/Controller/ThemingControllerTest.php index f32f3c790d0..d69ceefa0e5 100644 --- a/apps/theming/tests/Controller/ThemingControllerTest.php +++ b/apps/theming/tests/Controller/ThemingControllerTest.php @@ -96,7 +96,7 @@ class ThemingControllerTest extends TestCase { * @param string $value * @param string $message */ - public function testUpdateStylesheetSuccess($setting, $value, $message) { + public function testUpdateStylesheetSuccess($setting, $value, $message): void { $this->themingDefaults ->expects($this->once()) ->method('set') @@ -147,7 +147,7 @@ class ThemingControllerTest extends TestCase { * @param string $value * @param string $message */ - public function testUpdateStylesheetError($setting, $value, $message) { + public function testUpdateStylesheetError($setting, $value, $message): void { $this->themingDefaults ->expects($this->never()) ->method('set') @@ -172,7 +172,7 @@ class ThemingControllerTest extends TestCase { $this->assertEquals($expected, $this->themingController->updateStylesheet($setting, $value)); } - public function testUpdateLogoNoData() { + public function testUpdateLogoNoData(): void { $this->request ->expects($this->once()) ->method('getParam') @@ -204,7 +204,7 @@ class ThemingControllerTest extends TestCase { $this->assertEquals($expected, $this->themingController->uploadImage()); } - public function testUploadInvalidUploadKey() { + public function testUploadInvalidUploadKey(): void { $this->request ->expects($this->once()) ->method('getParam') @@ -241,7 +241,7 @@ class ThemingControllerTest extends TestCase { * @test * @return void */ - public function testUploadSVGFaviconWithoutImagemagick() { + public function testUploadSVGFaviconWithoutImagemagick(): void { $this->imageManager ->method('shouldReplaceIcons') ->willReturn(false); @@ -286,7 +286,7 @@ class ThemingControllerTest extends TestCase { $this->assertEquals($expected, $this->themingController->uploadImage()); } - public function testUpdateLogoInvalidMimeType() { + public function testUpdateLogoInvalidMimeType(): void { $this->request ->expects($this->once()) ->method('getParam') @@ -339,7 +339,7 @@ class ThemingControllerTest extends TestCase { } /** @dataProvider dataUpdateImages */ - public function testUpdateLogoNormalLogoUpload($mimeType, $folderExists = true) { + public function testUpdateLogoNormalLogoUpload($mimeType, $folderExists = true): void { $tmpLogo = \OC::$server->getTempManager()->getTemporaryFolder() . '/logo.svg'; $destination = \OC::$server->getTempManager()->getTemporaryFolder(); @@ -391,7 +391,7 @@ class ThemingControllerTest extends TestCase { } /** @dataProvider dataUpdateImages */ - public function testUpdateLogoLoginScreenUpload($folderExists) { + public function testUpdateLogoLoginScreenUpload($folderExists): void { $tmpLogo = \OC::$server->getTempManager()->getTemporaryFolder() . 'logo.png'; touch($tmpLogo); @@ -439,7 +439,7 @@ class ThemingControllerTest extends TestCase { $this->assertEquals($expected, $this->themingController->uploadImage()); } - public function testUpdateLogoLoginScreenUploadWithInvalidImage() { + public function testUpdateLogoLoginScreenUploadWithInvalidImage(): void { $tmpLogo = \OC::$server->getTempManager()->getTemporaryFolder() . '/logo.svg'; touch($tmpLogo); @@ -498,7 +498,7 @@ class ThemingControllerTest extends TestCase { /** * @dataProvider dataPhpUploadErrors */ - public function testUpdateLogoLoginScreenUploadWithInvalidImageUpload($error, $expectedErrorMessage) { + public function testUpdateLogoLoginScreenUploadWithInvalidImageUpload($error, $expectedErrorMessage): void { $this->request ->expects($this->once()) ->method('getParam') @@ -537,7 +537,7 @@ class ThemingControllerTest extends TestCase { /** * @dataProvider dataPhpUploadErrors */ - public function testUpdateLogoUploadWithInvalidImageUpload($error, $expectedErrorMessage) { + public function testUpdateLogoUploadWithInvalidImageUpload($error, $expectedErrorMessage): void { $this->request ->expects($this->once()) ->method('getParam') @@ -573,7 +573,7 @@ class ThemingControllerTest extends TestCase { $this->assertEquals($expected, $this->themingController->uploadImage()); } - public function testUndo() { + public function testUndo(): void { $this->l10n ->expects($this->once()) ->method('t') @@ -606,7 +606,7 @@ class ThemingControllerTest extends TestCase { } /** @dataProvider dataUndoDelete */ - public function testUndoDelete($value, $filename) { + public function testUndoDelete($value, $filename): void { $this->l10n ->expects($this->once()) ->method('t') @@ -633,7 +633,7 @@ class ThemingControllerTest extends TestCase { - public function testGetLogoNotExistent() { + public function testGetLogoNotExistent(): void { $this->imageManager->method('getImage') ->with($this->equalTo('logo')) ->willThrowException(new NotFoundException()); @@ -642,7 +642,7 @@ class ThemingControllerTest extends TestCase { $this->assertEquals($expected, $this->themingController->getImage('logo')); } - public function testGetLogo() { + public function testGetLogo(): void { $file = $this->createMock(ISimpleFile::class); $file->method('getName')->willReturn('logo.svg'); $file->method('getMTime')->willReturn(42); @@ -666,7 +666,7 @@ class ThemingControllerTest extends TestCase { } - public function testGetLoginBackgroundNotExistent() { + public function testGetLoginBackgroundNotExistent(): void { $this->imageManager->method('getImage') ->with($this->equalTo('background')) ->willThrowException(new NotFoundException()); @@ -674,7 +674,7 @@ class ThemingControllerTest extends TestCase { $this->assertEquals($expected, $this->themingController->getImage('background')); } - public function testGetLoginBackground() { + public function testGetLoginBackground(): void { $file = $this->createMock(ISimpleFile::class); $file->method('getName')->willReturn('background.png'); $file->method('getMTime')->willReturn(42); @@ -698,7 +698,7 @@ class ThemingControllerTest extends TestCase { @$this->assertEquals($expected, $this->themingController->getImage('background')); } - public function testGetManifest() { + public function testGetManifest(): void { $this->config ->expects($this->once()) ->method('getAppValue') diff --git a/apps/theming/tests/Controller/UserThemeControllerTest.php b/apps/theming/tests/Controller/UserThemeControllerTest.php index 8c3ae7364cd..7d369463c0d 100644 --- a/apps/theming/tests/Controller/UserThemeControllerTest.php +++ b/apps/theming/tests/Controller/UserThemeControllerTest.php @@ -104,7 +104,7 @@ class UserThemeControllerTest extends TestCase { * @param string $themeId * @param string $exception */ - public function testEnableTheme($themeId, ?string $exception = null) { + public function testEnableTheme($themeId, ?string $exception = null): void { $this->themesService ->expects($this->any()) ->method('getThemes') @@ -124,7 +124,7 @@ class UserThemeControllerTest extends TestCase { * @param string $themeId * @param string $exception */ - public function testDisableTheme($themeId, ?string $exception = null) { + public function testDisableTheme($themeId, ?string $exception = null): void { $this->themesService ->expects($this->any()) ->method('getThemes') diff --git a/apps/theming/tests/IconBuilderTest.php b/apps/theming/tests/IconBuilderTest.php index 0d8b8c83923..942bcf399fa 100644 --- a/apps/theming/tests/IconBuilderTest.php +++ b/apps/theming/tests/IconBuilderTest.php @@ -74,7 +74,7 @@ class IconBuilderTest extends TestCase { * @param $color * @param $file */ - public function testRenderAppIcon($app, $color, $file) { + public function testRenderAppIcon($app, $color, $file): void { $this->checkImagick(); $this->themingDefaults->expects($this->once()) ->method('getColorPrimary') @@ -103,7 +103,7 @@ class IconBuilderTest extends TestCase { * @param $color * @param $file */ - public function testGetTouchIcon($app, $color, $file) { + public function testGetTouchIcon($app, $color, $file): void { $this->checkImagick(); $this->themingDefaults->expects($this->once()) ->method('getColorPrimary') @@ -133,7 +133,7 @@ class IconBuilderTest extends TestCase { * @param $color * @param $file */ - public function testGetFavicon($app, $color, $file) { + public function testGetFavicon($app, $color, $file): void { $this->checkImagick(); $this->imageManager->expects($this->once()) ->method('shouldReplaceIcons') @@ -162,7 +162,7 @@ class IconBuilderTest extends TestCase { // cloud be something like $expectedIcon->compareImages($icon, Imagick::METRIC_MEANABSOLUTEERROR)[1]) } - public function testGetFaviconNotFound() { + public function testGetFaviconNotFound(): void { $this->checkImagick(); $this->expectWarning(Warning::class); $util = $this->getMockBuilder(Util::class)->disableOriginalConstructor()->getMock(); @@ -176,7 +176,7 @@ class IconBuilderTest extends TestCase { $this->assertFalse($iconBuilder->getFavicon('noapp')); } - public function testGetTouchIconNotFound() { + public function testGetTouchIconNotFound(): void { $this->checkImagick(); $this->expectWarning(Warning::class); $util = $this->getMockBuilder(Util::class)->disableOriginalConstructor()->getMock(); @@ -187,7 +187,7 @@ class IconBuilderTest extends TestCase { $this->assertFalse($iconBuilder->getTouchIcon('noapp')); } - public function testColorSvgNotFound() { + public function testColorSvgNotFound(): void { $this->checkImagick(); $this->expectWarning(Warning::class); $util = $this->getMockBuilder(Util::class)->disableOriginalConstructor()->getMock(); diff --git a/apps/theming/tests/ImageManagerTest.php b/apps/theming/tests/ImageManagerTest.php index f3c2156be7e..54e4e2a70ee 100644 --- a/apps/theming/tests/ImageManagerTest.php +++ b/apps/theming/tests/ImageManagerTest.php @@ -117,7 +117,7 @@ class ImageManagerTest extends TestCase { } } - public function testGetImageUrl() { + public function testGetImageUrl(): void { $this->checkImagick(); $file = $this->createMock(ISimpleFile::class); $this->config->expects($this->exactly(2)) @@ -133,7 +133,7 @@ class ImageManagerTest extends TestCase { $this->assertEquals('url-to-image?v=0', $this->imageManager->getImageUrl('logo', false)); } - public function testGetImageUrlDefault() { + public function testGetImageUrlDefault(): void { $this->config->expects($this->exactly(2)) ->method('getAppValue') ->withConsecutive( @@ -148,7 +148,7 @@ class ImageManagerTest extends TestCase { $this->assertEquals('logo/logo.png?v=0', $this->imageManager->getImageUrl('logo')); } - public function testGetImageUrlAbsolute() { + public function testGetImageUrlAbsolute(): void { $this->checkImagick(); $file = $this->createMock(ISimpleFile::class); $this->config->expects($this->exactly(2)) @@ -164,7 +164,7 @@ class ImageManagerTest extends TestCase { $this->assertEquals('url-to-image-absolute?v=0', $this->imageManager->getImageUrlAbsolute('logo', false)); } - public function testGetImage() { + public function testGetImage(): void { $this->checkImagick(); $this->config->expects($this->once()) ->method('getAppValue')->with('theming', 'logoMime', false) @@ -175,7 +175,7 @@ class ImageManagerTest extends TestCase { } - public function testGetImageUnset() { + public function testGetImageUnset(): void { $this->expectException(\OCP\Files\NotFoundException::class); $this->config->expects($this->once()) @@ -184,7 +184,7 @@ class ImageManagerTest extends TestCase { $this->imageManager->getImage('logo'); } - public function testGetCacheFolder() { + public function testGetCacheFolder(): void { $folder = $this->createMock(ISimpleFolder::class); $this->config->expects($this->once()) ->method('getAppValue') @@ -196,7 +196,7 @@ class ImageManagerTest extends TestCase { ->willReturn($folder); $this->assertEquals($folder, $this->imageManager->getCacheFolder()); } - public function testGetCacheFolderCreate() { + public function testGetCacheFolderCreate(): void { $folder = $this->createMock(ISimpleFolder::class); $this->config->expects($this->exactly(2)) ->method('getAppValue') @@ -219,7 +219,7 @@ class ImageManagerTest extends TestCase { $this->assertEquals($folder, $this->imageManager->getCacheFolder()); } - public function testGetCachedImage() { + public function testGetCachedImage(): void { $expected = $this->createMock(ISimpleFile::class); $folder = $this->setupCacheFolder(); $folder->expects($this->once()) @@ -230,7 +230,7 @@ class ImageManagerTest extends TestCase { } - public function testGetCachedImageNotFound() { + public function testGetCachedImageNotFound(): void { $this->expectException(\OCP\Files\NotFoundException::class); $folder = $this->setupCacheFolder(); @@ -241,7 +241,7 @@ class ImageManagerTest extends TestCase { $image = $this->imageManager->getCachedImage('filename'); } - public function testSetCachedImage() { + public function testSetCachedImage(): void { $folder = $this->setupCacheFolder(); $file = $this->createMock(ISimpleFile::class); $folder->expects($this->once()) @@ -258,7 +258,7 @@ class ImageManagerTest extends TestCase { $this->assertEquals($file, $this->imageManager->setCachedImage('filename', 'filecontent')); } - public function testSetCachedImageCreate() { + public function testSetCachedImageCreate(): void { $folder = $this->setupCacheFolder(); $file = $this->createMock(ISimpleFile::class); $folder->expects($this->once()) @@ -288,7 +288,7 @@ class ImageManagerTest extends TestCase { return $folder; } - public function testCleanup() { + public function testCleanup(): void { $folders = [ $this->createMock(ISimpleFolder::class), $this->createMock(ISimpleFolder::class), @@ -332,7 +332,7 @@ class ImageManagerTest extends TestCase { /** * @dataProvider dataUpdateImage */ - public function testUpdateImage($key, $tmpFile, $folderExists, $shouldConvert) { + public function testUpdateImage($key, $tmpFile, $folderExists, $shouldConvert): void { $file = $this->createMock(ISimpleFile::class); $folder = $this->createMock(ISimpleFolder::class); $oldFile = $this->createMock(ISimpleFile::class); diff --git a/apps/theming/tests/Service/ThemesServiceTest.php b/apps/theming/tests/Service/ThemesServiceTest.php index 1644deea4c7..77371cfe34c 100644 --- a/apps/theming/tests/Service/ThemesServiceTest.php +++ b/apps/theming/tests/Service/ThemesServiceTest.php @@ -70,7 +70,7 @@ class ThemesServiceTest extends TestCase { parent::setUp(); } - public function testGetThemes() { + public function testGetThemes(): void { $expected = [ 'default', 'light', @@ -82,7 +82,7 @@ class ThemesServiceTest extends TestCase { $this->assertEquals($expected, array_keys($this->themesService->getThemes())); } - public function testGetThemesEnforced() { + public function testGetThemesEnforced(): void { $this->config->expects($this->once()) ->method('getSystemValueString') ->with('enforce_theme', '') @@ -98,7 +98,7 @@ class ThemesServiceTest extends TestCase { $this->assertEquals($expected, array_keys($this->themesService->getThemes())); } - public function testGetThemesEnforcedInvalid() { + public function testGetThemesEnforcedInvalid(): void { $this->config->expects($this->once()) ->method('getSystemValueString') ->with('enforce_theme', '') @@ -136,7 +136,7 @@ class ThemesServiceTest extends TestCase { * @param string[] $enabledThemes * @param string[] $expectedEnabled */ - public function testEnableTheme(string $toEnable, array $enabledThemes, array $expectedEnabled) { + public function testEnableTheme(string $toEnable, array $enabledThemes, array $expectedEnabled): void { $user = $this->createMock(IUser::class); $this->userSession->expects($this->any()) ->method('getUser') @@ -170,7 +170,7 @@ class ThemesServiceTest extends TestCase { * @param string[] $enabledThemes * @param string[] $expectedEnabled */ - public function testDisableTheme(string $toDisable, array $enabledThemes, array $expectedEnabled) { + public function testDisableTheme(string $toDisable, array $enabledThemes, array $expectedEnabled): void { $user = $this->createMock(IUser::class); $this->userSession->expects($this->any()) ->method('getUser') @@ -204,7 +204,7 @@ class ThemesServiceTest extends TestCase { * @param string $toEnable * @param string[] $enabledThemes */ - public function testIsEnabled(string $themeId, array $enabledThemes, $expected) { + public function testIsEnabled(string $themeId, array $enabledThemes, $expected): void { $user = $this->createMock(IUser::class); $this->userSession->expects($this->any()) ->method('getUser') @@ -222,7 +222,7 @@ class ThemesServiceTest extends TestCase { $this->assertEquals($expected, $this->themesService->isEnabled($this->themes[$themeId])); } - public function testGetEnabledThemes() { + public function testGetEnabledThemes(): void { $user = $this->createMock(IUser::class); $this->userSession->expects($this->any()) ->method('getUser') @@ -244,7 +244,7 @@ class ThemesServiceTest extends TestCase { $this->assertEquals([], $this->themesService->getEnabledThemes()); } - public function testGetEnabledThemesEnforced() { + public function testGetEnabledThemesEnforced(): void { $user = $this->createMock(IUser::class); $this->userSession->expects($this->any()) ->method('getUser') @@ -282,7 +282,7 @@ class ThemesServiceTest extends TestCase { * @param string[] $enabledThemes * @param string[] $expected */ - public function testSetEnabledThemes(array $enabledThemes, array $expected) { + public function testSetEnabledThemes(array $enabledThemes, array $expected): void { $user = $this->createMock(IUser::class); $this->userSession->expects($this->any()) ->method('getUser') diff --git a/apps/theming/tests/ServicesTest.php b/apps/theming/tests/ServicesTest.php index 2e404d6fd43..3223de0a489 100644 --- a/apps/theming/tests/ServicesTest.php +++ b/apps/theming/tests/ServicesTest.php @@ -64,7 +64,7 @@ class ServicesTest extends TestCase { * @param string $service * @param string $expected */ - public function testContainerQuery($service, $expected = null) { + public function testContainerQuery($service, $expected = null): void { if ($expected === null) { $expected = $service; } diff --git a/apps/theming/tests/Settings/AdminSectionTest.php b/apps/theming/tests/Settings/AdminSectionTest.php index 8916313e9a2..a73eca1cc5a 100644 --- a/apps/theming/tests/Settings/AdminSectionTest.php +++ b/apps/theming/tests/Settings/AdminSectionTest.php @@ -31,11 +31,11 @@ class AdminSectionTest extends TestCase { ); } - public function testGetID() { + public function testGetID(): void { $this->assertSame('theming', $this->section->getID()); } - public function testGetName() { + public function testGetName(): void { $this->l ->expects($this->once()) ->method('t') @@ -45,11 +45,11 @@ class AdminSectionTest extends TestCase { $this->assertSame('Theming', $this->section->getName()); } - public function testGetPriority() { + public function testGetPriority(): void { $this->assertSame(30, $this->section->getPriority()); } - public function testGetIcon() { + public function testGetIcon(): void { $this->url->expects($this->once()) ->method('imagePath') ->with('theming', 'app-dark.svg') diff --git a/apps/theming/tests/Settings/AdminTest.php b/apps/theming/tests/Settings/AdminTest.php index d74668f5e6f..189a91bae3a 100644 --- a/apps/theming/tests/Settings/AdminTest.php +++ b/apps/theming/tests/Settings/AdminTest.php @@ -49,7 +49,7 @@ class AdminTest extends TestCase { ); } - public function testGetFormNoErrors() { + public function testGetFormNoErrors(): void { $this->config ->expects($this->once()) ->method('getSystemValue') @@ -84,7 +84,7 @@ class AdminTest extends TestCase { $this->assertEquals($expected, $this->admin->getForm()); } - public function testGetFormWithErrors() { + public function testGetFormWithErrors(): void { $this->config ->expects($this->once()) ->method('getSystemValue') @@ -124,11 +124,11 @@ class AdminTest extends TestCase { $this->assertEquals($expected, $this->admin->getForm()); } - public function testGetSection() { + public function testGetSection(): void { $this->assertSame('theming', $this->admin->getSection()); } - public function testGetPriority() { + public function testGetPriority(): void { $this->assertSame(5, $this->admin->getPriority()); } } diff --git a/apps/theming/tests/Settings/PersonalTest.php b/apps/theming/tests/Settings/PersonalTest.php index 88c5e93d1c7..4630ef48c8a 100644 --- a/apps/theming/tests/Settings/PersonalTest.php +++ b/apps/theming/tests/Settings/PersonalTest.php @@ -91,7 +91,7 @@ class PersonalTest extends TestCase { * @param string $toEnable * @param string[] $enabledThemes */ - public function testGetForm(string $enforcedTheme, $themesState) { + public function testGetForm(string $enforcedTheme, $themesState): void { $this->config->expects($this->once()) ->method('getSystemValueString') ->with('enforce_theme', '') @@ -125,11 +125,11 @@ class PersonalTest extends TestCase { $this->assertEquals($expected, $this->admin->getForm()); } - public function testGetSection() { + public function testGetSection(): void { $this->assertSame('theming', $this->admin->getSection()); } - public function testGetPriority() { + public function testGetPriority(): void { $this->assertSame(40, $this->admin->getPriority()); } diff --git a/apps/theming/tests/Themes/AccessibleThemeTestCase.php b/apps/theming/tests/Themes/AccessibleThemeTestCase.php index 5f13e2259aa..a1327a04f0b 100644 --- a/apps/theming/tests/Themes/AccessibleThemeTestCase.php +++ b/apps/theming/tests/Themes/AccessibleThemeTestCase.php @@ -148,7 +148,7 @@ class AccessibleThemeTestCase extends TestCase { /** * @dataProvider dataAccessibilityPairs */ - public function testAccessibilityOfVariables($mainColors, $backgroundColors, $minContrast) { + public function testAccessibilityOfVariables($mainColors, $backgroundColors, $minContrast): void { if (!isset($this->theme)) { $this->markTestSkipped('You need to setup $this->theme in your setUp function'); } elseif (!isset($this->util)) { diff --git a/apps/theming/tests/Themes/DarkHighContrastThemeTest.php b/apps/theming/tests/Themes/DarkHighContrastThemeTest.php index 30bbc5f110d..63fb2bf414d 100644 --- a/apps/theming/tests/Themes/DarkHighContrastThemeTest.php +++ b/apps/theming/tests/Themes/DarkHighContrastThemeTest.php @@ -108,27 +108,27 @@ class DarkHighContrastThemeTest extends AccessibleThemeTestCase { } - public function testGetId() { + public function testGetId(): void { $this->assertEquals('dark-highcontrast', $this->theme->getId()); } - public function testGetType() { + public function testGetType(): void { $this->assertEquals(ITheme::TYPE_THEME, $this->theme->getType()); } - public function testGetTitle() { + public function testGetTitle(): void { $this->assertEquals('Dark theme with high contrast mode', $this->theme->getTitle()); } - public function testGetEnableLabel() { + public function testGetEnableLabel(): void { $this->assertEquals('Enable dark high contrast mode', $this->theme->getEnableLabel()); } - public function testGetDescription() { + public function testGetDescription(): void { $this->assertEquals('Similar to the high contrast mode, but with dark colours.', $this->theme->getDescription()); } - public function testGetMediaQuery() { + public function testGetMediaQuery(): void { $this->assertEquals('(prefers-color-scheme: dark) and (prefers-contrast: more)', $this->theme->getMediaQuery()); } } diff --git a/apps/theming/tests/Themes/DarkThemeTest.php b/apps/theming/tests/Themes/DarkThemeTest.php index 16a289053ae..f53028d3a63 100644 --- a/apps/theming/tests/Themes/DarkThemeTest.php +++ b/apps/theming/tests/Themes/DarkThemeTest.php @@ -105,31 +105,31 @@ class DarkThemeTest extends AccessibleThemeTestCase { } - public function testGetId() { + public function testGetId(): void { $this->assertEquals('dark', $this->theme->getId()); } - public function testGetType() { + public function testGetType(): void { $this->assertEquals(ITheme::TYPE_THEME, $this->theme->getType()); } - public function testGetTitle() { + public function testGetTitle(): void { $this->assertEquals('Dark theme', $this->theme->getTitle()); } - public function testGetEnableLabel() { + public function testGetEnableLabel(): void { $this->assertEquals('Enable dark theme', $this->theme->getEnableLabel()); } - public function testGetDescription() { + public function testGetDescription(): void { $this->assertEquals('A dark theme to ease your eyes by reducing the overall luminosity and brightness.', $this->theme->getDescription()); } - public function testGetMediaQuery() { + public function testGetMediaQuery(): void { $this->assertEquals('(prefers-color-scheme: dark)', $this->theme->getMediaQuery()); } - public function testGetCustomCss() { + public function testGetCustomCss(): void { $this->assertEquals('', $this->theme->getCustomCss()); } } diff --git a/apps/theming/tests/Themes/DefaultThemeTest.php b/apps/theming/tests/Themes/DefaultThemeTest.php index d11237e774c..db6a5bf1cfc 100644 --- a/apps/theming/tests/Themes/DefaultThemeTest.php +++ b/apps/theming/tests/Themes/DefaultThemeTest.php @@ -109,31 +109,31 @@ class DefaultThemeTest extends AccessibleThemeTestCase { } - public function testGetId() { + public function testGetId(): void { $this->assertEquals('default', $this->theme->getId()); } - public function testGetType() { + public function testGetType(): void { $this->assertEquals(ITheme::TYPE_THEME, $this->theme->getType()); } - public function testGetTitle() { + public function testGetTitle(): void { $this->assertEquals('System default theme', $this->theme->getTitle()); } - public function testGetEnableLabel() { + public function testGetEnableLabel(): void { $this->assertEquals('Enable the system default', $this->theme->getEnableLabel()); } - public function testGetDescription() { + public function testGetDescription(): void { $this->assertEquals('Using the default system appearance.', $this->theme->getDescription()); } - public function testGetMediaQuery() { + public function testGetMediaQuery(): void { $this->assertEquals('', $this->theme->getMediaQuery()); } - public function testGetCustomCss() { + public function testGetCustomCss(): void { $this->assertEquals('', $this->theme->getCustomCss()); } @@ -141,7 +141,7 @@ class DefaultThemeTest extends AccessibleThemeTestCase { * Ensure parity between the default theme and the static generated file * @see ThemingController.php:313 */ - public function testThemindDisabledFallbackCss() { + public function testThemindDisabledFallbackCss(): void { // Generate variables $variables = ''; foreach ($this->theme->getCSSVariables() as $variable => $value) { diff --git a/apps/theming/tests/Themes/DyslexiaFontTest.php b/apps/theming/tests/Themes/DyslexiaFontTest.php index 99b6f8cfc8e..53505f4bd03 100644 --- a/apps/theming/tests/Themes/DyslexiaFontTest.php +++ b/apps/theming/tests/Themes/DyslexiaFontTest.php @@ -110,31 +110,31 @@ class DyslexiaFontTest extends TestCase { } - public function testGetId() { + public function testGetId(): void { $this->assertEquals('opendyslexic', $this->dyslexiaFont->getId()); } - public function testGetType() { + public function testGetType(): void { $this->assertEquals(ITheme::TYPE_FONT, $this->dyslexiaFont->getType()); } - public function testGetTitle() { + public function testGetTitle(): void { $this->assertNotEmpty($this->dyslexiaFont->getTitle()); } - public function testGetEnableLabel() { + public function testGetEnableLabel(): void { $this->assertNotEmpty($this->dyslexiaFont->getEnableLabel()); } - public function testGetDescription() { + public function testGetDescription(): void { $this->assertNotEmpty($this->dyslexiaFont->getDescription()); } - public function testGetMediaQuery() { + public function testGetMediaQuery(): void { $this->assertEquals('', $this->dyslexiaFont->getMediaQuery()); } - public function testGetCSSVariables() { + public function testGetCSSVariables(): void { $this->assertStringStartsWith('OpenDyslexic', $this->dyslexiaFont->getCSSVariables()['--font-face']); } @@ -156,7 +156,7 @@ class DyslexiaFontTest extends TestCase { * @param string $webRoot * @param bool $prettyUrlsEnabled */ - public function testGetCustomCss($webRoot, $prettyUrlsEnabled) { + public function testGetCustomCss($webRoot, $prettyUrlsEnabled): void { \OC::$WEBROOT = $webRoot; $this->config->expects($this->any()) ->method('getSystemValue') diff --git a/apps/theming/tests/Themes/HighContrastThemeTest.php b/apps/theming/tests/Themes/HighContrastThemeTest.php index 47c4b3bb374..603bf08a0ee 100644 --- a/apps/theming/tests/Themes/HighContrastThemeTest.php +++ b/apps/theming/tests/Themes/HighContrastThemeTest.php @@ -108,27 +108,27 @@ class HighContrastThemeTest extends AccessibleThemeTestCase { } - public function testGetId() { + public function testGetId(): void { $this->assertEquals('light-highcontrast', $this->theme->getId()); } - public function testGetType() { + public function testGetType(): void { $this->assertEquals(ITheme::TYPE_THEME, $this->theme->getType()); } - public function testGetTitle() { + public function testGetTitle(): void { $this->assertEquals('High contrast mode', $this->theme->getTitle()); } - public function testGetEnableLabel() { + public function testGetEnableLabel(): void { $this->assertEquals('Enable high contrast mode', $this->theme->getEnableLabel()); } - public function testGetDescription() { + public function testGetDescription(): void { $this->assertEquals('A high contrast mode to ease your navigation. Visual quality will be reduced but clarity will be increased.', $this->theme->getDescription()); } - public function testGetMediaQuery() { + public function testGetMediaQuery(): void { $this->assertEquals('(prefers-contrast: more)', $this->theme->getMediaQuery()); } } diff --git a/apps/theming/tests/ThemingDefaultsTest.php b/apps/theming/tests/ThemingDefaultsTest.php index 8edbcbc53c1..d8f169e7f3d 100644 --- a/apps/theming/tests/ThemingDefaultsTest.php +++ b/apps/theming/tests/ThemingDefaultsTest.php @@ -85,7 +85,7 @@ class ThemingDefaultsTest extends TestCase { ); } - public function testGetNameWithDefault() { + public function testGetNameWithDefault(): void { $this->config ->expects($this->once()) ->method('getAppValue') @@ -95,7 +95,7 @@ class ThemingDefaultsTest extends TestCase { $this->assertEquals('Nextcloud', $this->template->getName()); } - public function testGetNameWithCustom() { + public function testGetNameWithCustom(): void { $this->config ->expects($this->once()) ->method('getAppValue') @@ -105,7 +105,7 @@ class ThemingDefaultsTest extends TestCase { $this->assertEquals('MyCustomCloud', $this->template->getName()); } - public function testGetHTMLNameWithDefault() { + public function testGetHTMLNameWithDefault(): void { $this->config ->expects($this->once()) ->method('getAppValue') @@ -115,7 +115,7 @@ class ThemingDefaultsTest extends TestCase { $this->assertEquals('Nextcloud', $this->template->getHTMLName()); } - public function testGetHTMLNameWithCustom() { + public function testGetHTMLNameWithCustom(): void { $this->config ->expects($this->once()) ->method('getAppValue') @@ -125,7 +125,7 @@ class ThemingDefaultsTest extends TestCase { $this->assertEquals('MyCustomCloud', $this->template->getHTMLName()); } - public function testGetTitleWithDefault() { + public function testGetTitleWithDefault(): void { $this->config ->expects($this->once()) ->method('getAppValue') @@ -135,7 +135,7 @@ class ThemingDefaultsTest extends TestCase { $this->assertEquals('Nextcloud', $this->template->getTitle()); } - public function testGetTitleWithCustom() { + public function testGetTitleWithCustom(): void { $this->config ->expects($this->once()) ->method('getAppValue') @@ -146,7 +146,7 @@ class ThemingDefaultsTest extends TestCase { } - public function testGetEntityWithDefault() { + public function testGetEntityWithDefault(): void { $this->config ->expects($this->once()) ->method('getAppValue') @@ -156,7 +156,7 @@ class ThemingDefaultsTest extends TestCase { $this->assertEquals('Nextcloud', $this->template->getEntity()); } - public function testGetEntityWithCustom() { + public function testGetEntityWithCustom(): void { $this->config ->expects($this->once()) ->method('getAppValue') @@ -166,7 +166,7 @@ class ThemingDefaultsTest extends TestCase { $this->assertEquals('MyCustomCloud', $this->template->getEntity()); } - public function testGetBaseUrlWithDefault() { + public function testGetBaseUrlWithDefault(): void { $this->config ->expects($this->once()) ->method('getAppValue') @@ -176,7 +176,7 @@ class ThemingDefaultsTest extends TestCase { $this->assertEquals($this->defaults->getBaseUrl(), $this->template->getBaseUrl()); } - public function testGetBaseUrlWithCustom() { + public function testGetBaseUrlWithCustom(): void { $this->config ->expects($this->once()) ->method('getAppValue') @@ -197,7 +197,7 @@ class ThemingDefaultsTest extends TestCase { * @param $imprintUrl * @dataProvider legalUrlProvider */ - public function testGetImprintURL($imprintUrl) { + public function testGetImprintURL($imprintUrl): void { $this->config ->expects($this->once()) ->method('getAppValue') @@ -211,7 +211,7 @@ class ThemingDefaultsTest extends TestCase { * @param $privacyUrl * @dataProvider legalUrlProvider */ - public function testGetPrivacyURL($privacyUrl) { + public function testGetPrivacyURL($privacyUrl): void { $this->config ->expects($this->once()) ->method('getAppValue') @@ -221,7 +221,7 @@ class ThemingDefaultsTest extends TestCase { $this->assertEquals($privacyUrl, $this->template->getPrivacyUrl()); } - public function testGetSloganWithDefault() { + public function testGetSloganWithDefault(): void { $this->config ->expects($this->once()) ->method('getAppValue') @@ -231,7 +231,7 @@ class ThemingDefaultsTest extends TestCase { $this->assertEquals($this->defaults->getSlogan(), $this->template->getSlogan()); } - public function testGetSloganWithCustom() { + public function testGetSloganWithCustom(): void { $this->config ->expects($this->once()) ->method('getAppValue') @@ -241,7 +241,7 @@ class ThemingDefaultsTest extends TestCase { $this->assertEquals('My custom Slogan', $this->template->getSlogan()); } - public function testGetShortFooter() { + public function testGetShortFooter(): void { $this->config ->expects($this->exactly(5)) ->method('getAppValue') @@ -256,7 +256,7 @@ class ThemingDefaultsTest extends TestCase { $this->assertEquals('<a href="url" target="_blank" rel="noreferrer noopener" class="entity-name">Name</a> – Slogan', $this->template->getShortFooter()); } - public function testGetShortFooterEmptyUrl() { + public function testGetShortFooterEmptyUrl(): void { $this->navigationManager->expects($this->once())->method('getAll')->with(INavigationManager::TYPE_GUEST)->willReturn([]); $this->config ->expects($this->exactly(5)) @@ -272,7 +272,7 @@ class ThemingDefaultsTest extends TestCase { $this->assertEquals('<span class="entity-name">Name</span> – Slogan', $this->template->getShortFooter()); } - public function testGetShortFooterEmptySlogan() { + public function testGetShortFooterEmptySlogan(): void { $this->navigationManager->expects($this->once())->method('getAll')->with(INavigationManager::TYPE_GUEST)->willReturn([]); $this->config ->expects($this->exactly(5)) @@ -288,7 +288,7 @@ class ThemingDefaultsTest extends TestCase { $this->assertEquals('<a href="url" target="_blank" rel="noreferrer noopener" class="entity-name">Name</a>', $this->template->getShortFooter()); } - public function testGetShortFooterImprint() { + public function testGetShortFooterImprint(): void { $this->navigationManager->expects($this->once())->method('getAll')->with(INavigationManager::TYPE_GUEST)->willReturn([]); $this->config ->expects($this->exactly(5)) @@ -309,7 +309,7 @@ class ThemingDefaultsTest extends TestCase { $this->assertEquals('<a href="url" target="_blank" rel="noreferrer noopener" class="entity-name">Name</a> – Slogan<br/><span class="footer__legal-links"><a href="https://example.com/imprint" class="legal" target="_blank" rel="noreferrer noopener">Legal notice</a></span>', $this->template->getShortFooter()); } - public function testGetShortFooterPrivacy() { + public function testGetShortFooterPrivacy(): void { $this->navigationManager->expects($this->once())->method('getAll')->with(INavigationManager::TYPE_GUEST)->willReturn([]); $this->config ->expects($this->exactly(5)) @@ -330,7 +330,7 @@ class ThemingDefaultsTest extends TestCase { $this->assertEquals('<a href="url" target="_blank" rel="noreferrer noopener" class="entity-name">Name</a> – Slogan<br/><span class="footer__legal-links"><a href="https://example.com/privacy" class="legal" target="_blank" rel="noreferrer noopener">Privacy policy</a></span>', $this->template->getShortFooter()); } - public function testGetShortFooterAllLegalLinks() { + public function testGetShortFooterAllLegalLinks(): void { $this->navigationManager->expects($this->once())->method('getAll')->with(INavigationManager::TYPE_GUEST)->willReturn([]); $this->config ->expects($this->exactly(5)) @@ -362,7 +362,7 @@ class ThemingDefaultsTest extends TestCase { * @param $invalidImprintUrl * @dataProvider invalidLegalUrlProvider */ - public function testGetShortFooterInvalidImprint($invalidImprintUrl) { + public function testGetShortFooterInvalidImprint($invalidImprintUrl): void { $this->navigationManager->expects($this->once())->method('getAll')->with(INavigationManager::TYPE_GUEST)->willReturn([]); $this->config ->expects($this->exactly(5)) @@ -382,7 +382,7 @@ class ThemingDefaultsTest extends TestCase { * @param $invalidPrivacyUrl * @dataProvider invalidLegalUrlProvider */ - public function testGetShortFooterInvalidPrivacy($invalidPrivacyUrl) { + public function testGetShortFooterInvalidPrivacy($invalidPrivacyUrl): void { $this->navigationManager->expects($this->once())->method('getAll')->with(INavigationManager::TYPE_GUEST)->willReturn([]); $this->config ->expects($this->exactly(5)) @@ -398,7 +398,7 @@ class ThemingDefaultsTest extends TestCase { $this->assertEquals('<a href="url" target="_blank" rel="noreferrer noopener" class="entity-name">Name</a> – Slogan', $this->template->getShortFooter()); } - public function testGetColorPrimaryWithDefault() { + public function testGetColorPrimaryWithDefault(): void { $this->appConfig ->expects(self::once()) ->method('getValueBool') @@ -413,7 +413,7 @@ class ThemingDefaultsTest extends TestCase { $this->assertEquals($this->defaults->getColorPrimary(), $this->template->getColorPrimary()); } - public function testGetColorPrimaryWithCustom() { + public function testGetColorPrimaryWithCustom(): void { $this->appConfig ->expects(self::once()) ->method('getValueBool') @@ -472,7 +472,7 @@ class ThemingDefaultsTest extends TestCase { /** * @dataProvider dataGetColorPrimary */ - public function testGetColorPrimary(bool $disableTheming, string $primaryColor, string $userPrimaryColor, string $expected) { + public function testGetColorPrimary(bool $disableTheming, string $primaryColor, string $userPrimaryColor, string $expected): void { $user = $this->createMock(IUser::class); $this->userSession->expects($this->any()) ->method('getUser') @@ -499,7 +499,7 @@ class ThemingDefaultsTest extends TestCase { $this->assertEquals($expected, $this->template->getColorPrimary()); } - public function testSet() { + public function testSet(): void { $this->config ->expects($this->exactly(2)) ->method('setAppValue') @@ -527,7 +527,7 @@ class ThemingDefaultsTest extends TestCase { $this->template->set('MySetting', 'MyValue'); } - public function testUndoName() { + public function testUndoName(): void { $this->config ->expects($this->once()) ->method('deleteAppValue') @@ -550,7 +550,7 @@ class ThemingDefaultsTest extends TestCase { $this->assertSame('Nextcloud', $this->template->undo('name')); } - public function testUndoBaseUrl() { + public function testUndoBaseUrl(): void { $this->config ->expects($this->once()) ->method('deleteAppValue') @@ -573,7 +573,7 @@ class ThemingDefaultsTest extends TestCase { $this->assertSame($this->defaults->getBaseUrl(), $this->template->undo('url')); } - public function testUndoSlogan() { + public function testUndoSlogan(): void { $this->config ->expects($this->once()) ->method('deleteAppValue') @@ -596,7 +596,7 @@ class ThemingDefaultsTest extends TestCase { $this->assertSame($this->defaults->getSlogan(), $this->template->undo('slogan')); } - public function testUndoPrimaryColor() { + public function testUndoPrimaryColor(): void { $this->config ->expects($this->once()) ->method('deleteAppValue') @@ -614,7 +614,7 @@ class ThemingDefaultsTest extends TestCase { $this->assertSame($this->defaults->getColorPrimary(), $this->template->undo('primary_color')); } - public function testUndoDefaultAction() { + public function testUndoDefaultAction(): void { $this->config ->expects($this->once()) ->method('deleteAppValue') @@ -632,7 +632,7 @@ class ThemingDefaultsTest extends TestCase { $this->assertSame('', $this->template->undo('defaultitem')); } - public function testGetBackground() { + public function testGetBackground(): void { $this->imageManager ->expects($this->once()) ->method('getImageUrl') @@ -663,15 +663,15 @@ class ThemingDefaultsTest extends TestCase { $this->assertEquals('core-logo?v=0', $this->template->getLogo($useSvg)); } - public function testGetLogoDefaultWithSvg() { + public function testGetLogoDefaultWithSvg(): void { $this->getLogoHelper('logo/logo.svg', true); } - public function testGetLogoDefaultWithoutSvg() { + public function testGetLogoDefaultWithoutSvg(): void { $this->getLogoHelper('logo/logo.png', false); } - public function testGetLogoCustom() { + public function testGetLogoCustom(): void { $this->config ->expects($this->exactly(2)) ->method('getAppValue') @@ -689,7 +689,7 @@ class ThemingDefaultsTest extends TestCase { $this->assertEquals('custom-logo' . '?v=0', $this->template->getLogo()); } - public function testGetScssVariablesCached() { + public function testGetScssVariablesCached(): void { $this->config->expects($this->any())->method('getAppValue')->with('theming', 'cachebuster', '0')->willReturn('1'); $this->cacheFactory->expects($this->once()) ->method('createDistributed') @@ -699,7 +699,7 @@ class ThemingDefaultsTest extends TestCase { $this->assertEquals(['foo' => 'bar'], $this->template->getScssVariables()); } - public function testGetScssVariables() { + public function testGetScssVariables(): void { $this->config ->expects($this->any()) ->method('getAppValue') @@ -754,7 +754,7 @@ class ThemingDefaultsTest extends TestCase { $this->assertEquals($expected, $this->template->getScssVariables()); } - public function testGetDefaultAndroidURL() { + public function testGetDefaultAndroidURL(): void { $this->config ->expects($this->once()) ->method('getAppValue') @@ -764,7 +764,7 @@ class ThemingDefaultsTest extends TestCase { $this->assertEquals('https://play.google.com/store/apps/details?id=com.nextcloud.client', $this->template->getAndroidClientUrl()); } - public function testGetCustomAndroidURL() { + public function testGetCustomAndroidURL(): void { $this->config ->expects($this->once()) ->method('getAppValue') @@ -774,7 +774,7 @@ class ThemingDefaultsTest extends TestCase { $this->assertEquals('https://play.google.com/store/apps/details?id=com.mycloud.client', $this->template->getAndroidClientUrl()); } - public function testGetDefaultiOSURL() { + public function testGetDefaultiOSURL(): void { $this->config ->expects($this->once()) ->method('getAppValue') @@ -784,7 +784,7 @@ class ThemingDefaultsTest extends TestCase { $this->assertEquals('https://geo.itunes.apple.com/us/app/nextcloud/id1125420102?mt=8', $this->template->getiOSClientUrl()); } - public function testGetCustomiOSURL() { + public function testGetCustomiOSURL(): void { $this->config ->expects($this->once()) ->method('getAppValue') @@ -794,7 +794,7 @@ class ThemingDefaultsTest extends TestCase { $this->assertEquals('https://geo.itunes.apple.com/us/app/nextcloud/id1234567890?mt=8', $this->template->getiOSClientUrl()); } - public function testGetDefaultiTunesAppId() { + public function testGetDefaultiTunesAppId(): void { $this->config ->expects($this->once()) ->method('getAppValue') @@ -804,7 +804,7 @@ class ThemingDefaultsTest extends TestCase { $this->assertEquals('1125420102', $this->template->getiTunesAppId()); } - public function testGetCustomiTunesAppId() { + public function testGetCustomiTunesAppId(): void { $this->config ->expects($this->once()) ->method('getAppValue') @@ -824,7 +824,7 @@ class ThemingDefaultsTest extends TestCase { } /** @dataProvider dataReplaceImagePath */ - public function testReplaceImagePath($app, $image, $result = 'themingRoute?v=1234abcd') { + public function testReplaceImagePath($app, $image, $result = 'themingRoute?v=1234abcd'): void { $this->cache->expects($this->any()) ->method('get') ->with('shouldReplaceIcons') diff --git a/apps/theming/tests/UtilTest.php b/apps/theming/tests/UtilTest.php index 474daab6030..ba160684b7a 100644 --- a/apps/theming/tests/UtilTest.php +++ b/apps/theming/tests/UtilTest.php @@ -47,7 +47,7 @@ class UtilTest extends TestCase { /** * @dataProvider dataColorContrast */ - public function testColorContrast(string $color1, string $color2, $contrast) { + public function testColorContrast(string $color1, string $color2, $contrast): void { $this->assertEqualsWithDelta($contrast, $this->util->colorContrast($color1, $color2), .001); } @@ -62,78 +62,78 @@ class UtilTest extends TestCase { /** * @dataProvider dataInvertTextColor */ - public function testInvertTextColor($color, $expected) { + public function testInvertTextColor($color, $expected): void { $invert = $this->util->invertTextColor($color); $this->assertEquals($expected, $invert); } - public function testCalculateLuminanceLight() { + public function testCalculateLuminanceLight(): void { $luminance = $this->util->calculateLuminance('#ffffff'); $this->assertEquals(1, $luminance); } - public function testCalculateLuminanceDark() { + public function testCalculateLuminanceDark(): void { $luminance = $this->util->calculateLuminance('#000000'); $this->assertEquals(0, $luminance); } - public function testCalculateLuminanceLightShorthand() { + public function testCalculateLuminanceLightShorthand(): void { $luminance = $this->util->calculateLuminance('#fff'); $this->assertEquals(1, $luminance); } - public function testCalculateLuminanceDarkShorthand() { + public function testCalculateLuminanceDarkShorthand(): void { $luminance = $this->util->calculateLuminance('#000'); $this->assertEquals(0, $luminance); } - public function testInvertTextColorInvalid() { + public function testInvertTextColorInvalid(): void { $this->expectException(\Exception::class); $this->util->invertTextColor('aaabbbcccddd123'); } - public function testInvertTextColorEmpty() { + public function testInvertTextColorEmpty(): void { $this->expectException(\Exception::class); $this->util->invertTextColor(''); } - public function testElementColorDefaultBlack() { + public function testElementColorDefaultBlack(): void { $elementColor = $this->util->elementColor('#000000'); $this->assertEquals('#4d4d4d', $elementColor); } - public function testElementColorDefaultWhite() { + public function testElementColorDefaultWhite(): void { $elementColor = $this->util->elementColor('#ffffff'); $this->assertEquals('#b3b3b3', $elementColor); } - public function testElementColorBlackOnDarkBackground() { + public function testElementColorBlackOnDarkBackground(): void { $elementColor = $this->util->elementColor('#000000', false); $this->assertEquals('#4d4d4d', $elementColor); } - public function testElementColorBlackOnBrightBackground() { + public function testElementColorBlackOnBrightBackground(): void { $elementColor = $this->util->elementColor('#000000', true); $this->assertEquals('#000000', $elementColor); } - public function testElementColorWhiteOnBrightBackground() { + public function testElementColorWhiteOnBrightBackground(): void { $elementColor = $this->util->elementColor('#ffffff', true); $this->assertEquals('#b3b3b3', $elementColor); } - public function testElementColorWhiteOnDarkBackground() { + public function testElementColorWhiteOnDarkBackground(): void { $elementColor = $this->util->elementColor('#ffffff', false); $this->assertEquals('#ffffff', $elementColor); } - public function testGenerateRadioButtonWhite() { + public function testGenerateRadioButtonWhite(): void { $button = $this->util->generateRadioButton('#ffffff'); $expected = 'PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGhlaWdodD0iMTYiIHdpZHRoPSIxNiI+PHBhdGggZD0iTTggMWE3IDcgMCAwIDAtNyA3IDcgNyAwIDAgMCA3IDcgNyA3IDAgMCAwIDctNyA3IDcgMCAwIDAtNy03em0wIDFhNiA2IDAgMCAxIDYgNiA2IDYgMCAwIDEtNiA2IDYgNiAwIDAgMS02LTYgNiA2IDAgMCAxIDYtNnptMCAyYTQgNCAwIDEgMCAwIDggNCA0IDAgMCAwIDAtOHoiIGZpbGw9IiNmZmZmZmYiLz48L3N2Zz4='; $this->assertEquals($expected, $button); } - public function testGenerateRadioButtonBlack() { + public function testGenerateRadioButtonBlack(): void { $button = $this->util->generateRadioButton('#000000'); $expected = 'PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGhlaWdodD0iMTYiIHdpZHRoPSIxNiI+PHBhdGggZD0iTTggMWE3IDcgMCAwIDAtNyA3IDcgNyAwIDAgMCA3IDcgNyA3IDAgMCAwIDctNyA3IDcgMCAwIDAtNy03em0wIDFhNiA2IDAgMCAxIDYgNiA2IDYgMCAwIDEtNiA2IDYgNiAwIDAgMS02LTYgNiA2IDAgMCAxIDYtNnptMCAyYTQgNCAwIDEgMCAwIDggNCA0IDAgMCAwIDAtOHoiIGZpbGw9IiMwMDAwMDAiLz48L3N2Zz4='; $this->assertEquals($expected, $button); @@ -142,7 +142,7 @@ class UtilTest extends TestCase { /** * @dataProvider dataGetAppIcon */ - public function testGetAppIcon($app, $expected) { + public function testGetAppIcon($app, $expected): void { $this->appData->expects($this->any()) ->method('getFolder') ->with('global/images') @@ -159,7 +159,7 @@ class UtilTest extends TestCase { ]; } - public function testGetAppIconThemed() { + public function testGetAppIconThemed(): void { $file = $this->createMock(ISimpleFile::class); $folder = $this->createMock(ISimpleFolder::class); $folder->expects($this->once()) @@ -177,7 +177,7 @@ class UtilTest extends TestCase { /** * @dataProvider dataGetAppImage */ - public function testGetAppImage($app, $image, $expected) { + public function testGetAppImage($app, $image, $expected): void { $this->assertEquals($expected, $this->util->getAppImage($app, $image)); } @@ -190,14 +190,14 @@ class UtilTest extends TestCase { ]; } - public function testColorizeSvg() { + public function testColorizeSvg(): void { $input = '#0082c9 #0082C9 #000000 #FFFFFF'; $expected = '#AAAAAA #AAAAAA #000000 #FFFFFF'; $result = $this->util->colorizeSvg($input, '#AAAAAA'); $this->assertEquals($expected, $result); } - public function testIsAlreadyThemedFalse() { + public function testIsAlreadyThemedFalse(): void { $this->config->expects($this->once()) ->method('getSystemValue') ->with('theme', '') @@ -206,7 +206,7 @@ class UtilTest extends TestCase { $this->assertFalse($actual); } - public function testIsAlreadyThemedTrue() { + public function testIsAlreadyThemedTrue(): void { $this->config->expects($this->once()) ->method('getSystemValue') ->with('theme', '') @@ -225,7 +225,7 @@ class UtilTest extends TestCase { /** * @dataProvider dataIsBackgroundThemed */ - public function testIsBackgroundThemed($backgroundMime, $expected) { + public function testIsBackgroundThemed($backgroundMime, $expected): void { $this->config->expects($this->once()) ->method('getAppValue') ->with('theming', 'backgroundMime', '') diff --git a/apps/twofactor_backupcodes/tests/Db/BackupCodeMapperTest.php b/apps/twofactor_backupcodes/tests/Db/BackupCodeMapperTest.php index ce373aea1d9..5cde4c5a718 100644 --- a/apps/twofactor_backupcodes/tests/Db/BackupCodeMapperTest.php +++ b/apps/twofactor_backupcodes/tests/Db/BackupCodeMapperTest.php @@ -50,7 +50,7 @@ class BackupCodeMapperTest extends TestCase { $this->resetDB(); } - public function testGetBackupCodes() { + public function testGetBackupCodes(): void { $code1 = new BackupCode(); $code1->setUserId($this->testUID); $code1->setCode('1|$2y$10$Fyo.DkMtkaHapVvRVbQBeeIdi5x/6nmPnxiBzD0GDKa08NMus5xze'); @@ -76,7 +76,7 @@ class BackupCodeMapperTest extends TestCase { $this->assertInstanceOf(BackupCode::class, $dbCodes[1]); } - public function testDeleteCodes() { + public function testDeleteCodes(): void { $code = new BackupCode(); $code->setUserId($this->testUID); $code->setCode('1|$2y$10$CagG8pEhZL.xDirtCCP/KuuWtnsAasgq60zY9rU46dBK4w8yW0Z/y'); @@ -95,7 +95,7 @@ class BackupCodeMapperTest extends TestCase { $this->assertCount(0, $this->mapper->getBackupCodes($user)); } - public function testInsertArgonEncryptedCodes() { + public function testInsertArgonEncryptedCodes(): void { $code = new BackupCode(); $code->setUserId($this->testUID); $code->setCode('2|$argon2i$v=19$m=1024,t=2,p=2$MjJWUjRFWndtMm5BWGxOag$BusVxLeFyiLLWtaVvX/JRFBiPdZcjRrzpQ/rAhn6vqY'); diff --git a/apps/twofactor_backupcodes/tests/Service/BackupCodeStorageTest.php b/apps/twofactor_backupcodes/tests/Service/BackupCodeStorageTest.php index bd300b21b94..f184cb1c75c 100644 --- a/apps/twofactor_backupcodes/tests/Service/BackupCodeStorageTest.php +++ b/apps/twofactor_backupcodes/tests/Service/BackupCodeStorageTest.php @@ -38,7 +38,7 @@ class BackupCodeStorageTest extends TestCase { $this->overwriteService(IManager::class, $this->notificationManager); } - public function testSimpleWorkFlow() { + public function testSimpleWorkFlow(): void { $user = $this->getMockBuilder(\OCP\IUser::class)->getMock(); $user->expects($this->any()) ->method('getUID') diff --git a/apps/twofactor_backupcodes/tests/Unit/Activity/ProviderTest.php b/apps/twofactor_backupcodes/tests/Unit/Activity/ProviderTest.php index d73acad7979..fb2c419f521 100644 --- a/apps/twofactor_backupcodes/tests/Unit/Activity/ProviderTest.php +++ b/apps/twofactor_backupcodes/tests/Unit/Activity/ProviderTest.php @@ -41,7 +41,7 @@ class ProviderTest extends TestCase { $this->provider = new Provider($this->l10n, $this->urlGenerator, $this->activityManager); } - public function testParseUnrelated() { + public function testParseUnrelated(): void { $lang = 'ru'; $event = $this->createMock(IEvent::class); $event->expects($this->once()) @@ -61,7 +61,7 @@ class ProviderTest extends TestCase { /** * @dataProvider subjectData */ - public function testParse($subject) { + public function testParse($subject): void { $lang = 'ru'; $event = $this->createMock(IEvent::class); $l = $this->createMock(IL10N::class); @@ -93,7 +93,7 @@ class ProviderTest extends TestCase { $this->provider->parse($lang, $event); } - public function testParseInvalidSubject() { + public function testParseInvalidSubject(): void { $lang = 'ru'; $l = $this->createMock(IL10N::class); $event = $this->createMock(IEvent::class); diff --git a/apps/twofactor_backupcodes/tests/Unit/BackgroundJob/CheckBackupCodeTest.php b/apps/twofactor_backupcodes/tests/Unit/BackgroundJob/CheckBackupCodeTest.php index 5f95994e6fa..7b6fe6cb2d8 100644 --- a/apps/twofactor_backupcodes/tests/Unit/BackgroundJob/CheckBackupCodeTest.php +++ b/apps/twofactor_backupcodes/tests/Unit/BackgroundJob/CheckBackupCodeTest.php @@ -63,7 +63,7 @@ class CheckBackupCodeTest extends TestCase { ); } - public function testRunAlreadyGenerated() { + public function testRunAlreadyGenerated(): void { $this->user->method('isEnabled') ->willReturn(true); @@ -79,7 +79,7 @@ class CheckBackupCodeTest extends TestCase { $this->invokePrivate($this->checkBackupCodes, 'run', [[]]); } - public function testRun() { + public function testRun(): void { $this->user->method('getUID') ->willReturn('myUID'); $this->user->method('isEnabled') @@ -104,7 +104,7 @@ class CheckBackupCodeTest extends TestCase { $this->invokePrivate($this->checkBackupCodes, 'run', [[]]); } - public function testRunDisabledUser() { + public function testRunDisabledUser(): void { $this->user->method('getUID') ->willReturn('myUID'); $this->user->method('isEnabled') @@ -120,7 +120,7 @@ class CheckBackupCodeTest extends TestCase { $this->invokePrivate($this->checkBackupCodes, 'run', [[]]); } - public function testRunNoProviders() { + public function testRunNoProviders(): void { $this->user->method('isEnabled') ->willReturn(true); diff --git a/apps/twofactor_backupcodes/tests/Unit/BackgroundJob/RememberBackupCodesJobTest.php b/apps/twofactor_backupcodes/tests/Unit/BackgroundJob/RememberBackupCodesJobTest.php index 8b2714227cd..31b7d514246 100644 --- a/apps/twofactor_backupcodes/tests/Unit/BackgroundJob/RememberBackupCodesJobTest.php +++ b/apps/twofactor_backupcodes/tests/Unit/BackgroundJob/RememberBackupCodesJobTest.php @@ -59,7 +59,7 @@ class RememberBackupCodesJobTest extends TestCase { ); } - public function testInvalidUID() { + public function testInvalidUID(): void { $this->userManager->method('get') ->with('invalidUID') ->willReturn(null); @@ -78,7 +78,7 @@ class RememberBackupCodesJobTest extends TestCase { self::invokePrivate($this->job, 'run', [['uid' => 'invalidUID']]); } - public function testBackupCodesGenerated() { + public function testBackupCodesGenerated(): void { $user = $this->createMock(IUser::class); $user->method('getUID') ->willReturn('validUID'); @@ -108,7 +108,7 @@ class RememberBackupCodesJobTest extends TestCase { self::invokePrivate($this->job, 'run', [['uid' => 'validUID']]); } - public function testNoActiveProvider() { + public function testNoActiveProvider(): void { $user = $this->createMock(IUser::class); $user->method('getUID') ->willReturn('validUID'); @@ -136,7 +136,7 @@ class RememberBackupCodesJobTest extends TestCase { self::invokePrivate($this->job, 'run', [['uid' => 'validUID']]); } - public function testNotificationSend() { + public function testNotificationSend(): void { $user = $this->createMock(IUser::class); $user->method('getUID') ->willReturn('validUID'); @@ -176,7 +176,7 @@ class RememberBackupCodesJobTest extends TestCase { self::invokePrivate($this->job, 'run', [['uid' => 'validUID']]); } - public function testNotificationNotSendForDisabledUser() { + public function testNotificationNotSendForDisabledUser(): void { $user = $this->createMock(IUser::class); $user->method('getUID') ->willReturn('validUID'); diff --git a/apps/twofactor_backupcodes/tests/Unit/Controller/SettingsControllerTest.php b/apps/twofactor_backupcodes/tests/Unit/Controller/SettingsControllerTest.php index da4d58cf0bc..85b23e88fee 100644 --- a/apps/twofactor_backupcodes/tests/Unit/Controller/SettingsControllerTest.php +++ b/apps/twofactor_backupcodes/tests/Unit/Controller/SettingsControllerTest.php @@ -42,7 +42,7 @@ class SettingsControllerTest extends TestCase { $this->controller = new SettingsController('twofactor_backupcodes', $this->request, $this->storage, $this->userSession); } - public function testCreateCodes() { + public function testCreateCodes(): void { $user = $this->getMockBuilder(IUser::class)->getMock(); $codes = ['a', 'b']; diff --git a/apps/twofactor_backupcodes/tests/Unit/Event/CodesGeneratedTest.php b/apps/twofactor_backupcodes/tests/Unit/Event/CodesGeneratedTest.php index fd7841b0e98..3f619e387e9 100644 --- a/apps/twofactor_backupcodes/tests/Unit/Event/CodesGeneratedTest.php +++ b/apps/twofactor_backupcodes/tests/Unit/Event/CodesGeneratedTest.php @@ -13,7 +13,7 @@ use OCP\IUser; use Test\TestCase; class CodesGeneratedTest extends TestCase { - public function testCodeGeneratedEvent() { + public function testCodeGeneratedEvent(): void { $user = $this->createMock(IUser::class); $event = new CodesGenerated($user); diff --git a/apps/twofactor_backupcodes/tests/Unit/Listener/ActivityPublisherTest.php b/apps/twofactor_backupcodes/tests/Unit/Listener/ActivityPublisherTest.php index bfb5065fdfa..72ca91ed8eb 100644 --- a/apps/twofactor_backupcodes/tests/Unit/Listener/ActivityPublisherTest.php +++ b/apps/twofactor_backupcodes/tests/Unit/Listener/ActivityPublisherTest.php @@ -37,7 +37,7 @@ class ActivityPublisherTest extends TestCase { $this->listener = new ActivityPublisher($this->activityManager, $this->logger); } - public function testHandleGenericEvent() { + public function testHandleGenericEvent(): void { $event = $this->createMock(Event::class); $this->activityManager->expects($this->never()) ->method('publish'); @@ -45,7 +45,7 @@ class ActivityPublisherTest extends TestCase { $this->listener->handle($event); } - public function testHandleCodesGeneratedEvent() { + public function testHandleCodesGeneratedEvent(): void { $user = $this->createMock(IUser::class); $user->method('getUID')->willReturn('fritz'); $event = new CodesGenerated($user); diff --git a/apps/twofactor_backupcodes/tests/Unit/Listener/ClearNotificationsTest.php b/apps/twofactor_backupcodes/tests/Unit/Listener/ClearNotificationsTest.php index 14807ffdd5e..b4afa9c2a72 100644 --- a/apps/twofactor_backupcodes/tests/Unit/Listener/ClearNotificationsTest.php +++ b/apps/twofactor_backupcodes/tests/Unit/Listener/ClearNotificationsTest.php @@ -34,7 +34,7 @@ class ClearNotificationsTest extends TestCase { $this->listener = new ClearNotifications($this->notificationManager); } - public function testHandleGenericEvent() { + public function testHandleGenericEvent(): void { $event = $this->createMock(Event::class); $this->notificationManager->expects($this->never()) ->method($this->anything()); @@ -42,7 +42,7 @@ class ClearNotificationsTest extends TestCase { $this->listener->handle($event); } - public function testHandleCodesGeneratedEvent() { + public function testHandleCodesGeneratedEvent(): void { $user = $this->createMock(IUser::class); $user->method('getUID')->willReturn('fritz'); $event = new CodesGenerated($user); diff --git a/apps/twofactor_backupcodes/tests/Unit/Listener/ProviderDisabledTest.php b/apps/twofactor_backupcodes/tests/Unit/Listener/ProviderDisabledTest.php index f9e9f46b1d6..7f7b5dc3011 100644 --- a/apps/twofactor_backupcodes/tests/Unit/Listener/ProviderDisabledTest.php +++ b/apps/twofactor_backupcodes/tests/Unit/Listener/ProviderDisabledTest.php @@ -31,7 +31,7 @@ class ProviderDisabledTest extends TestCase { $this->listener = new ProviderDisabled($this->registy, $this->jobList); } - public function testHandleGenericEvent() { + public function testHandleGenericEvent(): void { $event = $this->createMock(Event::class); $this->jobList->expects($this->never()) ->method($this->anything()); @@ -39,7 +39,7 @@ class ProviderDisabledTest extends TestCase { $this->listener->handle($event); } - public function testHandleStillActiveProvider() { + public function testHandleStillActiveProvider(): void { $user = $this->createMock(IUser::class); $user->method('getUID') ->willReturn('myUID'); @@ -60,7 +60,7 @@ class ProviderDisabledTest extends TestCase { $this->listener->handle($event); } - public function testHandleNoActiveProvider() { + public function testHandleNoActiveProvider(): void { $user = $this->createMock(IUser::class); $user->method('getUID') ->willReturn('myUID'); diff --git a/apps/twofactor_backupcodes/tests/Unit/Listener/ProviderEnabledTest.php b/apps/twofactor_backupcodes/tests/Unit/Listener/ProviderEnabledTest.php index 60e8b13656c..145944fccca 100644 --- a/apps/twofactor_backupcodes/tests/Unit/Listener/ProviderEnabledTest.php +++ b/apps/twofactor_backupcodes/tests/Unit/Listener/ProviderEnabledTest.php @@ -31,7 +31,7 @@ class ProviderEnabledTest extends TestCase { $this->listener = new ProviderEnabled($this->registy, $this->jobList); } - public function testHandleGenericEvent() { + public function testHandleGenericEvent(): void { $event = $this->createMock(Event::class); $this->jobList->expects($this->never()) ->method($this->anything()); @@ -39,7 +39,7 @@ class ProviderEnabledTest extends TestCase { $this->listener->handle($event); } - public function testHandleCodesGeneratedEventAlraedyBackupcodes() { + public function testHandleCodesGeneratedEventAlraedyBackupcodes(): void { $user = $this->createMock(IUser::class); $user->method('getUID') ->willReturn('myUID'); @@ -59,7 +59,7 @@ class ProviderEnabledTest extends TestCase { $this->listener->handle($event); } - public function testHandleCodesGeneratedEventNoBackupcodes() { + public function testHandleCodesGeneratedEventNoBackupcodes(): void { $user = $this->createMock(IUser::class); $user->method('getUID') ->willReturn('myUID'); diff --git a/apps/twofactor_backupcodes/tests/Unit/Listener/RegistryUpdaterTest.php b/apps/twofactor_backupcodes/tests/Unit/Listener/RegistryUpdaterTest.php index d23c477cb7b..4f724f888d7 100644 --- a/apps/twofactor_backupcodes/tests/Unit/Listener/RegistryUpdaterTest.php +++ b/apps/twofactor_backupcodes/tests/Unit/Listener/RegistryUpdaterTest.php @@ -36,7 +36,7 @@ class RegistryUpdaterTest extends TestCase { $this->listener = new RegistryUpdater($this->registry, $this->provider); } - public function testHandleGenericEvent() { + public function testHandleGenericEvent(): void { $event = $this->createMock(Event::class); $this->registry->expects($this->never()) ->method('enableProviderFor'); @@ -44,7 +44,7 @@ class RegistryUpdaterTest extends TestCase { $this->listener->handle($event); } - public function testHandleCodesGeneratedEvent() { + public function testHandleCodesGeneratedEvent(): void { $user = $this->createMock(IUser::class); $event = new CodesGenerated($user); $this->registry->expects($this->once()) diff --git a/apps/twofactor_backupcodes/tests/Unit/Migration/CheckBackupCodeTest.php b/apps/twofactor_backupcodes/tests/Unit/Migration/CheckBackupCodeTest.php index 25972f8aaca..bb959ff08b3 100644 --- a/apps/twofactor_backupcodes/tests/Unit/Migration/CheckBackupCodeTest.php +++ b/apps/twofactor_backupcodes/tests/Unit/Migration/CheckBackupCodeTest.php @@ -28,11 +28,11 @@ class CheckBackupCodeTest extends TestCase { $this->checkBackupsCodes = new CheckBackupCodes($this->jobList); } - public function testGetName() { + public function testGetName(): void { $this->assertSame('Add background job to check for backup codes', $this->checkBackupsCodes->getName()); } - public function testRun() { + public function testRun(): void { $this->jobList->expects($this->once()) ->method('add') ->with( diff --git a/apps/twofactor_backupcodes/tests/Unit/Notification/NotifierTest.php b/apps/twofactor_backupcodes/tests/Unit/Notification/NotifierTest.php index 87aca38ba73..dc42c8c0bdc 100644 --- a/apps/twofactor_backupcodes/tests/Unit/Notification/NotifierTest.php +++ b/apps/twofactor_backupcodes/tests/Unit/Notification/NotifierTest.php @@ -49,7 +49,7 @@ class NotifierTest extends TestCase { } - public function testPrepareWrongApp() { + public function testPrepareWrongApp(): void { $this->expectException(\InvalidArgumentException::class); /** @var INotification|\PHPUnit\Framework\MockObject\MockObject $notification */ @@ -64,7 +64,7 @@ class NotifierTest extends TestCase { } - public function testPrepareWrongSubject() { + public function testPrepareWrongSubject(): void { $this->expectException(\InvalidArgumentException::class); /** @var INotification|\PHPUnit\Framework\MockObject\MockObject $notification */ @@ -79,7 +79,7 @@ class NotifierTest extends TestCase { $this->notifier->prepare($notification, 'en'); } - public function testPrepare() { + public function testPrepare(): void { /** @var \OCP\Notification\INotification|\PHPUnit\Framework\MockObject\MockObject $notification */ $notification = $this->createMock(INotification::class); diff --git a/apps/twofactor_backupcodes/tests/Unit/Provider/BackupCodesProviderTest.php b/apps/twofactor_backupcodes/tests/Unit/Provider/BackupCodesProviderTest.php index ffeb5fd1e15..24e986710c4 100644 --- a/apps/twofactor_backupcodes/tests/Unit/Provider/BackupCodesProviderTest.php +++ b/apps/twofactor_backupcodes/tests/Unit/Provider/BackupCodesProviderTest.php @@ -49,11 +49,11 @@ class BackupCodesProviderTest extends TestCase { $this->provider = new BackupCodesProvider($this->appName, $this->storage, $this->l10n, $this->appManager, $this->initialState); } - public function testGetId() { + public function testGetId(): void { $this->assertEquals('backup_codes', $this->provider->getId()); } - public function testGetDisplayName() { + public function testGetDisplayName(): void { $this->l10n->expects($this->once()) ->method('t') ->with('Backup code') @@ -61,7 +61,7 @@ class BackupCodesProviderTest extends TestCase { $this->assertSame('l10n backup code', $this->provider->getDisplayName()); } - public function testGetDescription() { + public function testGetDescription(): void { $this->l10n->expects($this->once()) ->method('t') ->with('Use backup code') @@ -69,14 +69,14 @@ class BackupCodesProviderTest extends TestCase { $this->assertSame('l10n use backup code', $this->provider->getDescription()); } - public function testGetTempalte() { + public function testGetTempalte(): void { $user = $this->getMockBuilder(IUser::class)->getMock(); $expected = new Template('twofactor_backupcodes', 'challenge'); $this->assertEquals($expected, $this->provider->getTemplate($user)); } - public function testVerfiyChallenge() { + public function testVerfiyChallenge(): void { $user = $this->getMockBuilder(IUser::class)->getMock(); $challenge = 'xyz'; @@ -88,7 +88,7 @@ class BackupCodesProviderTest extends TestCase { $this->assertFalse($this->provider->verifyChallenge($user, $challenge)); } - public function testIsTwoFactorEnabledForUser() { + public function testIsTwoFactorEnabledForUser(): void { $user = $this->getMockBuilder(IUser::class)->getMock(); $this->storage->expects($this->once()) @@ -99,7 +99,7 @@ class BackupCodesProviderTest extends TestCase { $this->assertTrue($this->provider->isTwoFactorAuthEnabledForUser($user)); } - public function testIsActiveNoProviders() { + public function testIsActiveNoProviders(): void { $user = $this->getMockBuilder(IUser::class)->getMock(); $this->appManager->expects($this->once()) @@ -119,7 +119,7 @@ class BackupCodesProviderTest extends TestCase { $this->assertFalse($this->provider->isActive($user)); } - public function testIsActiveWithProviders() { + public function testIsActiveWithProviders(): void { $user = $this->getMockBuilder(IUser::class)->getMock(); $this->appManager->expects($this->once()) diff --git a/apps/twofactor_backupcodes/tests/Unit/Service/BackupCodeStorageTest.php b/apps/twofactor_backupcodes/tests/Unit/Service/BackupCodeStorageTest.php index 7725102db88..67124a7a928 100644 --- a/apps/twofactor_backupcodes/tests/Unit/Service/BackupCodeStorageTest.php +++ b/apps/twofactor_backupcodes/tests/Unit/Service/BackupCodeStorageTest.php @@ -46,7 +46,7 @@ class BackupCodeStorageTest extends TestCase { $this->storage = new BackupCodeStorage($this->mapper, $this->random, $this->hasher, $this->eventDispatcher); } - public function testCreateCodes() { + public function testCreateCodes(): void { $user = $this->createMock(IUser::class); $number = 5; $user->method('getUID')->willReturn('fritz'); @@ -78,7 +78,7 @@ class BackupCodeStorageTest extends TestCase { } } - public function testHasBackupCodes() { + public function testHasBackupCodes(): void { $user = $this->createMock(IUser::class); $codes = [ new BackupCode(), @@ -93,7 +93,7 @@ class BackupCodeStorageTest extends TestCase { $this->assertTrue($this->storage->hasBackupCodes($user)); } - public function testHasBackupCodesNoCodes() { + public function testHasBackupCodesNoCodes(): void { $user = $this->createMock(IUser::class); $codes = []; @@ -105,7 +105,7 @@ class BackupCodeStorageTest extends TestCase { $this->assertFalse($this->storage->hasBackupCodes($user)); } - public function testGetBackupCodeState() { + public function testGetBackupCodeState(): void { $user = $this->createMock(IUser::class); $code1 = new BackupCode(); @@ -130,7 +130,7 @@ class BackupCodeStorageTest extends TestCase { $this->assertEquals($expected, $this->storage->getBackupCodesState($user)); } - public function testGetBackupCodeDisabled() { + public function testGetBackupCodeDisabled(): void { $user = $this->createMock(IUser::class); $codes = []; @@ -148,7 +148,7 @@ class BackupCodeStorageTest extends TestCase { $this->assertEquals($expected, $this->storage->getBackupCodesState($user)); } - public function testValidateCode() { + public function testValidateCode(): void { $user = $this->createMock(IUser::class); $code = new BackupCode(); $code->setUsed(0); @@ -174,7 +174,7 @@ class BackupCodeStorageTest extends TestCase { $this->assertEquals(1, $code->getUsed()); } - public function testValidateUsedCode() { + public function testValidateUsedCode(): void { $user = $this->createMock(IUser::class); $code = new BackupCode(); $code->setUsed('1'); @@ -195,7 +195,7 @@ class BackupCodeStorageTest extends TestCase { $this->assertFalse($this->storage->validateCode($user, 'CHALLENGE')); } - public function testValidateCodeWithWrongHash() { + public function testValidateCodeWithWrongHash(): void { $user = $this->createMock(IUser::class); $code = new BackupCode(); $code->setUsed(0); diff --git a/apps/updatenotification/tests/BackgroundJob/ResetTokenTest.php b/apps/updatenotification/tests/BackgroundJob/ResetTokenTest.php index b93efd3a275..1b0fe0cbc59 100644 --- a/apps/updatenotification/tests/BackgroundJob/ResetTokenTest.php +++ b/apps/updatenotification/tests/BackgroundJob/ResetTokenTest.php @@ -33,7 +33,7 @@ class ResetTokenTest extends TestCase { ); } - public function testRunWithNotExpiredToken() { + public function testRunWithNotExpiredToken(): void { $this->timeFactory ->expects($this->atLeastOnce()) ->method('getTime') @@ -54,7 +54,7 @@ class ResetTokenTest extends TestCase { static::invokePrivate($this->resetTokenBackgroundJob, 'run', [null]); } - public function testRunWithExpiredToken() { + public function testRunWithExpiredToken(): void { $this->timeFactory ->expects($this->once()) ->method('getTime') @@ -72,7 +72,7 @@ class ResetTokenTest extends TestCase { static::invokePrivate($this->resetTokenBackgroundJob, 'run', [null]); } - public function testRunWithExpiredTokenAndReadOnlyConfigFile() { + public function testRunWithExpiredTokenAndReadOnlyConfigFile(): void { $this->timeFactory ->expects($this->never()) ->method('getTime'); diff --git a/apps/updatenotification/tests/BackgroundJob/UpdateAvailableNotificationsTest.php b/apps/updatenotification/tests/BackgroundJob/UpdateAvailableNotificationsTest.php index ca058cedff7..ca488fd3014 100644 --- a/apps/updatenotification/tests/BackgroundJob/UpdateAvailableNotificationsTest.php +++ b/apps/updatenotification/tests/BackgroundJob/UpdateAvailableNotificationsTest.php @@ -80,7 +80,7 @@ class UpdateAvailableNotificationsTest extends TestCase { } } - public function testRun() { + public function testRun(): void { $job = $this->getJob([ 'checkCoreUpdate', 'checkAppUpdates', @@ -105,7 +105,7 @@ class UpdateAvailableNotificationsTest extends TestCase { self::invokePrivate($job, 'run', [null]); } - public function testRunNoInternet() { + public function testRunNoInternet(): void { $job = $this->getJob([ 'checkCoreUpdate', 'checkAppUpdates', @@ -160,7 +160,7 @@ class UpdateAvailableNotificationsTest extends TestCase { * @param null|string $readableVersion * @param null|int $errorDays */ - public function testCheckCoreUpdate(string $channel, $versionCheck, $version, $readableVersion, $errorDays) { + public function testCheckCoreUpdate(string $channel, $versionCheck, $version, $readableVersion, $errorDays): void { $job = $this->getJob([ 'getChannel', 'createNotifications', @@ -237,7 +237,7 @@ class UpdateAvailableNotificationsTest extends TestCase { * @param array $isUpdateAvailable * @param array $notifications */ - public function testCheckAppUpdates(array $apps, array $isUpdateAvailable, array $notifications) { + public function testCheckAppUpdates(array $apps, array $isUpdateAvailable, array $notifications): void { $job = $this->getJob([ 'isUpdateAvailable', 'createNotifications', @@ -277,7 +277,7 @@ class UpdateAvailableNotificationsTest extends TestCase { * @param string[]|null $users * @param array|null $userNotifications */ - public function testCreateNotifications(string $app, string $version, $lastNotification, $callDelete, $createNotification, $users, $userNotifications) { + public function testCreateNotifications(string $app, string $version, $lastNotification, $callDelete, $createNotification, $users, $userNotifications): void { $job = $this->getJob([ 'deleteOutdatedNotifications', 'getUsersToNotify', @@ -364,7 +364,7 @@ class UpdateAvailableNotificationsTest extends TestCase { * @param array $groupUsers * @param string[] $expected */ - public function testGetUsersToNotify(array $groups, array $groupUsers, array $expected) { + public function testGetUsersToNotify(array $groups, array $groupUsers, array $expected): void { $job = $this->getJob(); $this->appConfig->expects($this->once()) @@ -408,7 +408,7 @@ class UpdateAvailableNotificationsTest extends TestCase { * @param string $app * @param string $version */ - public function testDeleteOutdatedNotifications(string $app, string $version) { + public function testDeleteOutdatedNotifications(string $app, string $version): void { $notification = $this->createMock(INotification::class); $notification->expects($this->once()) ->method('setApp') diff --git a/apps/updatenotification/tests/Controller/AdminControllerTest.php b/apps/updatenotification/tests/Controller/AdminControllerTest.php index 74fcb4f8773..877a0276373 100644 --- a/apps/updatenotification/tests/Controller/AdminControllerTest.php +++ b/apps/updatenotification/tests/Controller/AdminControllerTest.php @@ -55,7 +55,7 @@ class AdminControllerTest extends TestCase { ); } - public function testCreateCredentials() { + public function testCreateCredentials(): void { $this->jobList ->expects($this->once()) ->method('add') diff --git a/apps/updatenotification/tests/Notification/NotifierTest.php b/apps/updatenotification/tests/Notification/NotifierTest.php index 7455966975a..1e53b8d4aea 100644 --- a/apps/updatenotification/tests/Notification/NotifierTest.php +++ b/apps/updatenotification/tests/Notification/NotifierTest.php @@ -90,7 +90,7 @@ class NotifierTest extends TestCase { * @param string $versionInstalled * @param bool $exception */ - public function testUpdateAlreadyInstalledCheck(string $versionNotification, string $versionInstalled, bool $exception) { + public function testUpdateAlreadyInstalledCheck(string $versionNotification, string $versionInstalled, bool $exception): void { $notifier = $this->getNotifier(); $notification = $this->createMock(INotification::class); diff --git a/apps/updatenotification/tests/Settings/AdminTest.php b/apps/updatenotification/tests/Settings/AdminTest.php index 80ad2ec7587..b39cb8fe127 100644 --- a/apps/updatenotification/tests/Settings/AdminTest.php +++ b/apps/updatenotification/tests/Settings/AdminTest.php @@ -80,7 +80,7 @@ class AdminTest extends TestCase { ); } - public function testGetFormWithUpdate() { + public function testGetFormWithUpdate(): void { $backend1 = $this->createMock(CountUsersBackend::class); $backend2 = $this->createMock(CountUsersBackend::class); $backend3 = $this->createMock(CountUsersBackend::class); @@ -206,7 +206,7 @@ class AdminTest extends TestCase { $this->assertEquals($expected, $this->admin->getForm()); } - public function testGetFormWithUpdateAndChangedUpdateServer() { + public function testGetFormWithUpdateAndChangedUpdateServer(): void { $backend1 = $this->createMock(CountUsersBackend::class); $backend2 = $this->createMock(CountUsersBackend::class); $backend3 = $this->createMock(CountUsersBackend::class); @@ -333,7 +333,7 @@ class AdminTest extends TestCase { $this->assertEquals($expected, $this->admin->getForm()); } - public function testGetFormWithUpdateAndCustomersUpdateServer() { + public function testGetFormWithUpdateAndCustomersUpdateServer(): void { $backend1 = $this->createMock(CountUsersBackend::class); $backend2 = $this->createMock(CountUsersBackend::class); $backend3 = $this->createMock(CountUsersBackend::class); @@ -461,11 +461,11 @@ class AdminTest extends TestCase { } - public function testGetSection() { + public function testGetSection(): void { $this->assertSame('overview', $this->admin->getSection()); } - public function testGetPriority() { + public function testGetPriority(): void { $this->assertSame(11, $this->admin->getPriority()); } @@ -527,7 +527,7 @@ class AdminTest extends TestCase { /** * @dataProvider changesProvider */ - public function testFilterChanges($changes, $userLang, $expectation) { + public function testFilterChanges($changes, $userLang, $expectation): void { $iterator = $this->createMock(ILanguageIterator::class); $iterator->expects($this->any()) ->method('current') diff --git a/apps/updatenotification/tests/UpdateCheckerTest.php b/apps/updatenotification/tests/UpdateCheckerTest.php index 54d756ddcb7..0497a992669 100644 --- a/apps/updatenotification/tests/UpdateCheckerTest.php +++ b/apps/updatenotification/tests/UpdateCheckerTest.php @@ -29,7 +29,7 @@ class UpdateCheckerTest extends TestCase { $this->updateChecker = new UpdateChecker($this->updater, $this->changesChecker); } - public function testGetUpdateStateWithUpdateAndInvalidLink() { + public function testGetUpdateStateWithUpdateAndInvalidLink(): void { $this->updater ->expects($this->once()) ->method('check') @@ -53,7 +53,7 @@ class UpdateCheckerTest extends TestCase { $this->assertSame($expected, $this->updateChecker->getUpdateState()); } - public function testGetUpdateStateWithUpdateAndValidLink() { + public function testGetUpdateStateWithUpdateAndValidLink(): void { $changes = [ 'changelog' => 'https://nextcloud.com/changelog/#123-0-0', 'whatsNew' => [ @@ -101,7 +101,7 @@ class UpdateCheckerTest extends TestCase { $this->assertSame($expected, $this->updateChecker->getUpdateState()); } - public function testGetUpdateStateWithoutUpdate() { + public function testGetUpdateStateWithoutUpdate(): void { $this->updater ->expects($this->once()) ->method('check') diff --git a/apps/user_ldap/tests/AccessTest.php b/apps/user_ldap/tests/AccessTest.php index b04a9f69e0b..79c0f3216a2 100644 --- a/apps/user_ldap/tests/AccessTest.php +++ b/apps/user_ldap/tests/AccessTest.php @@ -122,18 +122,18 @@ class AccessTest extends TestCase { return [$lw, $connector, $um, $helper]; } - public function testEscapeFilterPartValidChars() { + public function testEscapeFilterPartValidChars(): void { $input = 'okay'; $this->assertTrue($input === $this->access->escapeFilterPart($input)); } - public function testEscapeFilterPartEscapeWildcard() { + public function testEscapeFilterPartEscapeWildcard(): void { $input = '*'; $expected = '\\2a'; $this->assertTrue($expected === $this->access->escapeFilterPart($input)); } - public function testEscapeFilterPartEscapeWildcard2() { + public function testEscapeFilterPartEscapeWildcard2(): void { $input = 'foo*bar'; $expected = 'foo\\2abar'; $this->assertTrue($expected === $this->access->escapeFilterPart($input)); @@ -144,7 +144,7 @@ class AccessTest extends TestCase { * @param array $sidArray * @param $sidExpected */ - public function testConvertSID2StrSuccess(array $sidArray, $sidExpected) { + public function testConvertSID2StrSuccess(array $sidArray, $sidExpected): void { $sidBinary = implode('', $sidArray); $this->assertSame($sidExpected, $this->access->convertSID2Str($sidBinary)); } @@ -176,14 +176,14 @@ class AccessTest extends TestCase { ]; } - public function testConvertSID2StrInputError() { + public function testConvertSID2StrInputError(): void { $sidIllegal = 'foobar'; $sidExpected = ''; $this->assertSame($sidExpected, $this->access->convertSID2Str($sidIllegal)); } - public function testGetDomainDNFromDNSuccess() { + public function testGetDomainDNFromDNSuccess(): void { $inputDN = 'uid=zaphod,cn=foobar,dc=my,dc=server,dc=com'; $domainDN = 'dc=my,dc=server,dc=com'; @@ -195,7 +195,7 @@ class AccessTest extends TestCase { $this->assertSame($domainDN, $this->access->getDomainDNFromDN($inputDN)); } - public function testGetDomainDNFromDNError() { + public function testGetDomainDNFromDNError(): void { $inputDN = 'foobar'; $expected = ''; @@ -231,7 +231,7 @@ class AccessTest extends TestCase { * @dataProvider dnInputDataProvider * @param array $case */ - public function testStringResemblesDN($case) { + public function testStringResemblesDN($case): void { [$lw, $con, $um, $helper] = $this->getConnectorAndLdapMock(); /** @var IConfig|MockObject $config */ $config = $this->createMock(IConfig::class); @@ -253,7 +253,7 @@ class AccessTest extends TestCase { * @dataProvider dnInputDataProvider * @param $case */ - public function testStringResemblesDNLDAPmod($case) { + public function testStringResemblesDNLDAPmod($case): void { [, $con, $um, $helper] = $this->getConnectorAndLdapMock(); /** @var IConfig|MockObject $config */ $config = $this->createMock(IConfig::class); @@ -267,14 +267,14 @@ class AccessTest extends TestCase { $this->assertSame($case['expectedResult'], $access->stringResemblesDN($case['input'])); } - public function testCacheUserHome() { + public function testCacheUserHome(): void { $this->connection->expects($this->once()) ->method('writeToCache'); $this->access->cacheUserHome('foobar', '/foobars/path'); } - public function testBatchApplyUserAttributes() { + public function testBatchApplyUserAttributes(): void { $this->ldap->expects($this->any()) ->method('isResource') ->willReturn(true); @@ -332,7 +332,7 @@ class AccessTest extends TestCase { $this->access->batchApplyUserAttributes($data); } - public function testBatchApplyUserAttributesSkipped() { + public function testBatchApplyUserAttributesSkipped(): void { /** @var UserMapping|MockObject $mapperMock */ $mapperMock = $this->createMock(UserMapping::class); $mapperMock->expects($this->any()) @@ -373,7 +373,7 @@ class AccessTest extends TestCase { $this->access->batchApplyUserAttributes($data); } - public function testBatchApplyUserAttributesDontSkip() { + public function testBatchApplyUserAttributesDontSkip(): void { /** @var UserMapping|MockObject $mapperMock */ $mapperMock = $this->createMock(UserMapping::class); $mapperMock->expects($this->any()) @@ -428,7 +428,7 @@ class AccessTest extends TestCase { * @dataProvider dNAttributeProvider * @param $attribute */ - public function testSanitizeDN($attribute) { + public function testSanitizeDN($attribute): void { [$lw, $con, $um, $helper] = $this->getConnectorAndLdapMock(); /** @var IConfig|MockObject $config */ $config = $this->createMock(IConfig::class); @@ -450,7 +450,7 @@ class AccessTest extends TestCase { } - public function testSetPasswordWithDisabledChanges() { + public function testSetPasswordWithDisabledChanges(): void { $this->expectException(\Exception::class); $this->expectExceptionMessage('LDAP password changes are disabled'); @@ -462,7 +462,7 @@ class AccessTest extends TestCase { $this->access->setPassword('CN=foo', 'MyPassword'); } - public function testSetPasswordWithLdapNotAvailable() { + public function testSetPasswordWithLdapNotAvailable(): void { $this->connection ->method('__get') ->willReturn(true); @@ -481,7 +481,7 @@ class AccessTest extends TestCase { } - public function testSetPasswordWithRejectedChange() { + public function testSetPasswordWithRejectedChange(): void { $this->expectException(\OCP\HintException::class); $this->expectExceptionMessage('Password change rejected.'); @@ -503,7 +503,7 @@ class AccessTest extends TestCase { $this->access->setPassword('CN=foo', 'MyPassword'); } - public function testSetPassword() { + public function testSetPassword(): void { $this->connection ->method('__get') ->willReturn(true); @@ -565,7 +565,7 @@ class AccessTest extends TestCase { ->willReturnArgument(0); } - public function testSearchNoPagedSearch() { + public function testSearchNoPagedSearch(): void { // scenario: no pages search, 1 search base $filter = 'objectClass=nextcloudUser'; $base = 'ou=zombies,dc=foobar,dc=nextcloud,dc=com'; @@ -592,7 +592,7 @@ class AccessTest extends TestCase { $this->assertSame($expected, $result); } - public function testFetchListOfUsers() { + public function testFetchListOfUsers(): void { $filter = 'objectClass=nextcloudUser'; $base = 'ou=zombies,dc=foobar,dc=nextcloud,dc=com'; $attrs = ['dn', 'uid']; @@ -635,7 +635,7 @@ class AccessTest extends TestCase { $this->assertSame($expected, $list); } - public function testFetchListOfGroupsKnown() { + public function testFetchListOfGroupsKnown(): void { $filter = 'objectClass=nextcloudGroup'; $attributes = ['cn', 'gidNumber', 'dn']; $base = 'ou=SomeGroups,dc=my,dc=directory'; @@ -715,7 +715,7 @@ class AccessTest extends TestCase { * @param $name * @param $expected */ - public function testSanitizeUsername($name, $expected) { + public function testSanitizeUsername($name, $expected): void { if ($expected === null) { $this->expectException(\InvalidArgumentException::class); } @@ -726,12 +726,12 @@ class AccessTest extends TestCase { /** * @dataProvider groupIDCandidateProvider */ - public function testSanitizeGroupIDCandidate(string $name, string $expected) { + public function testSanitizeGroupIDCandidate(string $name, string $expected): void { $sanitizedName = $this->access->sanitizeGroupIDCandidate($name); $this->assertSame($expected, $sanitizedName); } - public function testUserStateUpdate() { + public function testUserStateUpdate(): void { $this->connection->expects($this->any()) ->method('__get') ->willReturnMap([ diff --git a/apps/user_ldap/tests/ConfigurationTest.php b/apps/user_ldap/tests/ConfigurationTest.php index 96b08c4cf8a..cced8334bf5 100644 --- a/apps/user_ldap/tests/ConfigurationTest.php +++ b/apps/user_ldap/tests/ConfigurationTest.php @@ -89,7 +89,7 @@ class ConfigurationTest extends \Test\TestCase { /** * @dataProvider configurationDataProvider */ - public function testSetValue($key, $input, $expected) { + public function testSetValue($key, $input, $expected): void { $this->configuration->setConfiguration([$key => $input]); $this->assertSame($this->configuration->$key, $expected); } @@ -108,7 +108,7 @@ class ConfigurationTest extends \Test\TestCase { /** * @dataProvider avatarRuleValueProvider */ - public function testGetAvatarAttributes($setting, $expected) { + public function testGetAvatarAttributes($setting, $expected): void { $this->configuration->setConfiguration(['ldapUserAvatarRule' => $setting]); $this->assertSame($expected, $this->configuration->getAvatarAttributes()); } @@ -116,7 +116,7 @@ class ConfigurationTest extends \Test\TestCase { /** * @dataProvider avatarRuleValueProvider */ - public function testResolveRule($setting, $expected) { + public function testResolveRule($setting, $expected): void { $this->configuration->setConfiguration(['ldapUserAvatarRule' => $setting]); // so far the only thing that can get resolved :) $this->assertSame($expected, $this->configuration->resolveRule('avatar')); diff --git a/apps/user_ldap/tests/ConnectionTest.php b/apps/user_ldap/tests/ConnectionTest.php index dfa3cf6beda..bc65de39f94 100644 --- a/apps/user_ldap/tests/ConnectionTest.php +++ b/apps/user_ldap/tests/ConnectionTest.php @@ -39,7 +39,7 @@ class ConnectionTest extends \Test\TestCase { ->willReturn(true); } - public function testOriginalAgentUnchangedOnClone() { + public function testOriginalAgentUnchangedOnClone(): void { //background: upon login a bind is done with the user credentials //which is valid for the whole LDAP resource. It needs to be reset //to the agent's credentials @@ -66,7 +66,7 @@ class ConnectionTest extends \Test\TestCase { $this->assertSame($agentPawd, $agent['ldapAgentPassword']); } - public function testUseBackupServer() { + public function testUseBackupServer(): void { $mainHost = 'ldap://nixda.ldap'; $backupHost = 'ldap://fallback.ldap'; $config = [ @@ -125,7 +125,7 @@ class ConnectionTest extends \Test\TestCase { $this->connection->init(); } - public function testDontUseBackupServerOnFailedAuth() { + public function testDontUseBackupServerOnFailedAuth(): void { $mainHost = 'ldap://nixda.ldap'; $backupHost = 'ldap://fallback.ldap'; $config = [ @@ -172,7 +172,7 @@ class ConnectionTest extends \Test\TestCase { $this->connection->init(); } - public function testBindWithInvalidCredentials() { + public function testBindWithInvalidCredentials(): void { // background: Bind with invalid credentials should return false // and not throw a ServerNotAvailableException. @@ -217,7 +217,7 @@ class ConnectionTest extends \Test\TestCase { } } - public function testStartTlsNegotiationFailure() { + public function testStartTlsNegotiationFailure(): void { // background: If Start TLS negotiation fails, // a ServerNotAvailableException should be thrown. diff --git a/apps/user_ldap/tests/GroupLDAPPluginTest.php b/apps/user_ldap/tests/GroupLDAPPluginTest.php index 24cfb5d51e9..f67de32c2e9 100644 --- a/apps/user_ldap/tests/GroupLDAPPluginTest.php +++ b/apps/user_ldap/tests/GroupLDAPPluginTest.php @@ -17,7 +17,7 @@ class GroupLDAPPluginTest extends \Test\TestCase { return new GroupPluginManager(); } - public function testImplementsActions() { + public function testImplementsActions(): void { $pluginManager = $this->getGroupPluginManager(); $plugin = $this->getMockBuilder('OCA\User_LDAP\Tests\LDAPGroupPluginDummy') @@ -44,7 +44,7 @@ class GroupLDAPPluginTest extends \Test\TestCase { $this->assertTrue($pluginManager->implementsActions(GroupInterface::ADD_TO_GROUP)); } - public function testCreateGroup() { + public function testCreateGroup(): void { $pluginManager = $this->getGroupPluginManager(); $plugin = $this->getMockBuilder('OCA\User_LDAP\Tests\LDAPGroupPluginDummy') @@ -66,7 +66,7 @@ class GroupLDAPPluginTest extends \Test\TestCase { } - public function testCreateGroupNotRegistered() { + public function testCreateGroupNotRegistered(): void { $this->expectException(\Exception::class); $this->expectExceptionMessage('No plugin implements createGroup in this LDAP Backend.'); @@ -74,7 +74,7 @@ class GroupLDAPPluginTest extends \Test\TestCase { $pluginManager->createGroup('foo'); } - public function testDeleteGroup() { + public function testDeleteGroup(): void { $pluginManager = $this->getGroupPluginManager(); $plugin = $this->getMockBuilder('OCA\User_LDAP\Tests\LDAPGroupPluginDummy') @@ -96,7 +96,7 @@ class GroupLDAPPluginTest extends \Test\TestCase { } - public function testDeleteGroupNotRegistered() { + public function testDeleteGroupNotRegistered(): void { $this->expectException(\Exception::class); $this->expectExceptionMessage('No plugin implements deleteGroup in this LDAP Backend.'); @@ -104,7 +104,7 @@ class GroupLDAPPluginTest extends \Test\TestCase { $pluginManager->deleteGroup('foo'); } - public function testAddToGroup() { + public function testAddToGroup(): void { $pluginManager = $this->getGroupPluginManager(); $plugin = $this->getMockBuilder('OCA\User_LDAP\Tests\LDAPGroupPluginDummy') @@ -127,7 +127,7 @@ class GroupLDAPPluginTest extends \Test\TestCase { } - public function testAddToGroupNotRegistered() { + public function testAddToGroupNotRegistered(): void { $this->expectException(\Exception::class); $this->expectExceptionMessage('No plugin implements addToGroup in this LDAP Backend.'); @@ -135,7 +135,7 @@ class GroupLDAPPluginTest extends \Test\TestCase { $pluginManager->addToGroup('foo', 'bar'); } - public function testRemoveFromGroup() { + public function testRemoveFromGroup(): void { $pluginManager = $this->getGroupPluginManager(); $plugin = $this->getMockBuilder('OCA\User_LDAP\Tests\LDAPGroupPluginDummy') @@ -158,7 +158,7 @@ class GroupLDAPPluginTest extends \Test\TestCase { } - public function testRemoveFromGroupNotRegistered() { + public function testRemoveFromGroupNotRegistered(): void { $this->expectException(\Exception::class); $this->expectExceptionMessage('No plugin implements removeFromGroup in this LDAP Backend.'); @@ -166,7 +166,7 @@ class GroupLDAPPluginTest extends \Test\TestCase { $pluginManager->removeFromGroup('foo', 'bar'); } - public function testCountUsersInGroup() { + public function testCountUsersInGroup(): void { $pluginManager = $this->getGroupPluginManager(); $plugin = $this->getMockBuilder('OCA\User_LDAP\Tests\LDAPGroupPluginDummy') @@ -189,7 +189,7 @@ class GroupLDAPPluginTest extends \Test\TestCase { } - public function testCountUsersInGroupNotRegistered() { + public function testCountUsersInGroupNotRegistered(): void { $this->expectException(\Exception::class); $this->expectExceptionMessage('No plugin implements countUsersInGroup in this LDAP Backend.'); @@ -197,7 +197,7 @@ class GroupLDAPPluginTest extends \Test\TestCase { $pluginManager->countUsersInGroup('foo', 'bar'); } - public function testgetGroupDetails() { + public function testgetGroupDetails(): void { $pluginManager = $this->getGroupPluginManager(); $plugin = $this->getMockBuilder('OCA\User_LDAP\Tests\LDAPGroupPluginDummy') @@ -219,7 +219,7 @@ class GroupLDAPPluginTest extends \Test\TestCase { } - public function testgetGroupDetailsNotRegistered() { + public function testgetGroupDetailsNotRegistered(): void { $this->expectException(\Exception::class); $this->expectExceptionMessage('No plugin implements getGroupDetails in this LDAP Backend.'); diff --git a/apps/user_ldap/tests/Group_LDAPTest.php b/apps/user_ldap/tests/Group_LDAPTest.php index 06d64b99a4f..58006627410 100644 --- a/apps/user_ldap/tests/Group_LDAPTest.php +++ b/apps/user_ldap/tests/Group_LDAPTest.php @@ -51,7 +51,7 @@ class Group_LDAPTest extends TestCase { $this->groupBackend = new GroupLDAP($this->access, $this->pluginManager, $this->config, $this->ncUserManager); } - public function testCountEmptySearchString() { + public function testCountEmptySearchString(): void { $groupDN = 'cn=group,dc=foo,dc=bar'; $this->enableGroups(); @@ -130,7 +130,7 @@ class Group_LDAPTest extends TestCase { }); } - public function testCountWithSearchString() { + public function testCountWithSearchString(): void { $this->enableGroups(); $this->access->expects($this->any()) @@ -174,7 +174,7 @@ class Group_LDAPTest extends TestCase { $this->assertSame(2, $users); } - public function testCountUsersWithPlugin() { + public function testCountUsersWithPlugin(): void { /** @var GroupPluginManager|MockObject $pluginManager */ $this->pluginManager = $this->getMockBuilder(GroupPluginManager::class) ->setMethods(['implementsActions', 'countUsersInGroup']) @@ -194,7 +194,7 @@ class Group_LDAPTest extends TestCase { $this->assertEquals($this->groupBackend->countUsersInGroup('gid', 'search'), 42); } - public function testGidNumber2NameSuccess() { + public function testGidNumber2NameSuccess(): void { $this->enableGroups(); $userDN = 'cn=alice,cn=foo,dc=barfoo,dc=bar'; @@ -214,7 +214,7 @@ class Group_LDAPTest extends TestCase { $this->assertSame('MyGroup', $group); } - public function testGidNumberID2NameNoGroup() { + public function testGidNumberID2NameNoGroup(): void { $this->enableGroups(); $userDN = 'cn=alice,cn=foo,dc=barfoo,dc=bar'; @@ -232,7 +232,7 @@ class Group_LDAPTest extends TestCase { $this->assertSame(false, $group); } - public function testGidNumberID2NameNoName() { + public function testGidNumberID2NameNoName(): void { $this->enableGroups(); $userDN = 'cn=alice,cn=foo,dc=barfoo,dc=bar'; @@ -251,7 +251,7 @@ class Group_LDAPTest extends TestCase { $this->assertSame(false, $group); } - public function testGetEntryGidNumberValue() { + public function testGetEntryGidNumberValue(): void { $this->enableGroups(); $dn = 'cn=foobar,cn=foo,dc=barfoo,dc=bar'; @@ -268,7 +268,7 @@ class Group_LDAPTest extends TestCase { $this->assertSame('3117', $gid); } - public function testGetEntryGidNumberNoValue() { + public function testGetEntryGidNumberNoValue(): void { $this->enableGroups(); $dn = 'cn=foobar,cn=foo,dc=barfoo,dc=bar'; @@ -285,7 +285,7 @@ class Group_LDAPTest extends TestCase { $this->assertSame(false, $gid); } - public function testPrimaryGroupID2NameSuccessCache() { + public function testPrimaryGroupID2NameSuccessCache(): void { $this->enableGroups(); $userDN = 'cn=alice,cn=foo,dc=barfoo,dc=bar'; @@ -313,7 +313,7 @@ class Group_LDAPTest extends TestCase { $this->assertSame('MyGroup', $group); } - public function testPrimaryGroupID2NameSuccess() { + public function testPrimaryGroupID2NameSuccess(): void { $this->enableGroups(); $userDN = 'cn=alice,cn=foo,dc=barfoo,dc=bar'; @@ -338,7 +338,7 @@ class Group_LDAPTest extends TestCase { $this->assertSame('MyGroup', $group); } - public function testPrimaryGroupID2NameNoSID() { + public function testPrimaryGroupID2NameNoSID(): void { $this->enableGroups(); $userDN = 'cn=alice,cn=foo,dc=barfoo,dc=bar'; @@ -360,7 +360,7 @@ class Group_LDAPTest extends TestCase { $this->assertSame(false, $group); } - public function testPrimaryGroupID2NameNoGroup() { + public function testPrimaryGroupID2NameNoGroup(): void { $this->enableGroups(); $userDN = 'cn=alice,cn=foo,dc=barfoo,dc=bar'; @@ -383,7 +383,7 @@ class Group_LDAPTest extends TestCase { $this->assertSame(false, $group); } - public function testPrimaryGroupID2NameNoName() { + public function testPrimaryGroupID2NameNoName(): void { $this->enableGroups(); $userDN = 'cn=alice,cn=foo,dc=barfoo,dc=bar'; @@ -407,7 +407,7 @@ class Group_LDAPTest extends TestCase { $this->assertSame(false, $group); } - public function testGetEntryGroupIDValue() { + public function testGetEntryGroupIDValue(): void { //tests getEntryGroupID via getGroupPrimaryGroupID //which is basically identical to getUserPrimaryGroupIDs $this->enableGroups(); @@ -426,7 +426,7 @@ class Group_LDAPTest extends TestCase { $this->assertSame('3117', $gid); } - public function testGetEntryGroupIDNoValue() { + public function testGetEntryGroupIDNoValue(): void { //tests getEntryGroupID via getGroupPrimaryGroupID //which is basically identical to getUserPrimaryGroupIDs $this->enableGroups(); @@ -449,7 +449,7 @@ class Group_LDAPTest extends TestCase { * tests whether Group Backend behaves correctly when cache with uid and gid * is hit */ - public function testInGroupHitsUidGidCache() { + public function testInGroupHitsUidGidCache(): void { $this->enableGroups(); $uid = 'someUser'; @@ -486,7 +486,7 @@ class Group_LDAPTest extends TestCase { /** * @dataProvider groupWithMembersProvider */ - public function testInGroupMember(string $gid, string $groupDn, array $memberDNs) { + public function testInGroupMember(string $gid, string $groupDn, array $memberDNs): void { $uid = 'someUser'; $userDn = $memberDNs[0]; @@ -527,7 +527,7 @@ class Group_LDAPTest extends TestCase { /** * @dataProvider groupWithMembersProvider */ - public function testInGroupMemberNot(string $gid, string $groupDn, array $memberDNs) { + public function testInGroupMemberNot(string $gid, string $groupDn, array $memberDNs): void { $uid = 'unelatedUser'; $userDn = 'uid=unrelatedUser,ou=unrelatedTeam,ou=unrelatedDepartment,dc=someDomain,dc=someTld'; @@ -568,7 +568,7 @@ class Group_LDAPTest extends TestCase { /** * @dataProvider groupWithMembersProvider */ - public function testInGroupMemberUid(string $gid, string $groupDn, array $memberDNs) { + public function testInGroupMemberUid(string $gid, string $groupDn, array $memberDNs): void { $memberUids = []; $userRecords = []; foreach ($memberDNs as $dn) { @@ -625,7 +625,7 @@ class Group_LDAPTest extends TestCase { $this->assertTrue($this->groupBackend->inGroup($uid, $gid)); } - public function testGetGroupsWithOffset() { + public function testGetGroupsWithOffset(): void { $this->enableGroups(); $this->access->expects($this->once()) @@ -642,7 +642,7 @@ class Group_LDAPTest extends TestCase { * tests that a user listing is complete, if all its members have the group * as their primary. */ - public function testUsersInGroupPrimaryMembersOnly() { + public function testUsersInGroupPrimaryMembersOnly(): void { $this->enableGroups(); $this->access->connection->expects($this->any()) @@ -685,7 +685,7 @@ class Group_LDAPTest extends TestCase { * tests that a user listing is complete, if all its members have the group * as their primary. */ - public function testUsersInGroupPrimaryAndUnixMembers() { + public function testUsersInGroupPrimaryAndUnixMembers(): void { $this->enableGroups(); $this->access->connection->expects($this->any()) @@ -726,7 +726,7 @@ class Group_LDAPTest extends TestCase { * tests that a user counting is complete, if all its members have the group * as their primary. */ - public function testCountUsersInGroupPrimaryMembersOnly() { + public function testCountUsersInGroupPrimaryMembersOnly(): void { $this->enableGroups(); $this->access->connection->expects($this->any()) @@ -761,7 +761,7 @@ class Group_LDAPTest extends TestCase { $this->assertSame(4, $users); } - public function testGetUserGroupsMemberOf() { + public function testGetUserGroupsMemberOf(): void { $this->enableGroups(); $dn = 'cn=userX,dc=foobar'; @@ -797,7 +797,7 @@ class Group_LDAPTest extends TestCase { $this->assertSame(2, count($groups)); } - public function testGetUserGroupsMemberOfDisabled() { + public function testGetUserGroupsMemberOfDisabled(): void { $this->access->connection->expects($this->any()) ->method('__get') ->willReturnCallback(function ($name) { @@ -856,7 +856,7 @@ class Group_LDAPTest extends TestCase { $this->groupBackend->getUserGroups('userX'); } - public function testGetUserGroupsOfflineUser() { + public function testGetUserGroupsOfflineUser(): void { $this->enableGroups(); $offlineUser = $this->createMock(OfflineUser::class); @@ -882,7 +882,7 @@ class Group_LDAPTest extends TestCase { * regression tests against a case where a json object was stored instead of expected list * @see https://github.com/nextcloud/server/issues/42374 */ - public function testGetUserGroupsOfflineUserUnexpectedJson() { + public function testGetUserGroupsOfflineUserUnexpectedJson(): void { $this->enableGroups(); $offlineUser = $this->createMock(OfflineUser::class); @@ -905,7 +905,7 @@ class Group_LDAPTest extends TestCase { $this->assertTrue(in_array('groupF', $returnedGroups)); } - public function testGetUserGroupsUnrecognizedOfflineUser() { + public function testGetUserGroupsUnrecognizedOfflineUser(): void { $this->enableGroups(); $dn = 'cn=userX,dc=foobar'; @@ -958,7 +958,7 @@ class Group_LDAPTest extends TestCase { /** * @dataProvider nestedGroupsProvider */ - public function testGetGroupsByMember(bool $nestedGroups) { + public function testGetGroupsByMember(bool $nestedGroups): void { $groupFilter = '(&(objectclass=nextcloudGroup)(nextcloudEnabled=TRUE))'; $this->access->connection->expects($this->any()) ->method('__get') @@ -1072,7 +1072,7 @@ class Group_LDAPTest extends TestCase { $this->assertEquals($expectedGroupsNames, $groupsAgain); } - public function testCreateGroupWithPlugin() { + public function testCreateGroupWithPlugin(): void { $this->pluginManager = $this->getMockBuilder(GroupPluginManager::class) ->setMethods(['implementsActions', 'createGroup']) ->getMock(); @@ -1092,7 +1092,7 @@ class Group_LDAPTest extends TestCase { } - public function testCreateGroupFailing() { + public function testCreateGroupFailing(): void { $this->expectException(\Exception::class); $this->pluginManager = $this->getMockBuilder(GroupPluginManager::class) @@ -1108,7 +1108,7 @@ class Group_LDAPTest extends TestCase { $this->groupBackend->createGroup('gid'); } - public function testDeleteGroupWithPlugin() { + public function testDeleteGroupWithPlugin(): void { $this->pluginManager = $this->getMockBuilder(GroupPluginManager::class) ->setMethods(['implementsActions', 'deleteGroup']) ->getMock(); @@ -1137,7 +1137,7 @@ class Group_LDAPTest extends TestCase { } - public function testDeleteGroupFailing() { + public function testDeleteGroupFailing(): void { $this->expectException(\Exception::class); $this->pluginManager = $this->getMockBuilder(GroupPluginManager::class) @@ -1153,7 +1153,7 @@ class Group_LDAPTest extends TestCase { $this->groupBackend->deleteGroup('gid'); } - public function testAddToGroupWithPlugin() { + public function testAddToGroupWithPlugin(): void { $this->pluginManager = $this->getMockBuilder(GroupPluginManager::class) ->setMethods(['implementsActions', 'addToGroup']) ->getMock(); @@ -1173,7 +1173,7 @@ class Group_LDAPTest extends TestCase { } - public function testAddToGroupFailing() { + public function testAddToGroupFailing(): void { $this->expectException(\Exception::class); $this->pluginManager = $this->getMockBuilder(GroupPluginManager::class) @@ -1189,7 +1189,7 @@ class Group_LDAPTest extends TestCase { $this->groupBackend->addToGroup('uid', 'gid'); } - public function testRemoveFromGroupWithPlugin() { + public function testRemoveFromGroupWithPlugin(): void { $this->pluginManager = $this->getMockBuilder(GroupPluginManager::class) ->setMethods(['implementsActions', 'removeFromGroup']) ->getMock(); @@ -1209,7 +1209,7 @@ class Group_LDAPTest extends TestCase { } - public function testRemoveFromGroupFailing() { + public function testRemoveFromGroupFailing(): void { $this->expectException(\Exception::class); $this->pluginManager = $this->getMockBuilder(GroupPluginManager::class) @@ -1225,7 +1225,7 @@ class Group_LDAPTest extends TestCase { $this->groupBackend->removeFromGroup('uid', 'gid'); } - public function testGetGroupDetailsWithPlugin() { + public function testGetGroupDetailsWithPlugin(): void { /** @var GroupPluginManager|MockObject $pluginManager */ $this->pluginManager = $this->getMockBuilder(GroupPluginManager::class) ->setMethods(['implementsActions', 'getGroupDetails']) @@ -1245,7 +1245,7 @@ class Group_LDAPTest extends TestCase { $this->assertEquals($this->groupBackend->getGroupDetails('gid'), 'result'); } - public function testGetGroupDetailsFailing() { + public function testGetGroupDetailsFailing(): void { $this->expectException(\Exception::class); $this->pluginManager = $this->getMockBuilder(GroupPluginManager::class) @@ -1333,7 +1333,7 @@ class Group_LDAPTest extends TestCase { * @param string[] $expectedMembers * @dataProvider groupMemberProvider */ - public function testGroupMembers(array $expectedResult, ?array $groupsInfo = null) { + public function testGroupMembers(array $expectedResult, ?array $groupsInfo = null): void { $this->access->expects($this->any()) ->method('readAttribute') ->willReturnCallback(function ($group) use ($groupsInfo) { @@ -1372,7 +1372,7 @@ class Group_LDAPTest extends TestCase { /** * @dataProvider displayNameProvider */ - public function testGetDisplayName(string $expected, $ldapResult) { + public function testGetDisplayName(string $expected, $ldapResult): void { $gid = 'graphic_novelists'; $this->access->expects($this->atLeastOnce()) diff --git a/apps/user_ldap/tests/HelperTest.php b/apps/user_ldap/tests/HelperTest.php index bbb3956f918..38c6a639340 100644 --- a/apps/user_ldap/tests/HelperTest.php +++ b/apps/user_ldap/tests/HelperTest.php @@ -26,7 +26,7 @@ class HelperTest extends \Test\TestCase { $this->helper = new Helper($this->config, \OC::$server->getDatabaseConnection()); } - public function testGetServerConfigurationPrefixes() { + public function testGetServerConfigurationPrefixes(): void { $this->config->method('getAppKeys') ->with($this->equalTo('user_ldap')) ->willReturn([ @@ -40,7 +40,7 @@ class HelperTest extends \Test\TestCase { $this->assertEquals(['', 's1'], $result); } - public function testGetServerConfigurationPrefixesActive() { + public function testGetServerConfigurationPrefixesActive(): void { $this->config->method('getAppKeys') ->with($this->equalTo('user_ldap')) ->willReturn([ @@ -65,7 +65,7 @@ class HelperTest extends \Test\TestCase { $this->assertEquals(['s1'], $result); } - public function testGetServerConfigurationHost() { + public function testGetServerConfigurationHost(): void { $this->config->method('getAppKeys') ->with($this->equalTo('user_ldap')) ->willReturn([ diff --git a/apps/user_ldap/tests/Jobs/CleanUpTest.php b/apps/user_ldap/tests/Jobs/CleanUpTest.php index 05d202f82df..582b6fba5d7 100644 --- a/apps/user_ldap/tests/Jobs/CleanUpTest.php +++ b/apps/user_ldap/tests/Jobs/CleanUpTest.php @@ -43,7 +43,7 @@ class CleanUpTest extends TestCase { /** * clean up job must not run when there are disabled configurations */ - public function test_runNotAllowedByDisabledConfigurations() { + public function test_runNotAllowedByDisabledConfigurations(): void { $this->mocks['helper']->expects($this->once()) ->method('haveDisabledConfigurations') ->willReturn(true); @@ -59,7 +59,7 @@ class CleanUpTest extends TestCase { * clean up job must not run when LDAP Helper is broken i.e. * returning unexpected results */ - public function test_runNotAllowedByBrokenHelper() { + public function test_runNotAllowedByBrokenHelper(): void { $this->mocks['helper']->expects($this->once()) ->method('haveDisabledConfigurations') ->will($this->throwException(new Exception())); @@ -74,7 +74,7 @@ class CleanUpTest extends TestCase { /** * clean up job must not run when it is not enabled */ - public function test_runNotAllowedBySysConfig() { + public function test_runNotAllowedBySysConfig(): void { $this->mocks['helper']->expects($this->once()) ->method('haveDisabledConfigurations') ->willReturn(false); @@ -90,7 +90,7 @@ class CleanUpTest extends TestCase { /** * clean up job is allowed to run */ - public function test_runIsAllowed() { + public function test_runIsAllowed(): void { $this->mocks['helper']->expects($this->once()) ->method('haveDisabledConfigurations') ->willReturn(false); @@ -106,7 +106,7 @@ class CleanUpTest extends TestCase { /** * check whether offset will be reset when it needs to */ - public function test_OffsetResetIsNecessary() { + public function test_OffsetResetIsNecessary(): void { $result = $this->bgJob->isOffsetResetNecessary($this->bgJob->getChunkSize() - 1); $this->assertSame(true, $result); } @@ -114,7 +114,7 @@ class CleanUpTest extends TestCase { /** * make sure offset is not reset when it is not due */ - public function test_OffsetResetIsNotNecessary() { + public function test_OffsetResetIsNotNecessary(): void { $result = $this->bgJob->isOffsetResetNecessary($this->bgJob->getChunkSize()); $this->assertSame(false, $result); } diff --git a/apps/user_ldap/tests/Jobs/SyncTest.php b/apps/user_ldap/tests/Jobs/SyncTest.php index 379402166e3..8277e7d48a9 100644 --- a/apps/user_ldap/tests/Jobs/SyncTest.php +++ b/apps/user_ldap/tests/Jobs/SyncTest.php @@ -152,7 +152,7 @@ class SyncTest extends TestCase { /** * @dataProvider moreResultsProvider */ - public function testMoreResults($pagingSize, $results, $expected) { + public function testMoreResults($pagingSize, $results, $expected): void { $connection = $this->createMock(Connection::class); $this->connectionFactory->expects($this->any()) ->method('get') @@ -207,7 +207,7 @@ class SyncTest extends TestCase { /** * @dataProvider cycleDataProvider */ - public function testDetermineNextCycle($cycleData, $prefixes, $expectedCycle) { + public function testDetermineNextCycle($cycleData, $prefixes, $expectedCycle): void { $this->helper->expects($this->any()) ->method('getServerConfigurationPrefixes') ->with(true) @@ -283,7 +283,7 @@ class SyncTest extends TestCase { /** * @dataProvider runDataProvider */ - public function testRun($runData) { + public function testRun($runData): void { $this->config->expects($this->any()) ->method('getAppValue') ->willReturnCallback(function ($app, $key, $default) use ($runData) { diff --git a/apps/user_ldap/tests/LDAPProviderTest.php b/apps/user_ldap/tests/LDAPProviderTest.php index d240b6d65c5..514cc137954 100644 --- a/apps/user_ldap/tests/LDAPProviderTest.php +++ b/apps/user_ldap/tests/LDAPProviderTest.php @@ -87,7 +87,7 @@ class LDAPProviderTest extends \Test\TestCase { } - public function testGetUserDNUserIDNotFound() { + public function testGetUserDNUserIDNotFound(): void { $this->expectException(\Exception::class); $this->expectExceptionMessage('User id not found in LDAP'); @@ -103,7 +103,7 @@ class LDAPProviderTest extends \Test\TestCase { $ldapProvider->getUserDN('nonexisting_user'); } - public function testGetUserDN() { + public function testGetUserDN(): void { $userBackend = $this->getMockBuilder('OCA\User_LDAP\User_LDAP') ->setMethods(['userExists', 'getLDAPAccess', 'username2dn']) ->disableOriginalConstructor() @@ -126,7 +126,7 @@ class LDAPProviderTest extends \Test\TestCase { } - public function testGetGroupDNGroupIDNotFound() { + public function testGetGroupDNGroupIDNotFound(): void { $this->expectException(\Exception::class); $this->expectExceptionMessage('Group id not found in LDAP'); @@ -147,7 +147,7 @@ class LDAPProviderTest extends \Test\TestCase { $ldapProvider->getGroupDN('nonexisting_group'); } - public function testGetGroupDN() { + public function testGetGroupDN(): void { $userBackend = $this->getMockBuilder('OCA\User_LDAP\User_LDAP') ->setMethods(['userExists', 'getLDAPAccess', 'username2dn']) ->disableOriginalConstructor() @@ -175,7 +175,7 @@ class LDAPProviderTest extends \Test\TestCase { $ldapProvider->getGroupDN('existing_group')); } - public function testGetUserName() { + public function testGetUserName(): void { $userBackend = $this->getMockBuilder('OCA\User_LDAP\User_LDAP') ->setMethods(['dn2UserName']) ->disableOriginalConstructor() @@ -191,7 +191,7 @@ class LDAPProviderTest extends \Test\TestCase { $ldapProvider->getUserName('cn=existing_user,ou=Are Sufficient To,ou=Test,dc=example,dc=org')); } - public function testDNasBaseParameter() { + public function testDNasBaseParameter(): void { $userBackend = $this->getMockBuilder('OCA\User_LDAP\User_LDAP') ->setMethods([]) ->disableOriginalConstructor() @@ -207,7 +207,7 @@ class LDAPProviderTest extends \Test\TestCase { $ldapProvider->DNasBaseParameter('cn=existing_user,ou=Are Sufficient To,ou=Test,dc=example,dc=org')); } - public function testSanitizeDN() { + public function testSanitizeDN(): void { $userBackend = $this->getMockBuilder('OCA\User_LDAP\User_LDAP') ->setMethods([]) ->disableOriginalConstructor() @@ -224,7 +224,7 @@ class LDAPProviderTest extends \Test\TestCase { } - public function testGetLDAPConnectionUserIDNotFound() { + public function testGetLDAPConnectionUserIDNotFound(): void { $this->expectException(\Exception::class); $this->expectExceptionMessage('User id not found in LDAP'); @@ -240,7 +240,7 @@ class LDAPProviderTest extends \Test\TestCase { $ldapProvider->getLDAPConnection('nonexisting_user'); } - public function testGetLDAPConnection() { + public function testGetLDAPConnection(): void { $userBackend = $this->getMockBuilder('OCA\User_LDAP\User_LDAP') ->setMethods(['userExists', 'getNewLDAPConnection']) ->disableOriginalConstructor() @@ -260,7 +260,7 @@ class LDAPProviderTest extends \Test\TestCase { } - public function testGetGroupLDAPConnectionGroupIDNotFound() { + public function testGetGroupLDAPConnectionGroupIDNotFound(): void { $this->expectException(\Exception::class); $this->expectExceptionMessage('Group id not found in LDAP'); @@ -281,7 +281,7 @@ class LDAPProviderTest extends \Test\TestCase { $ldapProvider->getGroupLDAPConnection('nonexisting_group'); } - public function testGetGroupLDAPConnection() { + public function testGetGroupLDAPConnection(): void { $userBackend = $this->getMockBuilder('OCA\User_LDAP\User_LDAP') ->disableOriginalConstructor() ->getMock(); @@ -307,7 +307,7 @@ class LDAPProviderTest extends \Test\TestCase { } - public function testGetLDAPBaseUsersUserIDNotFound() { + public function testGetLDAPBaseUsersUserIDNotFound(): void { $this->expectException(\Exception::class); $this->expectExceptionMessage('User id not found in LDAP'); @@ -323,7 +323,7 @@ class LDAPProviderTest extends \Test\TestCase { $ldapProvider->getLDAPBaseUsers('nonexisting_user'); } - public function testGetLDAPBaseUsers() { + public function testGetLDAPBaseUsers(): void { $bases = [ 'ou=users,ou=foobar,dc=example,dc=org', 'ou=users,ou=barfoo,dc=example,dc=org', @@ -370,7 +370,7 @@ class LDAPProviderTest extends \Test\TestCase { } - public function testGetLDAPBaseGroupsUserIDNotFound() { + public function testGetLDAPBaseGroupsUserIDNotFound(): void { $this->expectException(\Exception::class); $this->expectExceptionMessage('User id not found in LDAP'); @@ -386,7 +386,7 @@ class LDAPProviderTest extends \Test\TestCase { $ldapProvider->getLDAPBaseGroups('nonexisting_user'); } - public function testGetLDAPBaseGroups() { + public function testGetLDAPBaseGroups(): void { $bases = [ 'ou=groupd,ou=foobar,dc=example,dc=org', 'ou=groups,ou=barfoo,dc=example,dc=org', @@ -426,7 +426,7 @@ class LDAPProviderTest extends \Test\TestCase { } - public function testClearCacheUserIDNotFound() { + public function testClearCacheUserIDNotFound(): void { $this->expectException(\Exception::class); $this->expectExceptionMessage('User id not found in LDAP'); @@ -442,7 +442,7 @@ class LDAPProviderTest extends \Test\TestCase { $ldapProvider->clearCache('nonexisting_user'); } - public function testClearCache() { + public function testClearCache(): void { $userBackend = $this->getMockBuilder('OCA\User_LDAP\User_LDAP') ->setMethods(['userExists', 'getLDAPAccess', 'getConnection', 'clearCache']) ->disableOriginalConstructor() @@ -465,7 +465,7 @@ class LDAPProviderTest extends \Test\TestCase { } - public function testClearGroupCacheGroupIDNotFound() { + public function testClearGroupCacheGroupIDNotFound(): void { $this->expectException(\Exception::class); $this->expectExceptionMessage('Group id not found in LDAP'); @@ -484,7 +484,7 @@ class LDAPProviderTest extends \Test\TestCase { $ldapProvider->clearGroupCache('nonexisting_group'); } - public function testClearGroupCache() { + public function testClearGroupCache(): void { $userBackend = $this->getMockBuilder('OCA\User_LDAP\User_LDAP') ->disableOriginalConstructor() ->getMock(); @@ -509,7 +509,7 @@ class LDAPProviderTest extends \Test\TestCase { $this->addToAssertionCount(1); } - public function testDnExists() { + public function testDnExists(): void { $userBackend = $this->getMockBuilder('OCA\User_LDAP\User_LDAP') ->setMethods(['dn2UserName']) ->disableOriginalConstructor() @@ -524,7 +524,7 @@ class LDAPProviderTest extends \Test\TestCase { $this->assertTrue($ldapProvider->dnExists('cn=existing_user,ou=Are Sufficient To,ou=Test,dc=example,dc=org')); } - public function testFlagRecord() { + public function testFlagRecord(): void { $userBackend = $this->getMockBuilder('OCA\User_LDAP\User_LDAP') ->setMethods([]) ->disableOriginalConstructor() @@ -537,7 +537,7 @@ class LDAPProviderTest extends \Test\TestCase { $this->addToAssertionCount(1); } - public function testUnflagRecord() { + public function testUnflagRecord(): void { $userBackend = $this->getMockBuilder('OCA\User_LDAP\User_LDAP') ->setMethods([]) ->disableOriginalConstructor() @@ -551,7 +551,7 @@ class LDAPProviderTest extends \Test\TestCase { } - public function testGetLDAPDisplayNameFieldUserIDNotFound() { + public function testGetLDAPDisplayNameFieldUserIDNotFound(): void { $this->expectException(\Exception::class); $this->expectExceptionMessage('User id not found in LDAP'); @@ -567,7 +567,7 @@ class LDAPProviderTest extends \Test\TestCase { $ldapProvider->getLDAPDisplayNameField('nonexisting_user'); } - public function testGetLDAPDisplayNameField() { + public function testGetLDAPDisplayNameField(): void { $userBackend = $this->getMockBuilder('OCA\User_LDAP\User_LDAP') ->setMethods(['userExists', 'getLDAPAccess', 'getConnection', 'getConfiguration']) ->disableOriginalConstructor() @@ -589,7 +589,7 @@ class LDAPProviderTest extends \Test\TestCase { } - public function testGetLDAPEmailFieldUserIDNotFound() { + public function testGetLDAPEmailFieldUserIDNotFound(): void { $this->expectException(\Exception::class); $this->expectExceptionMessage('User id not found in LDAP'); @@ -605,7 +605,7 @@ class LDAPProviderTest extends \Test\TestCase { $ldapProvider->getLDAPEmailField('nonexisting_user'); } - public function testGetLDAPEmailField() { + public function testGetLDAPEmailField(): void { $userBackend = $this->getMockBuilder('OCA\User_LDAP\User_LDAP') ->setMethods(['userExists', 'getLDAPAccess', 'getConnection', 'getConfiguration']) ->disableOriginalConstructor() @@ -627,7 +627,7 @@ class LDAPProviderTest extends \Test\TestCase { } - public function testGetLDAPGroupMemberAssocUserIDNotFound() { + public function testGetLDAPGroupMemberAssocUserIDNotFound(): void { $this->expectException(\Exception::class); $this->expectExceptionMessage('Group id not found in LDAP'); @@ -648,7 +648,7 @@ class LDAPProviderTest extends \Test\TestCase { $ldapProvider->getLDAPGroupMemberAssoc('nonexisting_group'); } - public function testgetLDAPGroupMemberAssoc() { + public function testgetLDAPGroupMemberAssoc(): void { $userBackend = $this->getMockBuilder('OCA\User_LDAP\User_LDAP') ->disableOriginalConstructor() ->getMock(); @@ -674,7 +674,7 @@ class LDAPProviderTest extends \Test\TestCase { $this->assertEquals('assoc_type', $ldapProvider->getLDAPGroupMemberAssoc('existing_group')); } - public function testGetMultiValueUserAttributeUserNotFound() { + public function testGetMultiValueUserAttributeUserNotFound(): void { $this->expectException(\Exception::class); $this->expectExceptionMessage('User id not found in LDAP'); @@ -690,7 +690,7 @@ class LDAPProviderTest extends \Test\TestCase { $ldapProvider->getMultiValueUserAttribute('admin', 'mailAlias'); } - public function testGetMultiValueUserAttributeCacheHit() { + public function testGetMultiValueUserAttributeCacheHit(): void { $connection = $this->createMock(Connection::class); $connection->expects(self::once()) ->method('getFromCache') @@ -715,7 +715,7 @@ class LDAPProviderTest extends \Test\TestCase { $ldapProvider->getMultiValueUserAttribute('admin', 'mailAlias'); } - public function testGetMultiValueUserAttributeLdapError() { + public function testGetMultiValueUserAttributeLdapError(): void { $connection = $this->createMock(Connection::class); $connection->expects(self::once()) ->method('getFromCache') @@ -752,7 +752,7 @@ class LDAPProviderTest extends \Test\TestCase { self::assertCount(0, $values); } - public function testGetMultiValueUserAttribute() { + public function testGetMultiValueUserAttribute(): void { $connection = $this->createMock(Connection::class); $connection->expects(self::once()) ->method('getFromCache') @@ -789,7 +789,7 @@ class LDAPProviderTest extends \Test\TestCase { self::assertCount(2, $values); } - public function testGetUserAttributeLdapError() { + public function testGetUserAttributeLdapError(): void { $connection = $this->createMock(Connection::class); $connection->expects(self::once()) ->method('getFromCache') @@ -826,7 +826,7 @@ class LDAPProviderTest extends \Test\TestCase { self::assertNull($value); } - public function testGetUserAttribute() { + public function testGetUserAttribute(): void { $connection = $this->createMock(Connection::class); $connection->expects(self::once()) ->method('getFromCache') diff --git a/apps/user_ldap/tests/LDAPTest.php b/apps/user_ldap/tests/LDAPTest.php index 51ed0c2b462..b7349d11b36 100644 --- a/apps/user_ldap/tests/LDAPTest.php +++ b/apps/user_ldap/tests/LDAPTest.php @@ -36,7 +36,7 @@ class LDAPTest extends TestCase { * @param bool $passThrough * @dataProvider errorProvider */ - public function testSearchWithErrorHandler(string $errorMessage, bool $passThrough) { + public function testSearchWithErrorHandler(string $errorMessage, bool $passThrough): void { $wasErrorHandlerCalled = false; $errorHandler = function ($number, $message, $file, $line) use (&$wasErrorHandlerCalled) { $wasErrorHandlerCalled = true; @@ -59,7 +59,7 @@ class LDAPTest extends TestCase { restore_error_handler(); } - public function testModReplace() { + public function testModReplace(): void { $link = $this->createMock(LDAP::class); $userDN = 'CN=user'; $password = 'MyPassword'; diff --git a/apps/user_ldap/tests/Mapping/AbstractMappingTest.php b/apps/user_ldap/tests/Mapping/AbstractMappingTest.php index 478e5ea0395..e0a31c119ba 100644 --- a/apps/user_ldap/tests/Mapping/AbstractMappingTest.php +++ b/apps/user_ldap/tests/Mapping/AbstractMappingTest.php @@ -16,7 +16,7 @@ abstract class AbstractMappingTest extends \Test\TestCase { /** * kiss test on isColNameValid */ - public function testIsColNameValid() { + public function testIsColNameValid(): void { $dbMock = $this->createMock(IDBConnection::class); $mapper = $this->getMapper($dbMock); @@ -84,7 +84,7 @@ abstract class AbstractMappingTest extends \Test\TestCase { * tests map() method with input that should result in not-mapping. * Hint: successful mapping is tested inherently with mapEntries(). */ - public function testMap() { + public function testMap(): void { [$mapper, $data] = $this->initTest(); // test that mapping will not happen when it shall not @@ -104,7 +104,7 @@ abstract class AbstractMappingTest extends \Test\TestCase { * tests unmap() for both successful and unsuccessful removing of * mapping entries */ - public function testUnmap() { + public function testUnmap(): void { [$mapper, $data] = $this->initTest(); foreach ($data as $entry) { @@ -124,7 +124,7 @@ abstract class AbstractMappingTest extends \Test\TestCase { * tests getDNByName(), getNameByDN() and getNameByUUID() for successful * and unsuccessful requests. */ - public function testGetMethods() { + public function testGetMethods(): void { [$mapper, $data] = $this->initTest(); foreach ($data as $entry) { @@ -152,7 +152,7 @@ abstract class AbstractMappingTest extends \Test\TestCase { /** * tests getNamesBySearch() for successful and unsuccessful requests. */ - public function testSearch() { + public function testSearch(): void { [$mapper,] = $this->initTest(); $names = $mapper->getNamesBySearch('oo', '%', '%'); @@ -168,7 +168,7 @@ abstract class AbstractMappingTest extends \Test\TestCase { /** * tests setDNbyUUID() for successful and unsuccessful update. */ - public function testSetDNMethod() { + public function testSetDNMethod(): void { [$mapper, $data] = $this->initTest(); $newDN = 'uid=modified,dc=example,dc=org'; @@ -187,7 +187,7 @@ abstract class AbstractMappingTest extends \Test\TestCase { /** * tests setUUIDbyDN() for successful and unsuccessful update. */ - public function testSetUUIDMethod() { + public function testSetUUIDMethod(): void { /** @var AbstractMapping $mapper */ [$mapper, $data] = $this->initTest(); @@ -207,7 +207,7 @@ abstract class AbstractMappingTest extends \Test\TestCase { /** * tests clear() for successful update. */ - public function testClear() { + public function testClear(): void { [$mapper, $data] = $this->initTest(); $done = $mapper->clear(); @@ -221,7 +221,7 @@ abstract class AbstractMappingTest extends \Test\TestCase { /** * tests clear() for successful update. */ - public function testClearCb() { + public function testClearCb(): void { [$mapper, $data] = $this->initTest(); $callbackCalls = 0; @@ -244,7 +244,7 @@ abstract class AbstractMappingTest extends \Test\TestCase { /** * tests getList() method */ - public function testList() { + public function testList(): void { [$mapper, $data] = $this->initTest(); // get all entries without specifying offset or limit @@ -265,7 +265,7 @@ abstract class AbstractMappingTest extends \Test\TestCase { $this->assertSame(1, count($results)); } - public function testGetListOfIdsByDn() { + public function testGetListOfIdsByDn(): void { /** @var AbstractMapping $mapper */ [$mapper,] = $this->initTest(); diff --git a/apps/user_ldap/tests/Migration/AbstractUUIDFixTest.php b/apps/user_ldap/tests/Migration/AbstractUUIDFixTest.php index 9d433cf4937..f8abcaeb482 100644 --- a/apps/user_ldap/tests/Migration/AbstractUUIDFixTest.php +++ b/apps/user_ldap/tests/Migration/AbstractUUIDFixTest.php @@ -48,7 +48,7 @@ abstract class AbstractUUIDFixTest extends TestCase { ->willReturn($this->access); } - public function testRunSingleRecord() { + public function testRunSingleRecord(): void { $args = [ 'records' => [ 0 => [ @@ -72,7 +72,7 @@ abstract class AbstractUUIDFixTest extends TestCase { $this->job->run($args); } - public function testRunValidRecord() { + public function testRunValidRecord(): void { $correctUUID = '4355-AED3-9D73-03AD'; $args = [ 'records' => [ @@ -95,7 +95,7 @@ abstract class AbstractUUIDFixTest extends TestCase { $this->job->run($args); } - public function testRunRemovedRecord() { + public function testRunRemovedRecord(): void { $args = [ 'records' => [ 0 => [ @@ -117,7 +117,7 @@ abstract class AbstractUUIDFixTest extends TestCase { $this->job->run($args); } - public function testRunManyRecords() { + public function testRunManyRecords(): void { $args = [ 'records' => [ 0 => [ diff --git a/apps/user_ldap/tests/Migration/UUIDFixInsertTest.php b/apps/user_ldap/tests/Migration/UUIDFixInsertTest.php index 78d119bf566..f31da43c584 100644 --- a/apps/user_ldap/tests/Migration/UUIDFixInsertTest.php +++ b/apps/user_ldap/tests/Migration/UUIDFixInsertTest.php @@ -44,7 +44,7 @@ class UUIDFixInsertTest extends TestCase { ); } - public function testGetName() { + public function testGetName(): void { $this->assertSame('Insert UUIDFix background job for user and group in batches', $this->job->getName()); } @@ -97,7 +97,7 @@ class UUIDFixInsertTest extends TestCase { /** * @dataProvider recordProvider */ - public function testRun($userBatches, $groupBatches) { + public function testRun($userBatches, $groupBatches): void { $this->config->expects($this->once()) ->method('getAppValue') ->with('user_ldap', 'installed_version', '1.2.1') @@ -124,7 +124,7 @@ class UUIDFixInsertTest extends TestCase { /** * @dataProvider recordProviderTooLongAndNone */ - public function testRunWithManyAndNone($userBatches, $groupBatches) { + public function testRunWithManyAndNone($userBatches, $groupBatches): void { $this->config->expects($this->once()) ->method('getAppValue') ->with('user_ldap', 'installed_version', '1.2.1') @@ -155,7 +155,7 @@ class UUIDFixInsertTest extends TestCase { $this->job->run($out); } - public function testDonNotRun() { + public function testDonNotRun(): void { $this->config->expects($this->once()) ->method('getAppValue') ->with('user_ldap', 'installed_version', '1.2.1') diff --git a/apps/user_ldap/tests/Settings/AdminTest.php b/apps/user_ldap/tests/Settings/AdminTest.php index 7906a07c3e9..e06563d1856 100644 --- a/apps/user_ldap/tests/Settings/AdminTest.php +++ b/apps/user_ldap/tests/Settings/AdminTest.php @@ -34,7 +34,7 @@ class AdminTest extends TestCase { /** * @UseDB */ - public function testGetForm() { + public function testGetForm(): void { $prefixes = ['s01']; $hosts = ['s01' => '']; @@ -59,11 +59,11 @@ class AdminTest extends TestCase { $this->assertEquals($expected, $this->admin->getForm()); } - public function testGetSection() { + public function testGetSection(): void { $this->assertSame('ldap', $this->admin->getSection()); } - public function testGetPriority() { + public function testGetPriority(): void { $this->assertSame(5, $this->admin->getPriority()); } } diff --git a/apps/user_ldap/tests/Settings/SectionTest.php b/apps/user_ldap/tests/Settings/SectionTest.php index 5fe5476f1c3..722581713d1 100644 --- a/apps/user_ldap/tests/Settings/SectionTest.php +++ b/apps/user_ldap/tests/Settings/SectionTest.php @@ -29,11 +29,11 @@ class SectionTest extends TestCase { ); } - public function testGetID() { + public function testGetID(): void { $this->assertSame('ldap', $this->section->getID()); } - public function testGetName() { + public function testGetName(): void { $this->l ->expects($this->once()) ->method('t') @@ -43,11 +43,11 @@ class SectionTest extends TestCase { $this->assertSame('LDAP/AD integration', $this->section->getName()); } - public function testGetPriority() { + public function testGetPriority(): void { $this->assertSame(25, $this->section->getPriority()); } - public function testGetIcon() { + public function testGetIcon(): void { $this->url->expects($this->once()) ->method('imagePath') ->with('user_ldap', 'app-dark.svg') diff --git a/apps/user_ldap/tests/User/DeletedUsersIndexTest.php b/apps/user_ldap/tests/User/DeletedUsersIndexTest.php index 32fa5bc38bf..0e77f5023d5 100644 --- a/apps/user_ldap/tests/User/DeletedUsersIndexTest.php +++ b/apps/user_ldap/tests/User/DeletedUsersIndexTest.php @@ -54,7 +54,7 @@ class DeletedUsersIndexTest extends \Test\TestCase { parent::tearDown(); } - public function testMarkAndFetchUser() { + public function testMarkAndFetchUser(): void { $uids = [ 'cef3775c-71d2-48eb-8984-39a4051b0b95', '8c4bbb40-33ed-42d0-9b14-85b0ab76c1cc', @@ -82,7 +82,7 @@ class DeletedUsersIndexTest extends \Test\TestCase { $this->assertEmpty($uids); } - public function testUnmarkUser() { + public function testUnmarkUser(): void { $uids = [ '22a162c7-a9ee-487c-9f33-0563795583fb', '1fb4e0da-4a75-47f3-8fa7-becc7e35c9c5', diff --git a/apps/user_ldap/tests/User/ManagerTest.php b/apps/user_ldap/tests/User/ManagerTest.php index 597a2e69a0a..449f159ec4d 100644 --- a/apps/user_ldap/tests/User/ManagerTest.php +++ b/apps/user_ldap/tests/User/ManagerTest.php @@ -114,7 +114,7 @@ class ManagerTest extends \Test\TestCase { /** * @dataProvider dnProvider */ - public function testGetByDNExisting(string $inputDN) { + public function testGetByDNExisting(string $inputDN): void { $uid = '563418fc-423b-1033-8d1c-ad5f418ee02e'; $this->access->expects($this->once()) @@ -139,7 +139,7 @@ class ManagerTest extends \Test\TestCase { $this->assertInstanceOf(User::class, $user); } - public function testGetByDNNotExisting() { + public function testGetByDNNotExisting(): void { $inputDN = 'cn=gone,dc=foobar,dc=bar'; $this->access->expects($this->once()) @@ -161,7 +161,7 @@ class ManagerTest extends \Test\TestCase { $this->assertNull($user); } - public function testGetByUidExisting() { + public function testGetByUidExisting(): void { $dn = 'cn=foo,dc=foobar,dc=bar'; $uid = '563418fc-423b-1033-8d1c-ad5f418ee02e'; @@ -187,7 +187,7 @@ class ManagerTest extends \Test\TestCase { $this->assertInstanceOf(User::class, $user); } - public function testGetByUidNotExisting() { + public function testGetByUidNotExisting(): void { $uid = 'gone'; $this->access->expects($this->never()) @@ -213,7 +213,7 @@ class ManagerTest extends \Test\TestCase { /** * @dataProvider attributeRequestProvider */ - public function testGetAttributes($minimal) { + public function testGetAttributes($minimal): void { $this->connection->setConfiguration([ 'ldapEmailAttribute' => 'MAIL', 'ldapUserAvatarRule' => 'default', diff --git a/apps/user_ldap/tests/User/OfflineUserTest.php b/apps/user_ldap/tests/User/OfflineUserTest.php index 8ac0e617d80..e53bfca7f47 100644 --- a/apps/user_ldap/tests/User/OfflineUserTest.php +++ b/apps/user_ldap/tests/User/OfflineUserTest.php @@ -55,7 +55,7 @@ class OfflineUserTest extends TestCase { /** * @dataProvider shareOwnerProvider */ - public function testHasActiveShares(array $existingShareTypes, bool $expected) { + public function testHasActiveShares(array $existingShareTypes, bool $expected): void { $shareMock = $this->createMock(IShare::class); $this->shareManager->expects($this->atLeastOnce()) diff --git a/apps/user_ldap/tests/User/UserTest.php b/apps/user_ldap/tests/User/UserTest.php index 1d4aeb619b6..aca4e2434e2 100644 --- a/apps/user_ldap/tests/User/UserTest.php +++ b/apps/user_ldap/tests/User/UserTest.php @@ -87,12 +87,12 @@ class UserTest extends \Test\TestCase { ); } - public function testGetDNandUsername() { + public function testGetDNandUsername(): void { $this->assertSame($this->dn, $this->user->getDN()); $this->assertSame($this->uid, $this->user->getUsername()); } - public function testUpdateEmailProvided() { + public function testUpdateEmailProvided(): void { $this->connection->expects($this->once()) ->method('__get') ->with($this->equalTo('ldapEmailAttribute')) @@ -118,7 +118,7 @@ class UserTest extends \Test\TestCase { $this->user->updateEmail(); } - public function testUpdateEmailNotProvided() { + public function testUpdateEmailNotProvided(): void { $this->connection->expects($this->once()) ->method('__get') ->with($this->equalTo('ldapEmailAttribute')) @@ -136,7 +136,7 @@ class UserTest extends \Test\TestCase { $this->user->updateEmail(); } - public function testUpdateEmailNotConfigured() { + public function testUpdateEmailNotConfigured(): void { $this->connection->expects($this->once()) ->method('__get') ->with($this->equalTo('ldapEmailAttribute')) @@ -151,7 +151,7 @@ class UserTest extends \Test\TestCase { $this->user->updateEmail(); } - public function testUpdateQuotaAllProvided() { + public function testUpdateQuotaAllProvided(): void { $this->connection->expects($this->exactly(2)) ->method('__get') ->willReturnMap([ @@ -178,7 +178,7 @@ class UserTest extends \Test\TestCase { $this->user->updateQuota(); } - public function testUpdateQuotaToDefaultAllProvided() { + public function testUpdateQuotaToDefaultAllProvided(): void { $this->connection->expects($this->exactly(2)) ->method('__get') ->willReturnMap([ @@ -205,7 +205,7 @@ class UserTest extends \Test\TestCase { $this->user->updateQuota(); } - public function testUpdateQuotaToNoneAllProvided() { + public function testUpdateQuotaToNoneAllProvided(): void { $this->connection->expects($this->exactly(2)) ->method('__get') ->willReturnMap([ @@ -232,7 +232,7 @@ class UserTest extends \Test\TestCase { $this->user->updateQuota(); } - public function testUpdateQuotaDefaultProvided() { + public function testUpdateQuotaDefaultProvided(): void { $this->connection->expects($this->exactly(2)) ->method('__get') ->willReturnMap([ @@ -259,7 +259,7 @@ class UserTest extends \Test\TestCase { $this->user->updateQuota(); } - public function testUpdateQuotaIndividualProvided() { + public function testUpdateQuotaIndividualProvided(): void { $this->connection->expects($this->exactly(2)) ->method('__get') ->willReturnMap([ @@ -286,7 +286,7 @@ class UserTest extends \Test\TestCase { $this->user->updateQuota(); } - public function testUpdateQuotaNoneProvided() { + public function testUpdateQuotaNoneProvided(): void { $this->connection->expects($this->exactly(2)) ->method('__get') ->willReturnMap([ @@ -314,7 +314,7 @@ class UserTest extends \Test\TestCase { $this->user->updateQuota(); } - public function testUpdateQuotaNoneConfigured() { + public function testUpdateQuotaNoneConfigured(): void { $this->connection->expects($this->exactly(2)) ->method('__get') ->willReturnMap([ @@ -338,7 +338,7 @@ class UserTest extends \Test\TestCase { $this->user->updateQuota(); } - public function testUpdateQuotaFromValue() { + public function testUpdateQuotaFromValue(): void { $readQuota = '19 GB'; $this->connection->expects($this->exactly(2)) @@ -367,7 +367,7 @@ class UserTest extends \Test\TestCase { /** * Unparseable quota will fallback to use the LDAP default */ - public function testUpdateWrongQuotaAllProvided() { + public function testUpdateWrongQuotaAllProvided(): void { $this->connection->expects($this->exactly(2)) ->method('__get') ->willReturnMap([ @@ -397,7 +397,7 @@ class UserTest extends \Test\TestCase { /** * No user quota and wrong default will set 'default' as quota */ - public function testUpdateWrongDefaultQuotaProvided() { + public function testUpdateWrongDefaultQuotaProvided(): void { $this->connection->expects($this->exactly(2)) ->method('__get') ->willReturnMap([ @@ -424,7 +424,7 @@ class UserTest extends \Test\TestCase { /** * Wrong user quota and wrong default will set 'default' as quota */ - public function testUpdateWrongQuotaAndDefaultAllProvided() { + public function testUpdateWrongQuotaAndDefaultAllProvided(): void { $this->connection->expects($this->exactly(2)) ->method('__get') ->willReturnMap([ @@ -451,7 +451,7 @@ class UserTest extends \Test\TestCase { /** * No quota attribute set and wrong default will set 'default' as quota */ - public function testUpdateWrongDefaultQuotaNotProvided() { + public function testUpdateWrongDefaultQuotaNotProvided(): void { $this->connection->expects($this->exactly(2)) ->method('__get') ->willReturnMap([ @@ -529,7 +529,7 @@ class UserTest extends \Test\TestCase { $this->user->updateAvatar(); } - public function testUpdateAvatarKnownJpegPhotoProvided() { + public function testUpdateAvatarKnownJpegPhotoProvided(): void { $this->access->expects($this->once()) ->method('readAttribute') ->with($this->equalTo($this->dn), @@ -647,7 +647,7 @@ class UserTest extends \Test\TestCase { $this->user->updateAvatar(); } - public function testUpdateAvatarCorruptPhotoProvided() { + public function testUpdateAvatarCorruptPhotoProvided(): void { $this->access->expects($this->any()) ->method('readAttribute') ->willReturnCallback(function ($dn, $attr) { @@ -761,7 +761,7 @@ class UserTest extends \Test\TestCase { $this->assertFalse($this->user->updateAvatar()); } - public function testUpdateAvatarNotProvided() { + public function testUpdateAvatarNotProvided(): void { $this->access->expects($this->any()) ->method('readAttribute') ->willReturnCallback(function ($dn, $attr) { @@ -816,7 +816,7 @@ class UserTest extends \Test\TestCase { /** * @dataProvider extStorageHomeDataProvider */ - public function testUpdateExtStorageHome(string $expected, ?string $valueFromLDAP = null, bool $isSet = true) { + public function testUpdateExtStorageHome(string $expected, ?string $valueFromLDAP = null, bool $isSet = true): void { if ($valueFromLDAP === null) { $this->connection->expects($this->once()) ->method('__get') @@ -848,7 +848,7 @@ class UserTest extends \Test\TestCase { $this->assertSame($expected, $actual); } - public function testMarkLogin() { + public function testMarkLogin(): void { $this->config->expects($this->once()) ->method('setUserValue') ->with($this->equalTo($this->uid), @@ -860,7 +860,7 @@ class UserTest extends \Test\TestCase { $this->user->markLogin(); } - public function testGetAvatarImageProvided() { + public function testGetAvatarImageProvided(): void { $this->access->expects($this->once()) ->method('readAttribute') ->with($this->equalTo($this->dn), @@ -878,7 +878,7 @@ class UserTest extends \Test\TestCase { $this->user->getAvatarImage(); } - public function testGetAvatarImageDisabled() { + public function testGetAvatarImageDisabled(): void { $this->access->expects($this->never()) ->method('readAttribute') ->with($this->equalTo($this->dn), $this->anything()); @@ -898,7 +898,7 @@ class UserTest extends \Test\TestCase { ]; } - public function testProcessAttributes() { + public function testProcessAttributes(): void { $requiredMethods = [ 'updateQuota', 'updateEmail', @@ -973,7 +973,7 @@ class UserTest extends \Test\TestCase { /** * @dataProvider emptyHomeFolderAttributeValueProvider */ - public function testGetHomePathNotConfigured($attributeValue) { + public function testGetHomePathNotConfigured($attributeValue): void { $this->connection->expects($this->any()) ->method('__get') ->with($this->equalTo('homeFolderNamingRule')) @@ -989,7 +989,7 @@ class UserTest extends \Test\TestCase { $this->assertFalse($this->user->getHomePath()); } - public function testGetHomePathConfiguredNotAvailableAllowed() { + public function testGetHomePathConfiguredNotAvailableAllowed(): void { $this->connection->expects($this->any()) ->method('__get') ->with($this->equalTo('homeFolderNamingRule')) @@ -1013,7 +1013,7 @@ class UserTest extends \Test\TestCase { } - public function testGetHomePathConfiguredNotAvailableNotAllowed() { + public function testGetHomePathConfiguredNotAvailableNotAllowed(): void { $this->expectException(\Exception::class); $this->connection->expects($this->any()) @@ -1050,7 +1050,7 @@ class UserTest extends \Test\TestCase { /** * @dataProvider displayNameProvider */ - public function testComposeAndStoreDisplayName($part1, $part2, $expected, $expectTriggerChange) { + public function testComposeAndStoreDisplayName($part1, $part2, $expected, $expectTriggerChange): void { $this->config->expects($this->once()) ->method('setUserValue'); $oldName = $expectTriggerChange ? 'xxGunslingerxx' : null; @@ -1076,7 +1076,7 @@ class UserTest extends \Test\TestCase { $this->assertSame($expected, $displayName); } - public function testComposeAndStoreDisplayNameNoOverwrite() { + public function testComposeAndStoreDisplayNameNoOverwrite(): void { $displayName = 'Randall Flagg'; $this->config->expects($this->never()) ->method('setUserValue'); @@ -1091,7 +1091,7 @@ class UserTest extends \Test\TestCase { $this->assertSame($composedDisplayName, $displayName); } - public function testHandlePasswordExpiryWarningDefaultPolicy() { + public function testHandlePasswordExpiryWarningDefaultPolicy(): void { $this->connection->expects($this->any()) ->method('__get') ->willReturnCallback(function ($name) { @@ -1154,7 +1154,7 @@ class UserTest extends \Test\TestCase { \OC_Hook::emit('OC_User', 'post_login', ['uid' => $this->uid]); } - public function testHandlePasswordExpiryWarningCustomPolicy() { + public function testHandlePasswordExpiryWarningCustomPolicy(): void { $this->connection->expects($this->any()) ->method('__get') ->willReturnCallback(function ($name) { diff --git a/apps/user_ldap/tests/UserLDAPPluginTest.php b/apps/user_ldap/tests/UserLDAPPluginTest.php index 1e3cd6afbf8..5f11f817771 100644 --- a/apps/user_ldap/tests/UserLDAPPluginTest.php +++ b/apps/user_ldap/tests/UserLDAPPluginTest.php @@ -17,7 +17,7 @@ class UserLDAPPluginTest extends \Test\TestCase { return new UserPluginManager(); } - public function testImplementsActions() { + public function testImplementsActions(): void { $pluginManager = $this->getUserPluginManager(); $plugin = $this->getMockBuilder('OCA\User_LDAP\Tests\LDAPUserPluginDummy') @@ -44,7 +44,7 @@ class UserLDAPPluginTest extends \Test\TestCase { $this->assertTrue($pluginManager->implementsActions(Backend::PROVIDE_AVATAR)); } - public function testCreateUser() { + public function testCreateUser(): void { $pluginManager = $this->getUserPluginManager(); $plugin = $this->getMockBuilder('OCA\User_LDAP\Tests\LDAPUserPluginDummy') @@ -67,7 +67,7 @@ class UserLDAPPluginTest extends \Test\TestCase { } - public function testCreateUserNotRegistered() { + public function testCreateUserNotRegistered(): void { $this->expectException(\Exception::class); $this->expectExceptionMessage('No plugin implements createUser in this LDAP Backend.'); @@ -75,7 +75,7 @@ class UserLDAPPluginTest extends \Test\TestCase { $pluginManager->createUser('foo', 'bar'); } - public function testSetPassword() { + public function testSetPassword(): void { $pluginManager = $this->getUserPluginManager(); $plugin = $this->getMockBuilder('OCA\User_LDAP\Tests\LDAPUserPluginDummy') @@ -98,7 +98,7 @@ class UserLDAPPluginTest extends \Test\TestCase { } - public function testSetPasswordNotRegistered() { + public function testSetPasswordNotRegistered(): void { $this->expectException(\Exception::class); $this->expectExceptionMessage('No plugin implements setPassword in this LDAP Backend.'); @@ -106,7 +106,7 @@ class UserLDAPPluginTest extends \Test\TestCase { $pluginManager->setPassword('foo', 'bar'); } - public function testGetHome() { + public function testGetHome(): void { $pluginManager = $this->getUserPluginManager(); $plugin = $this->getMockBuilder('OCA\User_LDAP\Tests\LDAPUserPluginDummy') @@ -128,7 +128,7 @@ class UserLDAPPluginTest extends \Test\TestCase { } - public function testGetHomeNotRegistered() { + public function testGetHomeNotRegistered(): void { $this->expectException(\Exception::class); $this->expectExceptionMessage('No plugin implements getHome in this LDAP Backend.'); @@ -136,7 +136,7 @@ class UserLDAPPluginTest extends \Test\TestCase { $pluginManager->getHome('foo'); } - public function testGetDisplayName() { + public function testGetDisplayName(): void { $pluginManager = $this->getUserPluginManager(); $plugin = $this->getMockBuilder('OCA\User_LDAP\Tests\LDAPUserPluginDummy') @@ -158,7 +158,7 @@ class UserLDAPPluginTest extends \Test\TestCase { } - public function testGetDisplayNameNotRegistered() { + public function testGetDisplayNameNotRegistered(): void { $this->expectException(\Exception::class); $this->expectExceptionMessage('No plugin implements getDisplayName in this LDAP Backend.'); @@ -166,7 +166,7 @@ class UserLDAPPluginTest extends \Test\TestCase { $pluginManager->getDisplayName('foo'); } - public function testSetDisplayName() { + public function testSetDisplayName(): void { $pluginManager = $this->getUserPluginManager(); $plugin = $this->getMockBuilder('OCA\User_LDAP\Tests\LDAPUserPluginDummy') @@ -189,7 +189,7 @@ class UserLDAPPluginTest extends \Test\TestCase { } - public function testSetDisplayNameNotRegistered() { + public function testSetDisplayNameNotRegistered(): void { $this->expectException(\Exception::class); $this->expectExceptionMessage('No plugin implements setDisplayName in this LDAP Backend.'); @@ -197,7 +197,7 @@ class UserLDAPPluginTest extends \Test\TestCase { $pluginManager->setDisplayName('foo', 'bar'); } - public function testCanChangeAvatar() { + public function testCanChangeAvatar(): void { $pluginManager = $this->getUserPluginManager(); $plugin = $this->getMockBuilder('OCA\User_LDAP\Tests\LDAPUserPluginDummy') @@ -219,7 +219,7 @@ class UserLDAPPluginTest extends \Test\TestCase { } - public function testCanChangeAvatarNotRegistered() { + public function testCanChangeAvatarNotRegistered(): void { $this->expectException(\Exception::class); $this->expectExceptionMessage('No plugin implements canChangeAvatar in this LDAP Backend.'); @@ -227,7 +227,7 @@ class UserLDAPPluginTest extends \Test\TestCase { $pluginManager->canChangeAvatar('foo'); } - public function testCountUsers() { + public function testCountUsers(): void { $pluginManager = $this->getUserPluginManager(); $plugin = $this->getMockBuilder('OCA\User_LDAP\Tests\LDAPUserPluginDummy') @@ -246,7 +246,7 @@ class UserLDAPPluginTest extends \Test\TestCase { } - public function testCountUsersNotRegistered() { + public function testCountUsersNotRegistered(): void { $this->expectException(\Exception::class); $this->expectExceptionMessage('No plugin implements countUsers in this LDAP Backend.'); @@ -254,7 +254,7 @@ class UserLDAPPluginTest extends \Test\TestCase { $pluginManager->countUsers(); } - public function testDeleteUser() { + public function testDeleteUser(): void { $pluginManager = $this->getUserPluginManager(); $plugin = $this->getMockBuilder('OCA\User_LDAP\Tests\LDAPUserPluginDummy') @@ -282,7 +282,7 @@ class UserLDAPPluginTest extends \Test\TestCase { } - public function testDeleteUserNotRegistered() { + public function testDeleteUserNotRegistered(): void { $this->expectException(\Exception::class); $this->expectExceptionMessage('No plugin implements deleteUser in this LDAP Backend.'); diff --git a/apps/user_ldap/tests/User_LDAPTest.php b/apps/user_ldap/tests/User_LDAPTest.php index 8d6a56112ce..90166beccff 100644 --- a/apps/user_ldap/tests/User_LDAPTest.php +++ b/apps/user_ldap/tests/User_LDAPTest.php @@ -170,7 +170,7 @@ class User_LDAPTest extends TestCase { ->willReturn(['dn', 'uid', 'mail', 'displayname']); } - public function testCheckPasswordUidReturn() { + public function testCheckPasswordUidReturn(): void { $user = $this->createMock(User::class); $user->expects($this->any()) ->method('getUsername') @@ -189,7 +189,7 @@ class User_LDAPTest extends TestCase { $this->assertEquals('gunslinger', $result); } - public function testCheckPasswordWrongPassword() { + public function testCheckPasswordWrongPassword(): void { $this->prepareAccessForCheckPassword(); $backend = new UserLDAP($this->access, $this->notificationManager, $this->pluginManager, $this->logger, $this->deletedUsersIndex); \OC_User::useBackend($backend); @@ -198,7 +198,7 @@ class User_LDAPTest extends TestCase { $this->assertFalse($result); } - public function testCheckPasswordWrongUser() { + public function testCheckPasswordWrongUser(): void { $this->prepareAccessForCheckPassword(); $backend = new UserLDAP($this->access, $this->notificationManager, $this->pluginManager, $this->logger, $this->deletedUsersIndex); \OC_User::useBackend($backend); @@ -207,7 +207,7 @@ class User_LDAPTest extends TestCase { $this->assertFalse($result); } - public function testCheckPasswordNoDisplayName() { + public function testCheckPasswordNoDisplayName(): void { $this->prepareAccessForCheckPassword(true); $this->prepareAccessForCheckPassword(); @@ -222,7 +222,7 @@ class User_LDAPTest extends TestCase { $this->assertFalse($result); } - public function testCheckPasswordPublicAPI() { + public function testCheckPasswordPublicAPI(): void { $user = $this->createMock(User::class); $user->expects($this->any()) ->method('getUsername') @@ -244,7 +244,7 @@ class User_LDAPTest extends TestCase { $this->assertEquals('gunslinger', $result); } - public function testCheckPasswordPublicAPIWrongPassword() { + public function testCheckPasswordPublicAPIWrongPassword(): void { $this->prepareAccessForCheckPassword(); $backend = new UserLDAP($this->access, $this->notificationManager, $this->pluginManager, $this->logger, $this->deletedUsersIndex); \OC_User::useBackend($backend); @@ -257,7 +257,7 @@ class User_LDAPTest extends TestCase { $this->assertFalse($result); } - public function testCheckPasswordPublicAPIWrongUser() { + public function testCheckPasswordPublicAPIWrongUser(): void { $this->prepareAccessForCheckPassword(); $backend = new UserLDAP($this->access, $this->notificationManager, $this->pluginManager, $this->logger, $this->deletedUsersIndex); \OC_User::useBackend($backend); @@ -270,13 +270,13 @@ class User_LDAPTest extends TestCase { $this->assertFalse($result); } - public function testDeleteUserCancel() { + public function testDeleteUserCancel(): void { $backend = new UserLDAP($this->access, $this->notificationManager, $this->pluginManager, $this->logger, $this->deletedUsersIndex); $result = $backend->deleteUser('notme'); $this->assertFalse($result); } - public function testDeleteUserSuccess() { + public function testDeleteUserSuccess(): void { $uid = 'jeremy'; $home = '/var/vhome/jdings/'; @@ -316,7 +316,7 @@ class User_LDAPTest extends TestCase { $this->assertSame($backend->getHome($uid), $home); } - public function testDeleteUserWithPlugin() { + public function testDeleteUserWithPlugin(): void { $this->pluginManager->expects($this->once()) ->method('canDeleteUser') ->willReturn(true); @@ -395,7 +395,7 @@ class User_LDAPTest extends TestCase { ->willReturn(['dn', 'uid', 'mail', 'displayname']); } - public function testGetUsersNoParam() { + public function testGetUsersNoParam(): void { $this->prepareAccessForGetUsers(); $backend = new UserLDAP($this->access, $this->notificationManager, $this->pluginManager, $this->logger, $this->deletedUsersIndex); @@ -403,7 +403,7 @@ class User_LDAPTest extends TestCase { $this->assertEquals(3, count($result)); } - public function testGetUsersLimitOffset() { + public function testGetUsersLimitOffset(): void { $this->prepareAccessForGetUsers(); $backend = new UserLDAP($this->access, $this->notificationManager, $this->pluginManager, $this->logger, $this->deletedUsersIndex); @@ -411,7 +411,7 @@ class User_LDAPTest extends TestCase { $this->assertEquals(1, count($result)); } - public function testGetUsersLimitOffset2() { + public function testGetUsersLimitOffset2(): void { $this->prepareAccessForGetUsers(); $backend = new UserLDAP($this->access, $this->notificationManager, $this->pluginManager, $this->logger, $this->deletedUsersIndex); @@ -419,7 +419,7 @@ class User_LDAPTest extends TestCase { $this->assertEquals(2, count($result)); } - public function testGetUsersSearchWithResult() { + public function testGetUsersSearchWithResult(): void { $this->prepareAccessForGetUsers(); $backend = new UserLDAP($this->access, $this->notificationManager, $this->pluginManager, $this->logger, $this->deletedUsersIndex); @@ -427,7 +427,7 @@ class User_LDAPTest extends TestCase { $this->assertEquals(2, count($result)); } - public function testGetUsersSearchEmptyResult() { + public function testGetUsersSearchEmptyResult(): void { $this->prepareAccessForGetUsers(); $backend = new UserLDAP($this->access, $this->notificationManager, $this->pluginManager, $this->logger, $this->deletedUsersIndex); @@ -443,7 +443,7 @@ class User_LDAPTest extends TestCase { return $uids; } - public function testGetUsersViaAPINoParam() { + public function testGetUsersViaAPINoParam(): void { $this->prepareAccessForGetUsers(); $backend = new UserLDAP($this->access, $this->notificationManager, $this->pluginManager, $this->logger, $this->deletedUsersIndex); \OC_User::useBackend($backend); @@ -452,7 +452,7 @@ class User_LDAPTest extends TestCase { $this->assertEquals(3, count($result)); } - public function testGetUsersViaAPILimitOffset() { + public function testGetUsersViaAPILimitOffset(): void { $this->prepareAccessForGetUsers(); $backend = new UserLDAP($this->access, $this->notificationManager, $this->pluginManager, $this->logger, $this->deletedUsersIndex); \OC_User::useBackend($backend); @@ -461,7 +461,7 @@ class User_LDAPTest extends TestCase { $this->assertEquals(1, count($result)); } - public function testGetUsersViaAPILimitOffset2() { + public function testGetUsersViaAPILimitOffset2(): void { $this->prepareAccessForGetUsers(); $backend = new UserLDAP($this->access, $this->notificationManager, $this->pluginManager, $this->logger, $this->deletedUsersIndex); \OC_User::useBackend($backend); @@ -470,7 +470,7 @@ class User_LDAPTest extends TestCase { $this->assertEquals(2, count($result)); } - public function testGetUsersViaAPISearchWithResult() { + public function testGetUsersViaAPISearchWithResult(): void { $this->prepareAccessForGetUsers(); $backend = new UserLDAP($this->access, $this->notificationManager, $this->pluginManager, $this->logger, $this->deletedUsersIndex); \OC_User::useBackend($backend); @@ -479,7 +479,7 @@ class User_LDAPTest extends TestCase { $this->assertEquals(2, count($result)); } - public function testGetUsersViaAPISearchEmptyResult() { + public function testGetUsersViaAPISearchEmptyResult(): void { $this->prepareAccessForGetUsers(); $backend = new UserLDAP($this->access, $this->notificationManager, $this->pluginManager, $this->logger, $this->deletedUsersIndex); \OC_User::useBackend($backend); @@ -488,7 +488,7 @@ class User_LDAPTest extends TestCase { $this->assertEquals(0, count($result)); } - public function testUserExists() { + public function testUserExists(): void { $backend = new UserLDAP($this->access, $this->notificationManager, $this->pluginManager, $this->logger, $this->deletedUsersIndex); $this->prepareMockForUserExists(); @@ -510,7 +510,7 @@ class User_LDAPTest extends TestCase { $this->assertTrue($result); } - public function testUserExistsForDeleted() { + public function testUserExistsForDeleted(): void { $backend = new UserLDAP($this->access, $this->notificationManager, $this->pluginManager, $this->logger, $this->deletedUsersIndex); $this->prepareMockForUserExists(); @@ -535,7 +535,7 @@ class User_LDAPTest extends TestCase { $this->assertTrue($backend->userExists('formerUser')); } - public function testUserExistsForNeverExisting() { + public function testUserExistsForNeverExisting(): void { $backend = new UserLDAP($this->access, $this->notificationManager, $this->pluginManager, $this->logger, $this->deletedUsersIndex); $this->prepareMockForUserExists(); @@ -554,7 +554,7 @@ class User_LDAPTest extends TestCase { $this->assertFalse($result); } - public function testUserExistsPublicAPI() { + public function testUserExistsPublicAPI(): void { $backend = new UserLDAP($this->access, $this->notificationManager, $this->pluginManager, $this->logger, $this->deletedUsersIndex); $this->prepareMockForUserExists(); \OC_User::useBackend($backend); @@ -587,7 +587,7 @@ class User_LDAPTest extends TestCase { $this->assertTrue($result); } - public function testDeleteUserExisting() { + public function testDeleteUserExisting(): void { $backend = new UserLDAP($this->access, $this->notificationManager, $this->pluginManager, $this->logger, $this->deletedUsersIndex); //we do not support deleting existing users at all @@ -595,7 +595,7 @@ class User_LDAPTest extends TestCase { $this->assertFalse($result); } - public function testGetHomeAbsolutePath() { + public function testGetHomeAbsolutePath(): void { $backend = new UserLDAP($this->access, $this->notificationManager, $this->pluginManager, $this->logger, $this->deletedUsersIndex); $this->prepareMockForUserExists(); @@ -649,7 +649,7 @@ class User_LDAPTest extends TestCase { $this->assertEquals('/tmp/rolandshome/', $result); } - public function testGetHomeRelative() { + public function testGetHomeRelative(): void { $backend = new UserLDAP($this->access, $this->notificationManager, $this->pluginManager, $this->logger, $this->deletedUsersIndex); $this->prepareMockForUserExists(); @@ -705,7 +705,7 @@ class User_LDAPTest extends TestCase { } - public function testGetHomeNoPath() { + public function testGetHomeNoPath(): void { $this->expectException(\Exception::class); $backend = new UserLDAP($this->access, $this->notificationManager, $this->pluginManager, $this->logger, $this->deletedUsersIndex); @@ -750,7 +750,7 @@ class User_LDAPTest extends TestCase { $this->assertFalse($result); } - public function testGetHomeDeletedUser() { + public function testGetHomeDeletedUser(): void { $uid = 'newyorker'; $backend = new UserLDAP($this->access, $this->notificationManager, $this->pluginManager, $this->logger, $this->deletedUsersIndex); @@ -793,7 +793,7 @@ class User_LDAPTest extends TestCase { $this->assertFalse($result); } - public function testGetHomeWithPlugin() { + public function testGetHomeWithPlugin(): void { $this->pluginManager->expects($this->once()) ->method('implementsActions') ->with(Backend::GET_HOME) @@ -844,7 +844,7 @@ class User_LDAPTest extends TestCase { ->willReturn([]); } - public function testGetDisplayName() { + public function testGetDisplayName(): void { $this->prepareAccessForGetDisplayName(); $backend = new UserLDAP($this->access, $this->notificationManager, $this->pluginManager, $this->logger, $this->deletedUsersIndex); $this->prepareMockForUserExists(); @@ -915,7 +915,7 @@ class User_LDAPTest extends TestCase { $this->assertEquals(null, $result); } - public function testGetDisplayNamePublicAPI() { + public function testGetDisplayNamePublicAPI(): void { $this->access->expects($this->any()) ->method('username2dn') ->willReturnCallback(function ($uid) { @@ -1008,7 +1008,7 @@ class User_LDAPTest extends TestCase { $this->assertEquals('newyorker', $result); } - public function testGetDisplayNameWithPlugin() { + public function testGetDisplayNameWithPlugin(): void { $this->pluginManager->expects($this->once()) ->method('implementsActions') ->with(Backend::GET_DISPLAYNAME) @@ -1024,7 +1024,7 @@ class User_LDAPTest extends TestCase { //no test for getDisplayNames, because it just invokes getUsers and //getDisplayName - public function testCountUsers() { + public function testCountUsers(): void { $this->access->expects($this->once()) ->method('countUsers') ->willReturn(5); @@ -1035,7 +1035,7 @@ class User_LDAPTest extends TestCase { $this->assertEquals(5, $result); } - public function testCountUsersFailing() { + public function testCountUsersFailing(): void { $this->access->expects($this->once()) ->method('countUsers') ->willReturn(false); @@ -1046,7 +1046,7 @@ class User_LDAPTest extends TestCase { $this->assertFalse($result); } - public function testCountUsersWithPlugin() { + public function testCountUsersWithPlugin(): void { $this->pluginManager->expects($this->once()) ->method('implementsActions') ->with(Backend::COUNT_USERS) @@ -1058,7 +1058,7 @@ class User_LDAPTest extends TestCase { $this->assertEquals($this->backend->countUsers(), 42); } - public function testLoginName2UserNameSuccess() { + public function testLoginName2UserNameSuccess(): void { $loginName = 'Alice'; $username = 'alice'; $dn = 'uid=alice,dc=what,dc=ever'; @@ -1107,7 +1107,7 @@ class User_LDAPTest extends TestCase { $backend->loginName2UserName($loginName); } - public function testLoginName2UserNameNoUsersOnLDAP() { + public function testLoginName2UserNameNoUsersOnLDAP(): void { $loginName = 'Loki'; $this->access->expects($this->once()) @@ -1139,7 +1139,7 @@ class User_LDAPTest extends TestCase { $backend->loginName2UserName($loginName); } - public function testLoginName2UserNameOfflineUser() { + public function testLoginName2UserNameOfflineUser(): void { $loginName = 'Alice'; $dn = 'uid=alice,dc=what,dc=ever'; @@ -1237,7 +1237,7 @@ class User_LDAPTest extends TestCase { } - public function testSetPasswordInvalid() { + public function testSetPasswordInvalid(): void { $this->expectException(\OCP\HintException::class); $this->expectExceptionMessage('Password fails quality checking policy'); @@ -1251,7 +1251,7 @@ class User_LDAPTest extends TestCase { $this->assertTrue(\OC_User::setPassword('roland', 'dt')); } - public function testSetPasswordValid() { + public function testSetPasswordValid(): void { $this->prepareAccessForSetPassword($this->access); $this->userManager->expects($this->any()) @@ -1268,7 +1268,7 @@ class User_LDAPTest extends TestCase { $this->assertTrue(\OC_User::setPassword('roland', 'dt12234$')); } - public function testSetPasswordValidDisabled() { + public function testSetPasswordValidDisabled(): void { $this->userManager->expects($this->any()) ->method('get') ->willReturn($this->createMock(User::class)); @@ -1281,7 +1281,7 @@ class User_LDAPTest extends TestCase { } - public function testSetPasswordWithInvalidUser() { + public function testSetPasswordWithInvalidUser(): void { $this->expectException(\Exception::class); $this->expectExceptionMessage('LDAP setPassword: Could not get user object for uid NotExistingUser. Maybe the LDAP entry has no set display name attribute?'); @@ -1294,7 +1294,7 @@ class User_LDAPTest extends TestCase { $this->backend->setPassword('NotExistingUser', 'Password'); } - public function testSetPasswordWithUsernameFalse() { + public function testSetPasswordWithUsernameFalse(): void { $user = $this->createMock(User::class); $user ->expects($this->once()) @@ -1310,7 +1310,7 @@ class User_LDAPTest extends TestCase { $this->assertFalse($this->backend->setPassword('NotExistingUser', 'Password')); } - public function testSetPasswordWithPlugin() { + public function testSetPasswordWithPlugin(): void { $this->pluginManager->expects($this->once()) ->method('implementsActions') ->with(Backend::SET_PASSWORD) @@ -1333,7 +1333,7 @@ class User_LDAPTest extends TestCase { } /** @dataProvider avatarDataProvider */ - public function testCanChangeAvatar($imageData, $expected) { + public function testCanChangeAvatar($imageData, $expected): void { $isValidImage = str_starts_with((string)$imageData, 'valid'); $user = $this->createMock(User::class); @@ -1352,7 +1352,7 @@ class User_LDAPTest extends TestCase { $this->assertSame($expected, $this->backend->canChangeAvatar('uid')); } - public function testCanChangeAvatarWithPlugin() { + public function testCanChangeAvatarWithPlugin(): void { $this->pluginManager->expects($this->once()) ->method('implementsActions') ->with(Backend::PROVIDE_AVATAR) @@ -1365,7 +1365,7 @@ class User_LDAPTest extends TestCase { $this->assertEquals($this->backend->canChangeAvatar('uid'), 'result'); } - public function testSetDisplayNameWithPlugin() { + public function testSetDisplayNameWithPlugin(): void { $newDisplayName = 'J. Baker'; $this->pluginManager->expects($this->once()) ->method('implementsActions') @@ -1382,7 +1382,7 @@ class User_LDAPTest extends TestCase { } - public function testSetDisplayNameErrorWithPlugin() { + public function testSetDisplayNameErrorWithPlugin(): void { $this->expectException(\OCP\HintException::class); $newDisplayName = 'J. Baker'; @@ -1400,7 +1400,7 @@ class User_LDAPTest extends TestCase { $this->backend->setDisplayName('uid', $newDisplayName); } - public function testSetDisplayNameFailing() { + public function testSetDisplayNameFailing(): void { $this->pluginManager->expects($this->once()) ->method('implementsActions') ->with(Backend::SET_DISPLAYNAME) @@ -1411,7 +1411,7 @@ class User_LDAPTest extends TestCase { $this->assertFalse($this->backend->setDisplayName('uid', 'displayName')); } - public function testCreateUserWithPlugin() { + public function testCreateUserWithPlugin(): void { $uid = 'alien6372'; $uuid = '123-2345-36756-123-2345234-4431'; $pwd = 'passwørd'; @@ -1438,7 +1438,7 @@ class User_LDAPTest extends TestCase { $this->assertEquals($this->backend->createUser($uid, $pwd), true); } - public function testCreateUserFailing() { + public function testCreateUserFailing(): void { $this->pluginManager->expects($this->once()) ->method('implementsActions') ->with(Backend::CREATE_USER) @@ -1460,7 +1460,7 @@ class User_LDAPTest extends TestCase { /** * @dataProvider actionProvider */ - public function testImplementsAction($configurable, $value, $actionCode, $expected) { + public function testImplementsAction($configurable, $value, $actionCode, $expected): void { $this->pluginManager->expects($this->once()) ->method('getImplementedActions') ->willReturn(0); diff --git a/apps/user_ldap/tests/User_ProxyTest.php b/apps/user_ldap/tests/User_ProxyTest.php index 5af7fef3f00..4544276a714 100644 --- a/apps/user_ldap/tests/User_ProxyTest.php +++ b/apps/user_ldap/tests/User_ProxyTest.php @@ -58,7 +58,7 @@ class User_ProxyTest extends TestCase { ->getMock(); } - public function testSetPassword() { + public function testSetPassword(): void { $this->proxy ->expects($this->once()) ->method('handleRequest') @@ -68,7 +68,7 @@ class User_ProxyTest extends TestCase { $this->assertTrue($this->proxy->setPassword('MyUid', 'MyPassword')); } - public function testSetDisplayName() { + public function testSetDisplayName(): void { $this->proxy ->expects($this->once()) ->method('handleRequest') @@ -78,7 +78,7 @@ class User_ProxyTest extends TestCase { $this->assertTrue($this->proxy->setDisplayName('MyUid', 'MyPassword')); } - public function testCreateUser() { + public function testCreateUser(): void { $this->proxy ->expects($this->once()) ->method('handleRequest') diff --git a/apps/user_ldap/tests/WizardTest.php b/apps/user_ldap/tests/WizardTest.php index d3cf6ffb0ae..31fd28e2fa1 100644 --- a/apps/user_ldap/tests/WizardTest.php +++ b/apps/user_ldap/tests/WizardTest.php @@ -75,7 +75,7 @@ class WizardTest extends TestCase { ->willReturn(true); } - public function testCumulativeSearchOnAttributeLimited() { + public function testCumulativeSearchOnAttributeLimited(): void { [$wizard, $configuration, $ldap] = $this->getWizardAndMocks(); $configuration->expects($this->any()) @@ -135,7 +135,7 @@ class WizardTest extends TestCase { unset($uidnumber); } - public function testCumulativeSearchOnAttributeUnlimited() { + public function testCumulativeSearchOnAttributeUnlimited(): void { [$wizard, $configuration, $ldap] = $this->getWizardAndMocks(); $configuration->expects($this->any()) @@ -211,7 +211,7 @@ class WizardTest extends TestCase { unset($uidnumber); } - public function testDetectEmailAttributeAlreadySet() { + public function testDetectEmailAttributeAlreadySet(): void { [$wizard, $configuration, $ldap, $access] = $this->getWizardAndMocks(); @@ -233,7 +233,7 @@ class WizardTest extends TestCase { $wizard->detectEmailAttribute(); } - public function testDetectEmailAttributeOverrideSet() { + public function testDetectEmailAttributeOverrideSet(): void { [$wizard, $configuration, $ldap, $access] = $this->getWizardAndMocks(); @@ -272,7 +272,7 @@ class WizardTest extends TestCase { $result['changes']['ldap_email_attr']); } - public function testDetectEmailAttributeFind() { + public function testDetectEmailAttributeFind(): void { [$wizard, $configuration, $ldap, $access] = $this->getWizardAndMocks(); @@ -311,7 +311,7 @@ class WizardTest extends TestCase { $result['changes']['ldap_email_attr']); } - public function testDetectEmailAttributeFindNothing() { + public function testDetectEmailAttributeFindNothing(): void { [$wizard, $configuration, $ldap, $access] = $this->getWizardAndMocks(); @@ -349,7 +349,7 @@ class WizardTest extends TestCase { $this->assertSame(false, $result->hasChanges()); } - public function testCumulativeSearchOnAttributeSkipReadDN() { + public function testCumulativeSearchOnAttributeSkipReadDN(): void { // tests that there is no infinite loop, when skipping already processed // DNs (they can be returned multiple times for multiple filters ) [$wizard, $configuration, $ldap] = $this->getWizardAndMocks(); diff --git a/apps/user_status/tests/Unit/BackgroundJob/ClearOldStatusesBackgroundJobTest.php b/apps/user_status/tests/Unit/BackgroundJob/ClearOldStatusesBackgroundJobTest.php index d5c744b614e..90c85bcdaac 100644 --- a/apps/user_status/tests/Unit/BackgroundJob/ClearOldStatusesBackgroundJobTest.php +++ b/apps/user_status/tests/Unit/BackgroundJob/ClearOldStatusesBackgroundJobTest.php @@ -33,7 +33,7 @@ class ClearOldStatusesBackgroundJobTest extends TestCase { $this->job = new ClearOldStatusesBackgroundJob($this->time, $this->mapper); } - public function testRun() { + public function testRun(): void { $this->mapper->expects($this->once()) ->method('clearOlderThanClearAt') ->with(1337); diff --git a/apps/user_status/tests/Unit/Connector/UserStatusTest.php b/apps/user_status/tests/Unit/Connector/UserStatusTest.php index 8cc730b9836..fee9b4e4b89 100644 --- a/apps/user_status/tests/Unit/Connector/UserStatusTest.php +++ b/apps/user_status/tests/Unit/Connector/UserStatusTest.php @@ -13,7 +13,7 @@ use OCA\UserStatus\Db; use Test\TestCase; class UserStatusTest extends TestCase { - public function testUserStatus() { + public function testUserStatus(): void { $status = new Db\UserStatus(); $status->setUserId('user2'); $status->setStatus('away'); @@ -34,7 +34,7 @@ class UserStatusTest extends TestCase { $this->assertEquals('60000', $dateTime->format('U')); } - public function testUserStatusInvisible() { + public function testUserStatusInvisible(): void { $status = new Db\UserStatus(); $status->setUserId('user2'); $status->setStatus('invisible'); diff --git a/apps/user_status/tests/Unit/Controller/PredefinedStatusControllerTest.php b/apps/user_status/tests/Unit/Controller/PredefinedStatusControllerTest.php index 67670f56e5c..5709cdc89cf 100644 --- a/apps/user_status/tests/Unit/Controller/PredefinedStatusControllerTest.php +++ b/apps/user_status/tests/Unit/Controller/PredefinedStatusControllerTest.php @@ -31,7 +31,7 @@ class PredefinedStatusControllerTest extends TestCase { $this->service); } - public function testFindAll() { + public function testFindAll(): void { $this->service->expects($this->once()) ->method('getDefaultStatuses') ->with() diff --git a/apps/webhook_listeners/tests/Db/WebhookListenerMapperTest.php b/apps/webhook_listeners/tests/Db/WebhookListenerMapperTest.php index bf39d4779ea..aefed2961ea 100644 --- a/apps/webhook_listeners/tests/Db/WebhookListenerMapperTest.php +++ b/apps/webhook_listeners/tests/Db/WebhookListenerMapperTest.php @@ -48,7 +48,7 @@ class WebhookListenerMapperTest extends TestCase { $query->delete(WebhookListenerMapper::TABLE_NAME)->executeStatement(); } - public function testInsertListenerWithNotSupportedEvent() { + public function testInsertListenerWithNotSupportedEvent(): void { $this->expectException(\UnexpectedValueException::class); $listener1 = $this->mapper->addWebhookListener( null, @@ -64,7 +64,7 @@ class WebhookListenerMapperTest extends TestCase { ); } - public function testInsertListenerAndGetIt() { + public function testInsertListenerAndGetIt(): void { $listener1 = $this->mapper->addWebhookListener( null, 'bob', @@ -84,7 +84,7 @@ class WebhookListenerMapperTest extends TestCase { $this->assertEquals($listener1, $listener2); } - public function testInsertListenerAndGetItByUri() { + public function testInsertListenerAndGetItByUri(): void { $uri = 'https://webhook.example.com/endpoint'; $listener1 = $this->mapper->addWebhookListener( null, @@ -105,7 +105,7 @@ class WebhookListenerMapperTest extends TestCase { $this->assertContains($listener1->getId(), array_map(fn ($listener) => $listener->getId(), $listeners)); } - public function testInsertListenerAndGetItWithAuthData() { + public function testInsertListenerAndGetItWithAuthData(): void { $listener1 = $this->mapper->addWebhookListener( null, 'bob', @@ -125,7 +125,7 @@ class WebhookListenerMapperTest extends TestCase { $this->assertEquals($listener1, $listener2); } - public function testInsertListenerAndGetItByEventAndUser() { + public function testInsertListenerAndGetItByEventAndUser(): void { $listener1 = $this->mapper->addWebhookListener( null, 'bob', diff --git a/apps/webhook_listeners/tests/Service/PHPMongoQueryTest.php b/apps/webhook_listeners/tests/Service/PHPMongoQueryTest.php index 071330a79e3..b1094731733 100644 --- a/apps/webhook_listeners/tests/Service/PHPMongoQueryTest.php +++ b/apps/webhook_listeners/tests/Service/PHPMongoQueryTest.php @@ -41,7 +41,7 @@ class PHPMongoQueryTest extends TestCase { /** * @dataProvider dataExecuteQuery */ - public function testExecuteQuery(array $query, array $document, bool $matches) { + public function testExecuteQuery(array $query, array $document, bool $matches): void { $this->assertEquals($matches, PHPMongoQuery::executeQuery($query, $document)); } } diff --git a/apps/workflowengine/tests/Check/AbstractStringCheckTest.php b/apps/workflowengine/tests/Check/AbstractStringCheckTest.php index e5182bea483..eb40b164176 100644 --- a/apps/workflowengine/tests/Check/AbstractStringCheckTest.php +++ b/apps/workflowengine/tests/Check/AbstractStringCheckTest.php @@ -53,7 +53,7 @@ class AbstractStringCheckTest extends \Test\TestCase { * @param string $actualValue * @param bool $expected */ - public function testExecuteStringCheck($operation, $checkValue, $actualValue, $expected) { + public function testExecuteStringCheck($operation, $checkValue, $actualValue, $expected): void { $check = $this->getCheckMock(); /** @var \OCA\WorkflowEngine\Check\AbstractStringCheck $check */ @@ -74,7 +74,7 @@ class AbstractStringCheckTest extends \Test\TestCase { * @param string $operator * @param string $value */ - public function testValidateCheck($operator, $value) { + public function testValidateCheck($operator, $value): void { $check = $this->getCheckMock(); /** @var \OCA\WorkflowEngine\Check\AbstractStringCheck $check */ @@ -99,7 +99,7 @@ class AbstractStringCheckTest extends \Test\TestCase { * @param $exceptionCode * @param $exceptionMessage */ - public function testValidateCheckInvalid($operator, $value, $exceptionCode, $exceptionMessage) { + public function testValidateCheckInvalid($operator, $value, $exceptionCode, $exceptionMessage): void { $check = $this->getCheckMock(); try { @@ -125,7 +125,7 @@ class AbstractStringCheckTest extends \Test\TestCase { * @param array[] $matches * @param bool $expected */ - public function testMatch($pattern, $subject, $matches, $expected) { + public function testMatch($pattern, $subject, $matches, $expected): void { $check = $this->getCheckMock(); $this->invokePrivate($check, 'matches', [$matches]); diff --git a/apps/workflowengine/tests/Check/FileMimeTypeTest.php b/apps/workflowengine/tests/Check/FileMimeTypeTest.php index 60788036408..1fc5118c5c4 100644 --- a/apps/workflowengine/tests/Check/FileMimeTypeTest.php +++ b/apps/workflowengine/tests/Check/FileMimeTypeTest.php @@ -71,7 +71,7 @@ class FileMimeTypeTest extends TestCase { }); } - public function testUseCachedMimetype() { + public function testUseCachedMimetype(): void { $storage = new Temporary([]); $storage->mkdir('foo'); $storage->file_put_contents('foo/bar.txt', 'asd'); @@ -84,7 +84,7 @@ class FileMimeTypeTest extends TestCase { $this->assertTrue($check->executeCheck('is', 'text/plain')); } - public function testNonCachedNotExists() { + public function testNonCachedNotExists(): void { $storage = new Temporary([]); $check = new FileMimeType($this->l10n, $this->request, $this->mimeDetector); @@ -93,7 +93,7 @@ class FileMimeTypeTest extends TestCase { $this->assertTrue($check->executeCheck('is', 'text/plain-path-detected')); } - public function testNonCachedLocal() { + public function testNonCachedLocal(): void { $storage = new Temporary([]); $storage->mkdir('foo'); $storage->file_put_contents('foo/bar.txt', 'text-content'); @@ -104,7 +104,7 @@ class FileMimeTypeTest extends TestCase { $this->assertTrue($check->executeCheck('is', 'text/plain-content-detected')); } - public function testNonCachedNotLocal() { + public function testNonCachedNotLocal(): void { $storage = new TemporaryNoLocal([]); $storage->mkdir('foo'); $storage->file_put_contents('foo/bar.txt', 'text-content'); @@ -115,7 +115,7 @@ class FileMimeTypeTest extends TestCase { $this->assertTrue($check->executeCheck('is', 'text/plain-content-detected')); } - public function testFallback() { + public function testFallback(): void { $storage = new Temporary([]); $check = new FileMimeType($this->l10n, $this->request, $this->mimeDetector); @@ -124,7 +124,7 @@ class FileMimeTypeTest extends TestCase { $this->assertTrue($check->executeCheck('is', 'application/octet-stream')); } - public function testFromCacheCached() { + public function testFromCacheCached(): void { $storage = new Temporary([]); $storage->mkdir('foo'); $storage->file_put_contents('foo/bar.txt', 'text-content'); @@ -144,7 +144,7 @@ class FileMimeTypeTest extends TestCase { $this->assertTrue($newCheck->executeCheck('is', 'text/plain-content-detected')); } - public function testExistsCached() { + public function testExistsCached(): void { $storage = new TemporaryNoLocal([]); $storage->mkdir('foo'); $storage->file_put_contents('foo/bar.txt', 'text-content'); @@ -161,7 +161,7 @@ class FileMimeTypeTest extends TestCase { $this->assertTrue($newCheck->executeCheck('is', 'text/plain-path-detected')); } - public function testNonExistsNotCached() { + public function testNonExistsNotCached(): void { $storage = new TemporaryNoLocal([]); $check = new FileMimeType($this->l10n, $this->request, $this->mimeDetector); diff --git a/apps/workflowengine/tests/Check/RequestRemoteAddressTest.php b/apps/workflowengine/tests/Check/RequestRemoteAddressTest.php index 7c46a33a477..438a59a8a48 100644 --- a/apps/workflowengine/tests/Check/RequestRemoteAddressTest.php +++ b/apps/workflowengine/tests/Check/RequestRemoteAddressTest.php @@ -52,7 +52,7 @@ class RequestRemoteAddressTest extends \Test\TestCase { * @param string $ip * @param bool $expected */ - public function testExecuteCheckMatchesIPv4($value, $ip, $expected) { + public function testExecuteCheckMatchesIPv4($value, $ip, $expected): void { $check = new \OCA\WorkflowEngine\Check\RequestRemoteAddress($this->getL10NMock(), $this->request); $this->request->expects($this->once()) @@ -68,7 +68,7 @@ class RequestRemoteAddressTest extends \Test\TestCase { * @param string $ip * @param bool $expected */ - public function testExecuteCheckNotMatchesIPv4($value, $ip, $expected) { + public function testExecuteCheckNotMatchesIPv4($value, $ip, $expected): void { $check = new \OCA\WorkflowEngine\Check\RequestRemoteAddress($this->getL10NMock(), $this->request); $this->request->expects($this->once()) @@ -96,7 +96,7 @@ class RequestRemoteAddressTest extends \Test\TestCase { * @param string $ip * @param bool $expected */ - public function testExecuteCheckMatchesIPv6($value, $ip, $expected) { + public function testExecuteCheckMatchesIPv6($value, $ip, $expected): void { $check = new \OCA\WorkflowEngine\Check\RequestRemoteAddress($this->getL10NMock(), $this->request); $this->request->expects($this->once()) @@ -112,7 +112,7 @@ class RequestRemoteAddressTest extends \Test\TestCase { * @param string $ip * @param bool $expected */ - public function testExecuteCheckNotMatchesIPv6($value, $ip, $expected) { + public function testExecuteCheckNotMatchesIPv6($value, $ip, $expected): void { $check = new \OCA\WorkflowEngine\Check\RequestRemoteAddress($this->getL10NMock(), $this->request); $this->request->expects($this->once()) diff --git a/apps/workflowengine/tests/Check/RequestTimeTest.php b/apps/workflowengine/tests/Check/RequestTimeTest.php index 3c261fe2de3..34ea656f416 100644 --- a/apps/workflowengine/tests/Check/RequestTimeTest.php +++ b/apps/workflowengine/tests/Check/RequestTimeTest.php @@ -71,7 +71,7 @@ class RequestTimeTest extends \Test\TestCase { * @param int $timestamp * @param bool $expected */ - public function testExecuteCheckIn($value, $timestamp, $expected) { + public function testExecuteCheckIn($value, $timestamp, $expected): void { $check = new \OCA\WorkflowEngine\Check\RequestTime($this->getL10NMock(), $this->timeFactory); $this->timeFactory->expects($this->once()) @@ -87,7 +87,7 @@ class RequestTimeTest extends \Test\TestCase { * @param int $timestamp * @param bool $expected */ - public function testExecuteCheckNotIn($value, $timestamp, $expected) { + public function testExecuteCheckNotIn($value, $timestamp, $expected): void { $check = new \OCA\WorkflowEngine\Check\RequestTime($this->getL10NMock(), $this->timeFactory); $this->timeFactory->expects($this->once()) @@ -110,7 +110,7 @@ class RequestTimeTest extends \Test\TestCase { * @param string $operator * @param string $value */ - public function testValidateCheck($operator, $value) { + public function testValidateCheck($operator, $value): void { $check = new \OCA\WorkflowEngine\Check\RequestTime($this->getL10NMock(), $this->timeFactory); $check->validateCheck($operator, $value); $this->addToAssertionCount(1); @@ -135,7 +135,7 @@ class RequestTimeTest extends \Test\TestCase { * @param int $exceptionCode * @param string $exceptionMessage */ - public function testValidateCheckInvalid($operator, $value, $exceptionCode, $exceptionMessage) { + public function testValidateCheckInvalid($operator, $value, $exceptionCode, $exceptionMessage): void { $check = new \OCA\WorkflowEngine\Check\RequestTime($this->getL10NMock(), $this->timeFactory); try { diff --git a/apps/workflowengine/tests/Check/RequestUserAgentTest.php b/apps/workflowengine/tests/Check/RequestUserAgentTest.php index f41f95c15ff..f74cf669cc7 100644 --- a/apps/workflowengine/tests/Check/RequestUserAgentTest.php +++ b/apps/workflowengine/tests/Check/RequestUserAgentTest.php @@ -90,7 +90,7 @@ class RequestUserAgentTest extends TestCase { * @param string $actualValue * @param bool $expected */ - public function testExecuteCheck($operation, $checkValue, $actualValue, $expected) { + public function testExecuteCheck($operation, $checkValue, $actualValue, $expected): void { $this->request->expects($this->once()) ->method('getHeader') ->willReturn($actualValue); diff --git a/apps/workflowengine/tests/ManagerTest.php b/apps/workflowengine/tests/ManagerTest.php index 4a547f5c8bf..334666af039 100644 --- a/apps/workflowengine/tests/ManagerTest.php +++ b/apps/workflowengine/tests/ManagerTest.php @@ -123,7 +123,7 @@ class ManagerTest extends TestCase { } } - public function testChecks() { + public function testChecks(): void { $check1 = $this->invokePrivate($this->manager, 'addCheck', ['Test', 'equal', 1]); $check2 = $this->invokePrivate($this->manager, 'addCheck', ['Test', '!equal', 2]); @@ -144,7 +144,7 @@ class ManagerTest extends TestCase { $this->assertArrayHasKey($check2, $data); } - public function testScope() { + public function testScope(): void { $adminScope = $this->buildScope(); $userScope = $this->buildScope('jackie'); $entity = File::class; @@ -178,7 +178,7 @@ class ManagerTest extends TestCase { $this->assertTrue($this->invokePrivate($this->manager, 'canModify', [$opId3, $userScope])); } - public function testGetAllOperations() { + public function testGetAllOperations(): void { $adminScope = $this->buildScope(); $userScope = $this->buildScope('jackie'); $entity = File::class; @@ -249,7 +249,7 @@ class ManagerTest extends TestCase { $this->assertSame(2, count($userOps['OCA\WFE\TestUserOp'])); } - public function testGetOperations() { + public function testGetOperations(): void { $adminScope = $this->buildScope(); $userScope = $this->buildScope('jackie'); $entity = File::class; @@ -319,7 +319,7 @@ class ManagerTest extends TestCase { }); } - public function testGetAllConfiguredEvents() { + public function testGetAllConfiguredEvents(): void { $adminScope = $this->buildScope(); $userScope = $this->buildScope('jackie'); $entity = File::class; @@ -353,7 +353,7 @@ class ManagerTest extends TestCase { $this->assertEquals($allOperationsCached, $allOperations); } - public function testUpdateOperation() { + public function testUpdateOperation(): void { $adminScope = $this->buildScope(); $userScope = $this->buildScope('jackie'); $entity = File::class; @@ -434,7 +434,7 @@ class ManagerTest extends TestCase { } } - public function testDeleteOperation() { + public function testDeleteOperation(): void { $adminScope = $this->buildScope(); $userScope = $this->buildScope('jackie'); $entity = File::class; @@ -484,7 +484,7 @@ class ManagerTest extends TestCase { } } - public function testGetEntitiesListBuildInOnly() { + public function testGetEntitiesListBuildInOnly(): void { $fileEntityMock = $this->createMock(File::class); $this->container->expects($this->once()) @@ -498,7 +498,7 @@ class ManagerTest extends TestCase { $this->assertInstanceOf(IEntity::class, $entities[0]); } - public function testGetEntitiesList() { + public function testGetEntitiesList(): void { $fileEntityMock = $this->createMock(File::class); $this->container->expects($this->once()) @@ -532,7 +532,7 @@ class ManagerTest extends TestCase { $this->assertSame(1, $entityTypeCounts[1]); } - public function testValidateOperationOK() { + public function testValidateOperationOK(): void { $check = [ 'class' => ICheck::class, 'operator' => 'is', @@ -592,7 +592,7 @@ class ManagerTest extends TestCase { $this->manager->validateOperation(IOperation::class, 'test', [$check], 'operationData', $scopeMock, IEntity::class, ['MyEvent']); } - public function testValidateOperationCheckInputLengthError() { + public function testValidateOperationCheckInputLengthError(): void { $check = [ 'class' => ICheck::class, 'operator' => 'is', @@ -656,7 +656,7 @@ class ManagerTest extends TestCase { } } - public function testValidateOperationDataLengthError() { + public function testValidateOperationDataLengthError(): void { $check = [ 'class' => ICheck::class, 'operator' => 'is', @@ -720,7 +720,7 @@ class ManagerTest extends TestCase { } } - public function testValidateOperationScopeNotAvailable() { + public function testValidateOperationScopeNotAvailable(): void { $check = [ 'class' => ICheck::class, 'operator' => 'is', |