Skip to content

Commit

Permalink
Merge pull request #35620 from nextcloud/fix/fix-calendar-imip-tests
Browse files Browse the repository at this point in the history
  • Loading branch information
juliushaertl authored Dec 7, 2022
2 parents 744126a + 7cf1dec commit 3c8fb59
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions tests/lib/Calendar/ManagerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,20 @@
use OCP\AppFramework\Utility\ITimeFactory;
use OCP\Calendar\ICalendar;
use OCP\Calendar\ICreateFromString;
use OCP\Calendar\IHandleImipMessage;
use PHPUnit\Framework\MockObject\MockObject;
use Psr\Container\ContainerInterface;
use Psr\Log\LoggerInterface;
use Sabre\VObject\Document;
use Sabre\VObject\Reader;
use Test\TestCase;

/*
* This allows us to create Mock object supporting both interfaces
*/
interface ICreateFromStringAndHandleImipMessage extends ICreateFromString, IHandleImipMessage {
}

class ManagerTest extends TestCase {

/** @var Coordinator|MockObject */
Expand Down Expand Up @@ -334,7 +341,7 @@ public function testHandleImipReplyEventNotFound(): void {
'getCalendarsForPrincipal'
])
->getMock();
$calendar = $this->createMock(ICreateFromString::class);
$calendar = $this->createMock(ICreateFromStringAndHandleImipMessage::class);
$principalUri = 'principals/user/linus';
$sender = 'pierre@general-store.com';
$recipient = 'linus@stardew-tent-living.com';
Expand Down Expand Up @@ -371,7 +378,7 @@ public function testHandleImipReply(): void {
'getCalendarsForPrincipal'
])
->getMock();
$calendar = $this->createMock(ICreateFromString::class);
$calendar = $this->createMock(ICreateFromStringAndHandleImipMessage::class);
$principalUri = 'principals/user/linus';
$sender = 'pierre@general-store.com';
$recipient = 'linus@stardew-tent-living.com';
Expand Down Expand Up @@ -495,7 +502,7 @@ public function testHandleImipCancelOrganiserInReplyTo(): void {
$sender = 'clint@stardew-blacksmiths.com';
$recipient = 'pierre@general-store.com';
$replyTo = 'linus@stardew-tent-living.com';
$calendar = $this->createMock(ICreateFromString::class);
$calendar = $this->createMock(ICreateFromStringAndHandleImipMessage::class);
$calendarData = $this->getVCalendarCancel();

$this->time->expects(self::once())
Expand Down Expand Up @@ -532,7 +539,7 @@ public function testHandleImipCancel(): void {
$sender = 'linus@stardew-tent-living.com';
$recipient = 'pierre@general-store.com';
$replyTo = null;
$calendar = $this->createMock(ICreateFromString::class);
$calendar = $this->createMock(ICreateFromStringAndHandleImipMessage::class);
$calendarData = $this->getVCalendarCancel();

$this->time->expects(self::once())
Expand Down

0 comments on commit 3c8fb59

Please sign in to comment.