-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #49292 from nextcloud/backport/49290/stable30
- Loading branch information
Showing
1 changed file
with
16 additions
and
21 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 |
---|---|---|
|
@@ -50,9 +50,9 @@ public function testParseEventForOrganizerOnCreate(): void { | |
'significantChangeHash' => '', | ||
'attendees' => [], | ||
]; | ||
$currentEventInfo = $this->callMethod($this->broker, 'parseEventInfo', [$calendar]); | ||
$currentEventInfo = $this->invokePrivate($this->broker, 'parseEventInfo', [$calendar]); | ||
// test iTip generation | ||
$messages = $this->callMethod($this->broker, 'parseEventForOrganizer', [$calendar, $currentEventInfo, $previousEventInfo]); | ||
$messages = $this->invokePrivate($this->broker, 'parseEventForOrganizer', [$calendar, $currentEventInfo, $previousEventInfo]); | ||
$this->assertCount(1, $messages); | ||
$this->assertEquals('REQUEST', $messages[0]->method); | ||
$this->assertEquals($calendar->VEVENT->ORGANIZER->getValue(), $messages[0]->sender); | ||
|
@@ -64,13 +64,13 @@ public function testParseEventForOrganizerOnModify(): void { | |
|
||
// construct calendar and generate event info for modified event with one attendee | ||
$calendar = clone $this->vCalendar1a; | ||
$previousEventInfo = $this->callMethod($this->broker, 'parseEventInfo', [$calendar]); | ||
$previousEventInfo = $this->invokePrivate($this->broker, 'parseEventInfo', [$calendar]); | ||
$calendar->VEVENT->{'LAST-MODIFIED'}->setValue('20240701T020000Z'); | ||
$calendar->VEVENT->SEQUENCE->setValue(2); | ||
$calendar->VEVENT->SUMMARY->setValue('Test Event Modified'); | ||
$currentEventInfo = $this->callMethod($this->broker, 'parseEventInfo', [$calendar]); | ||
$currentEventInfo = $this->invokePrivate($this->broker, 'parseEventInfo', [$calendar]); | ||
// test iTip generation | ||
$messages = $this->callMethod($this->broker, 'parseEventForOrganizer', [$calendar, $currentEventInfo, $previousEventInfo]); | ||
$messages = $this->invokePrivate($this->broker, 'parseEventForOrganizer', [$calendar, $currentEventInfo, $previousEventInfo]); | ||
$this->assertCount(1, $messages); | ||
$this->assertEquals('REQUEST', $messages[0]->method); | ||
$this->assertEquals($calendar->VEVENT->ORGANIZER->getValue(), $messages[0]->sender); | ||
|
@@ -82,12 +82,12 @@ public function testParseEventForOrganizerOnDelete(): void { | |
|
||
// construct calendar and generate event info for modified event with one attendee | ||
$calendar = clone $this->vCalendar1a; | ||
$previousEventInfo = $this->callMethod($this->broker, 'parseEventInfo', [$calendar]); | ||
$previousEventInfo = $this->invokePrivate($this->broker, 'parseEventInfo', [$calendar]); | ||
$currentEventInfo = $previousEventInfo; | ||
$currentEventInfo['attendees'] = []; | ||
++$currentEventInfo['sequence']; | ||
// test iTip generation | ||
$messages = $this->callMethod($this->broker, 'parseEventForOrganizer', [$calendar, $currentEventInfo, $previousEventInfo]); | ||
$messages = $this->invokePrivate($this->broker, 'parseEventForOrganizer', [$calendar, $currentEventInfo, $previousEventInfo]); | ||
$this->assertCount(1, $messages); | ||
$this->assertEquals('CANCEL', $messages[0]->method); | ||
$this->assertEquals($calendar->VEVENT->ORGANIZER->getValue(), $messages[0]->sender); | ||
|
@@ -99,13 +99,13 @@ public function testParseEventForOrganizerOnStatusCancelled(): void { | |
|
||
// construct calendar and generate event info for modified event with one attendee | ||
$calendar = clone $this->vCalendar1a; | ||
$previousEventInfo = $this->callMethod($this->broker, 'parseEventInfo', [$calendar]); | ||
$previousEventInfo = $this->invokePrivate($this->broker, 'parseEventInfo', [$calendar]); | ||
$calendar->VEVENT->{'LAST-MODIFIED'}->setValue('20240701T020000Z'); | ||
$calendar->VEVENT->SEQUENCE->setValue(2); | ||
$calendar->VEVENT->STATUS->setValue('CANCELLED'); | ||
$currentEventInfo = $this->callMethod($this->broker, 'parseEventInfo', [$calendar]); | ||
$currentEventInfo = $this->invokePrivate($this->broker, 'parseEventInfo', [$calendar]); | ||
// test iTip generation | ||
$messages = $this->callMethod($this->broker, 'parseEventForOrganizer', [$calendar, $currentEventInfo, $previousEventInfo]); | ||
$messages = $this->invokePrivate($this->broker, 'parseEventForOrganizer', [$calendar, $currentEventInfo, $previousEventInfo]); | ||
$this->assertCount(1, $messages); | ||
$this->assertEquals('CANCEL', $messages[0]->method); | ||
$this->assertEquals($calendar->VEVENT->ORGANIZER->getValue(), $messages[0]->sender); | ||
|
@@ -117,7 +117,7 @@ public function testParseEventForOrganizerOnAddAttendee(): void { | |
|
||
// construct calendar and generate event info for modified event with two attendees | ||
$calendar = clone $this->vCalendar1a; | ||
$previousEventInfo = $this->callMethod($this->broker, 'parseEventInfo', [$calendar]); | ||
$previousEventInfo = $this->invokePrivate($this->broker, 'parseEventInfo', [$calendar]); | ||
$calendar->VEVENT->{'LAST-MODIFIED'}->setValue('20240701T020000Z'); | ||
$calendar->VEVENT->SEQUENCE->setValue(2); | ||
$calendar->VEVENT->add('ATTENDEE', 'mailto:[email protected]', [ | ||
|
@@ -127,9 +127,9 @@ public function testParseEventForOrganizerOnAddAttendee(): void { | |
'ROLE' => 'REQ-PARTICIPANT', | ||
'RSVP' => 'TRUE' | ||
]); | ||
$currentEventInfo = $this->callMethod($this->broker, 'parseEventInfo', [$calendar]); | ||
$currentEventInfo = $this->invokePrivate($this->broker, 'parseEventInfo', [$calendar]); | ||
// test iTip generation | ||
$messages = $this->callMethod($this->broker, 'parseEventForOrganizer', [$calendar, $currentEventInfo, $previousEventInfo]); | ||
$messages = $this->invokePrivate($this->broker, 'parseEventForOrganizer', [$calendar, $currentEventInfo, $previousEventInfo]); | ||
$this->assertCount(2, $messages); | ||
$this->assertEquals('REQUEST', $messages[0]->method); | ||
$this->assertEquals($calendar->VEVENT->ORGANIZER->getValue(), $messages[0]->sender); | ||
|
@@ -151,7 +151,7 @@ public function testParseEventForOrganizerOnRemoveAttendee(): void { | |
'ROLE' => 'REQ-PARTICIPANT', | ||
'RSVP' => 'TRUE' | ||
]); | ||
$previousEventInfo = $this->callMethod($this->broker, 'parseEventInfo', [$calendar]); | ||
$previousEventInfo = $this->invokePrivate($this->broker, 'parseEventInfo', [$calendar]); | ||
$calendar->VEVENT->{'LAST-MODIFIED'}->setValue('20240701T020000Z'); | ||
$calendar->VEVENT->SEQUENCE->setValue(2); | ||
$calendar->VEVENT->remove('ATTENDEE'); | ||
|
@@ -162,9 +162,9 @@ public function testParseEventForOrganizerOnRemoveAttendee(): void { | |
'ROLE' => 'REQ-PARTICIPANT', | ||
'RSVP' => 'TRUE' | ||
]); | ||
$currentEventInfo = $this->callMethod($this->broker, 'parseEventInfo', [$calendar]); | ||
$currentEventInfo = $this->invokePrivate($this->broker, 'parseEventInfo', [$calendar]); | ||
// test iTip generation | ||
$messages = $this->callMethod($this->broker, 'parseEventForOrganizer', [$calendar, $currentEventInfo, $previousEventInfo]); | ||
$messages = $this->invokePrivate($this->broker, 'parseEventForOrganizer', [$calendar, $currentEventInfo, $previousEventInfo]); | ||
$this->assertCount(2, $messages); | ||
$this->assertEquals('REQUEST', $messages[0]->method); | ||
$this->assertEquals($calendar->VEVENT->ORGANIZER->getValue(), $messages[0]->sender); | ||
|
@@ -175,9 +175,4 @@ public function testParseEventForOrganizerOnRemoveAttendee(): void { | |
|
||
} | ||
|
||
public static function callMethod($obj, $name, array $args) { | ||
$class = new \ReflectionClass($obj); | ||
$method = $class->getMethod($name); | ||
return $method->invokeArgs($obj, $args); | ||
} | ||
} |