-
-
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.
Update attendence for external users
For local users it's possible to select their calendar via the principal url and first update their own attendance status. External users have no calendar event hence the recipient is the organizer. Signed-off-by: Daniel Kesselberg <[email protected]>
- Loading branch information
1 parent
a44e728
commit 6df4391
Showing
3 changed files
with
84 additions
and
25 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
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
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 |
---|---|---|
|
@@ -76,7 +76,17 @@ protected function setUp(): void { | |
); | ||
} | ||
|
||
public function testAccept() { | ||
public function attendeeProvider(): array { | ||
return [ | ||
'local attendee' => [false], | ||
'external attendee' => [true] | ||
]; | ||
} | ||
|
||
/** | ||
* @dataProvider attendeeProvider | ||
*/ | ||
public function testAccept(bool $isExternalAttendee): void { | ||
$this->buildQueryExpects('TOKEN123', [ | ||
'id' => 0, | ||
'uid' => 'this-is-the-events-uid', | ||
|
@@ -109,21 +119,26 @@ public function testAccept() { | |
$called = false; | ||
$this->responseServer->expects($this->once()) | ||
->method('handleITipMessage') | ||
->willReturnCallback(function (Message $iTipMessage) use (&$called, $expected) { | ||
->willReturnCallback(function (Message $iTipMessage) use (&$called, $isExternalAttendee, $expected) { | ||
$called = true; | ||
$this->assertEquals('this-is-the-events-uid', $iTipMessage->uid); | ||
$this->assertEquals('VEVENT', $iTipMessage->component); | ||
$this->assertEquals('REPLY', $iTipMessage->method); | ||
$this->assertEquals(null, $iTipMessage->sequence); | ||
$this->assertEquals('mailto:[email protected]', $iTipMessage->sender); | ||
$this->assertEquals('mailto:[email protected]', $iTipMessage->recipient); | ||
if ($isExternalAttendee) { | ||
$this->assertEquals('mailto:[email protected]', $iTipMessage->recipient); | ||
} else { | ||
$this->assertEquals('mailto:[email protected]', $iTipMessage->recipient); | ||
} | ||
|
||
$iTipMessage->scheduleStatus = '1.2;Message delivered locally'; | ||
|
||
$this->assertEquals($expected, $iTipMessage->message->serialize()); | ||
}); | ||
|
||
|
||
$this->responseServer->expects($this->once()) | ||
->method('isExternalAttendee') | ||
->willReturn($isExternalAttendee); | ||
|
||
$response = $this->controller->accept('TOKEN123'); | ||
$this->assertInstanceOf(TemplateResponse::class, $response); | ||
|
@@ -132,7 +147,10 @@ public function testAccept() { | |
$this->assertTrue($called); | ||
} | ||
|
||
public function testAcceptSequence() { | ||
/** | ||
* @dataProvider attendeeProvider | ||
*/ | ||
public function testAcceptSequence(bool $isExternalAttendee): void { | ||
$this->buildQueryExpects('TOKEN123', [ | ||
'id' => 0, | ||
'uid' => 'this-is-the-events-uid', | ||
|
@@ -165,21 +183,26 @@ public function testAcceptSequence() { | |
$called = false; | ||
$this->responseServer->expects($this->once()) | ||
->method('handleITipMessage') | ||
->willReturnCallback(function (Message $iTipMessage) use (&$called, $expected) { | ||
->willReturnCallback(function (Message $iTipMessage) use (&$called, $isExternalAttendee, $expected) { | ||
$called = true; | ||
$this->assertEquals('this-is-the-events-uid', $iTipMessage->uid); | ||
$this->assertEquals('VEVENT', $iTipMessage->component); | ||
$this->assertEquals('REPLY', $iTipMessage->method); | ||
$this->assertEquals(1337, $iTipMessage->sequence); | ||
$this->assertEquals('mailto:[email protected]', $iTipMessage->sender); | ||
$this->assertEquals('mailto:[email protected]', $iTipMessage->recipient); | ||
if ($isExternalAttendee) { | ||
$this->assertEquals('mailto:[email protected]', $iTipMessage->recipient); | ||
} else { | ||
$this->assertEquals('mailto:[email protected]', $iTipMessage->recipient); | ||
} | ||
|
||
$iTipMessage->scheduleStatus = '1.2;Message delivered locally'; | ||
|
||
$this->assertEquals($expected, $iTipMessage->message->serialize()); | ||
}); | ||
|
||
|
||
$this->responseServer->expects($this->once()) | ||
->method('isExternalAttendee') | ||
->willReturn($isExternalAttendee); | ||
|
||
$response = $this->controller->accept('TOKEN123'); | ||
$this->assertInstanceOf(TemplateResponse::class, $response); | ||
|
@@ -188,7 +211,10 @@ public function testAcceptSequence() { | |
$this->assertTrue($called); | ||
} | ||
|
||
public function testAcceptRecurrenceId() { | ||
/** | ||
* @dataProvider attendeeProvider | ||
*/ | ||
public function testAcceptRecurrenceId(bool $isExternalAttendee): void { | ||
$this->buildQueryExpects('TOKEN123', [ | ||
'id' => 0, | ||
'uid' => 'this-is-the-events-uid', | ||
|
@@ -222,21 +248,26 @@ public function testAcceptRecurrenceId() { | |
$called = false; | ||
$this->responseServer->expects($this->once()) | ||
->method('handleITipMessage') | ||
->willReturnCallback(function (Message $iTipMessage) use (&$called, $expected) { | ||
->willReturnCallback(function (Message $iTipMessage) use (&$called, $isExternalAttendee, $expected) { | ||
$called = true; | ||
$this->assertEquals('this-is-the-events-uid', $iTipMessage->uid); | ||
$this->assertEquals('VEVENT', $iTipMessage->component); | ||
$this->assertEquals('REPLY', $iTipMessage->method); | ||
$this->assertEquals(0, $iTipMessage->sequence); | ||
$this->assertEquals('mailto:[email protected]', $iTipMessage->sender); | ||
$this->assertEquals('mailto:[email protected]', $iTipMessage->recipient); | ||
if ($isExternalAttendee) { | ||
$this->assertEquals('mailto:[email protected]', $iTipMessage->recipient); | ||
} else { | ||
$this->assertEquals('mailto:[email protected]', $iTipMessage->recipient); | ||
} | ||
|
||
$iTipMessage->scheduleStatus = '1.2;Message delivered locally'; | ||
|
||
$this->assertEquals($expected, $iTipMessage->message->serialize()); | ||
}); | ||
|
||
|
||
$this->responseServer->expects($this->once()) | ||
->method('isExternalAttendee') | ||
->willReturn($isExternalAttendee); | ||
|
||
$response = $this->controller->accept('TOKEN123'); | ||
$this->assertInstanceOf(TemplateResponse::class, $response); | ||
|
@@ -272,7 +303,10 @@ public function testAcceptExpiredToken() { | |
$this->assertEquals([], $response->getParams()); | ||
} | ||
|
||
public function testDecline() { | ||
/** | ||
* @dataProvider attendeeProvider | ||
*/ | ||
public function testDecline(bool $isExternalAttendee): void { | ||
$this->buildQueryExpects('TOKEN123', [ | ||
'id' => 0, | ||
'uid' => 'this-is-the-events-uid', | ||
|
@@ -305,21 +339,26 @@ public function testDecline() { | |
$called = false; | ||
$this->responseServer->expects($this->once()) | ||
->method('handleITipMessage') | ||
->willReturnCallback(function (Message $iTipMessage) use (&$called, $expected) { | ||
->willReturnCallback(function (Message $iTipMessage) use (&$called, $isExternalAttendee, $expected) { | ||
$called = true; | ||
$this->assertEquals('this-is-the-events-uid', $iTipMessage->uid); | ||
$this->assertEquals('VEVENT', $iTipMessage->component); | ||
$this->assertEquals('REPLY', $iTipMessage->method); | ||
$this->assertEquals(null, $iTipMessage->sequence); | ||
$this->assertEquals('mailto:[email protected]', $iTipMessage->sender); | ||
$this->assertEquals('mailto:[email protected]', $iTipMessage->recipient); | ||
if ($isExternalAttendee) { | ||
$this->assertEquals('mailto:[email protected]', $iTipMessage->recipient); | ||
} else { | ||
$this->assertEquals('mailto:[email protected]', $iTipMessage->recipient); | ||
} | ||
|
||
$iTipMessage->scheduleStatus = '1.2;Message delivered locally'; | ||
|
||
$this->assertEquals($expected, $iTipMessage->message->serialize()); | ||
}); | ||
|
||
|
||
$this->responseServer->expects($this->once()) | ||
->method('isExternalAttendee') | ||
->willReturn($isExternalAttendee); | ||
|
||
$response = $this->controller->decline('TOKEN123'); | ||
$this->assertInstanceOf(TemplateResponse::class, $response); | ||
|
@@ -335,7 +374,10 @@ public function testOptions() { | |
$this->assertEquals(['token' => 'TOKEN123'], $response->getParams()); | ||
} | ||
|
||
public function testProcessMoreOptionsResult() { | ||
/** | ||
* @dataProvider attendeeProvider | ||
*/ | ||
public function testProcessMoreOptionsResult(bool $isExternalAttendee): void { | ||
$this->request->expects($this->at(0)) | ||
->method('getParam') | ||
->with('partStat') | ||
|
@@ -383,20 +425,26 @@ public function testProcessMoreOptionsResult() { | |
$called = false; | ||
$this->responseServer->expects($this->once()) | ||
->method('handleITipMessage') | ||
->willReturnCallback(function (Message $iTipMessage) use (&$called, $expected) { | ||
->willReturnCallback(function (Message $iTipMessage) use (&$called, $isExternalAttendee, $expected) { | ||
$called = true; | ||
$this->assertEquals('this-is-the-events-uid', $iTipMessage->uid); | ||
$this->assertEquals('VEVENT', $iTipMessage->component); | ||
$this->assertEquals('REPLY', $iTipMessage->method); | ||
$this->assertEquals(null, $iTipMessage->sequence); | ||
$this->assertEquals('mailto:[email protected]', $iTipMessage->sender); | ||
$this->assertEquals('mailto:[email protected]', $iTipMessage->recipient); | ||
if ($isExternalAttendee) { | ||
$this->assertEquals('mailto:[email protected]', $iTipMessage->recipient); | ||
} else { | ||
$this->assertEquals('mailto:[email protected]', $iTipMessage->recipient); | ||
} | ||
|
||
$iTipMessage->scheduleStatus = '1.2;Message delivered locally'; | ||
|
||
$this->assertEquals($expected, $iTipMessage->message->serialize()); | ||
}); | ||
|
||
$this->responseServer->expects($this->once()) | ||
->method('isExternalAttendee') | ||
->willReturn($isExternalAttendee); | ||
|
||
|
||
$response = $this->controller->processMoreOptionsResult('TOKEN123'); | ||
|