aboutsummaryrefslogtreecommitdiffstats
path: root/apps/dav/tests
diff options
context:
space:
mode:
authorAnna <anna@nextcloud.com>2024-09-16 00:11:41 +0200
committerGitHub <noreply@github.com>2024-09-16 00:11:41 +0200
commitd46f271b1f3971120386591a3489f74b55f7a7ba (patch)
treeb85cded12ba149b5f594ab4d87c14a189065239a /apps/dav/tests
parentbdb2fdbe90285fa45c5763367e9ecd3ad3cb41a4 (diff)
parente4cf430233b971351e6c736813e2fb40382b828d (diff)
downloadnextcloud-server-d46f271b1f3971120386591a3489f74b55f7a7ba.tar.gz
nextcloud-server-d46f271b1f3971120386591a3489f74b55f7a7ba.zip
Merge pull request #48049 from nextcloud/refactor/void-tests
refactor: Add void return type to PHPUnit test methods
Diffstat (limited to 'apps/dav/tests')
-rw-r--r--apps/dav/tests/unit/BackgroundJob/OutOfOfficeEventDispatcherJobTest.php6
-rw-r--r--apps/dav/tests/unit/CalDAV/AppCalendar/AppCalendarTest.php4
-rw-r--r--apps/dav/tests/unit/CalDAV/AppCalendar/CalendarObjectTest.php26
-rw-r--r--apps/dav/tests/unit/CalDAV/CachedSubscriptionProviderTest.php4
-rw-r--r--apps/dav/tests/unit/CalDAV/CalDavBackendTest.php10
-rw-r--r--apps/dav/tests/unit/CalDAV/CalendarTest.php2
-rw-r--r--apps/dav/tests/unit/CalDAV/Schedule/IMipPluginTest.php2
-rw-r--r--apps/dav/tests/unit/CalDAV/Schedule/PluginTest.php6
-rw-r--r--apps/dav/tests/unit/CalDAV/WebcalCaching/ConnectionTest.php2
-rw-r--r--apps/dav/tests/unit/Controller/UpcomingEventsControllerTest.php4
-rw-r--r--apps/dav/tests/unit/Service/AbsenceServiceTest.php16
11 files changed, 41 insertions, 41 deletions
diff --git a/apps/dav/tests/unit/BackgroundJob/OutOfOfficeEventDispatcherJobTest.php b/apps/dav/tests/unit/BackgroundJob/OutOfOfficeEventDispatcherJobTest.php
index b42334523f8..5ddd9eba6f8 100644
--- a/apps/dav/tests/unit/BackgroundJob/OutOfOfficeEventDispatcherJobTest.php
+++ b/apps/dav/tests/unit/BackgroundJob/OutOfOfficeEventDispatcherJobTest.php
@@ -62,7 +62,7 @@ class OutOfOfficeEventDispatcherJobTest extends TestCase {
);
}
- public function testDispatchStartEvent() {
+ public function testDispatchStartEvent(): void {
$this->timezoneService->method('getUserTimezone')->with('user')->willReturn('Europe/Berlin');
$absence = new Absence();
@@ -94,7 +94,7 @@ class OutOfOfficeEventDispatcherJobTest extends TestCase {
]);
}
- public function testDispatchStopEvent() {
+ public function testDispatchStopEvent(): void {
$this->timezoneService->method('getUserTimezone')->with('user')->willReturn('Europe/Berlin');
$absence = new Absence();
@@ -126,7 +126,7 @@ class OutOfOfficeEventDispatcherJobTest extends TestCase {
]);
}
- public function testDoesntDispatchUnknownEvent() {
+ public function testDoesntDispatchUnknownEvent(): void {
$this->timezoneService->method('getUserTimezone')->with('user')->willReturn('Europe/Berlin');
$absence = new Absence();
diff --git a/apps/dav/tests/unit/CalDAV/AppCalendar/AppCalendarTest.php b/apps/dav/tests/unit/CalDAV/AppCalendar/AppCalendarTest.php
index b8983350348..f7fa114ff28 100644
--- a/apps/dav/tests/unit/CalDAV/AppCalendar/AppCalendarTest.php
+++ b/apps/dav/tests/unit/CalDAV/AppCalendar/AppCalendarTest.php
@@ -52,7 +52,7 @@ class AppCalendarTest extends TestCase {
$this->appCalendar->delete();
}
- public function testCreateFile() {
+ public function testCreateFile(): void {
$this->writeableCalendar->expects($this->exactly(3))
->method('createFromString')
->withConsecutive(['some-name', 'data'], ['other-name', ''], ['name', 'some data']);
@@ -69,7 +69,7 @@ class AppCalendarTest extends TestCase {
fclose($fp);
}
- public function testCreateFile_readOnly() {
+ public function testCreateFile_readOnly(): void {
// If writing is not supported
$this->expectException(\Sabre\DAV\Exception\Forbidden::class);
$this->expectExceptionMessage('Creating a new entry is not allowed');
diff --git a/apps/dav/tests/unit/CalDAV/AppCalendar/CalendarObjectTest.php b/apps/dav/tests/unit/CalDAV/AppCalendar/CalendarObjectTest.php
index 92288f5dfb0..a913c2dde6f 100644
--- a/apps/dav/tests/unit/CalDAV/AppCalendar/CalendarObjectTest.php
+++ b/apps/dav/tests/unit/CalDAV/AppCalendar/CalendarObjectTest.php
@@ -33,15 +33,15 @@ class CalendarObjectTest extends TestCase {
$this->calendarObject = new CalendarObject($this->calendar, $this->backend, $this->vobject);
}
- public function testGetOwner() {
+ public function testGetOwner(): void {
$this->assertEquals($this->calendarObject->getOwner(), 'owner');
}
- public function testGetGroup() {
+ public function testGetGroup(): void {
$this->assertEquals($this->calendarObject->getGroup(), 'group');
}
- public function testGetACL() {
+ public function testGetACL(): void {
$this->calendar->expects($this->exactly(2))
->method('getPermissions')
->willReturnOnConsecutiveCalls(Constants::PERMISSION_READ, Constants::PERMISSION_ALL);
@@ -70,17 +70,17 @@ class CalendarObjectTest extends TestCase {
]);
}
- public function testSetACL() {
+ public function testSetACL(): void {
$this->expectException(\Sabre\DAV\Exception\Forbidden::class);
$this->calendarObject->setACL([]);
}
- public function testPut_readOnlyBackend() {
+ public function testPut_readOnlyBackend(): void {
$this->expectException(\Sabre\DAV\Exception\Forbidden::class);
$this->calendarObject->put('foo');
}
- public function testPut_noPermissions() {
+ public function testPut_noPermissions(): void {
$this->expectException(\Sabre\DAV\Exception\Forbidden::class);
$backend = $this->createMock(ICreateFromString::class);
@@ -93,7 +93,7 @@ class CalendarObjectTest extends TestCase {
$calendarObject->put('foo');
}
- public function testPut() {
+ public function testPut(): void {
$backend = $this->createMock(ICreateFromString::class);
$calendarObject = new CalendarObject($this->calendar, $backend, $this->vobject);
@@ -110,19 +110,19 @@ class CalendarObjectTest extends TestCase {
$calendarObject->put('foo');
}
- public function testGet() {
+ public function testGet(): void {
$this->vobject->expects($this->once())
->method('serialize')
->willReturn('foo');
$this->assertEquals($this->calendarObject->get(), 'foo');
}
- public function testDelete_notWriteable() {
+ public function testDelete_notWriteable(): void {
$this->expectException(\Sabre\DAV\Exception\Forbidden::class);
$this->calendarObject->delete();
}
- public function testDelete_noPermission() {
+ public function testDelete_noPermission(): void {
$backend = $this->createMock(ICreateFromString::class);
$calendarObject = new CalendarObject($this->calendar, $backend, $this->vobject);
@@ -130,7 +130,7 @@ class CalendarObjectTest extends TestCase {
$calendarObject->delete();
}
- public function testDelete() {
+ public function testDelete(): void {
$backend = $this->createMock(ICreateFromString::class);
$calendarObject = new CalendarObject($this->calendar, $backend, $this->vobject);
@@ -153,7 +153,7 @@ class CalendarObjectTest extends TestCase {
$calendarObject->delete();
}
- public function testGetName() {
+ public function testGetName(): void {
$this->vobject->expects($this->exactly(2))
->method('getBaseComponent')
->willReturnOnConsecutiveCalls((object)['UID' => 'someid'], (object)['UID' => 'someid', 'X-FILENAME' => 'real-filename.ics']);
@@ -162,7 +162,7 @@ class CalendarObjectTest extends TestCase {
$this->assertEquals($this->calendarObject->getName(), 'real-filename.ics');
}
- public function testSetName() {
+ public function testSetName(): void {
$this->expectException(\Sabre\DAV\Exception\Forbidden::class);
$this->calendarObject->setName('Some name');
}
diff --git a/apps/dav/tests/unit/CalDAV/CachedSubscriptionProviderTest.php b/apps/dav/tests/unit/CalDAV/CachedSubscriptionProviderTest.php
index 22998eec3d9..be47b2bf640 100644
--- a/apps/dav/tests/unit/CalDAV/CachedSubscriptionProviderTest.php
+++ b/apps/dav/tests/unit/CalDAV/CachedSubscriptionProviderTest.php
@@ -47,7 +47,7 @@ class CachedSubscriptionProviderTest extends TestCase {
$this->provider = new CachedSubscriptionProvider($this->backend);
}
- public function testGetCalendars() {
+ public function testGetCalendars(): void {
$calendars = $this->provider->getCalendars(
'user-principal-123',
[]
@@ -58,7 +58,7 @@ class CachedSubscriptionProviderTest extends TestCase {
$this->assertInstanceOf(CachedSubscriptionImpl::class, $calendars[1]);
}
- public function testGetCalendarsFilterByUri() {
+ public function testGetCalendarsFilterByUri(): void {
$calendars = $this->provider->getCalendars(
'user-principal-123',
['subscription-1']
diff --git a/apps/dav/tests/unit/CalDAV/CalDavBackendTest.php b/apps/dav/tests/unit/CalDAV/CalDavBackendTest.php
index ac4045ea757..c82ca350c90 100644
--- a/apps/dav/tests/unit/CalDAV/CalDavBackendTest.php
+++ b/apps/dav/tests/unit/CalDAV/CalDavBackendTest.php
@@ -1490,7 +1490,7 @@ EOD;
self::assertSame(0, $deleted);
}
- public function testSearchAndExpandRecurrences() {
+ public function testSearchAndExpandRecurrences(): void {
$calendarId = $this->createTestCalendar();
$calendarInfo = [
'id' => $calendarId,
@@ -1646,7 +1646,7 @@ EOD;
self::assertEquals([$uri2], $changesAfter['deleted']);
}
- public function testSearchWithLimitAndTimeRange() {
+ public function testSearchWithLimitAndTimeRange(): void {
$calendarId = $this->createTestCalendar();
$calendarInfo = [
'id' => $calendarId,
@@ -1703,7 +1703,7 @@ EOD;
);
}
- public function testSearchWithLimitAndTimeRangeShouldNotReturnMoreObjectsThenLimit() {
+ public function testSearchWithLimitAndTimeRangeShouldNotReturnMoreObjectsThenLimit(): void {
$calendarId = $this->createTestCalendar();
$calendarInfo = [
'id' => $calendarId,
@@ -1753,7 +1753,7 @@ EOD;
);
}
- public function testSearchWithLimitAndTimeRangeShouldReturnObjectsInTheSameOrder() {
+ public function testSearchWithLimitAndTimeRangeShouldReturnObjectsInTheSameOrder(): void {
$calendarId = $this->createTestCalendar();
$calendarInfo = [
'id' => $calendarId,
@@ -1810,7 +1810,7 @@ EOD;
);
}
- public function testSearchShouldReturnObjectsInTheSameOrderMissingDate() {
+ public function testSearchShouldReturnObjectsInTheSameOrderMissingDate(): void {
$calendarId = $this->createTestCalendar();
$calendarInfo = [
'id' => $calendarId,
diff --git a/apps/dav/tests/unit/CalDAV/CalendarTest.php b/apps/dav/tests/unit/CalDAV/CalendarTest.php
index a2854823cbc..6433af8c340 100644
--- a/apps/dav/tests/unit/CalDAV/CalendarTest.php
+++ b/apps/dav/tests/unit/CalDAV/CalendarTest.php
@@ -442,7 +442,7 @@ EOD;
];
}
- public function testRemoveVAlarms() {
+ public function testRemoveVAlarms(): void {
$publicObjectData = <<<EOD
BEGIN:VCALENDAR
VERSION:2.0
diff --git a/apps/dav/tests/unit/CalDAV/Schedule/IMipPluginTest.php b/apps/dav/tests/unit/CalDAV/Schedule/IMipPluginTest.php
index bda3182d117..36ce091fc69 100644
--- a/apps/dav/tests/unit/CalDAV/Schedule/IMipPluginTest.php
+++ b/apps/dav/tests/unit/CalDAV/Schedule/IMipPluginTest.php
@@ -467,7 +467,7 @@ class IMipPluginTest extends TestCase {
$this->assertEquals('1.1', $message->getScheduleStatus());
}
- public function testEmailValidationFailed() {
+ public function testEmailValidationFailed(): void {
$message = new Message();
$message->method = 'REQUEST';
$message->message = new VCalendar();
diff --git a/apps/dav/tests/unit/CalDAV/Schedule/PluginTest.php b/apps/dav/tests/unit/CalDAV/Schedule/PluginTest.php
index aa2903b519f..8d98a765fc1 100644
--- a/apps/dav/tests/unit/CalDAV/Schedule/PluginTest.php
+++ b/apps/dav/tests/unit/CalDAV/Schedule/PluginTest.php
@@ -400,7 +400,7 @@ class PluginTest extends TestCase {
*
* Should generate 2 messages for attendees User 2 and User External
*/
- public function testCalendarObjectChangePersonalCalendarCreate() {
+ public function testCalendarObjectChangePersonalCalendarCreate(): void {
// define place holders
/** @var Message[] $iTipMessages */
@@ -504,7 +504,7 @@ class PluginTest extends TestCase {
*
* Should generate 3 messages for attendees User 2 (Sharee), User 3 (Non-Sharee) and User External
*/
- public function testCalendarObjectChangeSharedCalendarSharerCreate() {
+ public function testCalendarObjectChangeSharedCalendarSharerCreate(): void {
// define place holders
/** @var Message[] $iTipMessages */
@@ -620,7 +620,7 @@ class PluginTest extends TestCase {
*
* Should generate 3 messages for attendees User 1 (Sharer/Owner), User 3 (Non-Sharee) and User External
*/
- public function testCalendarObjectChangeSharedCalendarShreeCreate() {
+ public function testCalendarObjectChangeSharedCalendarShreeCreate(): void {
// define place holders
/** @var Message[] $iTipMessages */
diff --git a/apps/dav/tests/unit/CalDAV/WebcalCaching/ConnectionTest.php b/apps/dav/tests/unit/CalDAV/WebcalCaching/ConnectionTest.php
index ee903a5e0fa..0d836e44949 100644
--- a/apps/dav/tests/unit/CalDAV/WebcalCaching/ConnectionTest.php
+++ b/apps/dav/tests/unit/CalDAV/WebcalCaching/ConnectionTest.php
@@ -37,7 +37,7 @@ class ConnectionTest extends TestCase {
/**
* @dataProvider runLocalURLDataProvider
*/
- public function testLocalUrl($source) {
+ public function testLocalUrl($source): void {
$subscription = [
'id' => 42,
'uri' => 'sub123',
diff --git a/apps/dav/tests/unit/Controller/UpcomingEventsControllerTest.php b/apps/dav/tests/unit/Controller/UpcomingEventsControllerTest.php
index 9e5c03bb245..bab0ef77bd0 100644
--- a/apps/dav/tests/unit/Controller/UpcomingEventsControllerTest.php
+++ b/apps/dav/tests/unit/Controller/UpcomingEventsControllerTest.php
@@ -28,7 +28,7 @@ class UpcomingEventsControllerTest extends TestCase {
$this->service = $this->createMock(UpcomingEventsService::class);
}
- public function testGetEventsAnonymously() {
+ public function testGetEventsAnonymously(): void {
$controller = new UpcomingEventsController(
$this->request,
null,
@@ -41,7 +41,7 @@ class UpcomingEventsControllerTest extends TestCase {
self::assertSame(401, $response->getStatus());
}
- public function testGetEventsByLocation() {
+ public function testGetEventsByLocation(): void {
$controller = new UpcomingEventsController(
$this->request,
'u1',
diff --git a/apps/dav/tests/unit/Service/AbsenceServiceTest.php b/apps/dav/tests/unit/Service/AbsenceServiceTest.php
index 1bc5f53f18c..5cff29a6f61 100644
--- a/apps/dav/tests/unit/Service/AbsenceServiceTest.php
+++ b/apps/dav/tests/unit/Service/AbsenceServiceTest.php
@@ -62,7 +62,7 @@ class AbsenceServiceTest extends TestCase {
);
}
- public function testCreateAbsenceEmitsScheduledEvent() {
+ public function testCreateAbsenceEmitsScheduledEvent(): void {
$tz = new DateTimeZone('Europe/Berlin');
$user = $this->createMock(IUser::class);
$user->method('getUID')
@@ -117,7 +117,7 @@ class AbsenceServiceTest extends TestCase {
);
}
- public function testUpdateAbsenceEmitsChangedEvent() {
+ public function testUpdateAbsenceEmitsChangedEvent(): void {
$tz = new DateTimeZone('Europe/Berlin');
$user = $this->createMock(IUser::class);
$user->method('getUID')
@@ -181,7 +181,7 @@ class AbsenceServiceTest extends TestCase {
);
}
- public function testCreateAbsenceSchedulesBothJobs() {
+ public function testCreateAbsenceSchedulesBothJobs(): void {
$tz = new DateTimeZone('Europe/Berlin');
$startDateString = '2023-01-05';
$startDate = new DateTimeImmutable($startDateString, $tz);
@@ -230,7 +230,7 @@ class AbsenceServiceTest extends TestCase {
);
}
- public function testCreateAbsenceSchedulesOnlyEndJob() {
+ public function testCreateAbsenceSchedulesOnlyEndJob(): void {
$tz = new DateTimeZone('Europe/Berlin');
$endDateString = '2023-01-10';
$endDate = new DateTimeImmutable($endDateString, $tz);
@@ -271,7 +271,7 @@ class AbsenceServiceTest extends TestCase {
);
}
- public function testCreateAbsenceSchedulesNoJob() {
+ public function testCreateAbsenceSchedulesNoJob(): void {
$tz = new DateTimeZone('Europe/Berlin');
$user = $this->createMock(IUser::class);
$user->method('getUID')
@@ -306,7 +306,7 @@ class AbsenceServiceTest extends TestCase {
);
}
- public function testUpdateAbsenceSchedulesBothJobs() {
+ public function testUpdateAbsenceSchedulesBothJobs(): void {
$tz = new DateTimeZone('Europe/Berlin');
$startDateString = '2023-01-05';
$startDate = new DateTimeImmutable($startDateString, $tz);
@@ -362,7 +362,7 @@ class AbsenceServiceTest extends TestCase {
);
}
- public function testUpdateSchedulesOnlyEndJob() {
+ public function testUpdateSchedulesOnlyEndJob(): void {
$tz = new DateTimeZone('Europe/Berlin');
$endDateString = '2023-01-10';
$endDate = new DateTimeImmutable($endDateString, $tz);
@@ -410,7 +410,7 @@ class AbsenceServiceTest extends TestCase {
);
}
- public function testUpdateAbsenceSchedulesNoJob() {
+ public function testUpdateAbsenceSchedulesNoJob(): void {
$tz = new DateTimeZone('Europe/Berlin');
$user = $this->createMock(IUser::class);
$user->method('getUID')