@@ -251,7 +251,7 @@ public function testHandleImipReplyWrongMethod(): void {
251251 $ this ->logger ->expects (self ::once ())
252252 ->method ('warning ' );
253253 $ this ->time ->expects (self ::never ())
254- ->method ('getTimestamp ' );
254+ ->method ('getTime ' );
255255
256256 $ result = $ this ->manager ->handleIMipReply ($ principalUri , $ sender , $ recipient , $ calendarData ->serialize ());
257257 $ this ->assertFalse ($ result );
@@ -266,7 +266,7 @@ public function testHandleImipReplyOrganizerNotRecipient(): void {
266266 $ this ->logger ->expects (self ::once ())
267267 ->method ('warning ' );
268268 $ this ->time ->expects (self ::never ())
269- ->method ('getTimestamp ' );
269+ ->method ('getTime ' );
270270
271271 $ result = $ this ->manager ->handleIMipReply ($ principalUri , $ sender , $ recipient , $ calendarData ->serialize ());
272272 $ this ->assertFalse ($ result );
@@ -280,7 +280,7 @@ public function testHandleImipReplyDateInThePast(): void {
280280 $ calendarData ->VEVENT ->DTSTART = new \DateTime ('2013-04-07 ' ); // set to in the past
281281
282282 $ this ->time ->expects (self ::once ())
283- ->method ('getTimestamp ' )
283+ ->method ('getTime ' )
284284 ->willReturn (time ());
285285
286286 $ this ->logger ->expects (self ::once ())
@@ -301,15 +301,16 @@ public function testHandleImipReplyNoCalendars(): void {
301301 ])
302302 ->setMethods ([
303303 'getCalendarsForPrincipal '
304- ]);
304+ ])
305+ ->getMock ();
305306 $ principalUri = 'principals/user/linus ' ;
306307 $ sender = 'pierre@general-store.com ' ;
307308 $ recipient = 'linus@stardew-tent-living.com ' ;
308309 $ calendarData = $ this ->getVCalendarReply ();
309310
310311 $ this ->time ->expects (self ::once ())
311- ->method ('getTimestamp ' )
312- ->willReturn (202208219 );
312+ ->method ('getTime ' )
313+ ->willReturn (1628374233 );
313314 $ manager ->expects (self ::once ())
314315 ->method ('getCalendarsForPrincipal ' )
315316 ->willReturn ([]);
@@ -331,16 +332,17 @@ public function testHandleImipReplyEventNotFound(): void {
331332 ])
332333 ->setMethods ([
333334 'getCalendarsForPrincipal '
334- ]);
335+ ])
336+ ->getMock ();
335337 $ calendar = $ this ->createMock (ICreateFromString::class);
336338 $ principalUri = 'principals/user/linus ' ;
337339 $ sender = 'pierre@general-store.com ' ;
338340 $ recipient = 'linus@stardew-tent-living.com ' ;
339341 $ calendarData = $ this ->getVCalendarReply ();
340342
341343 $ this ->time ->expects (self ::once ())
342- ->method ('getTimestamp ' )
343- ->willReturn (202208219 );
344+ ->method ('getTime ' )
345+ ->willReturn (1628374233 );
344346 $ manager ->expects (self ::once ())
345347 ->method ('getCalendarsForPrincipal ' )
346348 ->willReturn ([$ calendar ]);
@@ -367,16 +369,17 @@ public function testHandleImipReply(): void {
367369 ])
368370 ->setMethods ([
369371 'getCalendarsForPrincipal '
370- ]);
372+ ])
373+ ->getMock ();
371374 $ calendar = $ this ->createMock (ICreateFromString::class);
372375 $ principalUri = 'principals/user/linus ' ;
373376 $ sender = 'pierre@general-store.com ' ;
374377 $ recipient = 'linus@stardew-tent-living.com ' ;
375378 $ calendarData = $ this ->getVCalendarReply ();
376379
377380 $ this ->time ->expects (self ::once ())
378- ->method ('getTimestamp ' )
379- ->willReturn (202208219 );
381+ ->method ('getTime ' )
382+ ->willReturn (1628374233 );
380383 $ manager ->expects (self ::once ())
381384 ->method ('getCalendarsForPrincipal ' )
382385 ->willReturn ([$ calendar ]);
@@ -397,12 +400,12 @@ public function testHandleImipCancelWrongMethod(): void {
397400 $ recipient = 'pierre@general-store.com ' ;
398401 $ replyTo = null ;
399402 $ calendarData = $ this ->getVCalendarCancel ();
400- $ calendarData ->VEVENT -> METHOD = 'REQUEST ' ;
403+ $ calendarData ->METHOD = 'REQUEST ' ;
401404
402405 $ this ->logger ->expects (self ::once ())
403406 ->method ('warning ' );
404407 $ this ->time ->expects (self ::never ())
405- ->method ('getTimestamp ' );
408+ ->method ('getTime ' );
406409
407410 $ result = $ this ->manager ->handleIMipCancel ($ principalUri , $ sender , $ replyTo , $ recipient , $ calendarData ->serialize ());
408411 $ this ->assertFalse ($ result );
@@ -414,12 +417,11 @@ public function testHandleImipCancelAttendeeNotRecipient(): void {
414417 $ recipient = 'leah@general-store.com ' ;
415418 $ replyTo = null ;
416419 $ calendarData = $ this ->getVCalendarCancel ();
417- $ calendarData ->VEVENT ->METHOD = 'CANCEL ' ;
418420
419421 $ this ->logger ->expects (self ::once ())
420422 ->method ('warning ' );
421423 $ this ->time ->expects (self ::never ())
422- ->method ('getTimestamp ' );
424+ ->method ('getTime ' );
423425
424426 $ result = $ this ->manager ->handleIMipCancel ($ principalUri , $ sender , $ replyTo , $ recipient , $ calendarData ->serialize ());
425427 $ this ->assertFalse ($ result );
@@ -434,7 +436,7 @@ public function testHandleImipCancelDateInThePast(): void {
434436 $ calendarData ->VEVENT ->DTSTART = new \DateTime ('2013-04-07 ' ); // set to in the past
435437
436438 $ this ->time ->expects (self ::once ())
437- ->method ('getTimestamp ' )
439+ ->method ('getTime ' )
438440 ->willReturn (time ());
439441 $ this ->logger ->expects (self ::once ())
440442 ->method ('warning ' );
@@ -454,25 +456,26 @@ public function testHandleImipCancelNoCalendars(): void {
454456 ])
455457 ->setMethods ([
456458 'getCalendarsForPrincipal '
457- ]);
459+ ])
460+ ->getMock ();
458461 $ principalUri = 'principals/user/pierre ' ;
459462 $ sender = 'linus@stardew-tent-living.com ' ;
460463 $ recipient = 'pierre@general-store.com ' ;
461464 $ replyTo = null ;
462465 $ calendarData = $ this ->getVCalendarCancel ();
463466
464467 $ this ->time ->expects (self ::once ())
465- ->method ('getTimestamp ' )
466- ->willReturn (202208219 );
468+ ->method ('getTime ' )
469+ ->willReturn (1628374233 );
467470 $ manager ->expects (self ::once ())
468471 ->method ('getCalendarsForPrincipal ' )
469472 ->with ($ principalUri )
470473 ->willReturn ([]);
471474 $ this ->logger ->expects (self ::once ())
472475 ->method ('warning ' );
473476
474- $ result = $ this -> manager ->handleIMipCancel ($ principalUri , $ sender , $ replyTo , $ recipient , $ calendarData ->serialize ());
475- $ this ->assertTrue ($ result );
477+ $ result = $ manager ->handleIMipCancel ($ principalUri , $ sender , $ replyTo , $ recipient , $ calendarData ->serialize ());
478+ $ this ->assertFalse ($ result );
476479 }
477480
478481 public function testHandleImipCancelOrganiserInReplyTo (): void {
@@ -486,18 +489,18 @@ public function testHandleImipCancelOrganiserInReplyTo(): void {
486489 ])
487490 ->setMethods ([
488491 'getCalendarsForPrincipal '
489- ]);
492+ ])
493+ ->getMock ();
490494 $ principalUri = 'principals/user/pierre ' ;
491495 $ sender = 'clint@stardew-blacksmiths.com ' ;
492496 $ recipient = 'pierre@general-store.com ' ;
493497 $ replyTo = 'linus@stardew-tent-living.com ' ;
494498 $ calendar = $ this ->createMock (ICreateFromString::class);
495499 $ calendarData = $ this ->getVCalendarCancel ();
496- $ calendarData ->VEVENT ->METHOD = 'CANCEL ' ;
497500
498501 $ this ->time ->expects (self ::once ())
499- ->method ('getTimestamp ' )
500- ->willReturn (202208219 );
502+ ->method ('getTime ' )
503+ ->willReturn (1628374233 );
501504 $ manager ->expects (self ::once ())
502505 ->method ('getCalendarsForPrincipal ' )
503506 ->with ($ principalUri )
@@ -508,8 +511,8 @@ public function testHandleImipCancelOrganiserInReplyTo(): void {
508511 $ calendar ->expects (self ::once ())
509512 ->method ('handleIMipMessage ' )
510513 ->with ('testname.ics ' , $ calendarData ->serialize ());
511- $ result = $ this -> manager ->handleIMipCancel ($ principalUri , $ sender , $ replyTo , $ recipient , $ calendarData ->serialize ());
512- $ this ->assertFalse ($ result );
514+ $ result = $ manager ->handleIMipCancel ($ principalUri , $ sender , $ replyTo , $ recipient , $ calendarData ->serialize ());
515+ $ this ->assertTrue ($ result );
513516 }
514517
515518 public function testHandleImipCancel (): void {
@@ -523,18 +526,18 @@ public function testHandleImipCancel(): void {
523526 ])
524527 ->setMethods ([
525528 'getCalendarsForPrincipal '
526- ]);
529+ ])
530+ ->getMock ();
527531 $ principalUri = 'principals/user/pierre ' ;
528532 $ sender = 'linus@stardew-tent-living.com ' ;
529533 $ recipient = 'pierre@general-store.com ' ;
530534 $ replyTo = null ;
531535 $ calendar = $ this ->createMock (ICreateFromString::class);
532536 $ calendarData = $ this ->getVCalendarCancel ();
533- $ calendarData ->VEVENT ->METHOD = 'CANCEL ' ;
534537
535538 $ this ->time ->expects (self ::once ())
536- ->method ('getTimestamp ' )
537- ->willReturn (202208219 );
539+ ->method ('getTime ' )
540+ ->willReturn (1628374233 );
538541 $ manager ->expects (self ::once ())
539542 ->method ('getCalendarsForPrincipal ' )
540543 ->with ($ principalUri )
@@ -545,8 +548,8 @@ public function testHandleImipCancel(): void {
545548 $ calendar ->expects (self ::once ())
546549 ->method ('handleIMipMessage ' )
547550 ->with ('testname.ics ' , $ calendarData ->serialize ());
548- $ result = $ this -> manager ->handleIMipCancel ($ principalUri , $ sender , $ replyTo , $ recipient , $ calendarData ->serialize ());
549- $ this ->assertFalse ($ result );
551+ $ result = $ manager ->handleIMipCancel ($ principalUri , $ sender , $ replyTo , $ recipient , $ calendarData ->serialize ());
552+ $ this ->assertTrue ($ result );
550553 }
551554
552555 private function getVCalendarReply (): Document {
0 commit comments