diff --git a/apps/dav/lib/CalDAV/CachedSubscription.php b/apps/dav/lib/CalDAV/CachedSubscription.php index 7b5a809c61e32..f9a5832a6a527 100644 --- a/apps/dav/lib/CalDAV/CachedSubscription.php +++ b/apps/dav/lib/CalDAV/CachedSubscription.php @@ -203,6 +203,6 @@ public function getChanges($syncToken, $syncLevel, $limit = null) { throw new UnsupportedLimitOnInitialSyncException(); } - return parent::getChanges($syncToken, $syncLevel, $limit); + return $this->caldavBackend->getChangesForCalendar($this->calendarInfo['id'], $syncToken, $syncLevel, $limit, CalDavBackend::CALENDAR_TYPE_SUBSCRIPTION); } } diff --git a/apps/dav/tests/unit/CalDAV/CachedSubscriptionTest.php b/apps/dav/tests/unit/CalDAV/CachedSubscriptionTest.php index 18fe0521436a3..ab9b4700a4abf 100644 --- a/apps/dav/tests/unit/CalDAV/CachedSubscriptionTest.php +++ b/apps/dav/tests/unit/CalDAV/CachedSubscriptionTest.php @@ -292,4 +292,24 @@ public function testCalendarQuery(): void { $this->assertEquals([99], $calendar->calendarQuery(['foo'])); } + + public function testGetChanges(): void { + $backend = $this->createMock(CalDavBackend::class); + $calendarInfo = [ + '{http://owncloud.org/ns}owner-principal' => 'user1', + 'principaluri' => 'user2', + 'id' => 666, + 'uri' => 'cal', + ]; + + $changes = ['syncToken' => 3, 'added' => ['a.ics'], 'modified' => [], 'deleted' => []]; + $backend->expects($this->once()) + ->method('getChangesForCalendar') + ->with(666, '2', 1, null, CalDavBackend::CALENDAR_TYPE_SUBSCRIPTION) + ->willReturn($changes); + + $calendar = new CachedSubscription($backend, $calendarInfo); + + $this->assertEquals($changes, $calendar->getChanges('2', 1)); + } }