diff options
author | Christoph Wurst <christoph@winzerhof-wurst.at> | 2020-04-10 15:19:56 +0300 |
---|---|---|
committer | Christoph Wurst <christoph@winzerhof-wurst.at> | 2020-04-10 15:19:56 +0300 |
commit | caff1023ea72bb2ea94130e18a2a6e2ccf819e5f (patch) | |
tree | 186d494c2aea5dea7255d3584ef5d595fc6e6194 /apps/dav/tests | |
parent | edf8ce32cffdb920e8171207b342abbd7f1fbe73 (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/dav/tests')
66 files changed, 102 insertions, 193 deletions
diff --git a/apps/dav/tests/unit/Avatars/AvatarHomeTest.php b/apps/dav/tests/unit/Avatars/AvatarHomeTest.php index 59edfed267e..cce30d75fd2 100644 --- a/apps/dav/tests/unit/Avatars/AvatarHomeTest.php +++ b/apps/dav/tests/unit/Avatars/AvatarHomeTest.php @@ -121,5 +121,4 @@ class AvatarHomeTest extends TestCase { public function testGetLastModified() { self::assertNull($this->home->getLastModified()); } - } diff --git a/apps/dav/tests/unit/Avatars/AvatarNodeTest.php b/apps/dav/tests/unit/Avatars/AvatarNodeTest.php index d93e8422884..de81e903667 100644 --- a/apps/dav/tests/unit/Avatars/AvatarNodeTest.php +++ b/apps/dav/tests/unit/Avatars/AvatarNodeTest.php @@ -27,7 +27,6 @@ use OCP\IAvatar; use Test\TestCase; class AvatarNodeTest extends TestCase { - public function testGetName() { /** @var IAvatar | \PHPUnit_Framework_MockObject_MockObject $a */ $a = $this->createMock(IAvatar::class); diff --git a/apps/dav/tests/unit/BackgroundJob/EventReminderJobTest.php b/apps/dav/tests/unit/BackgroundJob/EventReminderJobTest.php index 0704bf1e9d6..b19c78d83c4 100644 --- a/apps/dav/tests/unit/BackgroundJob/EventReminderJobTest.php +++ b/apps/dav/tests/unit/BackgroundJob/EventReminderJobTest.php @@ -53,8 +53,7 @@ class EventReminderJobTest extends TestCase { $this->backgroundJob = new EventReminderJob($this->reminderService, $this->config); } - public function data(): array - { + public function data(): array { return [ [true, true, true], [true, false, false], @@ -81,7 +80,6 @@ class EventReminderJobTest extends TestCase { ->method('getAppValue') ->with('dav', 'sendEventRemindersMode', 'backgroundjob') ->willReturn($sendEventRemindersMode ? 'backgroundjob' : 'cron'); - } if ($expectCall) { diff --git a/apps/dav/tests/unit/BackgroundJob/UpdateCalendarResourcesRoomsBackgroundJobTest.php b/apps/dav/tests/unit/BackgroundJob/UpdateCalendarResourcesRoomsBackgroundJobTest.php index d260ed352e6..cc960b4e5d2 100644 --- a/apps/dav/tests/unit/BackgroundJob/UpdateCalendarResourcesRoomsBackgroundJobTest.php +++ b/apps/dav/tests/unit/BackgroundJob/UpdateCalendarResourcesRoomsBackgroundJobTest.php @@ -147,7 +147,7 @@ class UpdateCalendarResourcesRoomsBackgroundJobTest extends TestCase { $res6->method('getAllAvailableMetadataKeys')->willReturn(['meta99', 'meta123']); $res6->method('getMetadataForKey')->willReturnCallback(function ($key) { - switch($key) { + switch ($key) { case 'meta99': return 'value99-new'; @@ -166,7 +166,7 @@ class UpdateCalendarResourcesRoomsBackgroundJobTest extends TestCase { $res7->method('getBackend')->willReturn($backend3); $res7->method('getAllAvailableMetadataKeys')->willReturn(['meta1']); $res7->method('getMetadataForKey')->willReturnCallback(function ($key) { - switch($key) { + switch ($key) { case 'meta1': return 'value1'; @@ -182,7 +182,7 @@ class UpdateCalendarResourcesRoomsBackgroundJobTest extends TestCase { $res8->method('getBackend')->willReturn($backend4); $res8->method('getAllAvailableMetadataKeys')->willReturn(['meta2']); $res8->method('getMetadataForKey')->willReturnCallback(function ($key) { - switch($key) { + switch ($key) { case 'meta2': return 'value2'; @@ -218,7 +218,7 @@ class UpdateCalendarResourcesRoomsBackgroundJobTest extends TestCase { $rows = []; $ids = []; $stmt = $query->execute(); - while($row = $stmt->fetch(\PDO::FETCH_ASSOC)) { + while ($row = $stmt->fetch(\PDO::FETCH_ASSOC)) { $ids[$row['backend_id'] . '::' . $row['resource_id']] = $row['id']; unset($row['id']); $rows[] = $row; @@ -288,7 +288,7 @@ class UpdateCalendarResourcesRoomsBackgroundJobTest extends TestCase { $rows2 = []; $stmt = $query2->execute(); - while($row = $stmt->fetch(\PDO::FETCH_ASSOC)) { + while ($row = $stmt->fetch(\PDO::FETCH_ASSOC)) { unset($row['id']); $rows2[] = $row; } diff --git a/apps/dav/tests/unit/CalDAV/AbstractCalDavBackend.php b/apps/dav/tests/unit/CalDAV/AbstractCalDavBackend.php index db823598c3d..ff62bdaa6d2 100644 --- a/apps/dav/tests/unit/CalDAV/AbstractCalDavBackend.php +++ b/apps/dav/tests/unit/CalDAV/AbstractCalDavBackend.php @@ -172,7 +172,6 @@ abstract class AbstractCalDavBackend extends TestCase { } protected function createEvent($calendarId, $start = '20130912T130000Z', $end = '20130912T140000Z') { - $randomPart = self::getUniqueID(); $calData = <<<EOD @@ -203,7 +202,7 @@ EOD; } protected function assertAcl($principal, $privilege, $acl) { - foreach($acl as $a) { + foreach ($acl as $a) { if ($a['principal'] === $principal && $a['privilege'] === $privilege) { $this->addToAssertionCount(1); return; @@ -213,7 +212,7 @@ EOD; } protected function assertNotAcl($principal, $privilege, $acl) { - foreach($acl as $a) { + foreach ($acl as $a) { if ($a['principal'] === $principal && $a['privilege'] === $privilege) { $this->fail("ACL contains $principal / $privilege"); return; diff --git a/apps/dav/tests/unit/CalDAV/Activity/Filter/GenericTest.php b/apps/dav/tests/unit/CalDAV/Activity/Filter/GenericTest.php index 4574a0e9aa2..7cc02ee008c 100644 --- a/apps/dav/tests/unit/CalDAV/Activity/Filter/GenericTest.php +++ b/apps/dav/tests/unit/CalDAV/Activity/Filter/GenericTest.php @@ -33,7 +33,6 @@ use Test\TestCase; * @group DB */ class GenericTest extends TestCase { - public function dataFilters() { return [ [Calendar::class], diff --git a/apps/dav/tests/unit/CalDAV/Activity/Setting/GenericTest.php b/apps/dav/tests/unit/CalDAV/Activity/Setting/GenericTest.php index 1f1a4429598..44c05e8b0a5 100644 --- a/apps/dav/tests/unit/CalDAV/Activity/Setting/GenericTest.php +++ b/apps/dav/tests/unit/CalDAV/Activity/Setting/GenericTest.php @@ -31,7 +31,6 @@ use OCP\Activity\ISetting; use Test\TestCase; class GenericTest extends TestCase { - public function dataSettings() { return [ [Calendar::class], diff --git a/apps/dav/tests/unit/CalDAV/CachedSubscriptionObjectTest.php b/apps/dav/tests/unit/CalDAV/CachedSubscriptionObjectTest.php index bb0e9aa22c4..51acfae8204 100644 --- a/apps/dav/tests/unit/CalDAV/CachedSubscriptionObjectTest.php +++ b/apps/dav/tests/unit/CalDAV/CachedSubscriptionObjectTest.php @@ -29,7 +29,6 @@ use OCA\DAV\CalDAV\CachedSubscriptionObject; use OCA\DAV\CalDAV\CalDavBackend; class CachedSubscriptionObjectTest extends \Test\TestCase { - public function testGet() { $backend = $this->createMock(CalDavBackend::class); $calendarInfo = [ @@ -92,5 +91,4 @@ class CachedSubscriptionObjectTest extends \Test\TestCase { $calendarObject = new CachedSubscriptionObject($backend, $calendarInfo, $objectData); $calendarObject->delete(); } - } diff --git a/apps/dav/tests/unit/CalDAV/CachedSubscriptionTest.php b/apps/dav/tests/unit/CalDAV/CachedSubscriptionTest.php index d0df178cc79..bc6942062b0 100644 --- a/apps/dav/tests/unit/CalDAV/CachedSubscriptionTest.php +++ b/apps/dav/tests/unit/CalDAV/CachedSubscriptionTest.php @@ -31,7 +31,6 @@ use OCA\DAV\CalDAV\CalDavBackend; use Sabre\DAV\PropPatch; class CachedSubscriptionTest extends \Test\TestCase { - public function testGetACL() { $backend = $this->createMock(CalDavBackend::class); $calendarInfo = [ diff --git a/apps/dav/tests/unit/CalDAV/CalDavBackendTest.php b/apps/dav/tests/unit/CalDAV/CalDavBackendTest.php index 8cb6b9fbf10..76335f00bfe 100644 --- a/apps/dav/tests/unit/CalDAV/CalDavBackendTest.php +++ b/apps/dav/tests/unit/CalDAV/CalDavBackendTest.php @@ -49,9 +49,7 @@ use Sabre\DAVACL\IACL; * @package OCA\DAV\Tests\unit\CalDAV */ class CalDavBackendTest extends AbstractCalDavBackend { - public function testCalendarOperations() { - $calendarId = $this->createTestCalendar(); // update it's display name @@ -206,7 +204,6 @@ EOD; } public function testCalendarObjectsOperations() { - $calendarId = $this->createTestCalendar(); // create a card @@ -313,7 +310,6 @@ EOD; } public function testMultiCalendarObjects() { - $calendarId = $this->createTestCalendar(); // create an event @@ -392,7 +388,7 @@ EOD; // get the cards $calendarObjects = $this->backend->getMultipleCalendarObjects($calendarId, [$uri1, $uri2]); $this->assertCount(2, $calendarObjects); - foreach($calendarObjects as $card) { + foreach ($calendarObjects as $card) { $this->assertArrayHasKey('id', $card); $this->assertArrayHasKey('uri', $card); $this->assertArrayHasKey('lastmodified', $card); @@ -988,8 +984,7 @@ EOD; $this->assertEquals(null, $this->backend->getCalendarObject($subscriptionId, $uri, CalDavBackend::CALENDAR_TYPE_SUBSCRIPTION)); } - public function testCalendarMovement() - { + public function testCalendarMovement() { $this->backend->createCalendar(self::UNIT_TEST_USER, 'Example', []); $this->assertCount(1, $this->backend->getCalendarsForUser(self::UNIT_TEST_USER)); diff --git a/apps/dav/tests/unit/CalDAV/CalendarTest.php b/apps/dav/tests/unit/CalDAV/CalendarTest.php index 534661af6c6..da3a6f9e55c 100644 --- a/apps/dav/tests/unit/CalDAV/CalendarTest.php +++ b/apps/dav/tests/unit/CalDAV/CalendarTest.php @@ -296,7 +296,6 @@ class CalendarTest extends TestCase { * @param bool $isShared */ public function testPrivateClassification($expectedChildren, $isShared) { - $calObject0 = ['uri' => 'event-0', 'classification' => CalDavBackend::CLASSIFICATION_PUBLIC]; $calObject1 = ['uri' => 'event-1', 'classification' => CalDavBackend::CLASSIFICATION_CONFIDENTIAL]; $calObject2 = ['uri' => 'event-2', 'classification' => CalDavBackend::CLASSIFICATION_PRIVATE]; @@ -323,7 +322,6 @@ class CalendarTest extends TestCase { if ($isShared) { $calendarInfo['{http://owncloud.org/ns}owner-principal'] = 'user1'; - } $c = new Calendar($backend, $calendarInfo, $this->l10n, $this->config); $children = $c->getChildren(); @@ -570,7 +568,7 @@ EOD; $backend->expects($this->any()) ->method('getCalendarObject') ->willReturnCallback(function ($cId, $uri) use ($publicObject, $confidentialObject) { - switch($uri) { + switch ($uri) { case 'event-0': return $publicObject; @@ -633,7 +631,6 @@ EOD; $this->assertEquals( $this->fixLinebreak($roCalendar->getChild('event-1')->get()), $this->fixLinebreak($confidentialObjectCleaned)); - } private function fixLinebreak($str) { diff --git a/apps/dav/tests/unit/CalDAV/Integration/ExternalCalendarTest.php b/apps/dav/tests/unit/CalDAV/Integration/ExternalCalendarTest.php index a6698087155..8d2fab953a7 100644 --- a/apps/dav/tests/unit/CalDAV/Integration/ExternalCalendarTest.php +++ b/apps/dav/tests/unit/CalDAV/Integration/ExternalCalendarTest.php @@ -27,7 +27,6 @@ use OCA\DAV\CalDAV\Integration\ExternalCalendar; use Test\TestCase; class ExternalCalendarTest extends TestCase { - private $abstractExternalCalendar; protected function setUp(): void { diff --git a/apps/dav/tests/unit/CalDAV/PluginTest.php b/apps/dav/tests/unit/CalDAV/PluginTest.php index 6a7d6f78850..2068c0c57fe 100644 --- a/apps/dav/tests/unit/CalDAV/PluginTest.php +++ b/apps/dav/tests/unit/CalDAV/PluginTest.php @@ -28,7 +28,7 @@ namespace OCA\DAV\Tests\unit\CalDAV; use OCA\DAV\CalDAV\Plugin; use Test\TestCase; -class PluginTest extends TestCase { +class PluginTest extends TestCase { /** @var Plugin */ private $plugin; diff --git a/apps/dav/tests/unit/CalDAV/PublicCalendarRootTest.php b/apps/dav/tests/unit/CalDAV/PublicCalendarRootTest.php index 2560fec9815..0e58c36b39d 100644 --- a/apps/dav/tests/unit/CalDAV/PublicCalendarRootTest.php +++ b/apps/dav/tests/unit/CalDAV/PublicCalendarRootTest.php @@ -52,7 +52,6 @@ use Test\TestCase; * @package OCA\DAV\Tests\unit\CalDAV */ class PublicCalendarRootTest extends TestCase { - const UNIT_TEST_USER = ''; /** @var CalDavBackend */ private $backend; @@ -136,7 +135,6 @@ class PublicCalendarRootTest extends TestCase { } public function testGetChild() { - $calendar = $this->createPublicCalendar(); $publicCalendars = $this->backend->getPublicCalendars(); @@ -170,5 +168,4 @@ class PublicCalendarRootTest extends TestCase { return $calendar; } - } diff --git a/apps/dav/tests/unit/CalDAV/PublicCalendarTest.php b/apps/dav/tests/unit/CalDAV/PublicCalendarTest.php index 1ef3287f15d..5710a1793c6 100644 --- a/apps/dav/tests/unit/CalDAV/PublicCalendarTest.php +++ b/apps/dav/tests/unit/CalDAV/PublicCalendarTest.php @@ -38,7 +38,6 @@ class PublicCalendarTest extends CalendarTest { * @param bool $isShared */ public function testPrivateClassification($expectedChildren, $isShared) { - $calObject0 = ['uri' => 'event-0', 'classification' => CalDavBackend::CLASSIFICATION_PUBLIC]; $calObject1 = ['uri' => 'event-1', 'classification' => CalDavBackend::CLASSIFICATION_CONFIDENTIAL]; $calObject2 = ['uri' => 'event-2', 'classification' => CalDavBackend::CLASSIFICATION_PRIVATE]; diff --git a/apps/dav/tests/unit/CalDAV/Publishing/PublisherTest.php b/apps/dav/tests/unit/CalDAV/Publishing/PublisherTest.php index 1e3ccc80750..7a555220d85 100644 --- a/apps/dav/tests/unit/CalDAV/Publishing/PublisherTest.php +++ b/apps/dav/tests/unit/CalDAV/Publishing/PublisherTest.php @@ -31,7 +31,6 @@ use Sabre\Xml\Writer; use Test\TestCase; class PublisherTest extends TestCase { - const NS_CALENDARSERVER = 'http://calendarserver.org/ns/'; public function testSerializePublished() { diff --git a/apps/dav/tests/unit/CalDAV/Publishing/PublishingTest.php b/apps/dav/tests/unit/CalDAV/Publishing/PublishingTest.php index 12278a80544..cf30df723cf 100644 --- a/apps/dav/tests/unit/CalDAV/Publishing/PublishingTest.php +++ b/apps/dav/tests/unit/CalDAV/Publishing/PublishingTest.php @@ -79,7 +79,6 @@ class PluginTest extends TestCase { } public function testPublishing() { - $this->book->expects($this->once())->method('setPublishStatus')->with(true); // setup request @@ -91,7 +90,6 @@ class PluginTest extends TestCase { } public function testUnPublishing() { - $this->book->expects($this->once())->method('setPublishStatus')->with(false); // setup request diff --git a/apps/dav/tests/unit/CalDAV/Reminder/NotificationProvider/AudioProviderTest.php b/apps/dav/tests/unit/CalDAV/Reminder/NotificationProvider/AudioProviderTest.php index 5e18be27422..9004a42f98d 100644 --- a/apps/dav/tests/unit/CalDAV/Reminder/NotificationProvider/AudioProviderTest.php +++ b/apps/dav/tests/unit/CalDAV/Reminder/NotificationProvider/AudioProviderTest.php @@ -30,9 +30,7 @@ namespace OCA\DAV\Tests\unit\CalDAV\Reminder\NotificationProvider; use OCA\DAV\CalDAV\Reminder\NotificationProvider\AudioProvider; class AudioProviderTest extends PushProviderTest { - public function testNotificationType():void { $this->assertEquals(AudioProvider::NOTIFICATION_TYPE, 'AUDIO'); } - } diff --git a/apps/dav/tests/unit/CalDAV/Reminder/NotificationProvider/EmailProviderTest.php b/apps/dav/tests/unit/CalDAV/Reminder/NotificationProvider/EmailProviderTest.php index 796ac38e1b2..cd111c44ae4 100644 --- a/apps/dav/tests/unit/CalDAV/Reminder/NotificationProvider/EmailProviderTest.php +++ b/apps/dav/tests/unit/CalDAV/Reminder/NotificationProvider/EmailProviderTest.php @@ -43,7 +43,6 @@ use OCP\Mail\IMessage; use Sabre\VObject\Component\VCalendar; class EmailProviderTest extends AbstractNotificationProviderTest { - const USER_EMAIL = 'frodo@hobb.it'; /** @var ILogger|\PHPUnit\Framework\MockObject\MockObject */ diff --git a/apps/dav/tests/unit/CalDAV/Reminder/NotifierTest.php b/apps/dav/tests/unit/CalDAV/Reminder/NotifierTest.php index 568a65b77d3..eb4e3310aab 100644 --- a/apps/dav/tests/unit/CalDAV/Reminder/NotifierTest.php +++ b/apps/dav/tests/unit/CalDAV/Reminder/NotifierTest.php @@ -103,8 +103,7 @@ class NotifierTest extends TestCase { } - public function testPrepareWrongApp(): void - { + public function testPrepareWrongApp(): void { $this->expectException(\InvalidArgumentException::class); $this->expectExceptionMessage('Notification not from this app'); @@ -138,8 +137,7 @@ class NotifierTest extends TestCase { $this->notifier->prepare($notification, 'en'); } - public function dataPrepare(): array - { + public function dataPrepare(): array { return [ [ 'calendar_reminder', @@ -176,8 +174,7 @@ class NotifierTest extends TestCase { * @param string $message * @throws \Exception */ - public function testPrepare(string $subjectType, array $subjectParams, string $subject, array $messageParams, string $message): void - { + public function testPrepare(string $subjectType, array $subjectParams, string $subject, array $messageParams, string $message): void { /** @var INotification|\PHPUnit\Framework\MockObject\MockObject $notification */ $notification = $this->createMock(INotification::class); diff --git a/apps/dav/tests/unit/CalDAV/ResourceBooking/AbstractPrincipalBackendTest.php b/apps/dav/tests/unit/CalDAV/ResourceBooking/AbstractPrincipalBackendTest.php index 1dbd45ea4ca..e614da37f4c 100644 --- a/apps/dav/tests/unit/CalDAV/ResourceBooking/AbstractPrincipalBackendTest.php +++ b/apps/dav/tests/unit/CalDAV/ResourceBooking/AbstractPrincipalBackendTest.php @@ -130,7 +130,6 @@ abstract class AbstractPrincipalBackendTest extends TestCase { '{http://nextcloud.com/ns}meta99' => 'value99' ] ], $actual); - } public function testGetNoPrincipalsByPrefixForWrongPrincipalPrefix() { @@ -586,5 +585,4 @@ abstract class AbstractPrincipalBackendTest extends TestCase { ]) ->execute(); } - } diff --git a/apps/dav/tests/unit/CalDAV/Schedule/IMipPluginTest.php b/apps/dav/tests/unit/CalDAV/Schedule/IMipPluginTest.php index a666aec95a7..a9946d7454b 100644 --- a/apps/dav/tests/unit/CalDAV/Schedule/IMipPluginTest.php +++ b/apps/dav/tests/unit/CalDAV/Schedule/IMipPluginTest.php @@ -54,33 +54,33 @@ use Test\TestCase; class IMipPluginTest extends TestCase { /** @var IMessage|MockObject */ - private $mailMessage; + private $mailMessage; - /** @var IMailer|MockObject */ - private $mailer; + /** @var IMailer|MockObject */ + private $mailer; - /** @var IEMailTemplate|MockObject */ - private $emailTemplate; + /** @var IEMailTemplate|MockObject */ + private $emailTemplate; - /** @var IAttachment|MockObject */ - private $emailAttachment; + /** @var IAttachment|MockObject */ + private $emailAttachment; - /** @var ITimeFactory|MockObject */ - private $timeFactory; + /** @var ITimeFactory|MockObject */ + private $timeFactory; - /** @var IConfig|MockObject */ - private $config; + /** @var IConfig|MockObject */ + private $config; - /** @var IUserManager|MockObject */ - private $userManager; + /** @var IUserManager|MockObject */ + private $userManager; - /** @var IQueryBuilder|MockObject */ - private $queryBuilder; + /** @var IQueryBuilder|MockObject */ + private $queryBuilder; - /** @var IMipPlugin */ - private $plugin; + /** @var IMipPlugin */ + private $plugin; - protected function setUp(): void { + protected function setUp(): void { $this->mailMessage = $this->createMock(IMessage::class); $this->mailMessage->method('setFrom')->willReturn($this->mailMessage); $this->mailMessage->method('setReplyTo')->willReturn($this->mailMessage); @@ -186,7 +186,6 @@ class IMipPluginTest extends TestCase { * @dataProvider dataNoMessageSendForPastEvents */ public function testNoMessageSendForPastEvents(array $veventParams, bool $expectsMail) { - $this->config ->method('getAppValue') ->with('dav', 'invitation_link_recipients', 'yes') @@ -319,8 +318,7 @@ class IMipPluginTest extends TestCase { ->willReturn($this->queryBuilder); $this->queryBuilder->expects($this->at(9)) ->method('execute'); - } - else { + } else { $this->queryBuilder->expects($this->never()) ->method('insert') ->with('calendar_invitations'); diff --git a/apps/dav/tests/unit/CalDAV/Schedule/PluginTest.php b/apps/dav/tests/unit/CalDAV/Schedule/PluginTest.php index 97d4e552fa4..859dccbe489 100644 --- a/apps/dav/tests/unit/CalDAV/Schedule/PluginTest.php +++ b/apps/dav/tests/unit/CalDAV/Schedule/PluginTest.php @@ -32,7 +32,7 @@ use Sabre\VObject\Parameter; use Sabre\VObject\Property\ICalendar\CalAddress; use Test\TestCase; -class PluginTest extends TestCase { +class PluginTest extends TestCase { /** @var Plugin */ private $plugin; /** @var Server|\PHPUnit_Framework_MockObject_MockObject */ diff --git a/apps/dav/tests/unit/CalDAV/Search/Request/CalendarSearchReportTest.php b/apps/dav/tests/unit/CalDAV/Search/Request/CalendarSearchReportTest.php index 178a05f112c..5211df8867a 100644 --- a/apps/dav/tests/unit/CalDAV/Search/Request/CalendarSearchReportTest.php +++ b/apps/dav/tests/unit/CalDAV/Search/Request/CalendarSearchReportTest.php @@ -30,7 +30,6 @@ use Sabre\Xml\Reader; use Test\TestCase; class CalendarSearchReportTest extends TestCase { - private $elementMap = [ '{http://nextcloud.com/ns}calendar-search' => 'OCA\\DAV\\CalDAV\\Search\\Xml\\Request\\CalendarSearchReport', diff --git a/apps/dav/tests/unit/CalDAV/Search/SearchPluginTest.php b/apps/dav/tests/unit/CalDAV/Search/SearchPluginTest.php index a789753065b..c6c468b9d62 100644 --- a/apps/dav/tests/unit/CalDAV/Search/SearchPluginTest.php +++ b/apps/dav/tests/unit/CalDAV/Search/SearchPluginTest.php @@ -32,7 +32,6 @@ use Sabre\Xml\Service; use Test\TestCase; class SearchPluginTest extends TestCase { - protected $server; /** @var \OCA\DAV\CalDAV\Search\SearchPlugin $plugin */ diff --git a/apps/dav/tests/unit/CalDAV/WebcalCaching/PluginTest.php b/apps/dav/tests/unit/CalDAV/WebcalCaching/PluginTest.php index 82c84423243..2d57ad3b7d5 100644 --- a/apps/dav/tests/unit/CalDAV/WebcalCaching/PluginTest.php +++ b/apps/dav/tests/unit/CalDAV/WebcalCaching/PluginTest.php @@ -28,7 +28,6 @@ use OCA\DAV\CalDAV\WebcalCaching\Plugin; use OCP\IRequest; class PluginTest extends \Test\TestCase { - public function testDisabled() { $request = $this->createMock(IRequest::class); $request->expects($this->at(0)) diff --git a/apps/dav/tests/unit/CapabilitiesTest.php b/apps/dav/tests/unit/CapabilitiesTest.php index 1e9c4bdf836..720d91fc17e 100644 --- a/apps/dav/tests/unit/CapabilitiesTest.php +++ b/apps/dav/tests/unit/CapabilitiesTest.php @@ -29,7 +29,7 @@ use Test\TestCase; /** * @package OCA\DAV\Tests\unit */ -class CapabilitiesTest extends TestCase { +class CapabilitiesTest extends TestCase { public function testGetCapabilities() { $capabilities = new Capabilities(); $expected = [ diff --git a/apps/dav/tests/unit/CardDAV/AddressBookImplTest.php b/apps/dav/tests/unit/CardDAV/AddressBookImplTest.php index 326e77a58be..e4e2d4aef8e 100644 --- a/apps/dav/tests/unit/CardDAV/AddressBookImplTest.php +++ b/apps/dav/tests/unit/CardDAV/AddressBookImplTest.php @@ -134,7 +134,6 @@ class AddressBookImplTest extends TestCase { * @param array $properties */ public function testCreate($properties) { - $uid = 'uid'; /** @var \PHPUnit_Framework_MockObject_MockObject | AddressBookImpl $addressBookImpl */ @@ -173,7 +172,6 @@ class AddressBookImplTest extends TestCase { } public function testUpdate() { - $uid = 'uid'; $uri = 'bla.vcf'; $properties = ['URI' => $uri, 'UID' => $uid, 'FN' => 'John Doe']; @@ -288,7 +286,6 @@ class AddressBookImplTest extends TestCase { $this->assertSame('uid1', $this->invokePrivate($addressBookImpl, 'createUid', []) ); - } public function testCreateEmptyVCard() { diff --git a/apps/dav/tests/unit/CardDAV/AddressBookTest.php b/apps/dav/tests/unit/CardDAV/AddressBookTest.php index c7557c29476..0edc130c904 100644 --- a/apps/dav/tests/unit/CardDAV/AddressBookTest.php +++ b/apps/dav/tests/unit/CardDAV/AddressBookTest.php @@ -32,7 +32,6 @@ use Sabre\DAV\PropPatch; use Test\TestCase; class AddressBookTest extends TestCase { - public function testDelete() { /** @var \PHPUnit_Framework_MockObject_MockObject | CardDavBackend $backend */ $backend = $this->getMockBuilder(CardDavBackend::class)->disableOriginalConstructor()->getMock(); @@ -152,4 +151,5 @@ class AddressBookTest extends TestCase { 'read-only property is false and no owner' => [true, false, false], 'read-only property is true and no owner' => [false, true, false], ]; - }} + } +} diff --git a/apps/dav/tests/unit/CardDAV/CardDavBackendTest.php b/apps/dav/tests/unit/CardDAV/CardDavBackendTest.php index 9d23280f607..e7d2197a6ee 100644 --- a/apps/dav/tests/unit/CardDAV/CardDavBackendTest.php +++ b/apps/dav/tests/unit/CardDAV/CardDavBackendTest.php @@ -206,7 +206,6 @@ class CardDavBackendTest extends TestCase { } public function testAddressBookSharing() { - $this->userManager->expects($this->any()) ->method('userExists') ->willReturn(true); @@ -333,7 +332,9 @@ class CardDavBackendTest extends TestCase { // get all the cards $cards = $this->backend->getCards($bookId); $this->assertEquals(3, count($cards)); - usort($cards, function ($a, $b) { return $a['id'] < $b['id'] ? -1 : 1; }); + usort($cards, function ($a, $b) { + return $a['id'] < $b['id'] ? -1 : 1; + }); $this->assertEquals($this->vcardTest0, $cards[0]['carddata']); $this->assertEquals($this->vcardTest1, $cards[1]['carddata']); @@ -342,8 +343,10 @@ class CardDavBackendTest extends TestCase { // get the cards 1 & 2 (not 0) $cards = $this->backend->getMultipleCards($bookId, [$uri1, $uri2]); $this->assertEquals(2, count($cards)); - usort($cards, function ($a, $b) { return $a['id'] < $b['id'] ? -1 : 1; }); - foreach($cards as $index => $card) { + usort($cards, function ($a, $b) { + return $a['id'] < $b['id'] ? -1 : 1; + }); + foreach ($cards as $index => $card) { $this->assertArrayHasKey('id', $card); $this->assertArrayHasKey('uri', $card); $this->assertArrayHasKey('lastmodified', $card); @@ -361,7 +364,6 @@ class CardDavBackendTest extends TestCase { } public function testMultipleUIDOnDifferentAddressbooks() { - $this->backend = $this->getMockBuilder(CardDavBackend::class) ->setConstructorArgs([$this->db, $this->principal, $this->userManager, $this->groupManager, $this->dispatcher]) ->setMethods(['updateProperties'])->getMock(); @@ -486,7 +488,6 @@ class CardDavBackendTest extends TestCase { } public function testSharing() { - $this->userManager->expects($this->any()) ->method('userExists') ->willReturn(true); @@ -525,7 +526,6 @@ class CardDavBackendTest extends TestCase { } public function testUpdateProperties() { - $bookId = 42; $cardUri = 'card-uri'; $cardId = 2; @@ -574,7 +574,6 @@ class CardDavBackendTest extends TestCase { } public function testPurgeProperties() { - $query = $this->db->getQueryBuilder(); $query->insert('cards_properties') ->values( @@ -608,7 +607,6 @@ class CardDavBackendTest extends TestCase { $this->assertSame(1, count($result)); $this->assertSame(1 ,(int)$result[0]['addressbookid']); $this->assertSame(2 ,(int)$result[0]['cardid']); - } public function testGetCardId() { @@ -664,7 +662,7 @@ class CardDavBackendTest extends TestCase { $vCardIds = []; $query = $this->db->getQueryBuilder(); - for($i=0; $i < 3; $i++) { + for ($i=0; $i < 3; $i++) { $query->insert($this->dbCardsTable) ->values( [ @@ -794,7 +792,7 @@ class CardDavBackendTest extends TestCase { public function testGetContact() { $query = $this->db->getQueryBuilder(); - for($i=0; $i<2; $i++) { + for ($i=0; $i<2; $i++) { $query->insert($this->dbCardsTable) ->values( [ diff --git a/apps/dav/tests/unit/CardDAV/ConverterTest.php b/apps/dav/tests/unit/CardDAV/ConverterTest.php index 7e93c05a3fc..da2255a7172 100644 --- a/apps/dav/tests/unit/CardDAV/ConverterTest.php +++ b/apps/dav/tests/unit/CardDAV/ConverterTest.php @@ -103,23 +103,23 @@ class ConverterTest extends TestCase { $this->assertInstanceOf('Sabre\VObject\Component\VCard', $vCard); $cardData = $vCard->jsonSerialize(); $this->compareData($expectedVCard, $cardData); - } else { $this->assertSame($expectedVCard, $vCard); } - } protected function compareData($expected, $data) { foreach ($expected as $key => $value) { $found = false; foreach ($data[1] as $d) { - if($d[0] === $key && $d[3] === $value) { + if ($d[0] === $key && $d[3] === $value) { $found = true; break; } } - if (!$found) $this->assertTrue(false, 'Expected data: ' . $key . ' not found.'); + if (!$found) { + $this->assertTrue(false, 'Expected data: ' . $key . ' not found.'); + } } } @@ -183,7 +183,6 @@ class ConverterTest extends TestCase { * @param $fullName */ public function testNameSplitter($expected, $fullName) { - $converter = new Converter($this->accountManager); $r = $converter->splitFullName($fullName); $r = implode(';', $r); diff --git a/apps/dav/tests/unit/CardDAV/ImageExportPluginTest.php b/apps/dav/tests/unit/CardDAV/ImageExportPluginTest.php index 6cdfe04e8a9..076c9119cd7 100644 --- a/apps/dav/tests/unit/CardDAV/ImageExportPluginTest.php +++ b/apps/dav/tests/unit/CardDAV/ImageExportPluginTest.php @@ -185,7 +185,6 @@ class ImageExportPluginTest extends TestCase { $this->response->expects($this->once()) ->method('setBody') ->with('imgdata'); - } else { $this->cache->method('get') ->with(1, 'card', $size, $card) diff --git a/apps/dav/tests/unit/CardDAV/Sharing/PluginTest.php b/apps/dav/tests/unit/CardDAV/Sharing/PluginTest.php index e0abbf7857d..647af7db69b 100644 --- a/apps/dav/tests/unit/CardDAV/Sharing/PluginTest.php +++ b/apps/dav/tests/unit/CardDAV/Sharing/PluginTest.php @@ -66,7 +66,6 @@ class PluginTest extends TestCase { } public function testSharing() { - $this->book->expects($this->once())->method('updateShares')->with([[ 'href' => 'principal:principals/admin', 'commonName' => null, diff --git a/apps/dav/tests/unit/CardDAV/SyncServiceTest.php b/apps/dav/tests/unit/CardDAV/SyncServiceTest.php index 9015528763f..f3dc3f95fa5 100644 --- a/apps/dav/tests/unit/CardDAV/SyncServiceTest.php +++ b/apps/dav/tests/unit/CardDAV/SyncServiceTest.php @@ -216,5 +216,4 @@ class SyncServiceTest extends TestCase { $ss->method('getCertPath')->willReturn(''); return $ss; } - } 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(); diff --git a/apps/dav/tests/unit/Comments/CommentsNodeTest.php b/apps/dav/tests/unit/Comments/CommentsNodeTest.php index a219b0a5c74..6bb0033ecb8 100644 --- a/apps/dav/tests/unit/Comments/CommentsNodeTest.php +++ b/apps/dav/tests/unit/Comments/CommentsNodeTest.php @@ -488,7 +488,7 @@ class CommentsNodeTest extends \Test\TestCase { $properties = $this->node->getProperties(null); - foreach($properties as $name => $value) { + foreach ($properties as $name => $value) { $this->assertArrayHasKey($name, $expected); $this->assertSame($expected[$name], $value); unset($expected[$name]); @@ -499,8 +499,10 @@ class CommentsNodeTest extends \Test\TestCase { public function readCommentProvider() { $creationDT = new \DateTime('2016-01-19 18:48:00'); $diff = new \DateInterval('PT2H'); - $readDT1 = clone $creationDT; $readDT1->sub($diff); - $readDT2 = clone $creationDT; $readDT2->add($diff); + $readDT1 = clone $creationDT; + $readDT1->sub($diff); + $readDT2 = clone $creationDT; + $readDT2->add($diff); return [ [$creationDT, $readDT1, 'true'], [$creationDT, $readDT2, 'false'], diff --git a/apps/dav/tests/unit/Comments/CommentsPluginTest.php b/apps/dav/tests/unit/Comments/CommentsPluginTest.php index 7210e96b122..c2234f116fc 100644 --- a/apps/dav/tests/unit/Comments/CommentsPluginTest.php +++ b/apps/dav/tests/unit/Comments/CommentsPluginTest.php @@ -772,7 +772,4 @@ class CommentsPluginTest extends \Test\TestCase { $this->plugin->onReport(CommentsPluginImplementation::REPORT_NAME, $parameters, '/' . $path); } - - - } diff --git a/apps/dav/tests/unit/Comments/RootCollectionTest.php b/apps/dav/tests/unit/Comments/RootCollectionTest.php index f039c0d6ea3..68098f2aebc 100644 --- a/apps/dav/tests/unit/Comments/RootCollectionTest.php +++ b/apps/dav/tests/unit/Comments/RootCollectionTest.php @@ -146,7 +146,7 @@ class RootCollectionTest extends \Test\TestCase { $this->prepareForInitCollections(); $children = $this->collection->getChildren(); $this->assertFalse(empty($children)); - foreach($children as $child) { + foreach ($children as $child) { $this->assertTrue($child instanceof EntityTypeCollectionImplementation); } } diff --git a/apps/dav/tests/unit/Connector/PublicAuthTest.php b/apps/dav/tests/unit/Connector/PublicAuthTest.php index ccf7d503205..bcec84d414c 100644 --- a/apps/dav/tests/unit/Connector/PublicAuthTest.php +++ b/apps/dav/tests/unit/Connector/PublicAuthTest.php @@ -267,5 +267,4 @@ class PublicAuthTest extends \Test\TestCase { $this->assertFalse($result); } - } 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])); } - } diff --git a/apps/dav/tests/unit/Controller/BirthdayCalendarControllerTest.php b/apps/dav/tests/unit/Controller/BirthdayCalendarControllerTest.php index 18f73d9685e..1e2cef4e37b 100644 --- a/apps/dav/tests/unit/Controller/BirthdayCalendarControllerTest.php +++ b/apps/dav/tests/unit/Controller/BirthdayCalendarControllerTest.php @@ -122,5 +122,4 @@ class BirthdayCalendarControllerTest extends TestCase { $response = $this->controller->disable(); $this->assertInstanceOf('OCP\AppFramework\Http\JSONResponse', $response); } - } diff --git a/apps/dav/tests/unit/DAV/AnonymousOptionsTest.php b/apps/dav/tests/unit/DAV/AnonymousOptionsTest.php index 721c2c4b074..cd7f4c24340 100644 --- a/apps/dav/tests/unit/DAV/AnonymousOptionsTest.php +++ b/apps/dav/tests/unit/DAV/AnonymousOptionsTest.php @@ -88,7 +88,5 @@ class SapiMock extends Sapi { * @return void */ static function sendResponse(ResponseInterface $response) { - } - } diff --git a/apps/dav/tests/unit/DAV/CustomPropertiesBackendTest.php b/apps/dav/tests/unit/DAV/CustomPropertiesBackendTest.php index 42c38cf5ce7..da812016f21 100644 --- a/apps/dav/tests/unit/DAV/CustomPropertiesBackendTest.php +++ b/apps/dav/tests/unit/DAV/CustomPropertiesBackendTest.php @@ -66,7 +66,6 @@ class CustomPropertiesBackendTest extends TestCase { $this->dbConnection, $this->user ); - } protected function tearDown(): void { diff --git a/apps/dav/tests/unit/DAV/Sharing/PluginTest.php b/apps/dav/tests/unit/DAV/Sharing/PluginTest.php index 07a9e2ce9f5..56d0867f015 100644 --- a/apps/dav/tests/unit/DAV/Sharing/PluginTest.php +++ b/apps/dav/tests/unit/DAV/Sharing/PluginTest.php @@ -68,7 +68,6 @@ class PluginTest extends TestCase { } public function testSharing() { - $this->book->expects($this->once())->method('updateShares')->with([[ 'href' => 'principal:principals/admin', 'commonName' => null, diff --git a/apps/dav/tests/unit/DAV/SystemPrincipalBackendTest.php b/apps/dav/tests/unit/DAV/SystemPrincipalBackendTest.php index 698e39a5218..1bb1f6d8380 100644 --- a/apps/dav/tests/unit/DAV/SystemPrincipalBackendTest.php +++ b/apps/dav/tests/unit/DAV/SystemPrincipalBackendTest.php @@ -137,6 +137,4 @@ class SystemPrincipalBackendTest extends TestCase { $result = $backend->getGroupMembership('principals/system/system'); $this->assertEquals([], $result); } - - } diff --git a/apps/dav/tests/unit/Migration/CalDAVRemoveEmptyValueTest.php b/apps/dav/tests/unit/Migration/CalDAVRemoveEmptyValueTest.php index dcc79d71ce0..6279583350b 100644 --- a/apps/dav/tests/unit/Migration/CalDAVRemoveEmptyValueTest.php +++ b/apps/dav/tests/unit/Migration/CalDAVRemoveEmptyValueTest.php @@ -37,7 +37,7 @@ use Test\TestCase; * @package OCA\DAV\Tests\Unit\DAV\Migration * @group DB */ -class CalDAVRemoveEmptyValueTest extends TestCase { +class CalDAVRemoveEmptyValueTest extends TestCase { /** @var ILogger|\PHPUnit_Framework_MockObject_MockObject */ private $logger; diff --git a/apps/dav/tests/unit/Migration/RefreshWebcalJobRegistrarTest.php b/apps/dav/tests/unit/Migration/RefreshWebcalJobRegistrarTest.php index 84dbe56a761..6856915961f 100644 --- a/apps/dav/tests/unit/Migration/RefreshWebcalJobRegistrarTest.php +++ b/apps/dav/tests/unit/Migration/RefreshWebcalJobRegistrarTest.php @@ -145,5 +145,4 @@ class RefreshWebcalJobRegistrarTest extends TestCase { $this->migration->run($output); } - } diff --git a/apps/dav/tests/unit/Migration/RegenerateBirthdayCalendarsTest.php b/apps/dav/tests/unit/Migration/RegenerateBirthdayCalendarsTest.php index 85a34d25694..ef7f2580941 100644 --- a/apps/dav/tests/unit/Migration/RegenerateBirthdayCalendarsTest.php +++ b/apps/dav/tests/unit/Migration/RegenerateBirthdayCalendarsTest.php @@ -98,6 +98,4 @@ class RegenerateBirthdayCalendarsTest extends TestCase { $this->migration->run($output); } - - } diff --git a/apps/dav/tests/unit/Provisioning/Apple/AppleProvisioningPluginTest.php b/apps/dav/tests/unit/Provisioning/Apple/AppleProvisioningPluginTest.php index 1b09c96c940..1c39f30527a 100644 --- a/apps/dav/tests/unit/Provisioning/Apple/AppleProvisioningPluginTest.php +++ b/apps/dav/tests/unit/Provisioning/Apple/AppleProvisioningPluginTest.php @@ -92,7 +92,8 @@ class AppleProvisioningPluginTest extends TestCase { $plugin = new AppleProvisioningPlugin($this->userSession, $this->urlGenerator, $this->themingDefaults, $this->request, $this->l10n, - function () {}); + function () { + }); $server->expects($this->at(0)) ->method('on') @@ -266,5 +267,4 @@ EOF $this->assertFalse($returnValue); } - } diff --git a/apps/dav/tests/unit/SystemTag/SystemTagPluginTest.php b/apps/dav/tests/unit/SystemTag/SystemTagPluginTest.php index ec80d916b58..dc47c20f345 100644 --- a/apps/dav/tests/unit/SystemTag/SystemTagPluginTest.php +++ b/apps/dav/tests/unit/SystemTag/SystemTagPluginTest.php @@ -43,7 +43,6 @@ use Sabre\HTTP\RequestInterface; use Sabre\HTTP\ResponseInterface; class SystemTagPluginTest extends \Test\TestCase { - const ID_PROPERTYNAME = \OCA\DAV\SystemTag\SystemTagPlugin::ID_PROPERTYNAME; const DISPLAYNAME_PROPERTYNAME = \OCA\DAV\SystemTag\SystemTagPlugin::DISPLAYNAME_PROPERTYNAME; const USERVISIBLE_PROPERTYNAME = \OCA\DAV\SystemTag\SystemTagPlugin::USERVISIBLE_PROPERTYNAME; @@ -748,5 +747,4 @@ class SystemTagPluginTest extends \Test\TestCase { $this->plugin->httpPost($request, $response); } - } diff --git a/apps/dav/tests/unit/Upload/AssemblyStreamTest.php b/apps/dav/tests/unit/Upload/AssemblyStreamTest.php index 2a4c832c71c..f7b34315106 100644 --- a/apps/dav/tests/unit/Upload/AssemblyStreamTest.php +++ b/apps/dav/tests/unit/Upload/AssemblyStreamTest.php @@ -64,7 +64,7 @@ class AssemblyStreamTest extends \Test\TestCase { $stream = \OCA\DAV\Upload\AssemblyStream::wrap($nodes); $offset = floor(strlen($expected) * 0.6); - if(fseek($stream, $offset) === -1) { + if (fseek($stream, $offset) === -1) { $this->fail('fseek failed'); } diff --git a/apps/dav/tests/unit/Upload/ChunkingPluginTest.php b/apps/dav/tests/unit/Upload/ChunkingPluginTest.php index f4f91c0e760..abbded089db 100644 --- a/apps/dav/tests/unit/Upload/ChunkingPluginTest.php +++ b/apps/dav/tests/unit/Upload/ChunkingPluginTest.php @@ -164,5 +164,4 @@ class ChunkingPluginTest extends TestCase { $this->assertFalse($this->plugin->beforeMove('source', 'target')); } - } diff --git a/apps/dav/tests/unit/Upload/FutureFileTest.php b/apps/dav/tests/unit/Upload/FutureFileTest.php index 248d4c826ae..793241cda72 100644 --- a/apps/dav/tests/unit/Upload/FutureFileTest.php +++ b/apps/dav/tests/unit/Upload/FutureFileTest.php @@ -29,7 +29,6 @@ namespace OCA\DAV\Tests\unit\Upload; use OCA\DAV\Connector\Sabre\Directory; class FutureFileTest extends \Test\TestCase { - public function testGetContentType() { $f = $this->mockFutureFile(); $this->assertEquals('application/octet-stream', $f->getContentType()); |