Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristoph Wurst <christoph@winzerhof-wurst.at>2020-04-10 15:19:56 +0300
committerChristoph Wurst <christoph@winzerhof-wurst.at>2020-04-10 15:19:56 +0300
commitcaff1023ea72bb2ea94130e18a2a6e2ccf819e5f (patch)
tree186d494c2aea5dea7255d3584ef5d595fc6e6194 /apps/files_sharing/tests
parentedf8ce32cffdb920e8171207b342abbd7f1fbe73 (diff)
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/files_sharing/tests')
-rw-r--r--apps/files_sharing/tests/ApiTest.php14
-rw-r--r--apps/files_sharing/tests/CacheTest.php3
-rw-r--r--apps/files_sharing/tests/CapabilitiesTest.php1
-rw-r--r--apps/files_sharing/tests/Command/CleanupRemoteStoragesTest.php1
-rw-r--r--apps/files_sharing/tests/Controller/ShareControllerTest.php6
-rw-r--r--apps/files_sharing/tests/DeleteOrphanedSharesJobTest.php4
-rw-r--r--apps/files_sharing/tests/EncryptedSizePropagationTest.php1
-rw-r--r--apps/files_sharing/tests/ExpireSharesJobTest.php5
-rw-r--r--apps/files_sharing/tests/External/CacheTest.php1
-rw-r--r--apps/files_sharing/tests/External/ManagerTest.php1
-rw-r--r--apps/files_sharing/tests/ExternalStorageTest.php2
-rw-r--r--apps/files_sharing/tests/HelperTest.php2
-rw-r--r--apps/files_sharing/tests/LockingTest.php1
-rw-r--r--apps/files_sharing/tests/Middleware/ShareInfoMiddlewareTest.php1
-rw-r--r--apps/files_sharing/tests/Middleware/SharingCheckMiddlewareTest.php5
-rw-r--r--apps/files_sharing/tests/ShareTest.php4
-rw-r--r--apps/files_sharing/tests/SharedMountTest.php10
-rw-r--r--apps/files_sharing/tests/SharedStorageTest.php2
-rw-r--r--apps/files_sharing/tests/TestCase.php14
-rw-r--r--apps/files_sharing/tests/UnshareChildrenTest.php2
-rw-r--r--apps/files_sharing/tests/UpdaterTest.php3
21 files changed, 25 insertions, 58 deletions
diff --git a/apps/files_sharing/tests/ApiTest.php b/apps/files_sharing/tests/ApiTest.php
index b8d5a21a739..2d262a0104a 100644
--- a/apps/files_sharing/tests/ApiTest.php
+++ b/apps/files_sharing/tests/ApiTest.php
@@ -53,7 +53,6 @@ use OCP\Share\IShare;
* TODO: convert to real intergration tests
*/
class ApiTest extends TestCase {
-
const TEST_FOLDER_NAME = '/folder_share_api_test';
const APP_NAME = 'files_sharing';
@@ -91,7 +90,7 @@ class ApiTest extends TestCase {
}
protected function tearDown(): void {
- if($this->view instanceof \OC\Files\View) {
+ if ($this->view instanceof \OC\Files\View) {
$this->view->unlink($this->filename);
$this->view->deleteAll($this->folder);
}
@@ -163,7 +162,6 @@ class ApiTest extends TestCase {
$ocs = $this->createOCS(self::TEST_FILES_SHARING_API_USER1);
$ocs->deleteShare($data['id']);
$ocs->cleanup();
-
}
@@ -197,7 +195,6 @@ class ApiTest extends TestCase {
$ocs = $this->createOCS(self::TEST_FILES_SHARING_API_USER1);
$ocs->deleteShare($data['id']);
$ocs->cleanup();
-
}
public function testCreateShareLink() {
@@ -249,7 +246,6 @@ class ApiTest extends TestCase {
}
function testEnforceLinkPassword() {
-
$password = md5(time());
$config = \OC::$server->getConfig();
$config->setAppValue('core', 'shareapi_enforce_links_password', 'yes');
@@ -259,7 +255,6 @@ class ApiTest extends TestCase {
$ocs->createShare($this->folder, \OCP\Constants::PERMISSION_ALL, \OCP\Share::SHARE_TYPE_LINK);
$this->fail();
} catch (OCSForbiddenException $e) {
-
}
$ocs->cleanup();
@@ -268,7 +263,6 @@ class ApiTest extends TestCase {
$ocs->createShare($this->folder, \OCP\Constants::PERMISSION_ALL, \OCP\Share::SHARE_TYPE_LINK, null, 'false', '');
$this->fail();
} catch (OCSForbiddenException $e) {
-
}
$ocs->cleanup();
@@ -290,7 +284,6 @@ class ApiTest extends TestCase {
$ocs->updateShare($data['id']);
$this->fail();
} catch (OCSBadRequestException $e) {
-
}
$ocs->cleanup();
@@ -933,7 +926,6 @@ class ApiTest extends TestCase {
* @depends testCreateShareLink
*/
function testUpdateShare() {
-
$password = md5(time());
$node1 = $this->userFolder->get($this->filename);
@@ -1054,7 +1046,6 @@ class ApiTest extends TestCase {
$ocs->updateShare($share1->getId());
$this->fail();
} catch (OCSBadRequestException $e) {
-
}
$ocs->cleanup();
@@ -1069,7 +1060,6 @@ class ApiTest extends TestCase {
$ocs->updateShare($share1->getId());
$this->fail();
} catch (OCSBadRequestException $e) {
-
}
$ocs->cleanup();
@@ -1372,7 +1362,7 @@ class ApiTest extends TestCase {
try {
$ocs->createShare($this->filename, \OCP\Constants::PERMISSION_ALL, \OCP\Share::SHARE_TYPE_LINK, null, 'false', '', null, $date->format('Y-m-d'));
$this->fail();
- } catch(OCSException $e) {
+ } catch (OCSException $e) {
$this->assertEquals(404, $e->getCode());
$this->assertEquals('Expiration date is in the past', $e->getMessage());
}
diff --git a/apps/files_sharing/tests/CacheTest.php b/apps/files_sharing/tests/CacheTest.php
index 94e5504aece..355a1a8bb1b 100644
--- a/apps/files_sharing/tests/CacheTest.php
+++ b/apps/files_sharing/tests/CacheTest.php
@@ -129,7 +129,7 @@ class CacheTest extends TestCase {
}
protected function tearDown(): void {
- if($this->sharedCache) {
+ if ($this->sharedCache) {
$this->sharedCache->clear();
}
@@ -219,7 +219,6 @@ class CacheTest extends TestCase {
$this->verifyFiles($expectedFiles, $results);
}
-
}
/**
* Test searching by mime type
diff --git a/apps/files_sharing/tests/CapabilitiesTest.php b/apps/files_sharing/tests/CapabilitiesTest.php
index e4c15887636..a49074cb60e 100644
--- a/apps/files_sharing/tests/CapabilitiesTest.php
+++ b/apps/files_sharing/tests/CapabilitiesTest.php
@@ -285,5 +285,4 @@ class CapabilitiesTest extends \Test\TestCase {
$this->assertArrayHasKey('federation', $result);
$this->assertFalse($result['federation']['outgoing']);
}
-
}
diff --git a/apps/files_sharing/tests/Command/CleanupRemoteStoragesTest.php b/apps/files_sharing/tests/Command/CleanupRemoteStoragesTest.php
index 9be1141f35f..dd03ffc6668 100644
--- a/apps/files_sharing/tests/Command/CleanupRemoteStoragesTest.php
+++ b/apps/files_sharing/tests/Command/CleanupRemoteStoragesTest.php
@@ -191,6 +191,5 @@ class CleanupRemoteStoragesTest extends TestCase {
$this->assertFalse($this->doesStorageExist($this->storages[3]['numeric_id']));
$this->assertTrue($this->doesStorageExist($this->storages[4]['numeric_id']));
$this->assertFalse($this->doesStorageExist($this->storages[5]['numeric_id']));
-
}
}
diff --git a/apps/files_sharing/tests/Controller/ShareControllerTest.php b/apps/files_sharing/tests/Controller/ShareControllerTest.php
index a43c050634b..2f1df959afb 100644
--- a/apps/files_sharing/tests/Controller/ShareControllerTest.php
+++ b/apps/files_sharing/tests/Controller/ShareControllerTest.php
@@ -162,7 +162,9 @@ class ShareControllerTest extends \Test\TestCase {
\OC_User::setUserId('');
Filesystem::tearDown();
$user = \OC::$server->getUserManager()->get($this->user);
- if ($user !== null) { $user->delete(); }
+ if ($user !== null) {
+ $user->delete();
+ }
\OC_User::setIncognitoMode(false);
\OC::$server->getSession()->set('public_link_authenticated', '');
@@ -208,7 +210,6 @@ class ShareControllerTest extends \Test\TestCase {
public function testShowShare() {
-
$note = 'personal note';
$this->shareController->setToken('token');
@@ -356,7 +357,6 @@ class ShareControllerTest extends \Test\TestCase {
}
public function testShowShareWithPrivateName() {
-
$note = 'personal note';
$this->shareController->setToken('token');
diff --git a/apps/files_sharing/tests/DeleteOrphanedSharesJobTest.php b/apps/files_sharing/tests/DeleteOrphanedSharesJobTest.php
index 0ed98f27cd3..a885750a566 100644
--- a/apps/files_sharing/tests/DeleteOrphanedSharesJobTest.php
+++ b/apps/files_sharing/tests/DeleteOrphanedSharesJobTest.php
@@ -100,11 +100,11 @@ class DeleteOrphanedSharesJobTest extends \Test\TestCase {
$userManager = \OC::$server->getUserManager();
$user1 = $userManager->get($this->user1);
- if($user1) {
+ if ($user1) {
$user1->delete();
}
$user2 = $userManager->get($this->user2);
- if($user2) {
+ if ($user2) {
$user2->delete();
}
diff --git a/apps/files_sharing/tests/EncryptedSizePropagationTest.php b/apps/files_sharing/tests/EncryptedSizePropagationTest.php
index 23f552260d6..9a8ff29d70a 100644
--- a/apps/files_sharing/tests/EncryptedSizePropagationTest.php
+++ b/apps/files_sharing/tests/EncryptedSizePropagationTest.php
@@ -42,5 +42,4 @@ class EncryptedSizePropagationTest extends SizePropagationTest {
$this->loginWithEncryption($name);
return new View('/' . $name . '/files');
}
-
}
diff --git a/apps/files_sharing/tests/ExpireSharesJobTest.php b/apps/files_sharing/tests/ExpireSharesJobTest.php
index 4fe1ccc7719..f8bf900cb79 100644
--- a/apps/files_sharing/tests/ExpireSharesJobTest.php
+++ b/apps/files_sharing/tests/ExpireSharesJobTest.php
@@ -78,11 +78,11 @@ class ExpireSharesJobTest extends \Test\TestCase {
$userManager = \OC::$server->getUserManager();
$user1 = $userManager->get($this->user1);
- if($user1) {
+ if ($user1) {
$user1->delete();
}
$user2 = $userManager->get($this->user2);
- if($user2) {
+ if ($user2) {
$user2->delete();
}
@@ -213,5 +213,4 @@ class ExpireSharesJobTest extends \Test\TestCase {
$shares = $this->getShares();
$this->assertCount(1, $shares);
}
-
}
diff --git a/apps/files_sharing/tests/External/CacheTest.php b/apps/files_sharing/tests/External/CacheTest.php
index 466806e09cb..be8911961df 100644
--- a/apps/files_sharing/tests/External/CacheTest.php
+++ b/apps/files_sharing/tests/External/CacheTest.php
@@ -130,5 +130,4 @@ class CacheTest extends TestCase {
$results[0]['displayname_owner']
);
}
-
}
diff --git a/apps/files_sharing/tests/External/ManagerTest.php b/apps/files_sharing/tests/External/ManagerTest.php
index 5a1e8ad14e1..9c84cb668ef 100644
--- a/apps/files_sharing/tests/External/ManagerTest.php
+++ b/apps/files_sharing/tests/External/ManagerTest.php
@@ -123,7 +123,6 @@ class ManagerTest extends TestCase {
}
public function testAddShare() {
-
$shareData1 = [
'remote' => 'http://localhost',
'token' => 'token1',
diff --git a/apps/files_sharing/tests/ExternalStorageTest.php b/apps/files_sharing/tests/ExternalStorageTest.php
index f2bf5738f36..fa8df930a4e 100644
--- a/apps/files_sharing/tests/ExternalStorageTest.php
+++ b/apps/files_sharing/tests/ExternalStorageTest.php
@@ -39,7 +39,6 @@ use OCP\Http\Client\IResponse;
* @group DB
*/
class ExternalStorageTest extends \Test\TestCase {
-
function optionsProvider() {
return [
[
@@ -125,7 +124,6 @@ class ExternalStorageTest extends \Test\TestCase {
* Dummy subclass to make it possible to access private members
*/
class TestSharingExternalStorage extends \OCA\Files_Sharing\External\Storage {
-
public function getBaseUri() {
return $this->createBaseUri();
}
diff --git a/apps/files_sharing/tests/HelperTest.php b/apps/files_sharing/tests/HelperTest.php
index 4a27ca4afec..a4311f908b3 100644
--- a/apps/files_sharing/tests/HelperTest.php
+++ b/apps/files_sharing/tests/HelperTest.php
@@ -47,7 +47,5 @@ class HelperTest extends TestCase {
// cleanup
\OC::$server->getConfig()->deleteSystemValue('share_folder');
-
}
-
}
diff --git a/apps/files_sharing/tests/LockingTest.php b/apps/files_sharing/tests/LockingTest.php
index bb50cc5bd38..c6a799f64a6 100644
--- a/apps/files_sharing/tests/LockingTest.php
+++ b/apps/files_sharing/tests/LockingTest.php
@@ -104,7 +104,6 @@ class LockingTest extends TestCase {
}
public function testChangeLock() {
-
Filesystem::initMountPoints($this->recipientUid);
$recipientView = new View('/' . $this->recipientUid . '/files');
$recipientView->lockFile('bar.txt', ILockingProvider::LOCK_SHARED);
diff --git a/apps/files_sharing/tests/Middleware/ShareInfoMiddlewareTest.php b/apps/files_sharing/tests/Middleware/ShareInfoMiddlewareTest.php
index 08d8e6e1486..c290183d046 100644
--- a/apps/files_sharing/tests/Middleware/ShareInfoMiddlewareTest.php
+++ b/apps/files_sharing/tests/Middleware/ShareInfoMiddlewareTest.php
@@ -154,5 +154,4 @@ class ShareInfoMiddlewareTest extends TestCase {
}
class ShareInfoMiddlewareTestController extends Controller {
-
}
diff --git a/apps/files_sharing/tests/Middleware/SharingCheckMiddlewareTest.php b/apps/files_sharing/tests/Middleware/SharingCheckMiddlewareTest.php
index 29dafb5762d..2c33f5617b7 100644
--- a/apps/files_sharing/tests/Middleware/SharingCheckMiddlewareTest.php
+++ b/apps/files_sharing/tests/Middleware/SharingCheckMiddlewareTest.php
@@ -101,14 +101,12 @@ class SharingCheckMiddlewareTest extends \Test\TestCase {
}
public function externalSharesChecksDataProvider() {
-
$data = [];
foreach ([false, true] as $annIn) {
foreach ([false, true] as $annOut) {
foreach ([false, true] as $confIn) {
foreach ([false, true] as $confOut) {
-
$res = true;
if (!$annIn && !$confIn) {
$res = false;
@@ -186,7 +184,6 @@ class SharingCheckMiddlewareTest extends \Test\TestCase {
}
public function testBeforeControllerWithShareControllerWithSharingEnabled() {
-
$share = $this->createMock(IShare::class);
$this->appManager
@@ -229,6 +226,4 @@ class SharingCheckMiddlewareTest extends \Test\TestCase {
public function testAfterExceptionWithS2SException() {
$this->assertEquals(new JSONResponse('My Exception message', 405), $this->sharingCheckMiddleware->afterException($this->controllerMock, 'myMethod', new S2SException('My Exception message')));
}
-
-
}
diff --git a/apps/files_sharing/tests/ShareTest.php b/apps/files_sharing/tests/ShareTest.php
index 63c2f2d19e3..313c8d8ac56 100644
--- a/apps/files_sharing/tests/ShareTest.php
+++ b/apps/files_sharing/tests/ShareTest.php
@@ -34,7 +34,6 @@ namespace OCA\Files_Sharing\Tests;
* @group DB
*/
class ShareTest extends TestCase {
-
const TEST_FOLDER_NAME = '/folder_share_api_test';
private static $tempStorage;
@@ -128,7 +127,6 @@ class ShareTest extends TestCase {
}
public function testShareWithDifferentShareFolder() {
-
$fileinfo = $this->view->getFileInfo($this->filename);
$folderinfo = $this->view->getFileInfo($this->folder);
@@ -203,7 +201,6 @@ class ShareTest extends TestCase {
* @dataProvider dataProviderTestFileSharePermissions
*/
public function testFileSharePermissions($permission, $expectedvalid) {
-
$pass = true;
try {
$this->share(
@@ -237,7 +234,6 @@ class ShareTest extends TestCase {
}
public function testFileOwner() {
-
$this->share(
\OCP\Share::SHARE_TYPE_USER,
$this->filename,
diff --git a/apps/files_sharing/tests/SharedMountTest.php b/apps/files_sharing/tests/SharedMountTest.php
index f3fe96d2c3d..59c0e3b76af 100644
--- a/apps/files_sharing/tests/SharedMountTest.php
+++ b/apps/files_sharing/tests/SharedMountTest.php
@@ -287,7 +287,9 @@ class SharedMountTest extends TestCase {
foreach ($allPermissions as $before) {
foreach ($allPermissions as $after) {
- if ($before === $after) { continue; }
+ if ($before === $after) {
+ continue;
+ }
$data[] = [
'file',
@@ -309,7 +311,9 @@ class SharedMountTest extends TestCase {
foreach ($allPermissions as $before) {
foreach ($allPermissions as $after) {
- if ($before === $after) { continue; }
+ if ($before === $after) {
+ continue;
+ }
$data[] = [
'folder',
@@ -331,7 +335,6 @@ class SharedMountTest extends TestCase {
* @dataProvider dataPermissionMovedGroupShare
*/
public function testPermissionMovedGroupShare($type, $beforePerm, $afterPerm) {
-
if ($type === 'file') {
$path = $this->filename;
} elseif ($type === 'folder') {
@@ -456,7 +459,6 @@ class SharedMountTest extends TestCase {
$testGroup->removeUser($user2);
$testGroup->removeUser($user3);
}
-
}
class DummyTestClassSharedMount extends \OCA\Files_Sharing\SharedMount {
diff --git a/apps/files_sharing/tests/SharedStorageTest.php b/apps/files_sharing/tests/SharedStorageTest.php
index 936295f45b7..7d20d98585f 100644
--- a/apps/files_sharing/tests/SharedStorageTest.php
+++ b/apps/files_sharing/tests/SharedStorageTest.php
@@ -40,7 +40,6 @@ use OCP\Share\IShare;
* @group DB
*/
class SharedStorageTest extends TestCase {
-
protected function setUp(): void {
parent::setUp();
\OCA\Files_Trashbin\Trashbin::registerHooks();
@@ -565,7 +564,6 @@ class SharedStorageTest extends TestCase {
$this->view->unlink($this->folder);
$this->shareManager->deleteShare($share);
-
}
public function testInitWithNonExistingUser() {
diff --git a/apps/files_sharing/tests/TestCase.php b/apps/files_sharing/tests/TestCase.php
index c9f024cd67a..323fc06f321 100644
--- a/apps/files_sharing/tests/TestCase.php
+++ b/apps/files_sharing/tests/TestCase.php
@@ -130,11 +130,17 @@ abstract class TestCase extends \Test\TestCase {
public static function tearDownAfterClass(): void {
// cleanup users
$user = \OC::$server->getUserManager()->get(self::TEST_FILES_SHARING_API_USER1);
- if ($user !== null) { $user->delete(); }
+ if ($user !== null) {
+ $user->delete();
+ }
$user = \OC::$server->getUserManager()->get(self::TEST_FILES_SHARING_API_USER2);
- if ($user !== null) { $user->delete(); }
+ if ($user !== null) {
+ $user->delete();
+ }
$user = \OC::$server->getUserManager()->get(self::TEST_FILES_SHARING_API_USER3);
- if ($user !== null) { $user->delete(); }
+ if ($user !== null) {
+ $user->delete();
+ }
// delete group
$group = \OC::$server->getGroupManager()->get(self::TEST_FILES_SHARING_API_GROUP1);
@@ -161,7 +167,6 @@ abstract class TestCase extends \Test\TestCase {
* @param bool $password
*/
protected static function loginHelper($user, $create = false, $password = false) {
-
if ($password === false) {
$password = $user;
}
@@ -218,7 +223,6 @@ abstract class TestCase extends \Test\TestCase {
$result->closeCursor();
return $share;
-
}
/**
diff --git a/apps/files_sharing/tests/UnshareChildrenTest.php b/apps/files_sharing/tests/UnshareChildrenTest.php
index d12bda4006c..56fdeb44a30 100644
--- a/apps/files_sharing/tests/UnshareChildrenTest.php
+++ b/apps/files_sharing/tests/UnshareChildrenTest.php
@@ -35,7 +35,6 @@ namespace OCA\Files_Sharing\Tests;
* @package OCA\Files_Sharing\Tests
*/
class UnshareChildrenTest extends TestCase {
-
protected $subsubfolder;
const TEST_FOLDER_NAME = '/folder_share_api_test';
@@ -75,7 +74,6 @@ class UnshareChildrenTest extends TestCase {
* @medium
*/
public function testUnshareChildren() {
-
$fileInfo2 = \OC\Files\Filesystem::getFileInfo($this->folder);
$this->share(
diff --git a/apps/files_sharing/tests/UpdaterTest.php b/apps/files_sharing/tests/UpdaterTest.php
index 7ca883c78f8..0abc76df433 100644
--- a/apps/files_sharing/tests/UpdaterTest.php
+++ b/apps/files_sharing/tests/UpdaterTest.php
@@ -36,7 +36,6 @@ namespace OCA\Files_Sharing\Tests;
* @group DB
*/
class UpdaterTest extends TestCase {
-
const TEST_FOLDER_NAME = '/folder_share_updater_test';
public static function setUpBeforeClass(): void {
@@ -199,7 +198,6 @@ class UpdaterTest extends TestCase {
* if a folder gets renamed all children mount points should be renamed too
*/
public function testRename() {
-
$fileinfo = \OC\Files\Filesystem::getFileInfo($this->folder);
$share = $this->share(
@@ -234,5 +232,4 @@ class UpdaterTest extends TestCase {
// cleanup
$this->shareManager->deleteShare($share);
}
-
}