summaryrefslogtreecommitdiffstats
path: root/apps/dav/tests/unit/Command
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/dav/tests/unit/Command
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/dav/tests/unit/Command')
-rw-r--r--apps/dav/tests/unit/Command/ListCalendarsTest.php12
-rw-r--r--apps/dav/tests/unit/Command/MoveCalendarTest.php32
-rw-r--r--apps/dav/tests/unit/Command/RemoveInvalidSharesTest.php1
3 files changed, 15 insertions, 30 deletions
diff --git a/apps/dav/tests/unit/Command/ListCalendarsTest.php b/apps/dav/tests/unit/Command/ListCalendarsTest.php
index 72c76ecc7a6..8960a9d7721 100644
--- a/apps/dav/tests/unit/Command/ListCalendarsTest.php
+++ b/apps/dav/tests/unit/Command/ListCalendarsTest.php
@@ -63,8 +63,7 @@ class ListCalendarsTest extends TestCase {
}
- public function testWithBadUser()
- {
+ public function testWithBadUser() {
$this->expectException(\InvalidArgumentException::class);
$this->userManager->expects($this->once())
@@ -79,8 +78,7 @@ class ListCalendarsTest extends TestCase {
$this->assertContains("User <" . self::USERNAME . "> in unknown", $commandTester->getDisplay());
}
- public function testWithCorrectUserWithNoCalendars()
- {
+ public function testWithCorrectUserWithNoCalendars() {
$this->userManager->expects($this->once())
->method('userExists')
->with(self::USERNAME)
@@ -98,8 +96,7 @@ class ListCalendarsTest extends TestCase {
$this->assertContains("User <" . self::USERNAME . "> has no calendars\n", $commandTester->getDisplay());
}
- public function dataExecute()
- {
+ public function dataExecute() {
return [
[false, '✓'],
[true, 'x']
@@ -109,8 +106,7 @@ class ListCalendarsTest extends TestCase {
/**
* @dataProvider dataExecute
*/
- public function testWithCorrectUser(bool $readOnly, string $output)
- {
+ public function testWithCorrectUser(bool $readOnly, string $output) {
$this->userManager->expects($this->once())
->method('userExists')
->with(self::USERNAME)
diff --git a/apps/dav/tests/unit/Command/MoveCalendarTest.php b/apps/dav/tests/unit/Command/MoveCalendarTest.php
index 36553ff65a2..156043411da 100644
--- a/apps/dav/tests/unit/Command/MoveCalendarTest.php
+++ b/apps/dav/tests/unit/Command/MoveCalendarTest.php
@@ -97,8 +97,7 @@ class MoveCalendarTest extends TestCase {
* @param $userOriginExists
* @param $userDestinationExists
*/
- public function testWithBadUserOrigin($userOriginExists, $userDestinationExists)
- {
+ public function testWithBadUserOrigin($userOriginExists, $userDestinationExists) {
$this->expectException(\InvalidArgumentException::class);
$this->userManager->expects($this->at(0))
@@ -122,8 +121,7 @@ class MoveCalendarTest extends TestCase {
}
- public function testMoveWithInexistantCalendar()
- {
+ public function testMoveWithInexistantCalendar() {
$this->expectException(\InvalidArgumentException::class);
$this->expectExceptionMessage('User <user> has no calendar named <personal>. You can run occ dav:list-calendars to list calendars URIs for this user.');
@@ -150,8 +148,7 @@ class MoveCalendarTest extends TestCase {
}
- public function testMoveWithExistingDestinationCalendar()
- {
+ public function testMoveWithExistingDestinationCalendar() {
$this->expectException(\InvalidArgumentException::class);
$this->expectExceptionMessage('User <user2> already has a calendar named <personal>.');
@@ -171,7 +168,7 @@ class MoveCalendarTest extends TestCase {
'id' => 1234,
]);
- $this->calDav->expects($this->at(1))->method('getCalendarByUri')
+ $this->calDav->expects($this->at(1))->method('getCalendarByUri')
->with('principals/users/user2', 'personal')
->willReturn([
'id' => 1234,
@@ -185,8 +182,7 @@ class MoveCalendarTest extends TestCase {
]);
}
- public function testMove()
- {
+ public function testMove() {
$this->userManager->expects($this->at(0))
->method('userExists')
->with('user')
@@ -221,8 +217,7 @@ class MoveCalendarTest extends TestCase {
$this->assertContains("[OK] Calendar <personal> was moved from user <user> to <user2>", $commandTester->getDisplay());
}
- public function dataTestMoveWithDestinationNotPartOfGroup(): array
- {
+ public function dataTestMoveWithDestinationNotPartOfGroup(): array {
return [
[true],
[false]
@@ -232,8 +227,7 @@ class MoveCalendarTest extends TestCase {
/**
* @dataProvider dataTestMoveWithDestinationNotPartOfGroup
*/
- public function testMoveWithDestinationNotPartOfGroup(bool $shareWithGroupMembersOnly)
- {
+ public function testMoveWithDestinationNotPartOfGroup(bool $shareWithGroupMembersOnly) {
$this->userManager->expects($this->at(0))
->method('userExists')
->with('user')
@@ -276,8 +270,7 @@ class MoveCalendarTest extends TestCase {
]);
}
- public function testMoveWithDestinationPartOfGroup()
- {
+ public function testMoveWithDestinationPartOfGroup() {
$this->userManager->expects($this->at(0))
->method('userExists')
->with('user')
@@ -322,8 +315,7 @@ class MoveCalendarTest extends TestCase {
$this->assertContains("[OK] Calendar <personal> was moved from user <user> to <user2>", $commandTester->getDisplay());
}
- public function testMoveWithDestinationNotPartOfGroupAndForce()
- {
+ public function testMoveWithDestinationNotPartOfGroupAndForce() {
$this->userManager->expects($this->at(0))
->method('userExists')
->with('user')
@@ -370,8 +362,7 @@ class MoveCalendarTest extends TestCase {
$this->assertContains("[OK] Calendar <personal> was moved from user <user> to <user2>", $commandTester->getDisplay());
}
- public function dataTestMoveWithCalendarAlreadySharedToDestination(): array
- {
+ public function dataTestMoveWithCalendarAlreadySharedToDestination(): array {
return [
[true],
[false]
@@ -381,8 +372,7 @@ class MoveCalendarTest extends TestCase {
/**
* @dataProvider dataTestMoveWithCalendarAlreadySharedToDestination
*/
- public function testMoveWithCalendarAlreadySharedToDestination(bool $force)
- {
+ public function testMoveWithCalendarAlreadySharedToDestination(bool $force) {
$this->userManager->expects($this->at(0))
->method('userExists')
->with('user')
diff --git a/apps/dav/tests/unit/Command/RemoveInvalidSharesTest.php b/apps/dav/tests/unit/Command/RemoveInvalidSharesTest.php
index ce830e3f699..2416ec6978f 100644
--- a/apps/dav/tests/unit/Command/RemoveInvalidSharesTest.php
+++ b/apps/dav/tests/unit/Command/RemoveInvalidSharesTest.php
@@ -36,7 +36,6 @@ use Test\TestCase;
* @group DB
*/
class RemoveInvalidSharesTest extends TestCase {
-
protected function setUp(): void {
parent::setUp();
$db = \OC::$server->getDatabaseConnection();