@@ -229,6 +229,50 @@ public function testNoCalendarEvents(): void {
229229 $ this ->service ->processCalendarStatus ('admin ' );
230230 }
231231
232+ public function testCalendarNoEventObjects (): void {
233+ $ user = $ this ->createConfiguredMock (IUser::class, [
234+ 'getUID ' => 'admin ' ,
235+ ]);
236+
237+ $ this ->userManager ->expects (self ::once ())
238+ ->method ('get ' )
239+ ->willReturn ($ user );
240+ $ this ->availabilityCoordinator ->expects (self ::once ())
241+ ->method ('getCurrentOutOfOfficeData ' )
242+ ->willReturn (null );
243+ $ this ->availabilityCoordinator ->expects (self ::never ())
244+ ->method ('isInEffect ' );
245+ $ this ->cache ->expects (self ::once ())
246+ ->method ('get ' )
247+ ->willReturn (null );
248+ $ this ->cache ->expects (self ::once ())
249+ ->method ('set ' );
250+ $ this ->calendarManager ->expects (self ::once ())
251+ ->method ('getCalendarsForPrincipal ' )
252+ ->willReturn ([$ this ->createMock (CalendarImpl::class)]);
253+ $ this ->calendarManager ->expects (self ::once ())
254+ ->method ('newQuery ' )
255+ ->willReturn (new CalendarQuery ('admin ' ));
256+ $ this ->timeFactory ->expects (self ::exactly (2 ))
257+ ->method ('getDateTime ' )
258+ ->willReturn (new \DateTime ());
259+ $ this ->userStatusService ->expects (self ::once ())
260+ ->method ('findByUserId ' )
261+ ->willThrowException (new DoesNotExistException ('' ));
262+ $ this ->calendarManager ->expects (self ::once ())
263+ ->method ('searchForPrincipal ' )
264+ ->willReturn ([['objects ' => []]]);
265+ $ this ->userStatusService ->expects (self ::once ())
266+ ->method ('revertUserStatus ' );
267+ $ this ->logger ->expects (self ::once ())
268+ ->method ('debug ' );
269+ $ this ->userStatusService ->expects (self ::never ())
270+ ->method ('setUserStatus ' );
271+
272+
273+ $ this ->service ->processCalendarStatus ('admin ' );
274+ }
275+
232276 public function testCalendarEvent (): void {
233277 $ user = $ this ->createConfiguredMock (IUser::class, [
234278 'getUID ' => 'admin ' ,
0 commit comments