diff options
author | Christoph Wurst <christoph@winzerhof-wurst.at> | 2020-04-10 14:19:56 +0200 |
---|---|---|
committer | Christoph Wurst <christoph@winzerhof-wurst.at> | 2020-04-10 14:19:56 +0200 |
commit | caff1023ea72bb2ea94130e18a2a6e2ccf819e5f (patch) | |
tree | 186d494c2aea5dea7255d3584ef5d595fc6e6194 /apps/dav/tests/unit/Connector/Sabre | |
parent | edf8ce32cffdb920e8171207b342abbd7f1fbe73 (diff) | |
download | nextcloud-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/dav/tests/unit/Connector/Sabre')
12 files changed, 26 insertions, 38 deletions
diff --git a/apps/dav/tests/unit/Connector/Sabre/BlockLegacyClientPluginTest.php b/apps/dav/tests/unit/Connector/Sabre/BlockLegacyClientPluginTest.php index 37663ebc0dc..d2f2d8f2d4c 100644 --- a/apps/dav/tests/unit/Connector/Sabre/BlockLegacyClientPluginTest.php +++ b/apps/dav/tests/unit/Connector/Sabre/BlockLegacyClientPluginTest.php @@ -135,5 +135,4 @@ class BlockLegacyClientPluginTest extends TestCase { ->willReturn(null); $this->blockLegacyClientVersionPlugin->beforeHandler($request); } - } diff --git a/apps/dav/tests/unit/Connector/Sabre/CommentsPropertiesPluginTest.php b/apps/dav/tests/unit/Connector/Sabre/CommentsPropertiesPluginTest.php index c5150d8a586..9585fae9cf8 100644 --- a/apps/dav/tests/unit/Connector/Sabre/CommentsPropertiesPluginTest.php +++ b/apps/dav/tests/unit/Connector/Sabre/CommentsPropertiesPluginTest.php @@ -61,7 +61,7 @@ class CommentsPropertiesPluginTest extends \Test\TestCase { public function nodeProvider() { $mocks = []; - foreach(['\OCA\DAV\Connector\Sabre\File', '\OCA\DAV\Connector\Sabre\Directory', '\Sabre\DAV\INode'] as $class) { + foreach (['\OCA\DAV\Connector\Sabre\File', '\OCA\DAV\Connector\Sabre\Directory', '\Sabre\DAV\INode'] as $class) { $mocks[] = $this->getMockBuilder($class) ->disableOriginalConstructor() ->getMock(); @@ -84,7 +84,7 @@ class CommentsPropertiesPluginTest extends \Test\TestCase { ->disableOriginalConstructor() ->getMock(); - if($expectedSuccessful) { + if ($expectedSuccessful) { $propFind->expects($this->exactly(3)) ->method('handle'); } else { @@ -157,11 +157,10 @@ class CommentsPropertiesPluginTest extends \Test\TestCase { ->willReturn(42); $unread = $this->plugin->getUnreadCount($node); - if(is_null($user)) { + if (is_null($user)) { $this->assertNull($unread); } else { $this->assertSame($unread, 42); } } - } diff --git a/apps/dav/tests/unit/Connector/Sabre/DirectoryTest.php b/apps/dav/tests/unit/Connector/Sabre/DirectoryTest.php index 94ef048eb57..d3d17eefec1 100644 --- a/apps/dav/tests/unit/Connector/Sabre/DirectoryTest.php +++ b/apps/dav/tests/unit/Connector/Sabre/DirectoryTest.php @@ -34,7 +34,6 @@ use OCA\DAV\Connector\Sabre\Directory; use OCP\Files\ForbiddenException; class TestViewDirectory extends \OC\Files\View { - private $updatables; private $deletables; private $canRename; diff --git a/apps/dav/tests/unit/Connector/Sabre/Exception/ForbiddenTest.php b/apps/dav/tests/unit/Connector/Sabre/Exception/ForbiddenTest.php index 1b48ccf77f7..1f6a80f3882 100644 --- a/apps/dav/tests/unit/Connector/Sabre/Exception/ForbiddenTest.php +++ b/apps/dav/tests/unit/Connector/Sabre/Exception/ForbiddenTest.php @@ -26,7 +26,6 @@ namespace OCA\DAV\Tests\unit\Connector\Sabre\Exception; use OCA\DAV\Connector\Sabre\Exception\Forbidden; class ForbiddenTest extends \Test\TestCase { - public function testSerialization() { // create xml doc diff --git a/apps/dav/tests/unit/Connector/Sabre/Exception/InvalidPathTest.php b/apps/dav/tests/unit/Connector/Sabre/Exception/InvalidPathTest.php index abe1d2e2858..bb3b421f630 100644 --- a/apps/dav/tests/unit/Connector/Sabre/Exception/InvalidPathTest.php +++ b/apps/dav/tests/unit/Connector/Sabre/Exception/InvalidPathTest.php @@ -27,7 +27,6 @@ namespace OCA\DAV\Tests\unit\Connector\Sabre\Exception; use OCA\DAV\Connector\Sabre\Exception\InvalidPath; class InvalidPathTest extends \Test\TestCase { - public function testSerialization() { // create xml doc diff --git a/apps/dav/tests/unit/Connector/Sabre/ExceptionLoggerPluginTest.php b/apps/dav/tests/unit/Connector/Sabre/ExceptionLoggerPluginTest.php index ff9fac3ff18..468624ce8ac 100644 --- a/apps/dav/tests/unit/Connector/Sabre/ExceptionLoggerPluginTest.php +++ b/apps/dav/tests/unit/Connector/Sabre/ExceptionLoggerPluginTest.php @@ -97,5 +97,4 @@ class ExceptionLoggerPluginTest extends TestCase { [4, 'This path leads to nowhere', new InvalidPath('This path leads to nowhere')] ]; } - } diff --git a/apps/dav/tests/unit/Connector/Sabre/FileTest.php b/apps/dav/tests/unit/Connector/Sabre/FileTest.php index d366726e919..52b94f63811 100644 --- a/apps/dav/tests/unit/Connector/Sabre/FileTest.php +++ b/apps/dav/tests/unit/Connector/Sabre/FileTest.php @@ -1080,7 +1080,7 @@ class FileTest extends TestCase { } $files = []; list($storage, $internalPath) = $userView->resolvePath($path); - if($storage instanceof Local) { + if ($storage instanceof Local) { $realPath = $storage->getSourcePath($internalPath); $dh = opendir($realPath); while (($file = readdir($dh)) !== false) { diff --git a/apps/dav/tests/unit/Connector/Sabre/MaintenancePluginTest.php b/apps/dav/tests/unit/Connector/Sabre/MaintenancePluginTest.php index be14400fad8..5a4424cb327 100644 --- a/apps/dav/tests/unit/Connector/Sabre/MaintenancePluginTest.php +++ b/apps/dav/tests/unit/Connector/Sabre/MaintenancePluginTest.php @@ -61,5 +61,4 @@ class MaintenancePluginTest extends TestCase { $this->maintenancePlugin->checkMaintenanceMode(); } - } diff --git a/apps/dav/tests/unit/Connector/Sabre/ObjectTreeTest.php b/apps/dav/tests/unit/Connector/Sabre/ObjectTreeTest.php index bc49fb442a2..c6d0a6a340f 100644 --- a/apps/dav/tests/unit/Connector/Sabre/ObjectTreeTest.php +++ b/apps/dav/tests/unit/Connector/Sabre/ObjectTreeTest.php @@ -44,7 +44,6 @@ use OCA\DAV\Connector\Sabre\ObjectTree; * @package OCA\DAV\Tests\Unit\Connector\Sabre */ class ObjectTreeTest extends \Test\TestCase { - public function copyDataProvider() { return [ // copy into same dir @@ -152,7 +151,6 @@ class ObjectTreeTest extends \Test\TestCase { $type, $enableChunkingHeader ) { - if ($enableChunkingHeader) { $_SERVER['HTTP_OC_CHUNKED'] = true; } @@ -284,8 +282,8 @@ class ObjectTreeTest extends \Test\TestCase { $view->expects($this->once()) ->method('resolvePath') ->willReturnCallback(function ($path) use ($storage) { - return [$storage, ltrim($path, '/')]; - }); + return [$storage, ltrim($path, '/')]; + }); $rootNode = $this->getMockBuilder(Directory::class) ->disableOriginalConstructor() diff --git a/apps/dav/tests/unit/Connector/Sabre/PrincipalTest.php b/apps/dav/tests/unit/Connector/Sabre/PrincipalTest.php index 93cae17d539..0f2305be23b 100644 --- a/apps/dav/tests/unit/Connector/Sabre/PrincipalTest.php +++ b/apps/dav/tests/unit/Connector/Sabre/PrincipalTest.php @@ -759,41 +759,41 @@ class PrincipalTest extends TestCase { ->method('shareApiEnabled') ->willReturn(true); - $this->shareManager->expects($this->once()) + $this->shareManager->expects($this->once()) ->method('shareWithGroupMembersOnly') ->willReturn(true); - $user = $this->createMock(IUser::class); - $this->userSession->expects($this->once()) + $user = $this->createMock(IUser::class); + $this->userSession->expects($this->once()) ->method('getUser') ->willReturn($user); - $this->groupManager->expects($this->at(0)) + $this->groupManager->expects($this->at(0)) ->method('getUserGroupIds') ->with($user) ->willReturn(['group1', 'group2']); - $user2 = $this->createMock(IUser::class); - $user2->method('getUID')->willReturn('user2'); - $user3 = $this->createMock(IUser::class); - $user3->method('getUID')->willReturn('user3'); + $user2 = $this->createMock(IUser::class); + $user2->method('getUID')->willReturn('user2'); + $user3 = $this->createMock(IUser::class); + $user3->method('getUID')->willReturn('user3'); - $this->userManager->expects($this->once()) + $this->userManager->expects($this->once()) ->method('getByEmail') ->with($email) ->willReturn([$email === 'user2@foo.bar' ? $user2 : $user3]); - if ($email === 'user2@foo.bar') { - $this->groupManager->expects($this->at(1)) + if ($email === 'user2@foo.bar') { + $this->groupManager->expects($this->at(1)) ->method('getUserGroupIds') ->with($user2) ->willReturn(['group1', 'group3']); - } else { - $this->groupManager->expects($this->at(1)) + } else { + $this->groupManager->expects($this->at(1)) ->method('getUserGroupIds') ->with($user3) ->willReturn(['group3', 'group3']); - } + } $this->assertEquals($expects, $this->connector->findByUri($uri, 'principals/users')); } @@ -813,16 +813,16 @@ class PrincipalTest extends TestCase { ->method('shareApiEnabled') ->willReturn(true); - $this->shareManager->expects($this->once()) + $this->shareManager->expects($this->once()) ->method('shareWithGroupMembersOnly') ->willReturn(false); - $user2 = $this->createMock(IUser::class); - $user2->method('getUID')->willReturn('user2'); - $user3 = $this->createMock(IUser::class); - $user3->method('getUID')->willReturn('user3'); + $user2 = $this->createMock(IUser::class); + $user2->method('getUID')->willReturn('user2'); + $user3 = $this->createMock(IUser::class); + $user3->method('getUID')->willReturn('user3'); - $this->userManager->expects($this->once()) + $this->userManager->expects($this->once()) ->method('getByEmail') ->with($email) ->willReturn([$email === 'user2@foo.bar' ? $user2 : $user3]); diff --git a/apps/dav/tests/unit/Connector/Sabre/SharesPluginTest.php b/apps/dav/tests/unit/Connector/Sabre/SharesPluginTest.php index e83aec4d198..dd1cc70046d 100644 --- a/apps/dav/tests/unit/Connector/Sabre/SharesPluginTest.php +++ b/apps/dav/tests/unit/Connector/Sabre/SharesPluginTest.php @@ -40,7 +40,6 @@ use OCP\Share\IShare; use Sabre\DAV\Tree; class SharesPluginTest extends \Test\TestCase { - const SHARETYPES_PROPERTYNAME = \OCA\DAV\Connector\Sabre\SharesPlugin::SHARETYPES_PROPERTYNAME; /** diff --git a/apps/dav/tests/unit/Connector/Sabre/TagsPluginTest.php b/apps/dav/tests/unit/Connector/Sabre/TagsPluginTest.php index 37dd72ab884..0cfa9c5229c 100644 --- a/apps/dav/tests/unit/Connector/Sabre/TagsPluginTest.php +++ b/apps/dav/tests/unit/Connector/Sabre/TagsPluginTest.php @@ -41,7 +41,6 @@ use Sabre\DAV\Tree; * See the COPYING-README file. */ class TagsPluginTest extends \Test\TestCase { - const TAGS_PROPERTYNAME = \OCA\DAV\Connector\Sabre\TagsPlugin::TAGS_PROPERTYNAME; const FAVORITE_PROPERTYNAME = \OCA\DAV\Connector\Sabre\TagsPlugin::FAVORITE_PROPERTYNAME; const TAG_FAVORITE = \OCA\DAV\Connector\Sabre\TagsPlugin::TAG_FAVORITE; @@ -430,5 +429,4 @@ class TagsPluginTest extends \Test\TestCase { $this->assertFalse(false, isset($result[self::TAGS_PROPERTYNAME])); $this->assertEquals(200, isset($result[self::FAVORITE_PROPERTYNAME])); } - } |