summaryrefslogtreecommitdiffstats
path: root/tests/php/Federation/FederationTest.php
diff options
context:
space:
mode:
authorJoas Schilling <coding@schilljs.com>2024-04-12 12:46:48 +0200
committerJoas Schilling <coding@schilljs.com>2024-04-12 12:46:48 +0200
commitf28f7e6354cce3ea56047b2830957eea232e02a2 (patch)
treecb64e56faefbe4eed2da3268197265a2a85d927d /tests/php/Federation/FederationTest.php
parent19937f6068274e311c13b1e4ff7e34ce5af1afca (diff)
fix(tests): Clean up unit test code
- static data providers - typed methods that consume data providers - type intersection with MockObject - move away from deprecated methods Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'tests/php/Federation/FederationTest.php')
-rw-r--r--tests/php/Federation/FederationTest.php72
1 files changed, 26 insertions, 46 deletions
diff --git a/tests/php/Federation/FederationTest.php b/tests/php/Federation/FederationTest.php
index e0d83b681..16c9fd477 100644
--- a/tests/php/Federation/FederationTest.php
+++ b/tests/php/Federation/FederationTest.php
@@ -66,49 +66,29 @@ use Psr\Log\LoggerInterface;
use Test\TestCase;
class FederationTest extends TestCase {
- protected ?FederationManager $federationManager = null;
-
- protected ?BackendNotifier $backendNotifier = null;
-
- protected ICloudIdManager|MockObject $cloudIdManager;
- /** @var ICloudFederationProviderManager|MockObject */
- protected $cloudFederationProviderManager;
-
- /** @var ICloudFederationFactory|MockObject */
- protected $cloudFederationFactory;
-
- /** @var Config|MockObject */
- protected $config;
- protected IAppConfig|MockObject $appConfig;
- /** @var LoggerInterface|MockObject */
- protected $logger;
-
- /** @var AddressHandler|MockObject */
- protected $addressHandler;
-
+ protected FederationManager&MockObject $federationManager;
+ protected ICloudIdManager&MockObject $cloudIdManager;
+ protected ICloudFederationProviderManager&MockObject $cloudFederationProviderManager;
+ protected ICloudFederationFactory&MockObject $cloudFederationFactory;
+ protected Config&MockObject $config;
+ protected IAppConfig&MockObject $appConfig;
+ protected LoggerInterface&MockObject $logger;
+ protected AddressHandler&MockObject $addressHandler;
+ protected IUserManager&MockObject $userManager;
+ protected IAppManager&MockObject $appManager;
+ protected IURLGenerator&MockObject $url;
+ protected INotificationManager&MockObject $notificationManager;
+ protected AttendeeMapper&MockObject $attendeeMapper;
+ protected ProxyCacheMessageMapper&MockObject $proxyCacheMessageMapper;
+ protected ProxyCacheMessageService&MockObject $proxyCacheMessageService;
+ protected FederationChatNotifier&MockObject $federationChatNotifier;
+ protected UserConverter&MockObject $userConverter;
+ protected ICacheFactory&MockObject $cacheFactory;
+ protected RetryNotificationMapper&MockObject $retryNotificationMapper;
+ protected ITimeFactory&MockObject $timeFactory;
+ protected RestrictionValidator&MockObject $restrictionValidator;
protected ?CloudFederationProviderTalk $cloudFederationProvider = null;
-
- /** @var IUserManager|MockObject */
- protected $userManager;
- protected IAppManager|MockObject $appManager;
-
- /** @var IURLGenerator|MockObject */
- protected $url;
-
- /** @var INotificationManager|MockObject */
- protected $notificationManager;
-
- /** @var AttendeeMapper|MockObject */
- protected $attendeeMapper;
-
- protected ProxyCacheMessageMapper|MockObject $proxyCacheMessageMapper;
- protected ProxyCacheMessageService|MockObject $proxyCacheMessageService;
- protected FederationChatNotifier|MockObject $federationChatNotifier;
- protected UserConverter|MockObject $userConverter;
- protected ICacheFactory|MockObject $cacheFactory;
- protected RetryNotificationMapper|MockObject $retryNotificationMapper;
- protected ITimeFactory|MockObject $timeFactory;
- protected RestrictionValidator|MockObject $restrictionValidator;
+ protected ?BackendNotifier $backendNotifier = null;
public function setUp(): void {
parent::setUp();
@@ -173,7 +153,7 @@ class FederationTest extends TestCase {
);
}
- public function testSendRemoteShareWithOwner() {
+ public function testSendRemoteShareWithOwner(): void {
$cloudShare = $this->createMock(ICloudFederationShare::class);
$providerId = '3';
@@ -276,7 +256,7 @@ class FederationTest extends TestCase {
$this->backendNotifier->sendRemoteShare($providerId, $token, $shareWith, $sharedBy, $shareType, $room, $attendee);
}
- public function testReceiveRemoteShare() {
+ public function testReceiveRemoteShare(): void {
$providerId = '3';
$token = 'abcdefghijklmno';
$shareWith = 'test@remote.test.local';
@@ -400,7 +380,7 @@ class FederationTest extends TestCase {
);
}
- public function testSendAcceptNotification() {
+ public function testSendAcceptNotification(): void {
$remote = 'https://remote.test.local';
$id = 50;
$token = 'abcdefghijklmno';
@@ -447,7 +427,7 @@ class FederationTest extends TestCase {
$this->assertTrue($success);
}
- public function testSendRejectNotification() {
+ public function testSendRejectNotification(): void {
$remote = 'https://remote.test.local';
$id = 50;
$token = 'abcdefghijklmno';