Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoas Schilling <coding@schilljs.com>2022-05-27 11:46:47 +0300
committerJoas Schilling <coding@schilljs.com>2022-05-27 11:46:47 +0300
commitf5878038ff8adde4683d2d6f124ab1c1d6b06467 (patch)
treeaf67ff38a0b6be7fcdeb9bf70cb8e5317ff47a46
parent52737c029c18d7bd504fbeb031f90ac446684cb1 (diff)
Fix unit tests
Signed-off-by: Joas Schilling <coding@schilljs.com>
-rw-r--r--apps/user_status/tests/Unit/Listener/UserLiveStatusListenerTest.php11
1 files changed, 7 insertions, 4 deletions
diff --git a/apps/user_status/tests/Unit/Listener/UserLiveStatusListenerTest.php b/apps/user_status/tests/Unit/Listener/UserLiveStatusListenerTest.php
index 2e815073b5a..b2d446d912e 100644
--- a/apps/user_status/tests/Unit/Listener/UserLiveStatusListenerTest.php
+++ b/apps/user_status/tests/Unit/Listener/UserLiveStatusListenerTest.php
@@ -30,6 +30,7 @@ use OCA\UserStatus\Db\UserStatus;
use OCA\UserStatus\Db\UserStatusMapper;
use OCA\UserStatus\Listener\UserDeletedListener;
use OCA\UserStatus\Listener\UserLiveStatusListener;
+use OCA\UserStatus\Service\StatusService;
use OCP\AppFramework\Db\DoesNotExistException;
use OCP\AppFramework\Utility\ITimeFactory;
use OCP\EventDispatcher\GenericEvent;
@@ -41,7 +42,8 @@ class UserLiveStatusListenerTest extends TestCase {
/** @var UserStatusMapper|\PHPUnit\Framework\MockObject\MockObject */
private $mapper;
-
+ /** @var StatusService|\PHPUnit\Framework\MockObject\MockObject */
+ private $statusService;
/** @var ITimeFactory|\PHPUnit\Framework\MockObject\MockObject */
private $timeFactory;
@@ -52,8 +54,9 @@ class UserLiveStatusListenerTest extends TestCase {
parent::setUp();
$this->mapper = $this->createMock(UserStatusMapper::class);
+ $this->statusService = $this->createMock(StatusService::class);
$this->timeFactory = $this->createMock(ITimeFactory::class);
- $this->listener = new UserLiveStatusListener($this->mapper, $this->timeFactory);
+ $this->listener = new UserLiveStatusListener($this->mapper, $this->statusService, $this->timeFactory);
}
/**
@@ -85,12 +88,12 @@ class UserLiveStatusListenerTest extends TestCase {
$userStatus->setStatusTimestamp($previousTimestamp);
$userStatus->setIsUserDefined($previousIsUserDefined);
- $this->mapper->expects($this->once())
+ $this->statusService->expects($this->once())
->method('findByUserId')
->with($userId)
->willReturn($userStatus);
} else {
- $this->mapper->expects($this->once())
+ $this->statusService->expects($this->once())
->method('findByUserId')
->with($userId)
->willThrowException(new DoesNotExistException(''));