From e3a52ce13e501005736736def2fa8889fe47add1 Mon Sep 17 00:00:00 2001 From: Anna Larch Date: Thu, 8 Sep 2022 02:26:46 +0200 Subject: [PATCH] Fix iMIP tests Signed-off-by: Anna Larch --- tests/lib/Calendar/ManagerTest.php | 29 +++++++++++++---------------- 1 file changed, 13 insertions(+), 16 deletions(-) diff --git a/tests/lib/Calendar/ManagerTest.php b/tests/lib/Calendar/ManagerTest.php index 9623c88e5c2..ba30be1b548 100644 --- a/tests/lib/Calendar/ManagerTest.php +++ b/tests/lib/Calendar/ManagerTest.php @@ -310,7 +310,7 @@ class ManagerTest extends TestCase { $this->time->expects(self::once()) ->method('getTime') - ->willReturn(202208219); + ->willReturn(1628374233); $manager->expects(self::once()) ->method('getCalendarsForPrincipal') ->willReturn([]); @@ -342,7 +342,7 @@ class ManagerTest extends TestCase { $this->time->expects(self::once()) ->method('getTime') - ->willReturn(202208219); + ->willReturn(1628374233); $manager->expects(self::once()) ->method('getCalendarsForPrincipal') ->willReturn([$calendar]); @@ -379,7 +379,7 @@ class ManagerTest extends TestCase { $this->time->expects(self::once()) ->method('getTime') - ->willReturn(202208219); + ->willReturn(1628374233); $manager->expects(self::once()) ->method('getCalendarsForPrincipal') ->willReturn([$calendar]); @@ -400,7 +400,7 @@ class ManagerTest extends TestCase { $recipient = 'pierre@general-store.com'; $replyTo = null; $calendarData = $this->getVCalendarCancel(); - $calendarData->VEVENT->METHOD = 'REQUEST'; + $calendarData->METHOD = 'REQUEST'; $this->logger->expects(self::once()) ->method('warning'); @@ -417,7 +417,6 @@ class ManagerTest extends TestCase { $recipient = 'leah@general-store.com'; $replyTo = null; $calendarData = $this->getVCalendarCancel(); - $calendarData->VEVENT->METHOD = 'CANCEL'; $this->logger->expects(self::once()) ->method('warning'); @@ -467,7 +466,7 @@ class ManagerTest extends TestCase { $this->time->expects(self::once()) ->method('getTime') - ->willReturn(202208219); + ->willReturn(1628374233); $manager->expects(self::once()) ->method('getCalendarsForPrincipal') ->with($principalUri) @@ -475,8 +474,8 @@ class ManagerTest extends TestCase { $this->logger->expects(self::once()) ->method('warning'); - $result = $this->manager->handleIMipCancel($principalUri, $sender, $replyTo, $recipient, $calendarData->serialize()); - $this->assertTrue($result); + $result = $manager->handleIMipCancel($principalUri, $sender, $replyTo, $recipient, $calendarData->serialize()); + $this->assertFalse($result); } public function testHandleImipCancelOrganiserInReplyTo(): void { @@ -498,11 +497,10 @@ class ManagerTest extends TestCase { $replyTo = 'linus@stardew-tent-living.com'; $calendar = $this->createMock(ICreateFromString::class); $calendarData = $this->getVCalendarCancel(); - $calendarData->VEVENT->METHOD = 'CANCEL'; $this->time->expects(self::once()) ->method('getTime') - ->willReturn(202208219); + ->willReturn(1628374233); $manager->expects(self::once()) ->method('getCalendarsForPrincipal') ->with($principalUri) @@ -513,8 +511,8 @@ class ManagerTest extends TestCase { $calendar->expects(self::once()) ->method('handleIMipMessage') ->with('testname.ics', $calendarData->serialize()); - $result = $this->manager->handleIMipCancel($principalUri, $sender, $replyTo, $recipient, $calendarData->serialize()); - $this->assertFalse($result); + $result = $manager->handleIMipCancel($principalUri, $sender, $replyTo, $recipient, $calendarData->serialize()); + $this->assertTrue($result); } public function testHandleImipCancel(): void { @@ -536,11 +534,10 @@ class ManagerTest extends TestCase { $replyTo = null; $calendar = $this->createMock(ICreateFromString::class); $calendarData = $this->getVCalendarCancel(); - $calendarData->VEVENT->METHOD = 'CANCEL'; $this->time->expects(self::once()) ->method('getTime') - ->willReturn(202208219); + ->willReturn(1628374233); $manager->expects(self::once()) ->method('getCalendarsForPrincipal') ->with($principalUri) @@ -551,8 +548,8 @@ class ManagerTest extends TestCase { $calendar->expects(self::once()) ->method('handleIMipMessage') ->with('testname.ics', $calendarData->serialize()); - $result = $this->manager->handleIMipCancel($principalUri, $sender, $replyTo, $recipient, $calendarData->serialize()); - $this->assertFalse($result); + $result = $manager->handleIMipCancel($principalUri, $sender, $replyTo, $recipient, $calendarData->serialize()); + $this->assertTrue($result); } private function getVCalendarReply(): Document {