summaryrefslogtreecommitdiffstats
path: root/apps/dav/tests/unit
diff options
context:
space:
mode:
authorThomas Citharel <tcit@tcit.fr>2021-08-13 14:19:03 +0200
committerMichaIng <micha@dietpi.com>2021-11-18 15:46:00 +0100
commit6269efd2f1a0c6c478600226acbdd305bfaf82e9 (patch)
tree11c559b4b1d2bf9cf5422d0b0f2ee877ed701dfb /apps/dav/tests/unit
parent8a25826610a496244fa0cbd685229ca9507ae523 (diff)
downloadnextcloud-server-6269efd2f1a0c6c478600226acbdd305bfaf82e9.tar.gz
nextcloud-server-6269efd2f1a0c6c478600226acbdd305bfaf82e9.zip
Delete calendar subscriptions as well when deleting user
Closes #28418 Signed-off-by: Thomas Citharel <tcit@tcit.fr>
Diffstat (limited to 'apps/dav/tests/unit')
-rw-r--r--apps/dav/tests/unit/DAV/HookManagerTest.php41
1 files changed, 23 insertions, 18 deletions
diff --git a/apps/dav/tests/unit/DAV/HookManagerTest.php b/apps/dav/tests/unit/DAV/HookManagerTest.php
index 8b8fad4d7cf..481f129ae90 100644
--- a/apps/dav/tests/unit/DAV/HookManagerTest.php
+++ b/apps/dav/tests/unit/DAV/HookManagerTest.php
@@ -38,6 +38,7 @@ use OCA\DAV\HookManager;
use OCP\IL10N;
use OCP\IUser;
use OCP\IUserManager;
+use PHPUnit\Framework\MockObject\MockObject;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
use Test\TestCase;
@@ -45,7 +46,7 @@ class HookManagerTest extends TestCase {
/** @var IL10N */
private $l10n;
- /** @var EventDispatcherInterface | \PHPUnit\Framework\MockObject\MockObject */
+ /** @var EventDispatcherInterface | MockObject */
private $eventDispatcher;
protected function setUp(): void {
@@ -66,17 +67,17 @@ class HookManagerTest extends TestCase {
->getMock();
$user->expects($this->once())->method('getUID')->willReturn('newUser');
- /** @var IUserManager | \PHPUnit\Framework\MockObject\MockObject $userManager */
+ /** @var IUserManager | MockObject $userManager */
$userManager = $this->getMockBuilder(IUserManager::class)
->disableOriginalConstructor()
->getMock();
- /** @var SyncService | \PHPUnit\Framework\MockObject\MockObject $syncService */
+ /** @var SyncService | MockObject $syncService */
$syncService = $this->getMockBuilder(SyncService::class)
->disableOriginalConstructor()
->getMock();
- /** @var CalDavBackend | \PHPUnit\Framework\MockObject\MockObject $cal */
+ /** @var CalDavBackend | MockObject $cal */
$cal = $this->getMockBuilder(CalDavBackend::class)
->disableOriginalConstructor()
->getMock();
@@ -85,7 +86,7 @@ class HookManagerTest extends TestCase {
'principals/users/newUser',
'personal', ['{DAV:}displayname' => 'Personal']);
- /** @var CardDavBackend | \PHPUnit\Framework\MockObject\MockObject $card */
+ /** @var CardDavBackend | MockObject $card */
$card = $this->getMockBuilder(CardDavBackend::class)
->disableOriginalConstructor()
->getMock();
@@ -104,24 +105,24 @@ class HookManagerTest extends TestCase {
->getMock();
$user->expects($this->once())->method('getUID')->willReturn('newUser');
- /** @var IUserManager | \PHPUnit\Framework\MockObject\MockObject $userManager */
+ /** @var IUserManager | MockObject $userManager */
$userManager = $this->getMockBuilder(IUserManager::class)
->disableOriginalConstructor()
->getMock();
- /** @var SyncService | \PHPUnit\Framework\MockObject\MockObject $syncService */
+ /** @var SyncService | MockObject $syncService */
$syncService = $this->getMockBuilder(SyncService::class)
->disableOriginalConstructor()
->getMock();
- /** @var CalDavBackend | \PHPUnit\Framework\MockObject\MockObject $cal */
+ /** @var CalDavBackend | MockObject $cal */
$cal = $this->getMockBuilder(CalDavBackend::class)
->disableOriginalConstructor()
->getMock();
$cal->expects($this->once())->method('getCalendarsForUserCount')->willReturn(1);
$cal->expects($this->never())->method('createCalendar');
- /** @var CardDavBackend | \PHPUnit\Framework\MockObject\MockObject $card */
+ /** @var CardDavBackend | MockObject $card */
$card = $this->getMockBuilder(CardDavBackend::class)
->disableOriginalConstructor()
->getMock();
@@ -138,17 +139,17 @@ class HookManagerTest extends TestCase {
->getMock();
$user->expects($this->once())->method('getUID')->willReturn('newUser');
- /** @var IUserManager | \PHPUnit\Framework\MockObject\MockObject $userManager */
+ /** @var IUserManager | MockObject $userManager */
$userManager = $this->getMockBuilder(IUserManager::class)
->disableOriginalConstructor()
->getMock();
- /** @var SyncService | \PHPUnit\Framework\MockObject\MockObject $syncService */
+ /** @var SyncService | MockObject $syncService */
$syncService = $this->getMockBuilder(SyncService::class)
->disableOriginalConstructor()
->getMock();
- /** @var CalDavBackend | \PHPUnit\Framework\MockObject\MockObject $cal */
+ /** @var CalDavBackend | MockObject $cal */
$cal = $this->getMockBuilder(CalDavBackend::class)
->disableOriginalConstructor()
->getMock();
@@ -157,7 +158,7 @@ class HookManagerTest extends TestCase {
'principals/users/newUser',
'personal', ['{DAV:}displayname' => 'Personal']);
- /** @var CardDavBackend | \PHPUnit\Framework\MockObject\MockObject $card */
+ /** @var CardDavBackend | MockObject $card */
$card = $this->getMockBuilder(CardDavBackend::class)
->disableOriginalConstructor()
->getMock();
@@ -175,30 +176,34 @@ class HookManagerTest extends TestCase {
->disableOriginalConstructor()
->getMock();
- /** @var IUserManager | \PHPUnit\Framework\MockObject\MockObject $userManager */
+ /** @var IUserManager | MockObject $userManager */
$userManager = $this->getMockBuilder(IUserManager::class)
->disableOriginalConstructor()
->getMock();
$userManager->expects($this->once())->method('get')->willReturn($user);
- /** @var SyncService | \PHPUnit\Framework\MockObject\MockObject $syncService */
+ /** @var SyncService | MockObject $syncService */
$syncService = $this->getMockBuilder(SyncService::class)
->disableOriginalConstructor()
->getMock();
$syncService->expects($this->once())
->method('deleteUser');
- /** @var CalDavBackend | \PHPUnit\Framework\MockObject\MockObject $cal */
+ /** @var CalDavBackend | MockObject $cal */
$cal = $this->getMockBuilder(CalDavBackend::class)
->disableOriginalConstructor()
->getMock();
$cal->expects($this->once())->method('getUsersOwnCalendars')->willReturn([
['id' => 'personal']
]);
- $cal->expects($this->once())->method('deleteCalendar');
+ $cal->expects($this->once())->method('getSubscriptionsForUser')->willReturn([
+ ['id' => 'some-subscription']
+ ]);
+ $cal->expects($this->once())->method('deleteCalendar')->with('personal');
+ $cal->expects($this->once())->method('deleteSubscription')->with('some-subscription');
$cal->expects($this->once())->method('deleteAllSharesByUser');
- /** @var CardDavBackend | \PHPUnit\Framework\MockObject\MockObject $card */
+ /** @var CardDavBackend | MockObject $card */
$card = $this->getMockBuilder(CardDavBackend::class)
->disableOriginalConstructor()
->getMock();