refactor: Add void return type to PHPUnit test methods

Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
This commit is contained in:
Christoph Wurst 2024-09-15 22:32:31 +02:00
Родитель 4281ce6fa1
Коммит 49dd79eabb
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: CC42AC2A7F0E56D8
670 изменённых файлов: 4750 добавлений и 4750 удалений

Просмотреть файл

@ -65,7 +65,7 @@ class ListenerTest extends TestCase {
);
}
public function testCommentEvent() {
public function testCommentEvent(): void {
$this->appManager->expects($this->any())
->method('isInstalled')
->with('activity')

Просмотреть файл

@ -30,7 +30,7 @@ class ApplicationTest extends TestCase {
parent::tearDown();
}
public function test() {
public function test(): void {
$app = new Application();
$c = $app->getContainer();

Просмотреть файл

@ -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) {

Просмотреть файл

@ -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')

Просмотреть файл

@ -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())

Просмотреть файл

@ -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())

Просмотреть файл

@ -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';

Просмотреть файл

@ -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();

Просмотреть файл

@ -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');

Просмотреть файл

@ -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');
}

Просмотреть файл

@ -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']

Просмотреть файл

@ -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,

Просмотреть файл

@ -442,7 +442,7 @@ EOD;
];
}
public function testRemoveVAlarms() {
public function testRemoveVAlarms(): void {
$publicObjectData = <<<EOD
BEGIN:VCALENDAR
VERSION:2.0

Просмотреть файл

@ -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();

Просмотреть файл

@ -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 */

Просмотреть файл

@ -37,7 +37,7 @@ class ConnectionTest extends TestCase {
/**
* @dataProvider runLocalURLDataProvider
*/
public function testLocalUrl($source) {
public function testLocalUrl($source): void {
$subscription = [
'id' => 42,
'uri' => 'sub123',

Просмотреть файл

@ -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',

Просмотреть файл

@ -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')

Просмотреть файл

@ -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);

Просмотреть файл

@ -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);

Просмотреть файл

@ -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)

Просмотреть файл

@ -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);

Просмотреть файл

@ -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();

Просмотреть файл

@ -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'];

Просмотреть файл

@ -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';

Просмотреть файл

@ -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);

Просмотреть файл

@ -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 */

Просмотреть файл

@ -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');

Просмотреть файл

@ -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);

Просмотреть файл

@ -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');

Просмотреть файл

@ -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');

Просмотреть файл

@ -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);

Просмотреть файл

@ -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');

Просмотреть файл

@ -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());
}
}

Просмотреть файл

@ -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);

Просмотреть файл

@ -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();

Просмотреть файл

@ -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);
}

Просмотреть файл

@ -130,7 +130,7 @@ class MountPublicLinkControllerTest extends \Test\TestCase {
$createSuccessful,
$expectedReturnData,
$permissions
) {
): void {
$this->federatedShareProvider->expects($this->any())
->method('isOutgoingServer2serverShareEnabled')
->willReturn($outgoingSharesAllowed);

Просмотреть файл

@ -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 = [

Просмотреть файл

@ -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();

Просмотреть файл

@ -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;

Просмотреть файл

@ -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());
}
}

Просмотреть файл

@ -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,

Просмотреть файл

@ -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';

Просмотреть файл

@ -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';

Просмотреть файл

@ -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);

Просмотреть файл

@ -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);

Просмотреть файл

@ -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')

Просмотреть файл

@ -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());
}
}

Просмотреть файл

@ -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()

Просмотреть файл

@ -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(

Просмотреть файл

@ -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());

Просмотреть файл

@ -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();

Просмотреть файл

@ -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());

Просмотреть файл

@ -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();

Просмотреть файл

@ -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]);

Просмотреть файл

@ -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();

Просмотреть файл

@ -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())

Просмотреть файл

@ -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')

Просмотреть файл

@ -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);

Просмотреть файл

@ -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');

Просмотреть файл

@ -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();

Просмотреть файл

@ -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())

Просмотреть файл

@ -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'])) {

Просмотреть файл

@ -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();

Просмотреть файл

@ -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]);

Просмотреть файл

@ -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);

Просмотреть файл

@ -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());

Просмотреть файл

@ -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')

Просмотреть файл

@ -53,7 +53,7 @@ class GlobalStoragesControllerTest extends StoragesControllerTest {
);
}
public function testAddLocalStorageWhenDisabled() {
public function testAddLocalStorageWhenDisabled(): void {
$this->controller = $this->createController(false);
parent::testAddLocalStorageWhenDisabled();
}

Просмотреть файл

@ -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);

Просмотреть файл

@ -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)

Просмотреть файл

@ -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);

Просмотреть файл

@ -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();

Просмотреть файл

@ -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')

Просмотреть файл

@ -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'),

Просмотреть файл

@ -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);

Просмотреть файл

@ -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')

Просмотреть файл

@ -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))

Просмотреть файл

@ -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);

Просмотреть файл

@ -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);

Просмотреть файл

@ -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');

Просмотреть файл

@ -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);
}

Просмотреть файл

@ -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');

Просмотреть файл

@ -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());
}
}

Просмотреть файл

@ -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());
}
}

Просмотреть файл

@ -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');
}
}

Просмотреть файл

@ -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');
}
}

Просмотреть файл

@ -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));

Просмотреть файл

@ -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'));
}
}

Просмотреть файл

@ -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());
}

Просмотреть файл

@ -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(''));
}

Просмотреть файл

@ -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');
}
}

Просмотреть файл

@ -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 */

Просмотреть файл

@ -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();

Просмотреть файл

@ -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);

Просмотреть файл

@ -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');

Просмотреть файл

@ -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']);

Просмотреть файл

@ -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())

Просмотреть файл

@ -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();

Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше