summaryrefslogtreecommitdiffstats
path: root/apps/dav/tests/unit/CalDAV/AbstractCalDavBackend.php
diff options
context:
space:
mode:
authorMorris Jobke <hey@morrisjobke.de>2021-06-07 11:12:22 +0200
committerGitHub <noreply@github.com>2021-06-07 11:12:22 +0200
commit92d19bd79bb9c8c541acabdd29c7cba065a54579 (patch)
tree0c87a9606321030a04a82744c6222ee63740a1fb /apps/dav/tests/unit/CalDAV/AbstractCalDavBackend.php
parentd1d472563002099594089f135429610bb55a674e (diff)
parente238b93234549a3d6234b06dc8f83dbe053ada2e (diff)
downloadnextcloud-server-92d19bd79bb9c8c541acabdd29c7cba065a54579.tar.gz
nextcloud-server-92d19bd79bb9c8c541acabdd29c7cba065a54579.zip
Merge pull request #27374 from nextcloud/bugfix/noid/adjust-unit-tests
Bugfix/noid/adjust unit tests
Diffstat (limited to 'apps/dav/tests/unit/CalDAV/AbstractCalDavBackend.php')
-rw-r--r--apps/dav/tests/unit/CalDAV/AbstractCalDavBackend.php30
1 files changed, 10 insertions, 20 deletions
diff --git a/apps/dav/tests/unit/CalDAV/AbstractCalDavBackend.php b/apps/dav/tests/unit/CalDAV/AbstractCalDavBackend.php
index 9414bebd0dd..94e099f523e 100644
--- a/apps/dav/tests/unit/CalDAV/AbstractCalDavBackend.php
+++ b/apps/dav/tests/unit/CalDAV/AbstractCalDavBackend.php
@@ -30,9 +30,6 @@ use OC\KnownUser\KnownUserService;
use OCA\DAV\CalDAV\CalDavBackend;
use OCA\DAV\CalDAV\Proxy\ProxyMapper;
use OCA\DAV\Connector\Sabre\Principal;
-use OCA\DAV\Events\CalendarCreatedEvent;
-use OCA\DAV\Events\CalendarDeletedEvent;
-use OCA\DAV\Events\CalendarObjectCreatedEvent;
use OCP\App\IAppManager;
use OCP\EventDispatcher\IEventDispatcher;
use OCP\IConfig;
@@ -65,9 +62,9 @@ abstract class AbstractCalDavBackend extends TestCase {
protected $userManager;
/** @var IGroupManager|\PHPUnit\Framework\MockObject\MockObject */
protected $groupManager;
- /** @var EventDispatcherInterface|\PHPUnit\Framework\MockObject\MockObject */
- protected $dispatcher;
/** @var IEventDispatcher|\PHPUnit\Framework\MockObject\MockObject */
+ protected $dispatcher;
+ /** @var EventDispatcherInterface|\PHPUnit\Framework\MockObject\MockObject */
protected $legacyDispatcher;
/** @var ISecureRandom */
@@ -146,11 +143,10 @@ abstract class AbstractCalDavBackend extends TestCase {
private function cleanupForPrincipal($principal): void {
$calendars = $this->backend->getCalendarsForUser($principal);
- $this->legacyDispatcher->expects(self::exactly(count($calendars)))
- ->method('dispatchTyped')
- ->with(self::callback(function ($event) {
- return $event instanceof CalendarDeletedEvent;
- }));
+ $this->dispatcher->expects(self::any())
+ ->method('dispatchTyped');
+ $this->legacyDispatcher->expects(self::any())
+ ->method('dispatch');
foreach ($calendars as $calendar) {
$this->backend->deleteCalendar($calendar['id'], true);
}
@@ -161,11 +157,8 @@ abstract class AbstractCalDavBackend extends TestCase {
}
protected function createTestCalendar() {
- $this->dispatcher->expects(self::once())
- ->method('dispatchTyped')
- ->with(self::callback(function ($event) {
- return $event instanceof CalendarCreatedEvent;
- }));
+ $this->dispatcher->expects(self::any())
+ ->method('dispatchTyped');
$this->backend->createCalendar(self::UNIT_TEST_USER, 'Example', [
'{http://apple.com/ns/ical/}calendar-color' => '#1C4587FF'
@@ -220,11 +213,8 @@ END:VCALENDAR
EOD;
$uri0 = $this->getUniqueID('event');
- $this->dispatcher->expects(self::once())
- ->method('dispatchTyped')
- ->with(self::callback(function ($event) {
- return $event instanceof CalendarObjectCreatedEvent;
- }));
+ $this->dispatcher->expects(self::atLeastOnce())
+ ->method('dispatchTyped');
$this->backend->createCalendarObject($calendarId, $uri0, $calData);