-
Notifications
You must be signed in to change notification settings - Fork 264
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: SebastianKrupinski <[email protected]>
- Loading branch information
1 parent
b9a0733
commit e8578ed
Showing
2 changed files
with
22 additions
and
17 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -49,12 +49,6 @@ class IMipServiceTest extends TestCase { | |
protected function setUp(): void { | ||
parent::setUp(); | ||
|
||
// iMIP is NC25+ | ||
if (!method_exists(IManager::class, 'handleImipReply')) { | ||
self::markTestIncomplete(); | ||
} | ||
|
||
|
||
$this->accountService = $this->createMock(AccountService::class); | ||
$this->calendarManager = $this->createMock(IManager::class); | ||
$this->mailboxMapper = $this->createMock(MailboxMapper::class); | ||
|
@@ -242,6 +236,12 @@ public function testImapConnectionServiceException(): void { | |
} | ||
|
||
public function testIsRequest(): void { | ||
|
||
// iMip Request is NC31+ | ||
if (!method_exists(IManager::class, 'handleImipRequest')) { | ||
self::markTestIncomplete(); | ||
} | ||
|
||
$message = new Message(); | ||
$message->setImipMessage(true); | ||
$message->setUid(1); | ||
|
@@ -252,9 +252,10 @@ public function testIsRequest(): void { | |
$mailAccount = new MailAccount(); | ||
$mailAccount->setId(200); | ||
$mailAccount->setEmail('[email protected]'); | ||
$mailAccount->setUserId('vincent'); | ||
$account = new Account($mailAccount); | ||
$imapMessage = $this->createMock(IMAPMessage::class); | ||
$imapMessage->scheduling[] = ['method' => 'REQUEST']; | ||
$imapMessage->scheduling[] = ['method' => 'REQUEST', 'contents' => 'VCALENDAR']; | ||
$addressList = $this->createMock(AddressList::class); | ||
$address = $this->createMock(Address::class); | ||
|
||
|
@@ -282,15 +283,17 @@ public function testIsRequest(): void { | |
->willReturn($address); | ||
$address->expects(self::once()) | ||
->method('getEmail') | ||
->willReturn('pam@stardew-bus-company.com'); | ||
->willReturn('pam@stardew-bus-service.com'); | ||
$this->logger->expects(self::never()) | ||
->method('info'); | ||
$this->calendarManager->expects(self::never()) | ||
->method('handleIMipReply'); | ||
$this->calendarManager->expects(self::never()) | ||
->method('handleIMipCancel'); | ||
$this->messageMapper->expects(self::never()) | ||
->method('updateBulk'); | ||
$this->calendarManager->expects(self::once()) | ||
->method('handleIMipRequest') | ||
->with('principals/users/vincent', | ||
'[email protected]', | ||
$account->getEmail(), | ||
$imapMessage->scheduling[0]['contents']); | ||
$this->messageMapper->expects(self::once()) | ||
->method('updateImipData'); | ||
|
||
$this->service->process(); | ||
} | ||
|
@@ -349,8 +352,6 @@ public function testIsReply(): void { | |
'[email protected]', | ||
$account->getEmail(), | ||
$imapMessage->scheduling[0]['contents']); | ||
$this->calendarManager->expects(self::never()) | ||
->method('handleIMipCancel'); | ||
$this->messageMapper->expects(self::once()) | ||
->method('updateImipData'); | ||
|
||
|