@@ -382,6 +382,82 @@ public function testHandleImipWithNoEvent(): void {
382382		$ this assertFalse ($ result
383383	}
384384
385+ 	public  function  testHandleImipMissingOrganizerWithRecipient (): void  {
386+ 		// construct mock user calendar 
387+ 		$ userCalendar$ this createMock (ITestCalendar::class);
388+ 		$ userCalendarexpects (self ::once ())
389+ 			->method ('isDeleted ' )
390+ 			->willReturn (false );
391+ 		$ userCalendarexpects (self ::once ())
392+ 			->method ('isWritable ' )
393+ 			->willReturn (true );
394+ 		$ userCalendarexpects (self ::once ())
395+ 			->method ('search ' )
396+ 			->willReturn ([['uri '  => 'principals/user/attendee1/personal ' ]]);
397+ 		// construct mock calendar manager and returns 
398+ 		/** @var Manager&MockObject $manager */ 
399+ 		$ manager$ this getMockBuilder (Manager::class)
400+ 			->setConstructorArgs ([
401+ 				$ this coordinator ,
402+ 				$ this container ,
403+ 				$ this logger ,
404+ 				$ this time ,
405+ 				$ this secureRandom ,
406+ 				$ this userManager ,
407+ 				$ this serverFactory ,
408+ 				$ this propertyMapper ,
409+ 			])
410+ 			->onlyMethods (['getCalendarsForPrincipal ' ])
411+ 			->getMock ();
412+ 		$ managerexpects (self ::once ())
413+ 			->method ('getCalendarsForPrincipal ' )
414+ 			->willReturn ([$ userCalendar
415+ 		// construct parameters 
416+ 		$ userId'attendee1 ' ;
417+ 		$ calendar$ this vCalendar1a ;
418+ 		$ calendaradd ('METHOD ' , 'REQUEST ' );
419+ 		$ calendarVEVENT ->remove ('ORGANIZER ' );
420+ 		// construct user calendar returns 
421+ 		$ userCalendarexpects (self ::once ())
422+ 			->method ('handleIMipMessage ' );
423+ 		// test method 
424+ 		$ result$ managerhandleIMip ($ userId$ calendarserialize (), ['recipient '  => 'organizer@testing.com ' ]);
425+ 	}
426+ 
427+ 	public  function  testHandleImipMissingOrganizerNoRecipient (): void  {
428+ 		// construct mock user calendar 
429+ 		$ userCalendar$ this createMock (ITestCalendar::class);
430+ 		// construct mock calendar manager and returns 
431+ 		/** @var Manager&MockObject $manager */ 
432+ 		$ manager$ this getMockBuilder (Manager::class)
433+ 			->setConstructorArgs ([
434+ 				$ this coordinator ,
435+ 				$ this container ,
436+ 				$ this logger ,
437+ 				$ this time ,
438+ 				$ this secureRandom ,
439+ 				$ this userManager ,
440+ 				$ this serverFactory ,
441+ 				$ this propertyMapper ,
442+ 			])
443+ 			->onlyMethods (['getCalendarsForPrincipal ' ])
444+ 			->getMock ();
445+ 		$ managerexpects (self ::once ())
446+ 			->method ('getCalendarsForPrincipal ' )
447+ 			->willReturn ([$ userCalendar
448+ 		// construct parameters 
449+ 		$ userId'attendee1 ' ;
450+ 		$ calendar$ this vCalendar1a ;
451+ 		$ calendaradd ('METHOD ' , 'REQUEST ' );
452+ 		$ calendarVEVENT ->remove ('ORGANIZER ' );
453+ 		// Logger expects warning 
454+ 		$ this logger ->expects ($ this once ())
455+ 			->method ('warning ' )
456+ 			->with ('iMip message event does not contain an organizer and no recipient was provided ' );
457+ 
458+ 		$ result$ managerhandleIMip ($ userId$ calendarserialize (), []);
459+ 	}
460+ 
385461	public  function  testHandleImipWithNoUid (): void  {
386462		// construct mock user calendar 
387463		$ userCalendar$ this createMock (ITestCalendar::class);
0 commit comments