aboutsummaryrefslogtreecommitdiffstats
path: root/apps/federation
diff options
context:
space:
mode:
authorChristoph Wurst <christoph@winzerhof-wurst.at>2024-09-15 22:32:31 +0200
committerChristoph Wurst <christoph@winzerhof-wurst.at>2024-09-15 22:32:31 +0200
commit49dd79eabb2b8902559a7a4e8f8fcad54f46b604 (patch)
tree2af18db46ba463368dc4461d7436fb69577923de /apps/federation
parent4281ce6fa1bb8235426099d720734d2394bec203 (diff)
downloadnextcloud-server-49dd79eabb2b8902559a7a4e8f8fcad54f46b604.tar.gz
nextcloud-server-49dd79eabb2b8902559a7a4e8f8fcad54f46b604.zip
refactor: Add void return type to PHPUnit test methods
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
Diffstat (limited to 'apps/federation')
-rw-r--r--apps/federation/tests/BackgroundJob/GetSharedSecretTest.php6
-rw-r--r--apps/federation/tests/BackgroundJob/RequestSharedSecretTest.php6
-rw-r--r--apps/federation/tests/DAV/FedAuthTest.php2
-rw-r--r--apps/federation/tests/DbHandlerTest.php24
-rw-r--r--apps/federation/tests/Middleware/AddServerMiddlewareTest.php2
-rw-r--r--apps/federation/tests/Settings/AdminTest.php6
-rw-r--r--apps/federation/tests/SyncFederationAddressbooksTest.php6
-rw-r--r--apps/federation/tests/TrustedServersTest.php4
8 files changed, 28 insertions, 28 deletions
diff --git a/apps/federation/tests/BackgroundJob/GetSharedSecretTest.php b/apps/federation/tests/BackgroundJob/GetSharedSecretTest.php
index bc3e971fad2..4fcb579d6f9 100644
--- a/apps/federation/tests/BackgroundJob/GetSharedSecretTest.php
+++ b/apps/federation/tests/BackgroundJob/GetSharedSecretTest.php
@@ -152,7 +152,7 @@ class GetSharedSecretTest extends TestCase {
*
* @param int $statusCode
*/
- public function testRun($statusCode) {
+ public function testRun($statusCode): void {
$target = 'targetURL';
$source = 'sourceURL';
$token = 'token';
@@ -210,7 +210,7 @@ class GetSharedSecretTest extends TestCase {
];
}
- public function testRunExpired() {
+ public function testRunExpired(): void {
$target = 'targetURL';
$source = 'sourceURL';
$token = 'token';
@@ -240,7 +240,7 @@ class GetSharedSecretTest extends TestCase {
$this->invokePrivate($this->getSharedSecret, 'run', [$argument]);
}
- public function testRunConnectionError() {
+ public function testRunConnectionError(): void {
$target = 'targetURL';
$source = 'sourceURL';
$token = 'token';
diff --git a/apps/federation/tests/BackgroundJob/RequestSharedSecretTest.php b/apps/federation/tests/BackgroundJob/RequestSharedSecretTest.php
index 7d67de38f5f..63b8324ad2e 100644
--- a/apps/federation/tests/BackgroundJob/RequestSharedSecretTest.php
+++ b/apps/federation/tests/BackgroundJob/RequestSharedSecretTest.php
@@ -87,7 +87,7 @@ class RequestSharedSecretTest extends TestCase {
* @param bool $isTrustedServer
* @param bool $retainBackgroundJob
*/
- public function testStart($isTrustedServer, $retainBackgroundJob) {
+ public function testStart($isTrustedServer, $retainBackgroundJob): void {
/** @var RequestSharedSecret |MockObject $requestSharedSecret */
$requestSharedSecret = $this->getMockBuilder('OCA\Federation\BackgroundJob\RequestSharedSecret')
->setConstructorArgs(
@@ -196,7 +196,7 @@ class RequestSharedSecretTest extends TestCase {
];
}
- public function testRunExpired() {
+ public function testRunExpired(): void {
$target = 'targetURL';
$source = 'sourceURL';
$token = 'token';
@@ -226,7 +226,7 @@ class RequestSharedSecretTest extends TestCase {
$this->invokePrivate($this->requestSharedSecret, 'run', [$argument]);
}
- public function testRunConnectionError() {
+ public function testRunConnectionError(): void {
$target = 'targetURL';
$source = 'sourceURL';
$token = 'token';
diff --git a/apps/federation/tests/DAV/FedAuthTest.php b/apps/federation/tests/DAV/FedAuthTest.php
index 2d71137ae38..d059fff0481 100644
--- a/apps/federation/tests/DAV/FedAuthTest.php
+++ b/apps/federation/tests/DAV/FedAuthTest.php
@@ -20,7 +20,7 @@ class FedAuthTest extends TestCase {
* @param string $user
* @param string $password
*/
- public function testFedAuth($expected, $user, $password) {
+ public function testFedAuth($expected, $user, $password): void {
/** @var DbHandler | \PHPUnit\Framework\MockObject\MockObject $db */
$db = $this->getMockBuilder('OCA\Federation\DbHandler')->disableOriginalConstructor()->getMock();
$db->method('auth')->willReturn(true);
diff --git a/apps/federation/tests/DbHandlerTest.php b/apps/federation/tests/DbHandlerTest.php
index df8cd36d8a8..aabbf1472e7 100644
--- a/apps/federation/tests/DbHandlerTest.php
+++ b/apps/federation/tests/DbHandlerTest.php
@@ -62,7 +62,7 @@ class DbHandlerTest extends TestCase {
* @param string $expectedUrl the url we expect to be written to the db
* @param string $expectedHash the hash value we expect to be written to the db
*/
- public function testAddServer($url, $expectedUrl, $expectedHash) {
+ public function testAddServer($url, $expectedUrl, $expectedHash): void {
$id = $this->dbHandler->addServer($url);
$query = $this->connection->getQueryBuilder()->select('*')->from($this->dbTable);
@@ -85,7 +85,7 @@ class DbHandlerTest extends TestCase {
];
}
- public function testRemove() {
+ public function testRemove(): void {
$id1 = $this->dbHandler->addServer('server1');
$id2 = $this->dbHandler->addServer('server2');
@@ -112,7 +112,7 @@ class DbHandlerTest extends TestCase {
}
- public function testGetServerById() {
+ public function testGetServerById(): void {
$this->dbHandler->addServer('server1');
$id = $this->dbHandler->addServer('server2');
@@ -120,7 +120,7 @@ class DbHandlerTest extends TestCase {
$this->assertSame('server2', $result['url']);
}
- public function testGetAll() {
+ public function testGetAll(): void {
$id1 = $this->dbHandler->addServer('server1');
$id2 = $this->dbHandler->addServer('server2');
@@ -139,7 +139,7 @@ class DbHandlerTest extends TestCase {
* @param string $checkForServer
* @param bool $expected
*/
- public function testServerExists($serverInTable, $checkForServer, $expected) {
+ public function testServerExists($serverInTable, $checkForServer, $expected): void {
$this->dbHandler->addServer($serverInTable);
$this->assertSame($expected,
$this->dbHandler->serverExists($checkForServer)
@@ -173,7 +173,7 @@ class DbHandlerTest extends TestCase {
$this->assertSame('token', $result[0]['token']);
}
- public function testGetToken() {
+ public function testGetToken(): void {
$this->dbHandler->addServer('server1');
$this->dbHandler->addToken('http://server1', 'token');
$this->assertSame('token',
@@ -200,7 +200,7 @@ class DbHandlerTest extends TestCase {
$this->assertSame('secret', $result[0]['shared_secret']);
}
- public function testGetSharedSecret() {
+ public function testGetSharedSecret(): void {
$this->dbHandler->addServer('server1');
$this->dbHandler->addSharedSecret('http://server1', 'secret');
$this->assertSame('secret',
@@ -208,7 +208,7 @@ class DbHandlerTest extends TestCase {
);
}
- public function testSetServerStatus() {
+ public function testSetServerStatus(): void {
$this->dbHandler->addServer('server1');
$query = $this->connection->getQueryBuilder()->select('*')->from($this->dbTable);
@@ -227,7 +227,7 @@ class DbHandlerTest extends TestCase {
$this->assertSame(TrustedServers::STATUS_OK, (int)$result[0]['status']);
}
- public function testGetServerStatus() {
+ public function testGetServerStatus(): void {
$this->dbHandler->addServer('server1');
$this->dbHandler->setServerStatus('http://server1', TrustedServers::STATUS_OK);
$this->assertSame(TrustedServers::STATUS_OK,
@@ -248,7 +248,7 @@ class DbHandlerTest extends TestCase {
* @param string $url
* @param string $expected
*/
- public function testHash($url, $expected) {
+ public function testHash($url, $expected): void {
$this->assertSame($expected,
$this->invokePrivate($this->dbHandler, 'hash', [$url])
);
@@ -269,7 +269,7 @@ class DbHandlerTest extends TestCase {
* @param string $url
* @param string $expected
*/
- public function testNormalizeUrl($url, $expected) {
+ public function testNormalizeUrl($url, $expected): void {
$this->assertSame($expected,
$this->invokePrivate($this->dbHandler, 'normalizeUrl', [$url])
);
@@ -288,7 +288,7 @@ class DbHandlerTest extends TestCase {
/**
* @dataProvider providesAuth
*/
- public function testAuth($expectedResult, $user, $password) {
+ public function testAuth($expectedResult, $user, $password): void {
if ($expectedResult) {
$this->dbHandler->addServer('url1');
$this->dbHandler->addSharedSecret('url1', $password);
diff --git a/apps/federation/tests/Middleware/AddServerMiddlewareTest.php b/apps/federation/tests/Middleware/AddServerMiddlewareTest.php
index 85b918a80f1..d5ee241a85a 100644
--- a/apps/federation/tests/Middleware/AddServerMiddlewareTest.php
+++ b/apps/federation/tests/Middleware/AddServerMiddlewareTest.php
@@ -49,7 +49,7 @@ class AddServerMiddlewareTest extends TestCase {
* @param \Exception $exception
* @param string $hint
*/
- public function testAfterException($exception, $hint) {
+ public function testAfterException($exception, $hint): void {
$this->logger->expects($this->once())->method('error');
$this->l10n->expects($this->any())->method('t')
diff --git a/apps/federation/tests/Settings/AdminTest.php b/apps/federation/tests/Settings/AdminTest.php
index 3bbf4c4a9e7..3d58fae2d7b 100644
--- a/apps/federation/tests/Settings/AdminTest.php
+++ b/apps/federation/tests/Settings/AdminTest.php
@@ -26,7 +26,7 @@ class AdminTest extends TestCase {
);
}
- public function testGetForm() {
+ public function testGetForm(): void {
$this->trustedServers
->expects($this->once())
->method('getServers')
@@ -39,11 +39,11 @@ class AdminTest extends TestCase {
$this->assertEquals($expected, $this->admin->getForm());
}
- public function testGetSection() {
+ public function testGetSection(): void {
$this->assertSame('sharing', $this->admin->getSection());
}
- public function testGetPriority() {
+ public function testGetPriority(): void {
$this->assertSame(30, $this->admin->getPriority());
}
}
diff --git a/apps/federation/tests/SyncFederationAddressbooksTest.php b/apps/federation/tests/SyncFederationAddressbooksTest.php
index 0f13dd0ec51..6d826741292 100644
--- a/apps/federation/tests/SyncFederationAddressbooksTest.php
+++ b/apps/federation/tests/SyncFederationAddressbooksTest.php
@@ -33,7 +33,7 @@ class SyncFederationAddressbooksTest extends \Test\TestCase {
$this->logger = $this->createMock(LoggerInterface::class);
}
- public function testSync() {
+ public function testSync(): void {
/** @var DbHandler | MockObject $dbHandler */
$dbHandler = $this->getMockBuilder('OCA\Federation\DbHandler')
->disableOriginalConstructor()
@@ -63,7 +63,7 @@ class SyncFederationAddressbooksTest extends \Test\TestCase {
$this->assertEquals('1', count($this->callBacks));
}
- public function testException() {
+ public function testException(): void {
/** @var DbHandler | MockObject $dbHandler */
$dbHandler = $this->getMockBuilder('OCA\Federation\DbHandler')->
disableOriginalConstructor()->
@@ -91,7 +91,7 @@ class SyncFederationAddressbooksTest extends \Test\TestCase {
$this->assertEquals(2, count($this->callBacks));
}
- public function testSuccessfulSyncWithoutChangesAfterFailure() {
+ public function testSuccessfulSyncWithoutChangesAfterFailure(): void {
/** @var DbHandler | MockObject $dbHandler */
$dbHandler = $this->getMockBuilder('OCA\Federation\DbHandler')
->disableOriginalConstructor()
diff --git a/apps/federation/tests/TrustedServersTest.php b/apps/federation/tests/TrustedServersTest.php
index 93c66ea8831..67b59c87bdb 100644
--- a/apps/federation/tests/TrustedServersTest.php
+++ b/apps/federation/tests/TrustedServersTest.php
@@ -173,13 +173,13 @@ class TrustedServersTest extends TestCase {
);
}
- public function testSetServerStatus() {
+ public function testSetServerStatus(): void {
$this->dbHandler->expects($this->once())->method('setServerStatus')
->with('url', 1);
$this->trustedServers->setServerStatus('url', 1);
}
- public function testGetServerStatus() {
+ public function testGetServerStatus(): void {
$this->dbHandler->expects($this->once())->method('getServerStatus')
->with('url')->willReturn(1);
$this->assertSame(