aboutsummaryrefslogtreecommitdiffstats
path: root/apps/dav/tests/unit/CalDAV
diff options
context:
space:
mode:
authorJoas Schilling <coding@schilljs.com>2024-01-08 12:46:59 +0100
committerJoas Schilling <coding@schilljs.com>2024-01-10 09:18:08 +0100
commite981619c0183619e0e63e6cc4b42b3dcc7ebeee8 (patch)
tree4f2f17c0bc542bc33c263367e060a9f89c846205 /apps/dav/tests/unit/CalDAV
parent73b14a28f24a02e08664c6cfc2cb42f5539e92b1 (diff)
downloadnextcloud-server-e981619c0183619e0e63e6cc4b42b3dcc7ebeee8.tar.gz
nextcloud-server-e981619c0183619e0e63e6cc4b42b3dcc7ebeee8.zip
fix(dav): Fix user status "Undefined array key 0 at StatusService.php#98"
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'apps/dav/tests/unit/CalDAV')
-rw-r--r--apps/dav/tests/unit/CalDAV/Status/StatusServiceTest.php44
1 files changed, 44 insertions, 0 deletions
diff --git a/apps/dav/tests/unit/CalDAV/Status/StatusServiceTest.php b/apps/dav/tests/unit/CalDAV/Status/StatusServiceTest.php
index 498a0b849fa..c60f3a0c325 100644
--- a/apps/dav/tests/unit/CalDAV/Status/StatusServiceTest.php
+++ b/apps/dav/tests/unit/CalDAV/Status/StatusServiceTest.php
@@ -229,6 +229,50 @@ class StatusServiceTest extends TestCase {
$this->service->processCalendarStatus('admin');
}
+ public function testCalendarNoEventObjects(): void {
+ $user = $this->createConfiguredMock(IUser::class, [
+ 'getUID' => 'admin',
+ ]);
+
+ $this->userManager->expects(self::once())
+ ->method('get')
+ ->willReturn($user);
+ $this->availabilityCoordinator->expects(self::once())
+ ->method('getCurrentOutOfOfficeData')
+ ->willReturn(null);
+ $this->availabilityCoordinator->expects(self::never())
+ ->method('isInEffect');
+ $this->cache->expects(self::once())
+ ->method('get')
+ ->willReturn(null);
+ $this->cache->expects(self::once())
+ ->method('set');
+ $this->calendarManager->expects(self::once())
+ ->method('getCalendarsForPrincipal')
+ ->willReturn([$this->createMock(CalendarImpl::class)]);
+ $this->calendarManager->expects(self::once())
+ ->method('newQuery')
+ ->willReturn(new CalendarQuery('admin'));
+ $this->timeFactory->expects(self::exactly(2))
+ ->method('getDateTime')
+ ->willReturn(new \DateTime());
+ $this->userStatusService->expects(self::once())
+ ->method('findByUserId')
+ ->willThrowException(new DoesNotExistException(''));
+ $this->calendarManager->expects(self::once())
+ ->method('searchForPrincipal')
+ ->willReturn([['objects' => []]]);
+ $this->userStatusService->expects(self::once())
+ ->method('revertUserStatus');
+ $this->logger->expects(self::once())
+ ->method('debug');
+ $this->userStatusService->expects(self::never())
+ ->method('setUserStatus');
+
+
+ $this->service->processCalendarStatus('admin');
+ }
+
public function testCalendarEvent(): void {
$user = $this->createConfiguredMock(IUser::class, [
'getUID' => 'admin',