aboutsummaryrefslogtreecommitdiffstats
path: root/apps/dav/tests
diff options
context:
space:
mode:
authorJoas Schilling <coding@schilljs.com>2016-10-13 15:34:26 +0200
committerJoas Schilling <coding@schilljs.com>2016-11-03 12:07:59 +0100
commit52dd27892b80ab91d0776c45d05d8447ac24b76e (patch)
tree56457a3d0eb6119bbe200413557bcb6d76a7329a /apps/dav/tests
parentd3e8463de28197de2d4d61c35906b020ec85b432 (diff)
downloadnextcloud-server-52dd27892b80ab91d0776c45d05d8447ac24b76e.tar.gz
nextcloud-server-52dd27892b80ab91d0776c45d05d8447ac24b76e.zip
Use the event dispatcher
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'apps/dav/tests')
-rw-r--r--apps/dav/tests/unit/CalDAV/AbstractCalDavBackendTest.php16
-rw-r--r--apps/dav/tests/unit/CalDAV/PublicCalendarRootTest.php41
2 files changed, 6 insertions, 51 deletions
diff --git a/apps/dav/tests/unit/CalDAV/AbstractCalDavBackendTest.php b/apps/dav/tests/unit/CalDAV/AbstractCalDavBackendTest.php
index a674c65c286..7d2e033e0b1 100644
--- a/apps/dav/tests/unit/CalDAV/AbstractCalDavBackendTest.php
+++ b/apps/dav/tests/unit/CalDAV/AbstractCalDavBackendTest.php
@@ -22,15 +22,12 @@
namespace OCA\DAV\Tests\unit\CalDAV;
-use OCA\DAV\CalDAV\Activity\Backend as ActivityBackend;
use OCA\DAV\CalDAV\CalDavBackend;
use OCA\DAV\Connector\Sabre\Principal;
-use OCP\Activity\IManager as IActivityManager;
-use OCP\IGroupManager;
use OCP\IUserManager;
-use OCP\IUserSession;
use OCP\Security\ISecureRandom;
use Sabre\CalDAV\Xml\Property\SupportedCalendarComponentSet;
+use Symfony\Component\EventDispatcher\EventDispatcherInterface;
use Test\TestCase;
/**
@@ -49,8 +46,6 @@ abstract class AbstractCalDavBackendTest extends TestCase {
protected $principal;
/** @var IUserManager|\PHPUnit_Framework_MockObject_MockObject */
protected $userManager;
- /** @var ActivityBackend|\PHPUnit_Framework_MockObject_MockObject */
- protected $activityBackend;
/** @var ISecureRandom */
private $random;
@@ -63,9 +58,7 @@ abstract class AbstractCalDavBackendTest extends TestCase {
parent::setUp();
$this->userManager = $this->createMock(IUserManager::class);
- $groupManager = $this->createMock(IGroupManager::class);
- $activityManager = $this->createMock(IActivityManager::class);
- $userSession = $this->createMock(IUserSession::class);
+ $dispatcher = $this->createMock(EventDispatcherInterface::class);
$this->principal = $this->getMockBuilder('OCA\DAV\Connector\Sabre\Principal')
->disableOriginalConstructor()
->setMethods(['getPrincipalByPath', 'getGroupMembership'])
@@ -80,10 +73,7 @@ abstract class AbstractCalDavBackendTest extends TestCase {
$db = \OC::$server->getDatabaseConnection();
$this->random = \OC::$server->getSecureRandom();
- $this->backend = new CalDavBackend($db, $this->principal, $this->userManager, $groupManager, $this->random, $activityManager, $userSession);
-
- $this->activityBackend = $this->createMock(ActivityBackend::class);
- $this->invokePrivate($this->backend, 'activityBackend', [$this->activityBackend]);
+ $this->backend = new CalDavBackend($db, $this->principal, $this->userManager, $this->random, $dispatcher);
$this->cleanUpBackend();
}
diff --git a/apps/dav/tests/unit/CalDAV/PublicCalendarRootTest.php b/apps/dav/tests/unit/CalDAV/PublicCalendarRootTest.php
index c3a3d783e18..59fa4747a93 100644
--- a/apps/dav/tests/unit/CalDAV/PublicCalendarRootTest.php
+++ b/apps/dav/tests/unit/CalDAV/PublicCalendarRootTest.php
@@ -2,17 +2,14 @@
namespace OCA\DAV\Tests\unit\CalDAV;
-use OCA\DAV\CalDAV\Activity\Backend as ActivityBackend;
use OCA\DAV\CalDAV\Calendar;
use OCA\DAV\Connector\Sabre\Principal;
-use OCP\Activity\IManager as IActivityManager;
-use OCP\IGroupManager;
use OCP\IL10N;
use OCA\DAV\CalDAV\CalDavBackend;
use OCA\DAV\CalDAV\PublicCalendarRoot;
use OCP\IUserManager;
-use OCP\IUserSession;
use OCP\Security\ISecureRandom;
+use Symfony\Component\EventDispatcher\EventDispatcherInterface;
use Test\TestCase;
/**
@@ -35,14 +32,6 @@ class PublicCalendarRootTest extends TestCase {
private $principal;
/** @var IUserManager|\PHPUnit_Framework_MockObject_MockObject */
protected $userManager;
- /** @var IGroupManager|\PHPUnit_Framework_MockObject_MockObject */
- protected $groupManager;
- /** @var IActivityManager|\PHPUnit_Framework_MockObject_MockObject */
- protected $activityManager;
- /** @var IUserSession|\PHPUnit_Framework_MockObject_MockObject */
- protected $userSession;
- /** @var ActivityBackend|\PHPUnit_Framework_MockObject_MockObject */
- protected $activityBackend;
/** @var ISecureRandom */
private $random;
@@ -53,24 +42,17 @@ class PublicCalendarRootTest extends TestCase {
$db = \OC::$server->getDatabaseConnection();
$this->principal = $this->createMock('OCA\DAV\Connector\Sabre\Principal');
$this->userManager = $this->createMock(IUserManager::class);
- $groupManager = $this->createMock(IGroupManager::class);
- $activityManager = $this->createMock(IActivityManager::class);
- $userSession = $this->createMock(IUserSession::class);
$this->random = \OC::$server->getSecureRandom();
+ $dispatcher = $this->createMock(EventDispatcherInterface::class);
$this->backend = new CalDavBackend(
$db,
$this->principal,
$this->userManager,
- $groupManager,
$this->random,
- $activityManager,
- $userSession
+ $dispatcher
);
- $this->activityBackend = $this->createMock(ActivityBackend::class);
- $this->invokePrivate($this->backend, 'activityBackend', [$this->activityBackend]);
-
$this->publicCalendarRoot = new PublicCalendarRoot($this->backend);
$this->l10n = $this->getMockBuilder('\OCP\IL10N')
@@ -95,14 +77,6 @@ class PublicCalendarRootTest extends TestCase {
}
public function testGetChild() {
- $this->activityBackend->expects($this->exactly(1))
- ->method('addCalendar');
- $this->activityBackend->expects($this->never())
- ->method('updateCalendar');
- $this->activityBackend->expects($this->never())
- ->method('deleteCalendar');
- $this->activityBackend->expects($this->never())
- ->method('updateCalendarShares');
$calendar = $this->createPublicCalendar();
@@ -117,15 +91,6 @@ class PublicCalendarRootTest extends TestCase {
}
public function testGetChildren() {
- $this->activityBackend->expects($this->exactly(1))
- ->method('addCalendar');
- $this->activityBackend->expects($this->never())
- ->method('updateCalendar');
- $this->activityBackend->expects($this->never())
- ->method('deleteCalendar');
- $this->activityBackend->expects($this->never())
- ->method('updateCalendarShares');
-
$this->createPublicCalendar();
$publicCalendars = $this->backend->getPublicCalendars();