-
-
Notifications
You must be signed in to change notification settings - Fork 4.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Julius Härtl <[email protected]>
- Loading branch information
1 parent
908b7aa
commit e29720f
Showing
1 changed file
with
28 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -78,7 +78,7 @@ public function testGetKey() { | |
} | ||
|
||
public function testGetDisplayname() { | ||
$this->assertEquals($this->calendarImpl->getDisplayName(),'user readable name 123'); | ||
$this->assertEquals($this->calendarImpl->getDisplayName(), 'user readable name 123'); | ||
} | ||
|
||
public function testGetDisplayColor() { | ||
|
@@ -141,17 +141,37 @@ public function testGetPermissionAll() { | |
} | ||
|
||
public function testHandleImipMessage(): void { | ||
$message = <<<EOF | ||
BEGIN:VCALENDAR | ||
PRODID:-//Nextcloud/Nextcloud CalDAV Server//EN | ||
METHOD:REPLY | ||
VERSION:2.0 | ||
BEGIN:VEVENT | ||
ATTENDEE;PARTSTAT=ACCEPTED:mailto:[email protected] | ||
ORGANIZER:mailto:[email protected] | ||
UID:aUniqueUid | ||
SEQUENCE:2 | ||
REQUEST-STATUS:2.0;Success | ||
END:VEVENT | ||
END:VCALENDAR | ||
EOF; | ||
|
||
/** @var CustomPrincipalPlugin|MockObject $authPlugin */ | ||
$authPlugin = $this->createMock(CustomPrincipalPlugin::class); | ||
$authPlugin->expects(self::once()) | ||
->method('setCurrentPrincipal') | ||
->with($this->calendar->getPrincipalURI()); | ||
|
||
/** @var \Sabre\DAVACL\Plugin|MockObject $schedulingPlugin */ | ||
/** @var \Sabre\DAVACL\Plugin|MockObject $aclPlugin*/ | ||
$aclPlugin = $this->createMock(\Sabre\DAVACL\Plugin::class); | ||
$aclPlugin->expects(self::once()) | ||
->method('getPrincipalByUri') | ||
->with('mailto:[email protected]'); | ||
|
||
/** @var Plugin|MockObject $schedulingPlugin */ | ||
$schedulingPlugin = $this->createMock(Plugin::class); | ||
$iTipMessage = $this->getITipMessage($message); | ||
$iTipMessage->recipient = "mailto:[email protected]"; | ||
$schedulingPlugin->expects(self::once()) | ||
->method('scheduleLocalDelivery') | ||
->with($iTipMessage); | ||
|
||
$server = $this->createMock(Server::class); | ||
$server->expects($this->any()) | ||
|
@@ -162,7 +182,7 @@ public function testHandleImipMessage(): void { | |
['caldav-schedule', $schedulingPlugin] | ||
]); | ||
|
||
$invitationResponseServer = $this->createPartialMock(InvitationResponseServer::class, ['getServer']); | ||
$invitationResponseServer = $this->createPartialMock(InvitationResponseServer::class, ['getServer', 'isExternalAttendee']); | ||
$invitationResponseServer->server = $server; | ||
$invitationResponseServer->expects($this->any()) | ||
->method('getServer') | ||
|
@@ -179,27 +199,6 @@ public function testHandleImipMessage(): void { | |
->method('getInvitationResponseServer') | ||
->willReturn($invitationResponseServer); | ||
|
||
$message = <<<EOF | ||
BEGIN:VCALENDAR | ||
PRODID:-//Nextcloud/Nextcloud CalDAV Server//EN | ||
METHOD:REPLY | ||
VERSION:2.0 | ||
BEGIN:VEVENT | ||
ATTENDEE;PARTSTAT=mailto:[email protected]:ACCEPTED | ||
ORGANIZER:mailto:[email protected] | ||
UID:aUniqueUid | ||
SEQUENCE:2 | ||
REQUEST-STATUS:2.0;Success | ||
END:VEVENT | ||
END:VCALENDAR | ||
EOF; | ||
/** @var Plugin|MockObject $schedulingPlugin */ | ||
$schedulingPlugin = $this->createMock(Plugin::class); | ||
$iTipMessage = $this->getITipMessage($message); | ||
$schedulingPlugin->expects(self::once()) | ||
->method('scheduleLocalDelivery') | ||
->with($iTipMessage); | ||
|
||
$calendarImpl->handleIMipMessage('filename.ics', $message); | ||
} | ||
|
||
|
@@ -247,7 +246,7 @@ public function testHandleImipMessageNoCalendarUri(): void { | |
METHOD:REPLY | ||
VERSION:2.0 | ||
BEGIN:VEVENT | ||
ATTENDEE;PARTSTAT=mailto:[email protected]:ACCEPTED | ||
ATTENDEE;PARTSTAT=ACCEPTED:mailto:[email protected] | ||
ORGANIZER:mailto:[email protected] | ||
UID:aUniqueUid | ||
SEQUENCE:2 | ||
|
@@ -261,7 +260,7 @@ public function testHandleImipMessageNoCalendarUri(): void { | |
} | ||
|
||
private function getITipMessage($calendarData): Message { | ||
$iTipMessage = new Message(); | ||
$iTipMessage = new Message(); | ||
/** @var VCalendar $vObject */ | ||
$vObject = Reader::read($calendarData); | ||
/** @var VEvent $vEvent */ | ||
|