summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorJoas Schilling <213943+nickvergessen@users.noreply.github.com>2022-04-07 08:52:32 +0200
committerGitHub <noreply@github.com>2022-04-07 08:52:32 +0200
commit1c09388fb2d46b9aba667df74bc9799d27edddf3 (patch)
tree9c1afce2b0f0380cecd5766131c5b6b31a355565 /tests
parentb8cadab10930df3854481d6cec0162cdbe2a25d2 (diff)
parent94c29af7fe1c56a17f2be37a9c3bb5543f56a404 (diff)
Merge pull request #7108 from nextcloud/feature/7079/property-typehinting-where-possible
Use PHP7.4 property typehinting where possible
Diffstat (limited to 'tests')
-rw-r--r--tests/php/CapabilitiesTest.php3
-rw-r--r--tests/php/Chat/AutoComplete/SearchPluginTest.php9
-rw-r--r--tests/php/Chat/AutoComplete/SorterTest.php15
-rw-r--r--tests/php/Chat/ChatManagerTest.php3
-rw-r--r--tests/php/Chat/Command/ExecutorTest.php3
-rw-r--r--tests/php/Chat/NotifierTest.php3
-rw-r--r--tests/php/Chat/Parser/UserMentionTest.php6
-rw-r--r--tests/php/Chat/SystemMessage/ListenerTest.php9
-rw-r--r--tests/php/Collaboration/Collaborators/RoomPluginTest.php19
-rw-r--r--tests/php/Collaboration/Resources/ConversationProviderTest.php3
-rw-r--r--tests/php/Controller/ChatControllerTest.php7
-rw-r--r--tests/php/Controller/SignalingControllerTest.php22
-rw-r--r--tests/php/Federation/FederationTest.php9
-rw-r--r--tests/php/Listener/RestrictStartingCallsTest.php3
-rw-r--r--tests/php/Model/AttendeeMapperTest.php4
-rw-r--r--tests/php/Notification/NotifierTest.php6
-rw-r--r--tests/php/Service/ParticipantServiceTest.php9
-rw-r--r--tests/php/Service/RoomServiceTest.php3
-rw-r--r--tests/php/Settings/Admin/AdminSettingsTest.php6
-rw-r--r--tests/php/Settings/Admin/SectionTest.php6
-rw-r--r--tests/php/Signaling/BackendNotifierTest.php42
-rw-r--r--tests/php/TalkSessionTest.php3
-rw-r--r--tests/psalm-baseline.xml89
23 files changed, 80 insertions, 202 deletions
diff --git a/tests/php/CapabilitiesTest.php b/tests/php/CapabilitiesTest.php
index 518fa14b9..2ebf6b006 100644
--- a/tests/php/CapabilitiesTest.php
+++ b/tests/php/CapabilitiesTest.php
@@ -46,8 +46,7 @@ class CapabilitiesTest extends TestCase {
protected $commentsManager;
/** @var IUserSession|MockObject */
protected $userSession;
- /** @var array */
- protected $baseFeatures;
+ protected ?array $baseFeatures = null;
public function setUp(): void {
parent::setUp();
diff --git a/tests/php/Chat/AutoComplete/SearchPluginTest.php b/tests/php/Chat/AutoComplete/SearchPluginTest.php
index e1a832934..b6e885b44 100644
--- a/tests/php/Chat/AutoComplete/SearchPluginTest.php
+++ b/tests/php/Chat/AutoComplete/SearchPluginTest.php
@@ -21,6 +21,7 @@
namespace OCA\Talk\Tests\php\Chat\AutoComplete;
+use Test\TestCase;
use OCA\Talk\Chat\AutoComplete\SearchPlugin;
use OCA\Talk\Files\Util;
use OCA\Talk\GuestManager;
@@ -36,7 +37,7 @@ use OCP\IUser;
use OCP\IUserManager;
use PHPUnit\Framework\MockObject\MockObject;
-class SearchPluginTest extends \Test\TestCase {
+class SearchPluginTest extends TestCase {
/** @var IUserManager|MockObject */
protected $userManager;
@@ -50,10 +51,8 @@ class SearchPluginTest extends \Test\TestCase {
protected $util;
/** @var IL10N|MockObject */
protected $l;
- /** @var string */
- protected $userId;
- /** @var SearchPlugin */
- protected $plugin;
+ protected ?string $userId = null;
+ protected SearchPlugin $plugin;
public function setUp(): void {
parent::setUp();
diff --git a/tests/php/Chat/AutoComplete/SorterTest.php b/tests/php/Chat/AutoComplete/SorterTest.php
index 2fffedd90..cb165ea06 100644
--- a/tests/php/Chat/AutoComplete/SorterTest.php
+++ b/tests/php/Chat/AutoComplete/SorterTest.php
@@ -23,22 +23,21 @@ declare(strict_types=1);
namespace OCA\Talk\Tests\php\Chat;
+use Test\TestCase;
use OCA\Talk\Chat\AutoComplete\Sorter;
use OCA\Talk\Chat\CommentsManager;
use PHPUnit\Framework\MockObject\MockObject;
-class SorterTest extends \Test\TestCase {
+class SorterTest extends TestCase {
/** @var CommentsManager|MockObject */
protected $commentsManager;
- /** @var string */
- protected $userId;
+ protected string $userId;
- /** @var Sorter */
- protected $sorter;
+ protected ?Sorter $sorter = null;
- protected $user1 = [
+ protected array $user1 = [
'label' => 'Seattle',
'value' => [
'shareType' => 'user',
@@ -46,7 +45,7 @@ class SorterTest extends \Test\TestCase {
],
];
- protected $user2 = [
+ protected array $user2 = [
'label' => 'New York',
'value' => [
'shareType' => 'user',
@@ -54,7 +53,7 @@ class SorterTest extends \Test\TestCase {
],
];
- protected $user3 = [
+ protected array $user3 = [
'label' => 'ttle Sea',
'value' => [
'shareType' => 'user',
diff --git a/tests/php/Chat/ChatManagerTest.php b/tests/php/Chat/ChatManagerTest.php
index 7145ef8ab..86750e8c4 100644
--- a/tests/php/Chat/ChatManagerTest.php
+++ b/tests/php/Chat/ChatManagerTest.php
@@ -70,8 +70,7 @@ class ChatManagerTest extends TestCase {
protected $timeFactory;
/** @var AttachmentService|MockObject */
protected $attachmentService;
- /** @var ChatManager */
- protected $chatManager;
+ protected ?ChatManager $chatManager = null;
public function setUp(): void {
parent::setUp();
diff --git a/tests/php/Chat/Command/ExecutorTest.php b/tests/php/Chat/Command/ExecutorTest.php
index 6ca43ee35..9bf4a985c 100644
--- a/tests/php/Chat/Command/ExecutorTest.php
+++ b/tests/php/Chat/Command/ExecutorTest.php
@@ -53,8 +53,7 @@ class ExecutorTest extends TestCase {
/** @var IL10N|MockObject */
protected $l10n;
- /** @var Executor */
- protected $executor;
+ protected ?Executor $executor = null;
public function setUp(): void {
parent::setUp();
diff --git a/tests/php/Chat/NotifierTest.php b/tests/php/Chat/NotifierTest.php
index c921ac318..3ee7e4593 100644
--- a/tests/php/Chat/NotifierTest.php
+++ b/tests/php/Chat/NotifierTest.php
@@ -59,8 +59,7 @@ class NotifierTest extends TestCase {
/** @var Util|MockObject */
protected $util;
- /** @var Notifier */
- protected $notifier;
+ protected Notifier $notifier;
public function setUp(): void {
parent::setUp();
diff --git a/tests/php/Chat/Parser/UserMentionTest.php b/tests/php/Chat/Parser/UserMentionTest.php
index 497d933bb..d677adf63 100644
--- a/tests/php/Chat/Parser/UserMentionTest.php
+++ b/tests/php/Chat/Parser/UserMentionTest.php
@@ -24,6 +24,7 @@ declare(strict_types=1);
namespace OCA\Talk\Tests\php\Chat\Parser;
+use Test\TestCase;
use OCA\Talk\Chat\Parser\UserMention;
use OCA\Talk\Exceptions\ParticipantNotFoundException;
use OCA\Talk\GuestManager;
@@ -38,7 +39,7 @@ use OCP\IUser;
use OCP\IUserManager;
use PHPUnit\Framework\MockObject\MockObject;
-class UserMentionTest extends \Test\TestCase {
+class UserMentionTest extends TestCase {
/** @var ICommentsManager|MockObject */
protected $commentsManager;
@@ -49,8 +50,7 @@ class UserMentionTest extends \Test\TestCase {
/** @var IL10N|MockObject */
protected $l;
- /** @var UserMention */
- protected $parser;
+ protected ?UserMention $parser = null;
public function setUp(): void {
parent::setUp();
diff --git a/tests/php/Chat/SystemMessage/ListenerTest.php b/tests/php/Chat/SystemMessage/ListenerTest.php
index 8a11d896a..448a676fb 100644
--- a/tests/php/Chat/SystemMessage/ListenerTest.php
+++ b/tests/php/Chat/SystemMessage/ListenerTest.php
@@ -44,8 +44,7 @@ use Test\TestCase;
class ListenerTest extends TestCase {
public const DUMMY_REFERENCE_ID = 'DUMMY_REFERENCE_ID';
- /** @var Listener */
- protected $listener;
+ protected ?Listener $listener = null;
/** @var IRequest|MockObject */
protected $request;
@@ -61,10 +60,8 @@ class ListenerTest extends TestCase {
protected $timeFactory;
/** @var IEventDispatcher|MockObject */
protected $eventDispatcher;
- /** @var array */
- protected $handlers;
- /** @var \DateTime */
- protected $dummyTime;
+ protected ?array $handlers = null;
+ protected ?\DateTime $dummyTime = null;
public function setUp(): void {
parent::setUp();
diff --git a/tests/php/Collaboration/Collaborators/RoomPluginTest.php b/tests/php/Collaboration/Collaborators/RoomPluginTest.php
index cc5a868e0..867449be3 100644
--- a/tests/php/Collaboration/Collaborators/RoomPluginTest.php
+++ b/tests/php/Collaboration/Collaborators/RoomPluginTest.php
@@ -25,6 +25,7 @@ declare(strict_types=1);
namespace OCA\Talk\Tests\php\Collaboration\Collaborators;
+use Test\TestCase;
use OCA\Talk\Collaboration\Collaborators\RoomPlugin;
use OCA\Talk\Manager;
use OCA\Talk\Room;
@@ -34,22 +35,16 @@ use OCP\IUser;
use OCP\IUserSession;
use OCP\Share\IShare;
-class RoomPluginTest extends \Test\TestCase {
+class RoomPluginTest extends TestCase {
+ protected ?Manager $manager = null;
- /** @var Manager */
- protected $manager;
+ protected ?IUserSession $userSession = null;
- /** @var IUserSession */
- protected $userSession;
+ protected ?IUser $user = null;
- /** @var IUser */
- protected $user;
+ protected ?ISearchResult $searchResult = null;
- /** @var ISearchResult */
- protected $searchResult;
-
- /** @var RoomPlugin */
- protected $plugin;
+ protected ?RoomPlugin $plugin = null;
public function setUp(): void {
parent::setUp();
diff --git a/tests/php/Collaboration/Resources/ConversationProviderTest.php b/tests/php/Collaboration/Resources/ConversationProviderTest.php
index df80d82ed..9c154cb83 100644
--- a/tests/php/Collaboration/Resources/ConversationProviderTest.php
+++ b/tests/php/Collaboration/Resources/ConversationProviderTest.php
@@ -46,8 +46,7 @@ class ConversationProviderTest extends TestCase {
protected $userSession;
/** @var IURLGenerator|MockObject */
protected $urlGenerator;
- /** @var ConversationProvider */
- protected $provider;
+ protected ?ConversationProvider $provider = null;
public function setUp(): void {
parent::setUp();
diff --git a/tests/php/Controller/ChatControllerTest.php b/tests/php/Controller/ChatControllerTest.php
index ba24bf7f2..6ea619f1d 100644
--- a/tests/php/Controller/ChatControllerTest.php
+++ b/tests/php/Controller/ChatControllerTest.php
@@ -56,9 +56,7 @@ use PHPUnit\Framework\MockObject\MockObject;
use Test\TestCase;
class ChatControllerTest extends TestCase {
-
- /** @var string */
- private $userId;
+ private ?string $userId = null;
/** @var IUserManager|MockObject */
protected $userManager;
/** @var IAppManager|MockObject */
@@ -99,8 +97,7 @@ class ChatControllerTest extends TestCase {
/** @var Room|MockObject */
protected $room;
- /** @var ChatController */
- private $controller;
+ private ?ChatController $controller = null;
/** @var Callback */
private $newMessageDateTimeConstraint;
diff --git a/tests/php/Controller/SignalingControllerTest.php b/tests/php/Controller/SignalingControllerTest.php
index 9c95b35cb..ec0851335 100644
--- a/tests/php/Controller/SignalingControllerTest.php
+++ b/tests/php/Controller/SignalingControllerTest.php
@@ -22,6 +22,8 @@
namespace OCA\Talk\Tests\php\Controller;
+use Test\TestCase;
+use OCP\IRequest;
use OCA\Talk\Chat\CommentsManager;
use OCA\Talk\Config;
use OCA\Talk\Controller\SignalingController;
@@ -67,10 +69,8 @@ class CustomInputSignalingController extends SignalingController {
/**
* @group DB
*/
-class SignalingControllerTest extends \Test\TestCase {
-
- /** @var Config */
- private $config;
+class SignalingControllerTest extends TestCase {
+ private ?Config $config = null;
/** @var TalkSession|MockObject */
private $session;
/** @var \OCA\Talk\Signaling\Manager|MockObject */
@@ -91,17 +91,13 @@ class SignalingControllerTest extends \Test\TestCase {
protected $timeFactory;
/** @var IClientService|MockObject */
protected $clientService;
- /** @var string */
- private $userId;
- /** @var ISecureRandom */
- private $secureRandom;
- /** @var IEventDispatcher */
- private $dispatcher;
+ private ?string $userId = null;
+ private ?ISecureRandom $secureRandom = null;
+ private ?IEventDispatcher $dispatcher = null;
/** @var LoggerInterface|MockObject */
private $logger;
- /** @var CustomInputSignalingController */
- private $controller;
+ private ?\OCA\Talk\Tests\php\Controller\CustomInputSignalingController $controller = null;
public function setUp(): void {
parent::setUp();
@@ -135,7 +131,7 @@ class SignalingControllerTest extends \Test\TestCase {
private function recreateSignalingController() {
$this->controller = new CustomInputSignalingController(
'spreed',
- $this->createMock(\OCP\IRequest::class),
+ $this->createMock(IRequest::class),
$this->config,
$this->signalingManager,
$this->session,
diff --git a/tests/php/Federation/FederationTest.php b/tests/php/Federation/FederationTest.php
index 1774bcecb..8bb7bd13d 100644
--- a/tests/php/Federation/FederationTest.php
+++ b/tests/php/Federation/FederationTest.php
@@ -48,11 +48,9 @@ use Psr\Log\LoggerInterface;
use Test\TestCase;
class FederationTest extends TestCase {
- /** @var FederationManager */
- protected $federationManager;
+ protected ?FederationManager $federationManager = null;
- /** @var Notifications */
- protected $notifications;
+ protected ?Notifications $notifications = null;
/** @var ICloudFederationProviderManager|MockObject */
protected $cloudFederationProviderManager;
@@ -66,8 +64,7 @@ class FederationTest extends TestCase {
/** @var AddressHandler|MockObject */
protected $addressHandler;
- /** @var CloudFederationProviderTalk */
- protected $cloudFederationProvider;
+ protected ?CloudFederationProviderTalk $cloudFederationProvider = null;
/** @var IUserManager|MockObject */
protected $userManager;
diff --git a/tests/php/Listener/RestrictStartingCallsTest.php b/tests/php/Listener/RestrictStartingCallsTest.php
index bdc2d2e43..b94da5a55 100644
--- a/tests/php/Listener/RestrictStartingCallsTest.php
+++ b/tests/php/Listener/RestrictStartingCallsTest.php
@@ -41,8 +41,7 @@ class RestrictStartingCallsTest extends TestCase {
protected $serverConfig;
/** @var ParticipantService|MockObject */
protected $participantService;
- /** @var RestrictStartingCalls */
- protected $listener;
+ protected ?RestrictStartingCalls $listener = null;
public function setUp(): void {
parent::setUp();
diff --git a/tests/php/Model/AttendeeMapperTest.php b/tests/php/Model/AttendeeMapperTest.php
index c4cee5e40..985d71aec 100644
--- a/tests/php/Model/AttendeeMapperTest.php
+++ b/tests/php/Model/AttendeeMapperTest.php
@@ -33,9 +33,7 @@ use Test\TestCase;
* @group DB
*/
class AttendeeMapperTest extends TestCase {
-
- /** @var AttendeeMapper */
- protected $attendeeMapper;
+ protected ?AttendeeMapper $attendeeMapper = null;
public function setUp(): void {
diff --git a/tests/php/Notification/NotifierTest.php b/tests/php/Notification/NotifierTest.php
index 44cc8fe3e..4527dad1c 100644
--- a/tests/php/Notification/NotifierTest.php
+++ b/tests/php/Notification/NotifierTest.php
@@ -21,6 +21,7 @@
namespace OCA\Talk\Tests\php\Notifications;
+use Test\TestCase;
use OCA\FederatedFileSharing\AddressHandler;
use OCA\Talk\Chat\CommentsManager;
use OCA\Talk\Chat\MessageParser;
@@ -48,7 +49,7 @@ use OCP\RichObjectStrings\Definitions;
use OCP\Share\IManager as IShareManager;
use PHPUnit\Framework\MockObject\MockObject;
-class NotifierTest extends \Test\TestCase {
+class NotifierTest extends TestCase {
/** @var IFactory|MockObject */
protected $lFactory;
@@ -74,8 +75,7 @@ class NotifierTest extends \Test\TestCase {
protected $messageParser;
/** @var Definitions|MockObject */
protected $definitions;
- /** @var Notifier */
- protected $notifier;
+ protected ?Notifier $notifier = null;
/** @var AddressHandler|MockObject */
protected $addressHandler;
diff --git a/tests/php/Service/ParticipantServiceTest.php b/tests/php/Service/ParticipantServiceTest.php
index 98f23a10e..da6fb6f0c 100644
--- a/tests/php/Service/ParticipantServiceTest.php
+++ b/tests/php/Service/ParticipantServiceTest.php
@@ -54,10 +54,8 @@ class ParticipantServiceTest extends TestCase {
protected $serverConfig;
/** @var Config|MockObject */
protected $talkConfig;
- /** @var AttendeeMapper */
- protected $attendeeMapper;
- /** @var SessionMapper */
- protected $sessionMapper;
+ protected ?AttendeeMapper $attendeeMapper = null;
+ protected ?SessionMapper $sessionMapper = null;
/** @var SessionService|MockObject */
protected $sessionService;
/** @var ISecureRandom|MockObject */
@@ -76,8 +74,7 @@ class ParticipantServiceTest extends TestCase {
protected $time;
/** @var ICacheFactory|MockObject */
protected $cacheFactory;
- /** @var ParticipantService */
- private $service;
+ private ?ParticipantService $service = null;
public function setUp(): void {
diff --git a/tests/php/Service/RoomServiceTest.php b/tests/php/Service/RoomServiceTest.php
index c373d2382..faf324a78 100644
--- a/tests/php/Service/RoomServiceTest.php
+++ b/tests/php/Service/RoomServiceTest.php
@@ -46,8 +46,7 @@ class RoomServiceTest extends TestCase {
protected $shareManager;
/** @var IEventDispatcher|MockObject */
protected $dispatcher;
- /** @var RoomService */
- private $service;
+ private ?RoomService $service = null;
public function setUp(): void {
diff --git a/tests/php/Settings/Admin/AdminSettingsTest.php b/tests/php/S