aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSalvatore Martire <4652631+salmart-dev@users.noreply.github.com>2025-06-30 18:10:45 +0200
committerSalvatore Martire <4652631+salmart-dev@users.noreply.github.com>2025-07-01 15:15:53 +0200
commit289b7ab6845576c6cb7a96df1631d549cfb5ddab (patch)
treef6660d9c35dc297b1e135238a4b93df21b876dcb
parent125696bfbcd0364fd66d48a35508545426138fd0 (diff)
downloadnextcloud-server-289b7ab6845576c6cb7a96df1631d549cfb5ddab.tar.gz
nextcloud-server-289b7ab6845576c6cb7a96df1631d549cfb5ddab.zip
test: check that UserStatusAutomation is cleaned upfix/timedjob-execution-time
Signed-off-by: Salvatore Martire <4652631+salmart-dev@users.noreply.github.com>
-rw-r--r--apps/dav/tests/unit/DAV/Listener/UserEventsListenerTest.php27
1 files changed, 27 insertions, 0 deletions
diff --git a/apps/dav/tests/unit/DAV/Listener/UserEventsListenerTest.php b/apps/dav/tests/unit/DAV/Listener/UserEventsListenerTest.php
index 40d2fb62431..8e410eb0a78 100644
--- a/apps/dav/tests/unit/DAV/Listener/UserEventsListenerTest.php
+++ b/apps/dav/tests/unit/DAV/Listener/UserEventsListenerTest.php
@@ -10,12 +10,14 @@ declare(strict_types=1);
namespace OCA\DAV\Tests\unit\DAV\Listener;
+use OCA\DAV\BackgroundJob\UserStatusAutomation;
use OCA\DAV\CalDAV\CalDavBackend;
use OCA\DAV\CardDAV\CardDavBackend;
use OCA\DAV\CardDAV\SyncService;
use OCA\DAV\Listener\UserEventsListener;
use OCA\DAV\Service\ExampleContactService;
use OCA\DAV\Service\ExampleEventService;
+use OCP\BackgroundJob\IJobList;
use OCP\Defaults;
use OCP\IUser;
use OCP\IUserManager;
@@ -46,6 +48,7 @@ class UserEventsListenerTest extends TestCase {
$this->exampleContactService = $this->createMock(ExampleContactService::class);
$this->exampleEventService = $this->createMock(ExampleEventService::class);
$this->logger = $this->createMock(LoggerInterface::class);
+ $this->jobList = $this->createMock(IJobList::class);
$this->userEventsListener = new UserEventsListener(
$this->userManager,
@@ -56,6 +59,7 @@ class UserEventsListenerTest extends TestCase {
$this->exampleContactService,
$this->exampleEventService,
$this->logger,
+ $this->jobList,
);
}
@@ -153,4 +157,27 @@ class UserEventsListenerTest extends TestCase {
$this->userEventsListener->preDeleteUser($user);
$this->userEventsListener->postDeleteUser('newUser');
}
+
+ public function testDeleteUserAutomationEvent(): void {
+ $user = $this->createMock(IUser::class);
+ $user->expects($this->once())->method('getUID')->willReturn('newUser');
+
+ $this->syncService->expects($this->once())
+ ->method('deleteUser');
+
+ $this->calDavBackend->expects($this->once())->method('getUsersOwnCalendars')->willReturn([
+ ['id' => []]
+ ]);
+ $this->calDavBackend->expects($this->once())->method('getSubscriptionsForUser')->willReturn([
+ ['id' => []]
+ ]);
+ $this->cardDavBackend->expects($this->once())->method('getUsersOwnAddressBooks')->willReturn([
+ ['id' => []]
+ ]);
+
+ $this->jobList->expects(self::once())->method('remove')->with(UserStatusAutomation::class, ['userId' => 'newUser']);
+
+ $this->userEventsListener->preDeleteUser($user);
+ $this->userEventsListener->postDeleteUser('newUser');
+ }
}