Skip to content

Commit e3a52ce

Browse files
committed
Fix iMIP tests
Signed-off-by: Anna Larch <anna@nextcloud.com>
1 parent f7d73b0 commit e3a52ce

1 file changed

Lines changed: 13 additions & 16 deletions

File tree

tests/lib/Calendar/ManagerTest.php

Lines changed: 13 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -310,7 +310,7 @@ public function testHandleImipReplyNoCalendars(): void {
310310

311311
$this->time->expects(self::once())
312312
->method('getTime')
313-
->willReturn(202208219);
313+
->willReturn(1628374233);
314314
$manager->expects(self::once())
315315
->method('getCalendarsForPrincipal')
316316
->willReturn([]);
@@ -342,7 +342,7 @@ public function testHandleImipReplyEventNotFound(): void {
342342

343343
$this->time->expects(self::once())
344344
->method('getTime')
345-
->willReturn(202208219);
345+
->willReturn(1628374233);
346346
$manager->expects(self::once())
347347
->method('getCalendarsForPrincipal')
348348
->willReturn([$calendar]);
@@ -379,7 +379,7 @@ public function testHandleImipReply(): void {
379379

380380
$this->time->expects(self::once())
381381
->method('getTime')
382-
->willReturn(202208219);
382+
->willReturn(1628374233);
383383
$manager->expects(self::once())
384384
->method('getCalendarsForPrincipal')
385385
->willReturn([$calendar]);
@@ -400,7 +400,7 @@ public function testHandleImipCancelWrongMethod(): void {
400400
$recipient = 'pierre@general-store.com';
401401
$replyTo = null;
402402
$calendarData = $this->getVCalendarCancel();
403-
$calendarData->VEVENT->METHOD = 'REQUEST';
403+
$calendarData->METHOD = 'REQUEST';
404404

405405
$this->logger->expects(self::once())
406406
->method('warning');
@@ -417,7 +417,6 @@ public function testHandleImipCancelAttendeeNotRecipient(): void {
417417
$recipient = 'leah@general-store.com';
418418
$replyTo = null;
419419
$calendarData = $this->getVCalendarCancel();
420-
$calendarData->VEVENT->METHOD = 'CANCEL';
421420

422421
$this->logger->expects(self::once())
423422
->method('warning');
@@ -467,16 +466,16 @@ public function testHandleImipCancelNoCalendars(): void {
467466

468467
$this->time->expects(self::once())
469468
->method('getTime')
470-
->willReturn(202208219);
469+
->willReturn(1628374233);
471470
$manager->expects(self::once())
472471
->method('getCalendarsForPrincipal')
473472
->with($principalUri)
474473
->willReturn([]);
475474
$this->logger->expects(self::once())
476475
->method('warning');
477476

478-
$result = $this->manager->handleIMipCancel($principalUri, $sender, $replyTo, $recipient, $calendarData->serialize());
479-
$this->assertTrue($result);
477+
$result = $manager->handleIMipCancel($principalUri, $sender, $replyTo, $recipient, $calendarData->serialize());
478+
$this->assertFalse($result);
480479
}
481480

482481
public function testHandleImipCancelOrganiserInReplyTo(): void {
@@ -498,11 +497,10 @@ public function testHandleImipCancelOrganiserInReplyTo(): void {
498497
$replyTo = 'linus@stardew-tent-living.com';
499498
$calendar = $this->createMock(ICreateFromString::class);
500499
$calendarData = $this->getVCalendarCancel();
501-
$calendarData->VEVENT->METHOD = 'CANCEL';
502500

503501
$this->time->expects(self::once())
504502
->method('getTime')
505-
->willReturn(202208219);
503+
->willReturn(1628374233);
506504
$manager->expects(self::once())
507505
->method('getCalendarsForPrincipal')
508506
->with($principalUri)
@@ -513,8 +511,8 @@ public function testHandleImipCancelOrganiserInReplyTo(): void {
513511
$calendar->expects(self::once())
514512
->method('handleIMipMessage')
515513
->with('testname.ics', $calendarData->serialize());
516-
$result = $this->manager->handleIMipCancel($principalUri, $sender, $replyTo, $recipient, $calendarData->serialize());
517-
$this->assertFalse($result);
514+
$result = $manager->handleIMipCancel($principalUri, $sender, $replyTo, $recipient, $calendarData->serialize());
515+
$this->assertTrue($result);
518516
}
519517

520518
public function testHandleImipCancel(): void {
@@ -536,11 +534,10 @@ public function testHandleImipCancel(): void {
536534
$replyTo = null;
537535
$calendar = $this->createMock(ICreateFromString::class);
538536
$calendarData = $this->getVCalendarCancel();
539-
$calendarData->VEVENT->METHOD = 'CANCEL';
540537

541538
$this->time->expects(self::once())
542539
->method('getTime')
543-
->willReturn(202208219);
540+
->willReturn(1628374233);
544541
$manager->expects(self::once())
545542
->method('getCalendarsForPrincipal')
546543
->with($principalUri)
@@ -551,8 +548,8 @@ public function testHandleImipCancel(): void {
551548
$calendar->expects(self::once())
552549
->method('handleIMipMessage')
553550
->with('testname.ics', $calendarData->serialize());
554-
$result = $this->manager->handleIMipCancel($principalUri, $sender, $replyTo, $recipient, $calendarData->serialize());
555-
$this->assertFalse($result);
551+
$result = $manager->handleIMipCancel($principalUri, $sender, $replyTo, $recipient, $calendarData->serialize());
552+
$this->assertTrue($result);
556553
}
557554

558555
private function getVCalendarReply(): Document {

0 commit comments

Comments
 (0)