aboutsummaryrefslogtreecommitdiffstats
path: root/apps/user_status/tests
diff options
context:
space:
mode:
Diffstat (limited to 'apps/user_status/tests')
-rw-r--r--apps/user_status/tests/Unit/BackgroundJob/ClearOldStatusesBackgroundJobTest.php13
-rw-r--r--apps/user_status/tests/Unit/CapabilitiesTest.php13
-rw-r--r--apps/user_status/tests/Unit/Connector/UserStatusProviderTest.php9
-rw-r--r--apps/user_status/tests/Unit/Controller/PredefinedStatusControllerTest.php12
-rw-r--r--apps/user_status/tests/Unit/Controller/StatusesControllerTest.php9
-rw-r--r--apps/user_status/tests/Unit/Controller/UserStatusControllerTest.php68
-rw-r--r--apps/user_status/tests/Unit/Dashboard/UserStatusWidgetTest.php33
-rw-r--r--apps/user_status/tests/Unit/Db/UserStatusMapperTest.php16
-rw-r--r--apps/user_status/tests/Unit/Listener/UserDeletedListenerTest.php9
-rw-r--r--apps/user_status/tests/Unit/Listener/UserLiveStatusListenerTest.php37
-rw-r--r--apps/user_status/tests/Unit/Service/PredefinedStatusServiceTest.php33
-rw-r--r--apps/user_status/tests/Unit/Service/StatusServiceTest.php86
12 files changed, 93 insertions, 245 deletions
diff --git a/apps/user_status/tests/Unit/BackgroundJob/ClearOldStatusesBackgroundJobTest.php b/apps/user_status/tests/Unit/BackgroundJob/ClearOldStatusesBackgroundJobTest.php
index 90c85bcdaac..66142082343 100644
--- a/apps/user_status/tests/Unit/BackgroundJob/ClearOldStatusesBackgroundJobTest.php
+++ b/apps/user_status/tests/Unit/BackgroundJob/ClearOldStatusesBackgroundJobTest.php
@@ -11,18 +11,13 @@ namespace OCA\UserStatus\Tests\BackgroundJob;
use OCA\UserStatus\BackgroundJob\ClearOldStatusesBackgroundJob;
use OCA\UserStatus\Db\UserStatusMapper;
use OCP\AppFramework\Utility\ITimeFactory;
+use PHPUnit\Framework\MockObject\MockObject;
use Test\TestCase;
class ClearOldStatusesBackgroundJobTest extends TestCase {
-
- /** @var ITimeFactory|\PHPUnit\Framework\MockObject\MockObject */
- private $time;
-
- /** @var UserStatusMapper|\PHPUnit\Framework\MockObject\MockObject */
- private $mapper;
-
- /** @var ClearOldStatusesBackgroundJob */
- private $job;
+ private ITimeFactory&MockObject $time;
+ private UserStatusMapper&MockObject $mapper;
+ private ClearOldStatusesBackgroundJob $job;
protected function setUp(): void {
parent::setUp();
diff --git a/apps/user_status/tests/Unit/CapabilitiesTest.php b/apps/user_status/tests/Unit/CapabilitiesTest.php
index 9e72d49fe31..ef721eaa90b 100644
--- a/apps/user_status/tests/Unit/CapabilitiesTest.php
+++ b/apps/user_status/tests/Unit/CapabilitiesTest.php
@@ -10,15 +10,12 @@ namespace OCA\UserStatus\Tests;
use OCA\UserStatus\Capabilities;
use OCP\IEmojiHelper;
+use PHPUnit\Framework\MockObject\MockObject;
use Test\TestCase;
class CapabilitiesTest extends TestCase {
-
- /** @var IEmojiHelper|\PHPUnit\Framework\MockObject\MockObject */
- private $emojiHelper;
-
- /** @var Capabilities */
- private $capabilities;
+ private IEmojiHelper&MockObject $emojiHelper;
+ private Capabilities $capabilities;
protected function setUp(): void {
parent::setUp();
@@ -28,8 +25,6 @@ class CapabilitiesTest extends TestCase {
}
/**
- * @param bool $supportsEmojis
- *
* @dataProvider getCapabilitiesDataProvider
*/
public function testGetCapabilities(bool $supportsEmojis): void {
@@ -46,7 +41,7 @@ class CapabilitiesTest extends TestCase {
], $this->capabilities->getCapabilities());
}
- public function getCapabilitiesDataProvider(): array {
+ public static function getCapabilitiesDataProvider(): array {
return [
[true],
[false],
diff --git a/apps/user_status/tests/Unit/Connector/UserStatusProviderTest.php b/apps/user_status/tests/Unit/Connector/UserStatusProviderTest.php
index 7e2da883af4..df6c55488d5 100644
--- a/apps/user_status/tests/Unit/Connector/UserStatusProviderTest.php
+++ b/apps/user_status/tests/Unit/Connector/UserStatusProviderTest.php
@@ -11,15 +11,12 @@ namespace OCA\UserStatus\Tests\Connector;
use OCA\UserStatus\Connector\UserStatusProvider;
use OCA\UserStatus\Db\UserStatus;
use OCA\UserStatus\Service\StatusService;
+use PHPUnit\Framework\MockObject\MockObject;
use Test\TestCase;
class UserStatusProviderTest extends TestCase {
-
- /** @var \PHPUnit\Framework\MockObject\MockObject */
- private $service;
-
- /** @var UserStatusProvider */
- private $provider;
+ private StatusService&MockObject $service;
+ private UserStatusProvider $provider;
protected function setUp(): void {
parent::setUp();
diff --git a/apps/user_status/tests/Unit/Controller/PredefinedStatusControllerTest.php b/apps/user_status/tests/Unit/Controller/PredefinedStatusControllerTest.php
index 5709cdc89cf..0f96f41a524 100644
--- a/apps/user_status/tests/Unit/Controller/PredefinedStatusControllerTest.php
+++ b/apps/user_status/tests/Unit/Controller/PredefinedStatusControllerTest.php
@@ -11,15 +11,12 @@ namespace OCA\UserStatus\Tests\Controller;
use OCA\UserStatus\Controller\PredefinedStatusController;
use OCA\UserStatus\Service\PredefinedStatusService;
use OCP\IRequest;
+use PHPUnit\Framework\MockObject\MockObject;
use Test\TestCase;
class PredefinedStatusControllerTest extends TestCase {
-
- /** @var PredefinedStatusService|\PHPUnit\Framework\MockObject\MockObject */
- private $service;
-
- /** @var PredefinedStatusController */
- private $controller;
+ private PredefinedStatusService&MockObject $service;
+ private PredefinedStatusController $controller;
protected function setUp(): void {
parent::setUp();
@@ -27,8 +24,7 @@ class PredefinedStatusControllerTest extends TestCase {
$request = $this->createMock(IRequest::class);
$this->service = $this->createMock(PredefinedStatusService::class);
- $this->controller = new PredefinedStatusController('user_status', $request,
- $this->service);
+ $this->controller = new PredefinedStatusController('user_status', $request, $this->service);
}
public function testFindAll(): void {
diff --git a/apps/user_status/tests/Unit/Controller/StatusesControllerTest.php b/apps/user_status/tests/Unit/Controller/StatusesControllerTest.php
index fe3e1c56a7e..76d337879c3 100644
--- a/apps/user_status/tests/Unit/Controller/StatusesControllerTest.php
+++ b/apps/user_status/tests/Unit/Controller/StatusesControllerTest.php
@@ -14,15 +14,12 @@ use OCA\UserStatus\Service\StatusService;
use OCP\AppFramework\Db\DoesNotExistException;
use OCP\AppFramework\OCS\OCSNotFoundException;
use OCP\IRequest;
+use PHPUnit\Framework\MockObject\MockObject;
use Test\TestCase;
class StatusesControllerTest extends TestCase {
-
- /** @var StatusService|\PHPUnit\Framework\MockObject\MockObject */
- private $service;
-
- /** @var StatusesController */
- private $controller;
+ private StatusService&MockObject $service;
+ private StatusesController $controller;
protected function setUp(): void {
parent::setUp();
diff --git a/apps/user_status/tests/Unit/Controller/UserStatusControllerTest.php b/apps/user_status/tests/Unit/Controller/UserStatusControllerTest.php
index 26b29bcc74c..45ee9c4fdba 100644
--- a/apps/user_status/tests/Unit/Controller/UserStatusControllerTest.php
+++ b/apps/user_status/tests/Unit/Controller/UserStatusControllerTest.php
@@ -21,22 +21,16 @@ use OCP\AppFramework\Db\DoesNotExistException;
use OCP\AppFramework\OCS\OCSBadRequestException;
use OCP\AppFramework\OCS\OCSNotFoundException;
use OCP\IRequest;
+use PHPUnit\Framework\MockObject\MockObject;
use Psr\Log\LoggerInterface;
use Test\TestCase;
use Throwable;
class UserStatusControllerTest extends TestCase {
- /** @var LoggerInterface|\PHPUnit\Framework\MockObject\MockObject */
- private $logger;
-
- /** @var StatusService|\PHPUnit\Framework\MockObject\MockObject */
- private $statusService;
-
- /** @var CalendarStatusService|\PHPUnit\Framework\MockObject\MockObject $calendarStatusService */
- private $calendarStatusService;
-
- /** @var UserStatusController */
- private $controller;
+ private LoggerInterface&MockObject $logger;
+ private StatusService&MockObject $statusService;
+ private CalendarStatusService&MockObject $calendarStatusService;
+ private UserStatusController $controller;
protected function setUp(): void {
parent::setUp();
@@ -94,19 +88,10 @@ class UserStatusControllerTest extends TestCase {
}
/**
- * @param string $statusType
- * @param string|null $statusIcon
- * @param string|null $message
- * @param int|null $clearAt
- * @param bool $expectSuccess
- * @param bool $expectException
- * @param Throwable|null $exception
- * @param bool $expectLogger
- * @param string|null $expectedLogMessage
- *
* @dataProvider setStatusDataProvider
*/
- public function testSetStatus(string $statusType,
+ public function testSetStatus(
+ string $statusType,
?string $statusIcon,
?string $message,
?int $clearAt,
@@ -114,7 +99,8 @@ class UserStatusControllerTest extends TestCase {
bool $expectException,
?Throwable $exception,
bool $expectLogger,
- ?string $expectedLogMessage): void {
+ ?string $expectedLogMessage,
+ ): void {
$userStatus = $this->getUserStatus();
if ($expectException) {
@@ -155,7 +141,7 @@ class UserStatusControllerTest extends TestCase {
}
}
- public function setStatusDataProvider(): array {
+ public static function setStatusDataProvider(): array {
return [
['busy', '👨🏽‍💻', 'Busy developing the status feature', 500, true, false, null, false, null],
['busy', '👨🏽‍💻', 'Busy developing the status feature', 500, false, true, new InvalidStatusTypeException('Original exception message'), true,
@@ -164,23 +150,17 @@ class UserStatusControllerTest extends TestCase {
}
/**
- * @param string $messageId
- * @param int|null $clearAt
- * @param bool $expectSuccess
- * @param bool $expectException
- * @param Throwable|null $exception
- * @param bool $expectLogger
- * @param string|null $expectedLogMessage
- *
* @dataProvider setPredefinedMessageDataProvider
*/
- public function testSetPredefinedMessage(string $messageId,
+ public function testSetPredefinedMessage(
+ string $messageId,
?int $clearAt,
bool $expectSuccess,
bool $expectException,
?Throwable $exception,
bool $expectLogger,
- ?string $expectedLogMessage): void {
+ ?string $expectedLogMessage,
+ ): void {
$userStatus = $this->getUserStatus();
if ($expectException) {
@@ -221,7 +201,7 @@ class UserStatusControllerTest extends TestCase {
}
}
- public function setPredefinedMessageDataProvider(): array {
+ public static function setPredefinedMessageDataProvider(): array {
return [
['messageId-42', 500, true, false, null, false, null],
['messageId-42', 500, false, true, new InvalidClearAtException('Original exception message'), true,
@@ -232,19 +212,10 @@ class UserStatusControllerTest extends TestCase {
}
/**
- * @param string|null $statusIcon
- * @param string $message
- * @param int|null $clearAt
- * @param bool $expectSuccess
- * @param bool $expectException
- * @param Throwable|null $exception
- * @param bool $expectLogger
- * @param string|null $expectedLogMessage
- * @param bool $expectSuccessAsReset
- *
* @dataProvider setCustomMessageDataProvider
*/
- public function testSetCustomMessage(?string $statusIcon,
+ public function testSetCustomMessage(
+ ?string $statusIcon,
string $message,
?int $clearAt,
bool $expectSuccess,
@@ -252,7 +223,8 @@ class UserStatusControllerTest extends TestCase {
?Throwable $exception,
bool $expectLogger,
?string $expectedLogMessage,
- bool $expectSuccessAsReset = false): void {
+ bool $expectSuccessAsReset = false,
+ ): void {
$userStatus = $this->getUserStatus();
if ($expectException) {
@@ -308,7 +280,7 @@ class UserStatusControllerTest extends TestCase {
}
}
- public function setCustomMessageDataProvider(): array {
+ public static function setCustomMessageDataProvider(): array {
return [
['👨🏽‍💻', 'Busy developing the status feature', 500, true, false, null, false, null],
['👨🏽‍💻', '', 500, true, false, null, false, null, false],
diff --git a/apps/user_status/tests/Unit/Dashboard/UserStatusWidgetTest.php b/apps/user_status/tests/Unit/Dashboard/UserStatusWidgetTest.php
index e776837fac8..8773b04c95f 100644
--- a/apps/user_status/tests/Unit/Dashboard/UserStatusWidgetTest.php
+++ b/apps/user_status/tests/Unit/Dashboard/UserStatusWidgetTest.php
@@ -16,33 +16,18 @@ use OCP\IL10N;
use OCP\IURLGenerator;
use OCP\IUserManager;
use OCP\IUserSession;
+use PHPUnit\Framework\MockObject\MockObject;
use Test\TestCase;
class UserStatusWidgetTest extends TestCase {
-
- /** @var IL10N|\PHPUnit\Framework\MockObject\MockObject */
- private $l10n;
-
- /** @var IDateTimeFormatter|\PHPUnit\Framework\MockObject\MockObject */
- private $dateTimeFormatter;
-
- /** @var IURLGenerator|\PHPUnit\Framework\MockObject\MockObject */
- private $urlGenerator;
-
- /** @var IInitialState|\PHPUnit\Framework\MockObject\MockObject */
- private $initialState;
-
- /** @var IUserManager|\PHPUnit\Framework\MockObject\MockObject */
- private $userManager;
-
- /** @var IUserSession|\PHPUnit\Framework\MockObject\MockObject */
- private $userSession;
-
- /** @var StatusService|\PHPUnit\Framework\MockObject\MockObject */
- private $service;
-
- /** @var UserStatusWidget */
- private $widget;
+ private IL10N&MockObject $l10n;
+ private IDateTimeFormatter&MockObject $dateTimeFormatter;
+ private IURLGenerator&MockObject $urlGenerator;
+ private IInitialState&MockObject $initialState;
+ private IUserManager&MockObject $userManager;
+ private IUserSession&MockObject $userSession;
+ private StatusService&MockObject $service;
+ private UserStatusWidget $widget;
protected function setUp(): void {
parent::setUp();
diff --git a/apps/user_status/tests/Unit/Db/UserStatusMapperTest.php b/apps/user_status/tests/Unit/Db/UserStatusMapperTest.php
index 46147c6a822..c9bda492210 100644
--- a/apps/user_status/tests/Unit/Db/UserStatusMapperTest.php
+++ b/apps/user_status/tests/Unit/Db/UserStatusMapperTest.php
@@ -15,9 +15,7 @@ use OCP\DB\Exception;
use Test\TestCase;
class UserStatusMapperTest extends TestCase {
-
- /** @var UserStatusMapper */
- private $mapper;
+ private UserStatusMapper $mapper;
protected function setUp(): void {
parent::setUp();
@@ -137,11 +135,6 @@ class UserStatusMapperTest extends TestCase {
}
/**
- * @param string $status
- * @param bool $isUserDefined
- * @param int $timestamp
- * @param bool $expectsClean
- *
* @dataProvider clearStatusesOlderThanDataProvider
*/
public function testClearStatusesOlderThan(string $status, bool $isUserDefined, int $timestamp, bool $expectsClean): void {
@@ -169,7 +162,7 @@ class UserStatusMapperTest extends TestCase {
}
}
- public function clearStatusesOlderThanDataProvider(): array {
+ public static function clearStatusesOlderThanDataProvider(): array {
return [
['offline', false, 6000, false],
['online', true, 6000, false],
@@ -231,7 +224,7 @@ class UserStatusMapperTest extends TestCase {
$this->mapper->insert($userStatus3);
}
- public function dataCreateBackupStatus(): array {
+ public static function dataCreateBackupStatus(): array {
return [
[false, false, false],
[true, false, true],
@@ -242,9 +235,6 @@ class UserStatusMapperTest extends TestCase {
/**
* @dataProvider dataCreateBackupStatus
- * @param bool $hasStatus
- * @param bool $hasBackup
- * @param bool $backupCreated
*/
public function testCreateBackupStatus(bool $hasStatus, bool $hasBackup, bool $backupCreated): void {
if ($hasStatus) {
diff --git a/apps/user_status/tests/Unit/Listener/UserDeletedListenerTest.php b/apps/user_status/tests/Unit/Listener/UserDeletedListenerTest.php
index 128b5c78c48..fbcea23338d 100644
--- a/apps/user_status/tests/Unit/Listener/UserDeletedListenerTest.php
+++ b/apps/user_status/tests/Unit/Listener/UserDeletedListenerTest.php
@@ -13,15 +13,12 @@ use OCA\UserStatus\Service\StatusService;
use OCP\EventDispatcher\GenericEvent;
use OCP\IUser;
use OCP\User\Events\UserDeletedEvent;
+use PHPUnit\Framework\MockObject\MockObject;
use Test\TestCase;
class UserDeletedListenerTest extends TestCase {
-
- /** @var StatusService|\PHPUnit\Framework\MockObject\MockObject */
- private $service;
-
- /** @var UserDeletedListener */
- private $listener;
+ private StatusService&MockObject $service;
+ private UserDeletedListener $listener;
protected function setUp(): void {
parent::setUp();
diff --git a/apps/user_status/tests/Unit/Listener/UserLiveStatusListenerTest.php b/apps/user_status/tests/Unit/Listener/UserLiveStatusListenerTest.php
index 421cce046df..c94315a7a93 100644
--- a/apps/user_status/tests/Unit/Listener/UserLiveStatusListenerTest.php
+++ b/apps/user_status/tests/Unit/Listener/UserLiveStatusListenerTest.php
@@ -11,7 +11,6 @@ namespace OCA\UserStatus\Tests\Listener;
use OCA\DAV\CalDAV\Status\StatusService as CalendarStatusService;
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;
@@ -24,20 +23,13 @@ use Psr\Log\LoggerInterface;
use Test\TestCase;
class UserLiveStatusListenerTest extends TestCase {
+ private UserStatusMapper&MockObject $mapper;
+ private StatusService&MockObject $statusService;
+ private ITimeFactory&MockObject $timeFactory;
+ private CalendarStatusService&MockObject $calendarStatusService;
- /** @var UserStatusMapper|MockObject */
- private $mapper;
- /** @var StatusService|MockObject */
- private $statusService;
- /** @var ITimeFactory|MockObject */
- private $timeFactory;
-
- /** @var UserDeletedListener */
- private $listener;
-
- private CalendarStatusService|MockObject $calendarStatusService;
-
- private LoggerInterface|MockObject $logger;
+ private LoggerInterface&MockObject $logger;
+ private UserLiveStatusListener $listener;
protected function setUp(): void {
parent::setUp();
@@ -58,25 +50,18 @@ class UserLiveStatusListenerTest extends TestCase {
}
/**
- * @param string $userId
- * @param string $previousStatus
- * @param int $previousTimestamp
- * @param bool $previousIsUserDefined
- * @param string $eventStatus
- * @param int $eventTimestamp
- * @param bool $expectExisting
- * @param bool $expectUpdate
- *
* @dataProvider handleEventWithCorrectEventDataProvider
*/
- public function testHandleWithCorrectEvent(string $userId,
+ public function testHandleWithCorrectEvent(
+ string $userId,
string $previousStatus,
int $previousTimestamp,
bool $previousIsUserDefined,
string $eventStatus,
int $eventTimestamp,
bool $expectExisting,
- bool $expectUpdate): void {
+ bool $expectUpdate,
+ ): void {
$userStatus = new UserStatus();
if ($expectExisting) {
@@ -143,7 +128,7 @@ class UserLiveStatusListenerTest extends TestCase {
}
}
- public function handleEventWithCorrectEventDataProvider(): array {
+ public static function handleEventWithCorrectEventDataProvider(): array {
return [
['john.doe', 'offline', 0, false, 'online', 5000, true, true],
['john.doe', 'offline', 0, false, 'online', 5000, false, true],
diff --git a/apps/user_status/tests/Unit/Service/PredefinedStatusServiceTest.php b/apps/user_status/tests/Unit/Service/PredefinedStatusServiceTest.php
index 12b34ed0b4d..091466637f0 100644
--- a/apps/user_status/tests/Unit/Service/PredefinedStatusServiceTest.php
+++ b/apps/user_status/tests/Unit/Service/PredefinedStatusServiceTest.php
@@ -10,15 +10,12 @@ namespace OCA\UserStatus\Tests\Service;
use OCA\UserStatus\Service\PredefinedStatusService;
use OCP\IL10N;
+use PHPUnit\Framework\MockObject\MockObject;
use Test\TestCase;
class PredefinedStatusServiceTest extends TestCase {
-
- /** @var IL10N|\PHPUnit\Framework\MockObject\MockObject */
- protected $l10n;
-
- /** @var PredefinedStatusService */
- protected $service;
+ protected IL10N&MockObject $l10n;
+ protected PredefinedStatusService $service;
protected function setUp(): void {
parent::setUp();
@@ -97,9 +94,6 @@ class PredefinedStatusServiceTest extends TestCase {
}
/**
- * @param string $id
- * @param string|null $expectedIcon
- *
* @dataProvider getIconForIdDataProvider
*/
public function testGetIconForId(string $id, ?string $expectedIcon): void {
@@ -107,10 +101,7 @@ class PredefinedStatusServiceTest extends TestCase {
$this->assertEquals($expectedIcon, $actual);
}
- /**
- * @return array
- */
- public function getIconForIdDataProvider(): array {
+ public static function getIconForIdDataProvider(): array {
return [
['meeting', '📅'],
['commuting', '🚌'],
@@ -123,9 +114,6 @@ class PredefinedStatusServiceTest extends TestCase {
}
/**
- * @param string $id
- * @param string|null $expected
- *
* @dataProvider getTranslatedStatusForIdDataProvider
*/
public function testGetTranslatedStatusForId(string $id, ?string $expected): void {
@@ -136,10 +124,7 @@ class PredefinedStatusServiceTest extends TestCase {
$this->assertEquals($expected, $actual);
}
- /**
- * @return array
- */
- public function getTranslatedStatusForIdDataProvider(): array {
+ public static function getTranslatedStatusForIdDataProvider(): array {
return [
['meeting', 'In a meeting'],
['commuting', 'Commuting'],
@@ -152,9 +137,6 @@ class PredefinedStatusServiceTest extends TestCase {
}
/**
- * @param string $id
- * @param bool $expected
- *
* @dataProvider isValidIdDataProvider
*/
public function testIsValidId(string $id, bool $expected): void {
@@ -162,10 +144,7 @@ class PredefinedStatusServiceTest extends TestCase {
$this->assertEquals($expected, $actual);
}
- /**
- * @return array
- */
- public function isValidIdDataProvider(): array {
+ public static function isValidIdDataProvider(): array {
return [
['meeting', true],
['commuting', true],
diff --git a/apps/user_status/tests/Unit/Service/StatusServiceTest.php b/apps/user_status/tests/Unit/Service/StatusServiceTest.php
index 801d0cea0fc..7aeb1d48448 100644
--- a/apps/user_status/tests/Unit/Service/StatusServiceTest.php
+++ b/apps/user_status/tests/Unit/Service/StatusServiceTest.php
@@ -31,27 +31,13 @@ use Psr\Log\LoggerInterface;
use Test\TestCase;
class StatusServiceTest extends TestCase {
-
- /** @var UserStatusMapper|MockObject */
- private $mapper;
-
- /** @var ITimeFactory|MockObject */
- private $timeFactory;
-
- /** @var PredefinedStatusService|MockObject */
- private $predefinedStatusService;
-
- /** @var IEmojiHelper|MockObject */
- private $emojiHelper;
-
- /** @var IConfig|MockObject */
- private $config;
-
- /** @var IUserManager|MockObject */
- private $userManager;
-
- /** @var LoggerInterface|MockObject */
- private $logger;
+ private UserStatusMapper&MockObject $mapper;
+ private ITimeFactory&MockObject $timeFactory;
+ private PredefinedStatusService&MockObject $predefinedStatusService;
+ private IEmojiHelper&MockObject $emojiHelper;
+ private IConfig&MockObject $config;
+ private IUserManager&MockObject $userManager;
+ private LoggerInterface&MockObject $logger;
private StatusService $service;
@@ -236,20 +222,10 @@ class StatusServiceTest extends TestCase {
}
/**
- * @param string $userId
- * @param string $status
- * @param int|null $statusTimestamp
- * @param bool $isUserDefined
- * @param bool $expectExisting
- * @param bool $expectSuccess
- * @param bool $expectTimeFactory
- * @param bool $expectException
- * @param string|null $expectedExceptionClass
- * @param string|null $expectedExceptionMessage
- *
* @dataProvider setStatusDataProvider
*/
- public function testSetStatus(string $userId,
+ public function testSetStatus(
+ string $userId,
string $status,
?int $statusTimestamp,
bool $isUserDefined,
@@ -258,7 +234,8 @@ class StatusServiceTest extends TestCase {
bool $expectTimeFactory,
bool $expectException,
?string $expectedExceptionClass,
- ?string $expectedExceptionMessage): void {
+ ?string $expectedExceptionMessage,
+ ): void {
$userStatus = new UserStatus();
if ($expectExisting) {
@@ -309,7 +286,7 @@ class StatusServiceTest extends TestCase {
}
}
- public function setStatusDataProvider(): array {
+ public static function setStatusDataProvider(): array {
return [
['john.doe', 'online', 50, true, true, true, false, false, null, null],
['john.doe', 'online', 50, true, false, true, false, false, null, null],
@@ -368,19 +345,10 @@ class StatusServiceTest extends TestCase {
}
/**
- * @param string $userId
- * @param string $messageId
- * @param bool $isValidMessageId
- * @param int|null $clearAt
- * @param bool $expectExisting
- * @param bool $expectSuccess
- * @param bool $expectException
- * @param string|null $expectedExceptionClass
- * @param string|null $expectedExceptionMessage
- *
* @dataProvider setPredefinedMessageDataProvider
*/
- public function testSetPredefinedMessage(string $userId,
+ public function testSetPredefinedMessage(
+ string $userId,
string $messageId,
bool $isValidMessageId,
?int $clearAt,
@@ -388,7 +356,8 @@ class StatusServiceTest extends TestCase {
bool $expectSuccess,
bool $expectException,
?string $expectedExceptionClass,
- ?string $expectedExceptionMessage): void {
+ ?string $expectedExceptionMessage,
+ ): void {
$userStatus = new UserStatus();
if ($expectExisting) {
@@ -451,7 +420,7 @@ class StatusServiceTest extends TestCase {
}
}
- public function setPredefinedMessageDataProvider(): array {
+ public static function setPredefinedMessageDataProvider(): array {
return [
['john.doe', 'sick-leave', true, null, true, true, false, null, null],
['john.doe', 'sick-leave', true, null, false, true, false, null, null],
@@ -465,20 +434,10 @@ class StatusServiceTest extends TestCase {
}
/**
- * @param string $userId
- * @param string|null $statusIcon
- * @param bool $supportsEmoji
- * @param string $message
- * @param int|null $clearAt
- * @param bool $expectExisting
- * @param bool $expectSuccess
- * @param bool $expectException
- * @param string|null $expectedExceptionClass
- * @param string|null $expectedExceptionMessage
- *
* @dataProvider setCustomMessageDataProvider
*/
- public function testSetCustomMessage(string $userId,
+ public function testSetCustomMessage(
+ string $userId,
?string $statusIcon,
bool $supportsEmoji,
string $message,
@@ -487,7 +446,8 @@ class StatusServiceTest extends TestCase {
bool $expectSuccess,
bool $expectException,
?string $expectedExceptionClass,
- ?string $expectedExceptionMessage): void {
+ ?string $expectedExceptionMessage,
+ ): void {
$userStatus = new UserStatus();
if ($expectExisting) {
@@ -548,7 +508,7 @@ class StatusServiceTest extends TestCase {
}
}
- public function setCustomMessageDataProvider(): array {
+ public static function setCustomMessageDataProvider(): array {
return [
['john.doe', '😁', true, 'Custom message', null, true, true, false, null, null],
['john.doe', '😁', true, 'Custom message', null, false, true, false, null, null],
@@ -815,7 +775,7 @@ class StatusServiceTest extends TestCase {
$this->service->revertMultipleUserStatus(['john', 'nobackup', 'backuponly', 'nobackupanddnd'], 'call');
}
- public function dataSetUserStatus(): array {
+ public static function dataSetUserStatus(): array {
return [
[IUserStatus::MESSAGE_CALENDAR_BUSY, '', false],