summaryrefslogtreecommitdiffstats
path: root/apps/dav/tests
diff options
context:
space:
mode:
authorJulius Härtl <jus@bitgrid.net>2022-11-07 21:20:47 +0100
committerJulius Härtl <jus@bitgrid.net>2022-11-09 16:37:34 +0100
commite29720f9b2aaf7467acdcfe3c9dde9eceda2e3bf (patch)
treee9d19deac0a412ff3c11f9551c1228b7b9c41915 /apps/dav/tests
parent908b7aa70af4417a0011e1b09ba44dc9b50792f2 (diff)
downloadnextcloud-server-e29720f9b2aaf7467acdcfe3c9dde9eceda2e3bf.tar.gz
nextcloud-server-e29720f9b2aaf7467acdcfe3c9dde9eceda2e3bf.zip
Next attemp on imip tests
Signed-off-by: Julius Härtl <jus@bitgrid.net>
Diffstat (limited to 'apps/dav/tests')
-rw-r--r--apps/dav/tests/unit/CalDAV/CalendarImplTest.php57
1 files changed, 28 insertions, 29 deletions
diff --git a/apps/dav/tests/unit/CalDAV/CalendarImplTest.php b/apps/dav/tests/unit/CalDAV/CalendarImplTest.php
index b504e8b1249..92fd760b248 100644
--- a/apps/dav/tests/unit/CalDAV/CalendarImplTest.php
+++ b/apps/dav/tests/unit/CalDAV/CalendarImplTest.php
@@ -78,7 +78,7 @@ class CalendarImplTest extends \Test\TestCase {
}
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 @@ class CalendarImplTest extends \Test\TestCase {
}
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:lewis@stardew-tent-living.com
+ORGANIZER:mailto:pierre@generalstore.com
+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:lewis@stardew-tent-living.com');
+
+ /** @var Plugin|MockObject $schedulingPlugin */
+ $schedulingPlugin = $this->createMock(Plugin::class);
+ $iTipMessage = $this->getITipMessage($message);
+ $iTipMessage->recipient = "mailto:lewis@stardew-tent-living.com";
+ $schedulingPlugin->expects(self::once())
+ ->method('scheduleLocalDelivery')
+ ->with($iTipMessage);
$server = $this->createMock(Server::class);
$server->expects($this->any())
@@ -162,7 +182,7 @@ class CalendarImplTest extends \Test\TestCase {
['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 @@ class CalendarImplTest extends \Test\TestCase {
->method('getInvitationResponseServer')
->willReturn($invitationResponseServer);
- $message = <<<EOF
-BEGIN:VCALENDAR
-PRODID:-//Nextcloud/Nextcloud CalDAV Server//EN
-METHOD:REPLY
-VERSION:2.0
-BEGIN:VEVENT
-ATTENDEE;PARTSTAT=mailto:lewis@stardew-tent-living.com:ACCEPTED
-ORGANIZER:mailto:pierre@generalstore.com
-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 @@ PRODID:-//Nextcloud/Nextcloud CalDAV Server//EN
METHOD:REPLY
VERSION:2.0
BEGIN:VEVENT
-ATTENDEE;PARTSTAT=mailto:lewis@stardew-tent-living.com:ACCEPTED
+ATTENDEE;PARTSTAT=ACCEPTED:mailto:lewis@stardew-tent-living.com
ORGANIZER:mailto:pierre@generalstore.com
UID:aUniqueUid
SEQUENCE:2
@@ -261,7 +260,7 @@ EOF;
}
private function getITipMessage($calendarData): Message {
- $iTipMessage = new Message();
+ $iTipMessage = new Message();
/** @var VCalendar $vObject */
$vObject = Reader::read($calendarData);
/** @var VEvent $vEvent */