serverConfig = $this->createMock(IConfig::class); $this->talkConfig = $this->createMock(Config::class); $this->attendeeMapper = new AttendeeMapper(\OCP\Server::get(IDBConnection::class)); $this->sessionMapper = new SessionMapper(\OCP\Server::get(IDBConnection::class)); $this->sessionService = $this->createMock(SessionService::class); $this->secureRandom = $this->createMock(ISecureRandom::class); $this->dispatcher = $this->createMock(IEventDispatcher::class); $this->userManager = $this->createMock(IUserManager::class); $this->cloudIdManager = $this->createMock(ICloudIdManager::class); $this->groupManager = $this->createMock(IGroupManager::class); $this->membershipService = $this->createMock(MembershipService::class); $this->federationBackendNotifier = $this->createMock(BackendNotifier::class); $this->time = $this->createMock(ITimeFactory::class); $this->cacheFactory = $this->createMock(ICacheFactory::class); $this->userStatusManager = $this->createMock(IManager::class); $this->logger = $this->createMock(LoggerInterface::class); $this->service = new ParticipantService( $this->serverConfig, $this->talkConfig, $this->attendeeMapper, $this->sessionMapper, $this->sessionService, $this->secureRandom, \OCP\Server::get(IDBConnection::class), $this->dispatcher, $this->userManager, $this->cloudIdManager, $this->groupManager, $this->membershipService, $this->federationBackendNotifier, $this->time, $this->cacheFactory, $this->userStatusManager, $this->logger ); } public function tearDown(): void { try { $attendee = $this->attendeeMapper->findByActor(123456789, Attendee::ACTOR_USERS, 'test'); $this->sessionMapper->deleteByAttendeeId($attendee->getId()); $this->attendeeMapper->delete($attendee); } catch (DoesNotExistException $exception) { } parent::tearDown(); } public function testGetParticipantsByNotificationLevel(): void { $attendee = new Attendee(); $attendee->setActorType(Attendee::ACTOR_USERS); $attendee->setActorId('test'); $attendee->setRoomId(123456789); $attendee->setNotificationLevel(Participant::NOTIFY_MENTION); $this->attendeeMapper->insert($attendee); $session1 = new Session(); $session1->setAttendeeId($attendee->getId()); $session1->setSessionId(self::getUniqueID('session1')); $this->sessionMapper->insert($session1); $session2 = new Session(); $session2->setAttendeeId($attendee->getId()); $session2->setSessionId(self::getUniqueID('session2')); $this->sessionMapper->insert($session2); $room = $this->createMock(Room::class); $room->method('getId') ->willReturn(123456789); $participants = $this->service->getParticipantsByNotificationLevel($room, Participant::NOTIFY_MENTION); self::assertCount(1, $participants); } }