diff options
Diffstat (limited to 'tests')
22 files changed, 75 insertions, 118 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/Settings/Admin/AdminSettingsTest.php index b23429a72..a5b81e4b0 100644 --- a/tests/php/Settings/Admin/AdminSettingsTest.php +++ b/tests/php/Settings/Admin/AdminSettingsTest.php @@ -23,6 +23,7 @@ declare(strict_types=1); namespace OCA\Talk\Tests\php\Settings\Admin; +use Test\TestCase; use OCA\Talk\Config; use OCA\Talk\MatterbridgeManager; use OCA\Talk\Service\CommandService; @@ -36,7 +37,7 @@ use OCP\IUserSession; use OCP\L10N\IFactory; use PHPUnit\Framework\MockObject\MockObject; -class AdminSettingsTest extends \Test\TestCase { +class AdminSettingsTest extends TestCase { /** @var Config|MockObject */ protected $talkConfig; @@ -58,8 +59,7 @@ class AdminSettingsTest extends \Test\TestCase { protected $l10n; /** @var IFactory|MockObject */ protected $l10nFactory; - /** @var AdminSettings */ - protected $admin; + protected ?AdminSettings $admin = null; public function setUp(): void { parent::setUp(); diff --git a/tests/php/Settings/Admin/SectionTest.php b/tests/php/Settings/Admin/SectionTest.php index a156cdcea..cfdff1537 100644 --- a/tests/php/Settings/Admin/SectionTest.php +++ b/tests/php/Settings/Admin/SectionTest.php @@ -23,19 +23,19 @@ declare(strict_types=1); namespace OCA\Talk\Tests\php\Settings\Admin; +use Test\TestCase; use OCA\Talk\Settings\Admin\Section; use OCP\IL10N; use OCP\IURLGenerator; use PHPUnit\Framework\MockObject\MockObject; -class SectionTest extends \Test\TestCase { +class SectionTest extends TestCase { /** @var IURLGenerator|MockObject */ protected $url; /** @var IL10N|MockObject */ protected $l; - /** @var Section */ - protected $admin; + protected ?Section $admin = null; public function setUp(): void { parent::setUp(); diff --git a/tests/php/Signaling/BackendNotifierTest.php b/tests/php/Signaling/BackendNotifierTest.php index 351cc3335..eb871389b 100644 --- a/tests/php/Signaling/BackendNotifierTest.php +++ b/tests/php/Signaling/BackendNotifierTest.php @@ -22,6 +22,7 @@ namespace OCA\Talk\Tests\php\Signaling; +use Test\TestCase; use OCA\Talk\AppInfo\Application; use OCA\Talk\Chat\CommentsManager; use OCA\Talk\Config; @@ -51,7 +52,7 @@ use PHPUnit\Framework\MockObject\MockObject; use Psr\Log\LoggerInterface; class CustomBackendNotifier extends BackendNotifier { - private $requests = []; + private array $requests = []; public function getRequests(): array { return $this->requests; @@ -72,12 +73,9 @@ class CustomBackendNotifier extends BackendNotifier { /** * @group DB */ -class BackendNotifierTest extends \Test\TestCase { - - /** @var Config */ - private $config; - /** @var ISecureRandom */ - private $secureRandom; +class BackendNotifierTest extends TestCase { + private ?Config $config = null; + private ?ISecureRandom $secureRandom = null; /** @var ITimeFactory|MockObject */ private $timeFactory; /** @var ParticipantService|MockObject */ @@ -86,25 +84,17 @@ class BackendNotifierTest extends \Test\TestCase { private $signalingManager; /** @var IURLGenerator|MockObject */ private $urlGenerator; - /** @var CustomBackendNotifier */ - private $controller; - - /** @var Manager */ - private $manager; - - /** @var string */ - private $userId; - /** @var string */ - private $signalingSecret; - /** @var string */ - private $baseUrl; - - /** @var Application */ - protected $app; - /** @var BackendNotifier */ - protected $originalBackendNotifier; - /** @var IEventDispatcher */ - private $dispatcher; + private ?\OCA\Talk\Tests\php\Signaling\CustomBackendNotifier $controller = null; + + private ?Manager $manager = null; + + private ?string $userId = null; + private ?string $signalingSecret = null; + private ?string $baseUrl = null; + + protected Application $app; + protected BackendNotifier $originalBackendNotifier; + private ?IEventDispatcher $dispatcher = null; public function setUp(): void { parent::setUp(); diff --git a/tests/php/TalkSessionTest.php b/tests/php/TalkSessionTest.php index 5f183760e..48bb03beb 100644 --- a/tests/php/TalkSessionTest.php +++ b/tests/php/TalkSessionTest.php @@ -35,8 +35,7 @@ class TalkSessionTest extends TestCase { /** @var ISession|MockObject */ protected $session; - /** @var TalkSession */ - protected $talkSession; + protected ?TalkSession $talkSession = null; public function setUp(): void { parent::setUp(); |