summaryrefslogtreecommitdiffstats
path: root/apps/federatedfilesharing/tests
diff options
context:
space:
mode:
authorChristoph Wurst <christoph@winzerhof-wurst.at>2020-04-10 14:19:56 +0200
committerChristoph Wurst <christoph@winzerhof-wurst.at>2020-04-10 14:19:56 +0200
commitcaff1023ea72bb2ea94130e18a2a6e2ccf819e5f (patch)
tree186d494c2aea5dea7255d3584ef5d595fc6e6194 /apps/federatedfilesharing/tests
parentedf8ce32cffdb920e8171207b342abbd7f1fbe73 (diff)
downloadnextcloud-server-caff1023ea72bb2ea94130e18a2a6e2ccf819e5f.tar.gz
nextcloud-server-caff1023ea72bb2ea94130e18a2a6e2ccf819e5f.zip
Format control structures, classes, methods and function
To continue this formatting madness, here's a tiny patch that adds unified formatting for control structures like if and loops as well as classes, their methods and anonymous functions. This basically forces the constructs to start on the same line. This is not exactly what PSR2 wants, but I think we can have a few exceptions with "our" style. The starting of braces on the same line is pracrically standard for our code. This also removes and empty lines from method/function bodies at the beginning and end. Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
Diffstat (limited to 'apps/federatedfilesharing/tests')
-rw-r--r--apps/federatedfilesharing/tests/Controller/MountPublicLinkControllerTest.php4
-rw-r--r--apps/federatedfilesharing/tests/Controller/RequestHandlerControllerTest.php10
-rw-r--r--apps/federatedfilesharing/tests/FederatedShareProviderTest.php5
-rw-r--r--apps/federatedfilesharing/tests/NotificationsTest.php3
-rw-r--r--apps/federatedfilesharing/tests/TestCase.php3
-rw-r--r--apps/federatedfilesharing/tests/TokenHandlerTest.php3
6 files changed, 2 insertions, 26 deletions
diff --git a/apps/federatedfilesharing/tests/Controller/MountPublicLinkControllerTest.php b/apps/federatedfilesharing/tests/Controller/MountPublicLinkControllerTest.php
index 123f669e74e..e6b4c09ccc5 100644
--- a/apps/federatedfilesharing/tests/Controller/MountPublicLinkControllerTest.php
+++ b/apps/federatedfilesharing/tests/Controller/MountPublicLinkControllerTest.php
@@ -135,7 +135,6 @@ class MountPublicLinkControllerTest extends \Test\TestCase {
$createSuccessful,
$expectedReturnData
) {
-
$this->federatedShareProvider->expects($this->any())
->method('isOutgoingServer2serverShareEnabled')
->willReturn($outgoingSharesAllowed);
@@ -188,9 +187,7 @@ class MountPublicLinkControllerTest extends \Test\TestCase {
$this->assertSame(Http::STATUS_OK, $result->getStatus());
$this->assertTrue(isset($result->getData()['remoteUrl']));
$this->assertSame($expectedReturnData, $result->getData()['remoteUrl']);
-
}
-
}
public function dataTestCreateFederatedShare() {
@@ -207,5 +204,4 @@ class MountPublicLinkControllerTest extends \Test\TestCase {
['user@server', false, true, 'token', true, true, 'This server doesn\'t support outgoing federated shares'],
];
}
-
}
diff --git a/apps/federatedfilesharing/tests/Controller/RequestHandlerControllerTest.php b/apps/federatedfilesharing/tests/Controller/RequestHandlerControllerTest.php
index f8de6919be6..df138333de6 100644
--- a/apps/federatedfilesharing/tests/Controller/RequestHandlerControllerTest.php
+++ b/apps/federatedfilesharing/tests/Controller/RequestHandlerControllerTest.php
@@ -48,7 +48,6 @@ use OCP\Share\IShare;
* @group DB
*/
class RequestHandlerControllerTest extends \Test\TestCase {
-
private $owner = 'owner';
private $user1 = 'user1';
private $user2 = 'user2';
@@ -102,7 +101,6 @@ class RequestHandlerControllerTest extends \Test\TestCase {
private $cloudFederationShare;
protected function setUp(): void {
-
$this->share = $this->getMockBuilder(IShare::class)->getMock();
$this->federatedShareProvider = $this->getMockBuilder('OCA\FederatedFileSharing\FederatedShareProvider')
->disableOriginalConstructor()->getMock();
@@ -144,7 +142,6 @@ class RequestHandlerControllerTest extends \Test\TestCase {
$this->cloudFederationFactory,
$this->cloudFederationProviderManager
);
-
}
function testCreateShare() {
@@ -186,11 +183,9 @@ class RequestHandlerControllerTest extends \Test\TestCase {
$result = $this->requestHandler->createShare();
$this->assertInstanceOf(DataResponse::class, $result);
-
}
function testDeclineShare() {
-
$id = 42;
$_POST['token'] = 'token';
@@ -211,12 +206,10 @@ class RequestHandlerControllerTest extends \Test\TestCase {
$result = $this->requestHandler->declineShare($id);
$this->assertInstanceOf(DataResponse::class, $result);
-
}
function testAcceptShare() {
-
$id = 42;
$_POST['token'] = 'token';
@@ -237,8 +230,5 @@ class RequestHandlerControllerTest extends \Test\TestCase {
$result = $this->requestHandler->acceptShare($id);
$this->assertInstanceOf(DataResponse::class, $result);
-
}
-
-
}
diff --git a/apps/federatedfilesharing/tests/FederatedShareProviderTest.php b/apps/federatedfilesharing/tests/FederatedShareProviderTest.php
index 1c82c310c1f..825b8382d1e 100644
--- a/apps/federatedfilesharing/tests/FederatedShareProviderTest.php
+++ b/apps/federatedfilesharing/tests/FederatedShareProviderTest.php
@@ -415,7 +415,6 @@ class FederatedShareProviderTest extends \Test\TestCase {
*
*/
public function testUpdate($owner, $sharedBy) {
-
$this->provider = $this->getMockBuilder('OCA\FederatedFileSharing\FederatedShareProvider')
->setConstructorArgs(
[
@@ -468,7 +467,7 @@ class FederatedShareProviderTest extends \Test\TestCase {
$sharedBy . '@http://localhost/'
)->willReturn(true);
- if($owner === $sharedBy) {
+ if ($owner === $sharedBy) {
$this->provider->expects($this->never())->method('sendPermissionUpdate');
} else {
$this->provider->expects($this->once())->method('sendPermissionUpdate');
@@ -631,7 +630,7 @@ class FederatedShareProviderTest extends \Test\TestCase {
return ['user', 'server.com'];
}
return ['user2', 'server.com'];
- });
+ });
$this->tokenHandler->method('generateToken')->willReturn('token');
$this->notifications
diff --git a/apps/federatedfilesharing/tests/NotificationsTest.php b/apps/federatedfilesharing/tests/NotificationsTest.php
index a835709c978..af48b594380 100644
--- a/apps/federatedfilesharing/tests/NotificationsTest.php
+++ b/apps/federatedfilesharing/tests/NotificationsTest.php
@@ -62,7 +62,6 @@ class NotificationsTest extends \Test\TestCase {
->disableOriginalConstructor()->getMock();
$this->cloudFederationProviderManager = $this->createMock(ICloudFederationProviderManager::class);
$this->cloudFederationFactory = $this->createMock(ICloudFederationFactory::class);
-
}
/**
@@ -142,7 +141,6 @@ class NotificationsTest extends \Test\TestCase {
$this->assertSame($expected,
$instance->sendUpdateToRemote($remote, $id, $token, $action, ['data1Key' => 'data1Value'], $try)
);
-
}
@@ -162,5 +160,4 @@ class NotificationsTest extends \Test\TestCase {
[0, ['success' => false, 'result' => json_encode(['ocs' => ['meta' => ['statuscode' => 400]]])], false],
];
}
-
}
diff --git a/apps/federatedfilesharing/tests/TestCase.php b/apps/federatedfilesharing/tests/TestCase.php
index 83393af69f6..813c3c8a15f 100644
--- a/apps/federatedfilesharing/tests/TestCase.php
+++ b/apps/federatedfilesharing/tests/TestCase.php
@@ -36,7 +36,6 @@ use OC\Group\Database;
* Base class for sharing tests.
*/
abstract class TestCase extends \Test\TestCase {
-
const TEST_FILES_SHARING_API_USER1 = "test-share-user1";
const TEST_FILES_SHARING_API_USER2 = "test-share-user2";
@@ -91,7 +90,6 @@ abstract class TestCase extends \Test\TestCase {
* @param bool $password
*/
protected static function loginHelper($user, $create = false, $password = false) {
-
if ($password === false) {
$password = $user;
}
@@ -129,5 +127,4 @@ abstract class TestCase extends \Test\TestCase {
$isInitialized->setValue($storage, false);
$isInitialized->setAccessible(false);
}
-
}
diff --git a/apps/federatedfilesharing/tests/TokenHandlerTest.php b/apps/federatedfilesharing/tests/TokenHandlerTest.php
index 8ddc4bc039b..50479654752 100644
--- a/apps/federatedfilesharing/tests/TokenHandlerTest.php
+++ b/apps/federatedfilesharing/tests/TokenHandlerTest.php
@@ -47,7 +47,6 @@ class TokenHandlerTest extends \Test\TestCase {
}
public function testGenerateToken() {
-
$this->secureRandom->expects($this->once())->method('generate')
->with(
$this->expectedTokenLength,
@@ -56,7 +55,5 @@ class TokenHandlerTest extends \Test\TestCase {
->willReturn('mytoken');
$this->assertSame('mytoken', $this->tokenHandler->generateToken());
-
}
-
}