|
|
|
@ -35,7 +35,8 @@ use OCA\DAV\CalDAV\Schedule\IMipService; |
|
|
|
use OCP\AppFramework\Utility\ITimeFactory; |
|
|
|
use OCP\Defaults; |
|
|
|
use OCP\IConfig; |
|
|
|
use OCP\IUserManager; |
|
|
|
use OCP\IUser; |
|
|
|
use OCP\IUserSession; |
|
|
|
use OCP\Mail\IAttachment; |
|
|
|
use OCP\Mail\IEMailTemplate; |
|
|
|
use OCP\Mail\IMailer; |
|
|
|
@ -68,8 +69,11 @@ class IMipPluginTest extends TestCase { |
|
|
|
/** @var IConfig|MockObject */ |
|
|
|
private $config; |
|
|
|
|
|
|
|
/** @var IUserManager|MockObject */ |
|
|
|
private $userManager; |
|
|
|
/** @var IUserSession|MockObject */ |
|
|
|
private $userSession; |
|
|
|
|
|
|
|
/** @var IUser|MockObject */ |
|
|
|
private $user; |
|
|
|
|
|
|
|
/** @var IMipPlugin */ |
|
|
|
private $plugin; |
|
|
|
@ -107,8 +111,16 @@ class IMipPluginTest extends TestCase { |
|
|
|
$this->timeFactory->method('getTime')->willReturn(1496912528); // 2017-01-01
|
|
|
|
|
|
|
|
$this->config = $this->createMock(IConfig::class); |
|
|
|
|
|
|
|
$this->user = $this->createMock(IUser::class); |
|
|
|
/* |
|
|
|
$this->user->method('getUID'); |
|
|
|
$this->user->method('getDisplayName'); |
|
|
|
*/ |
|
|
|
|
|
|
|
$this->userManager = $this->createMock(IUserManager::class); |
|
|
|
$this->userSession = $this->createMock(IUserSession::class); |
|
|
|
$this->userSession->method('getUser') |
|
|
|
->willReturn($this->user); |
|
|
|
|
|
|
|
$this->defaults = $this->createMock(Defaults::class); |
|
|
|
$this->defaults->method('getName') |
|
|
|
@ -124,8 +136,7 @@ class IMipPluginTest extends TestCase { |
|
|
|
$this->logger, |
|
|
|
$this->timeFactory, |
|
|
|
$this->defaults, |
|
|
|
$this->userManager, |
|
|
|
'user123', |
|
|
|
$this->userSession, |
|
|
|
$this->service, |
|
|
|
$this->eventComparisonService |
|
|
|
); |
|
|
|
@ -213,8 +224,15 @@ class IMipPluginTest extends TestCase { |
|
|
|
->method('buildBodyData') |
|
|
|
->with($newVevent, $oldVEvent) |
|
|
|
->willReturn($data); |
|
|
|
$this->userManager->expects(self::never()) |
|
|
|
->method('getDisplayName'); |
|
|
|
$this->user->expects(self::any()) |
|
|
|
->method('getUID') |
|
|
|
->willReturn('user1'); |
|
|
|
$this->user->expects(self::any()) |
|
|
|
->method('getDisplayName') |
|
|
|
->willReturn('Mr. Wizard'); |
|
|
|
$this->userSession->expects(self::any()) |
|
|
|
->method('getUser') |
|
|
|
->willReturn($this->user); |
|
|
|
$this->service->expects(self::once()) |
|
|
|
->method('getFrom'); |
|
|
|
$this->service->expects(self::once()) |
|
|
|
@ -307,8 +325,15 @@ class IMipPluginTest extends TestCase { |
|
|
|
->willReturn(true); |
|
|
|
$this->service->expects(self::never()) |
|
|
|
->method('buildBodyData'); |
|
|
|
$this->userManager->expects(self::never()) |
|
|
|
->method('getDisplayName'); |
|
|
|
$this->user->expects(self::any()) |
|
|
|
->method('getUID') |
|
|
|
->willReturn('user1'); |
|
|
|
$this->user->expects(self::any()) |
|
|
|
->method('getDisplayName') |
|
|
|
->willReturn('Mr. Wizard'); |
|
|
|
$this->userSession->expects(self::any()) |
|
|
|
->method('getUser') |
|
|
|
->willReturn($this->user); |
|
|
|
$this->service->expects(self::never()) |
|
|
|
->method('getFrom'); |
|
|
|
$this->service->expects(self::never()) |
|
|
|
@ -331,7 +356,6 @@ class IMipPluginTest extends TestCase { |
|
|
|
$this->assertEquals('1.0', $message->getScheduleStatus()); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public function testParsingRecurrence(): void { |
|
|
|
$message = new Message(); |
|
|
|
$message->method = 'REQUEST'; |
|
|
|
@ -404,9 +428,15 @@ class IMipPluginTest extends TestCase { |
|
|
|
->method('buildBodyData') |
|
|
|
->with($newVevent, null) |
|
|
|
->willReturn($data); |
|
|
|
$this->userManager->expects(self::once()) |
|
|
|
$this->user->expects(self::any()) |
|
|
|
->method('getUID') |
|
|
|
->willReturn('user1'); |
|
|
|
$this->user->expects(self::any()) |
|
|
|
->method('getDisplayName') |
|
|
|
->willReturn('Mr. Wizard'); |
|
|
|
$this->userSession->expects(self::any()) |
|
|
|
->method('getUser') |
|
|
|
->willReturn($this->user); |
|
|
|
$this->service->expects(self::once()) |
|
|
|
->method('getFrom'); |
|
|
|
$this->service->expects(self::once()) |
|
|
|
@ -529,8 +559,15 @@ class IMipPluginTest extends TestCase { |
|
|
|
->method('buildBodyData') |
|
|
|
->with($newVevent, null) |
|
|
|
->willReturn($data); |
|
|
|
$this->userManager->expects(self::never()) |
|
|
|
->method('getDisplayName'); |
|
|
|
$this->user->expects(self::any()) |
|
|
|
->method('getUID') |
|
|
|
->willReturn('user1'); |
|
|
|
$this->user->expects(self::any()) |
|
|
|
->method('getDisplayName') |
|
|
|
->willReturn('Mr. Wizard'); |
|
|
|
$this->userSession->expects(self::any()) |
|
|
|
->method('getUser') |
|
|
|
->willReturn($this->user); |
|
|
|
$this->service->expects(self::once()) |
|
|
|
->method('getFrom'); |
|
|
|
$this->service->expects(self::once()) |
|
|
|
@ -618,8 +655,15 @@ class IMipPluginTest extends TestCase { |
|
|
|
->method('buildBodyData') |
|
|
|
->with($newVevent, null) |
|
|
|
->willReturn($data); |
|
|
|
$this->userManager->expects(self::never()) |
|
|
|
->method('getDisplayName'); |
|
|
|
$this->user->expects(self::any()) |
|
|
|
->method('getUID') |
|
|
|
->willReturn('user1'); |
|
|
|
$this->user->expects(self::any()) |
|
|
|
->method('getDisplayName') |
|
|
|
->willReturn('Mr. Wizard'); |
|
|
|
$this->userSession->expects(self::any()) |
|
|
|
->method('getUser') |
|
|
|
->willReturn($this->user); |
|
|
|
$this->service->expects(self::once()) |
|
|
|
->method('getFrom'); |
|
|
|
$this->service->expects(self::once()) |
|
|
|
@ -704,9 +748,15 @@ class IMipPluginTest extends TestCase { |
|
|
|
->method('buildBodyData') |
|
|
|
->with($newVevent, null) |
|
|
|
->willReturn($data); |
|
|
|
$this->userManager->expects(self::once()) |
|
|
|
$this->user->expects(self::any()) |
|
|
|
->method('getUID') |
|
|
|
->willReturn('user1'); |
|
|
|
$this->user->expects(self::any()) |
|
|
|
->method('getDisplayName') |
|
|
|
->willReturn('Mr. Wizard'); |
|
|
|
$this->userSession->expects(self::any()) |
|
|
|
->method('getUser') |
|
|
|
->willReturn($this->user); |
|
|
|
$this->service->expects(self::once()) |
|
|
|
->method('getFrom'); |
|
|
|
$this->service->expects(self::once()) |
|
|
|
|