t('Please contact the organizer directly.'));?>
- + diff --git a/apps/dav/tests/integration/UserMigration/CalendarMigratorTest.php b/apps/dav/tests/integration/UserMigration/CalendarMigratorTest.php index bb7f83e4d34da..3690b1c120eb6 100644 --- a/apps/dav/tests/integration/UserMigration/CalendarMigratorTest.php +++ b/apps/dav/tests/integration/UserMigration/CalendarMigratorTest.php @@ -53,6 +53,7 @@ function (string $filename) { VObjectReader::OPTION_FORGIVING, ); [$initialCalendarUri, $ext] = explode('.', $filename, 2); + return [UUIDUtil::getUUID(), $filename, $initialCalendarUri, $vCalendar]; }, array_diff( diff --git a/apps/dav/tests/integration/UserMigration/ContactsMigratorTest.php b/apps/dav/tests/integration/UserMigration/ContactsMigratorTest.php index 17d4cf2153605..bd26d56d15a9b 100644 --- a/apps/dav/tests/integration/UserMigration/ContactsMigratorTest.php +++ b/apps/dav/tests/integration/UserMigration/ContactsMigratorTest.php @@ -60,6 +60,7 @@ function (string $filename) { [$initialAddressBookUri, $ext] = explode('.', $filename, 2); $metadata = ['displayName' => ucwords(str_replace('-', ' ', $initialAddressBookUri))]; + return [UUIDUtil::getUUID(), $filename, $initialAddressBookUri, $metadata, $vCards]; }, array_diff( diff --git a/apps/dav/tests/unit/BackgroundJob/UserStatusAutomationTest.php b/apps/dav/tests/unit/BackgroundJob/UserStatusAutomationTest.php index 7e30ec3d2fe7b..5fd51b13f2dac 100644 --- a/apps/dav/tests/unit/BackgroundJob/UserStatusAutomationTest.php +++ b/apps/dav/tests/unit/BackgroundJob/UserStatusAutomationTest.php @@ -113,6 +113,7 @@ public function testRunNoOOO(string $ruleDay, string $currentTime, bool $isAvail ->method('setUserStatus') ->with('user', IUserStatus::MESSAGE_AVAILABILITY, IUserStatus::DND, true); } + $automation = $this->getAutomationMock(['getAvailabilityFromPropertiesTable']); $automation->method('getAvailabilityFromPropertiesTable') ->with('user') diff --git a/apps/dav/tests/unit/CalDAV/AbstractCalDavBackend.php b/apps/dav/tests/unit/CalDAV/AbstractCalDavBackend.php index 946a2328bf8df..6e6ffc9679b14 100644 --- a/apps/dav/tests/unit/CalDAV/AbstractCalDavBackend.php +++ b/apps/dav/tests/unit/CalDAV/AbstractCalDavBackend.php @@ -122,6 +122,7 @@ public function cleanUpBackend(): void { if (is_null($this->backend)) { return; } + $this->principal->expects($this->any())->method('getGroupMembership') ->withAnyParameters() ->willReturn([self::UNIT_TEST_GROUP, self::UNIT_TEST_GROUP2]); @@ -136,6 +137,7 @@ private function cleanupForPrincipal($principal): void { foreach ($calendars as $calendar) { $this->backend->deleteCalendar($calendar['id'], true); } + $subscriptions = $this->backend->getSubscriptionsForUser($principal); foreach ($subscriptions as $subscription) { $this->backend->deleteSubscription($subscription['id']); @@ -241,6 +243,7 @@ protected function assertAcl($principal, $privilege, $acl) { return; } } + $this->fail("ACL does not contain $principal / $privilege"); } @@ -251,6 +254,7 @@ protected function assertNotAcl($principal, $privilege, $acl) { return; } } + $this->addToAssertionCount(1); } diff --git a/apps/dav/tests/unit/CalDAV/Activity/BackendTest.php b/apps/dav/tests/unit/CalDAV/Activity/BackendTest.php index 6ace633b072f7..43a2a422d060d 100644 --- a/apps/dav/tests/unit/CalDAV/Activity/BackendTest.php +++ b/apps/dav/tests/unit/CalDAV/Activity/BackendTest.php @@ -363,6 +363,7 @@ protected function getUsers(array $users) { foreach ($users as $user) { $list[] = $this->getUserMock($user); } + return $list; } @@ -375,6 +376,7 @@ protected function getUserMock($uid) { $user->expects($this->once()) ->method('getUID') ->willReturn($uid); + return $user; } } diff --git a/apps/dav/tests/unit/CalDAV/Activity/Provider/EventTest.php b/apps/dav/tests/unit/CalDAV/Activity/Provider/EventTest.php index ec237825731c5..704c031af5f4b 100644 --- a/apps/dav/tests/unit/CalDAV/Activity/Provider/EventTest.php +++ b/apps/dav/tests/unit/CalDAV/Activity/Provider/EventTest.php @@ -114,10 +114,12 @@ public function testGenerateObjectParameter(int $id, string $name, ?array $link, ->willReturn('fullLink'); } } + $objectParameter = ['id' => $id, 'name' => $name]; if ($link) { $objectParameter['link'] = $link; } + $result = [ 'type' => 'calendar-event', 'id' => $id, @@ -126,6 +128,7 @@ public function testGenerateObjectParameter(int $id, string $name, ?array $link, if ($link && $calendarAppEnabled) { $result['link'] = 'fullLink'; } + $this->assertEquals($result, $this->invokePrivate($this->provider, 'generateObjectParameter', [$objectParameter, $affectedUser])); } diff --git a/apps/dav/tests/unit/CalDAV/CalDavBackendTest.php b/apps/dav/tests/unit/CalDAV/CalDavBackendTest.php index c82ca350c909b..ba389f67faa85 100644 --- a/apps/dav/tests/unit/CalDAV/CalDavBackendTest.php +++ b/apps/dav/tests/unit/CalDAV/CalDavBackendTest.php @@ -720,6 +720,7 @@ public function testGetDenormalizedData($expected, $key, $calData): void { if (($e->getMessage() === 'Epoch doesn\'t fit in a PHP integer') && (PHP_INT_SIZE < 8)) { $this->markTestSkipped('This fail on 32bits because of PHP limitations in DateTime'); } + throw $e; } } diff --git a/apps/dav/tests/unit/CalDAV/CalendarTest.php b/apps/dav/tests/unit/CalDAV/CalendarTest.php index 6433af8c3402a..ffc77b5c2165d 100644 --- a/apps/dav/tests/unit/CalDAV/CalendarTest.php +++ b/apps/dav/tests/unit/CalDAV/CalendarTest.php @@ -167,6 +167,7 @@ public function testPropPatch($ownerPrincipal, $principalUri, $mutations, $share ->method('updateCalendar') ->with(666, $propPatch); } + $c->propPatch($propPatch); $this->addToAssertionCount(1); } @@ -187,9 +188,11 @@ public function testAcl($expectsWrite, $readOnlyValue, $hasOwnerSet, $uri = 'def if (!is_null($readOnlyValue)) { $calendarInfo['{http://owncloud.org/ns}read-only'] = $readOnlyValue; } + if ($hasOwnerSet) { $calendarInfo['{http://owncloud.org/ns}owner-principal'] = 'user1'; } + $c = new Calendar($backend, $calendarInfo, $this->l10n, $this->config, $this->logger); $acl = $c->getACL(); $childAcl = $c->getChildACL(); @@ -257,6 +260,7 @@ public function testAcl($expectsWrite, $readOnlyValue, $hasOwnerSet, $uri = 'def ]; } } + $this->assertEquals($expectedAcl, $acl); $this->assertEquals($expectedAcl, $childAcl); } @@ -306,6 +310,7 @@ public function testPrivateClassification($expectedChildren, $isShared): void { if ($isShared) { $calendarInfo['{http://owncloud.org/ns}owner-principal'] = 'user1'; } + $c = new Calendar($backend, $calendarInfo, $this->l10n, $this->config, $this->logger); $children = $c->getChildren(); $this->assertEquals($expectedChildren, count($children)); @@ -423,6 +428,7 @@ public function testConfidentialClassification($expectedChildren, $isShared): vo $l10n->expects($this->never()) ->method('t'); } + $c = new Calendar($backend, $calendarInfo, $l10n, $this->config, $this->logger); $calData = $c->getChild('event-1')->get(); diff --git a/apps/dav/tests/unit/CalDAV/PublicCalendarRootTest.php b/apps/dav/tests/unit/CalDAV/PublicCalendarRootTest.php index 4333754222bad..4c9b1e2507714 100644 --- a/apps/dav/tests/unit/CalDAV/PublicCalendarRootTest.php +++ b/apps/dav/tests/unit/CalDAV/PublicCalendarRootTest.php @@ -94,6 +94,7 @@ protected function tearDown(): void { if (is_null($this->backend)) { return; } + $this->principal->expects($this->any())->method('getGroupMembership') ->withAnyParameters() ->willReturn([]); diff --git a/apps/dav/tests/unit/CalDAV/Publishing/PublisherTest.php b/apps/dav/tests/unit/CalDAV/Publishing/PublisherTest.php index 769e153764671..e60dd0e80723e 100644 --- a/apps/dav/tests/unit/CalDAV/Publishing/PublisherTest.php +++ b/apps/dav/tests/unit/CalDAV/Publishing/PublisherTest.php @@ -54,6 +54,7 @@ private function write($input) { $writer->openMemory(); $writer->setIndent(true); $writer->write($input); + return $writer->outputMemory(); } } diff --git a/apps/dav/tests/unit/CalDAV/Reminder/NotifierTest.php b/apps/dav/tests/unit/CalDAV/Reminder/NotifierTest.php index dcf11a1a6b833..8ccd2a076acd2 100644 --- a/apps/dav/tests/unit/CalDAV/Reminder/NotifierTest.php +++ b/apps/dav/tests/unit/CalDAV/Reminder/NotifierTest.php @@ -47,6 +47,7 @@ protected function setUp(): void { if (!is_array($args)) { $args = [$args]; } + return vsprintf($string, $args); }); $this->l10n->expects($this->any()) @@ -60,6 +61,7 @@ protected function setUp(): void { ->willReturnCallback(function ($textSingular, $textPlural, $count, $args) { $text = $count === 1 ? $textSingular : $textPlural; $text = str_replace('%n', (string)$count, $text); + return vsprintf($text, $args); }); $this->factory = $this->createMock(IFactory::class); diff --git a/apps/dav/tests/unit/CalDAV/Reminder/ReminderServiceTest.php b/apps/dav/tests/unit/CalDAV/Reminder/ReminderServiceTest.php index 198c8d97b125d..9c0865e392e24 100644 --- a/apps/dav/tests/unit/CalDAV/Reminder/ReminderServiceTest.php +++ b/apps/dav/tests/unit/CalDAV/Reminder/ReminderServiceTest.php @@ -713,6 +713,7 @@ public function testProcessReminders():void { if ($vevent->DTSTART->getDateTime()->format(DateTime::ATOM) !== '2016-06-09T00:00:00+00:00') { return false; } + return true; }, 'Displayname 123', $user)); $provider2->expects($this->once()) @@ -721,6 +722,7 @@ public function testProcessReminders():void { if ($vevent->DTSTART->getDateTime()->format(DateTime::ATOM) !== '2016-06-09T00:00:00+00:00') { return false; } + return true; }, 'Displayname 123', $user)); $provider3->expects($this->once()) @@ -729,6 +731,7 @@ public function testProcessReminders():void { if ($vevent->DTSTART->getDateTime()->format(DateTime::ATOM) !== '2016-06-09T00:00:00+00:00') { return false; } + return true; }, 'Displayname 123', $user)); $provider4->expects($this->once()) @@ -737,6 +740,7 @@ public function testProcessReminders():void { if ($vevent->DTSTART->getDateTime()->format(DateTime::ATOM) !== '2016-06-30T00:00:00+00:00') { return false; } + return true; }, 'Displayname 123', $user)); $provider5->expects($this->once()) @@ -745,6 +749,7 @@ public function testProcessReminders():void { if ($vevent->DTSTART->getDateTime()->format(DateTime::ATOM) !== '2016-07-07T00:00:00+00:00') { return false; } + return true; }, 'Displayname 123', $user)); diff --git a/apps/dav/tests/unit/CalDAV/ResourceBooking/AbstractPrincipalBackendTest.php b/apps/dav/tests/unit/CalDAV/ResourceBooking/AbstractPrincipalBackendTest.php index ed39129fa56b4..2018aa60eaa71 100644 --- a/apps/dav/tests/unit/CalDAV/ResourceBooking/AbstractPrincipalBackendTest.php +++ b/apps/dav/tests/unit/CalDAV/ResourceBooking/AbstractPrincipalBackendTest.php @@ -220,9 +220,11 @@ public function testSetGroupMemberSet(): void { if ($proxy->getOwnerId() !== $this->principalPrefix . '/backend1-res1') { return false; } + if ($proxy->getProxyId() !== $this->principalPrefix . '/backend1-res2') { return false; } + if ($proxy->getPermissions() !== 3) { return false; } @@ -234,9 +236,11 @@ public function testSetGroupMemberSet(): void { if ($proxy->getOwnerId() !== $this->principalPrefix . '/backend1-res1') { return false; } + if ($proxy->getProxyId() !== $this->principalPrefix . '/backend2-res3') { return false; } + if ($proxy->getPermissions() !== 3) { return false; } diff --git a/apps/dav/tests/unit/CalDAV/Schedule/IMipPluginTest.php b/apps/dav/tests/unit/CalDAV/Schedule/IMipPluginTest.php index 36ce091fc6907..7b85f33a4acc5 100644 --- a/apps/dav/tests/unit/CalDAV/Schedule/IMipPluginTest.php +++ b/apps/dav/tests/unit/CalDAV/Schedule/IMipPluginTest.php @@ -199,6 +199,7 @@ public function testParsingSingle(): void { $atnd = $attendee; } } + $this->plugin->setVCalendar($oldVCalendar); $this->service->expects(self::once()) ->method('getLastOccurrence') @@ -302,6 +303,7 @@ public function testAttendeeIsResource(): void { $room = $attendee; } } + $this->plugin->setVCalendar($oldVCalendar); $this->service->expects(self::once()) ->method('getLastOccurrence') @@ -403,6 +405,7 @@ public function testParsingRecurrence(): void { $atnd = $attendee; } } + $this->plugin->setVCalendar($oldVCalendar); $this->service->expects(self::once()) ->method('getLastOccurrence') @@ -534,6 +537,7 @@ public function testFailedDelivery(): void { $atnd = $attendee; } } + $this->plugin->setVCalendar($oldVcalendar); $this->service->expects(self::once()) ->method('getLastOccurrence') @@ -626,6 +630,7 @@ public function testMailProviderSend(): void { $attendee = $entry; } } + // construct body data return $data = ['invitee_name' => 'Mr. Wizard', 'meeting_title' => 'Fellowship meeting without (!) Boromir', @@ -735,6 +740,7 @@ public function testNoOldEvent(): void { $atnd = $attendee; } } + $this->service->expects(self::once()) ->method('getLastOccurrence') ->willReturn(1496912700); @@ -828,6 +834,7 @@ public function testNoButtons(): void { $atnd = $attendee; } } + $this->service->expects(self::once()) ->method('getLastOccurrence') ->willReturn(1496912700); diff --git a/apps/dav/tests/unit/CalDAV/Schedule/PluginTest.php b/apps/dav/tests/unit/CalDAV/Schedule/PluginTest.php index 8d98a765fc1bd..9a4e33f8b8275 100644 --- a/apps/dav/tests/unit/CalDAV/Schedule/PluginTest.php +++ b/apps/dav/tests/unit/CalDAV/Schedule/PluginTest.php @@ -295,12 +295,15 @@ public function testPropFindDefaultCalendarUrl(string $principalUri, ?string $ca $this->plugin->propFindDefaultCalendarUrl($propFind, $node); $this->assertNull($propFind->get(Plugin::SCHEDULE_DEFAULT_CALENDAR_URL)); + return; } + if ($principalUri === 'principals/something-else') { $this->plugin->propFindDefaultCalendarUrl($propFind, $node); $this->assertNull($propFind->get(Plugin::SCHEDULE_DEFAULT_CALENDAR_URL)); + return; } @@ -380,7 +383,7 @@ public function testPropFindDefaultCalendarUrl(string $principalUri, ?string $ca $this->server->expects($this->once()) ->method('getPropertiesForPath') - ->with($calendarHome .'/' . $calendarUri, [], 1) + ->with($calendarHome . '/' . $calendarUri, [], 1) ->willReturn($properties); $this->plugin->propFindDefaultCalendarUrl($propFind, $node); @@ -392,7 +395,7 @@ public function testPropFindDefaultCalendarUrl(string $principalUri, ?string $ca /** @var LocalHref $result */ $result = $propFind->get(Plugin::SCHEDULE_DEFAULT_CALENDAR_URL); - $this->assertEquals('/remote.php/dav/'. $calendarHome . '/' . $calendarUri, $result->getHref()); + $this->assertEquals('/remote.php/dav/' . $calendarHome . '/' . $calendarUri, $result->getHref()); } /** @@ -449,6 +452,7 @@ function (string $eventName, array $arguments = [], ?callable $continueCallBack $this->assertEquals('schedule', $eventName); $this->assertCount(1, $arguments); $iTipMessages[] = $arguments[0]; + return true; } ); @@ -554,6 +558,7 @@ function (string $eventName, array $arguments = [], ?callable $continueCallBack $this->assertEquals('schedule', $eventName); $this->assertCount(1, $arguments); $iTipMessages[] = $arguments[0]; + return true; } ); @@ -677,6 +682,7 @@ function (string $eventName, array $arguments = [], ?callable $continueCallBack $this->assertEquals('schedule', $eventName); $this->assertCount(1, $arguments); $iTipMessages[] = $arguments[0]; + return true; } ); diff --git a/apps/dav/tests/unit/CalDAV/Search/Request/CalendarSearchReportTest.php b/apps/dav/tests/unit/CalDAV/Search/Request/CalendarSearchReportTest.php index cbfd4639ed75e..e7fd528a21e5f 100644 --- a/apps/dav/tests/unit/CalDAV/Search/Request/CalendarSearchReportTest.php +++ b/apps/dav/tests/unit/CalDAV/Search/Request/CalendarSearchReportTest.php @@ -317,6 +317,7 @@ private function parse($xml, array $elementMap = []) { $reader = new Reader(); $reader->elementMap = array_merge($this->elementMap, $elementMap); $reader->xml($xml); + return $reader->parse(); } } diff --git a/apps/dav/tests/unit/CardDAV/Activity/BackendTest.php b/apps/dav/tests/unit/CardDAV/Activity/BackendTest.php index 134a6ca5ca04e..4eeabcf9148e0 100644 --- a/apps/dav/tests/unit/CardDAV/Activity/BackendTest.php +++ b/apps/dav/tests/unit/CardDAV/Activity/BackendTest.php @@ -494,6 +494,7 @@ protected function getUsers(array $users): array { foreach ($users as $user) { $list[] = $this->getUserMock($user); } + return $list; } @@ -506,6 +507,7 @@ protected function getUserMock(string $uid) { $user->expects($this->once()) ->method('getUID') ->willReturn($uid); + return $user; } } diff --git a/apps/dav/tests/unit/CardDAV/AddressBookTest.php b/apps/dav/tests/unit/CardDAV/AddressBookTest.php index cbdb9a1402ca4..622f2e72b7164 100644 --- a/apps/dav/tests/unit/CardDAV/AddressBookTest.php +++ b/apps/dav/tests/unit/CardDAV/AddressBookTest.php @@ -131,9 +131,11 @@ public function testAcl($expectsWrite, $readOnlyValue, $hasOwnerSet): void { if (!is_null($readOnlyValue)) { $addressBookInfo['{http://owncloud.org/ns}read-only'] = $readOnlyValue; } + if ($hasOwnerSet) { $addressBookInfo['{http://owncloud.org/ns}owner-principal'] = 'user1'; } + $l10n = $this->createMock(IL10N::class); $logger = $this->createMock(LoggerInterface::class); $addressBook = new AddressBook($backend, $addressBookInfo, $l10n, $logger); @@ -167,6 +169,7 @@ public function testAcl($expectsWrite, $readOnlyValue, $hasOwnerSet): void { ]; } } + $this->assertEquals($expectedAcl, $acl); $this->assertEquals($expectedAcl, $childAcl); } diff --git a/apps/dav/tests/unit/CardDAV/BirthdayServiceTest.php b/apps/dav/tests/unit/CardDAV/BirthdayServiceTest.php index aeee04fd6eee8..3948ef608e931 100644 --- a/apps/dav/tests/unit/CardDAV/BirthdayServiceTest.php +++ b/apps/dav/tests/unit/CardDAV/BirthdayServiceTest.php @@ -254,6 +254,7 @@ public function testOnCardChanged($expectedOp): void { [1234, 'default-gump.vcf-anniversary.ics'] ); } + if ($expectedOp === 'create') { $vCal = new VCalendar(); $vCal->PRODID = '-//Nextcloud testing//mocked object//'; @@ -265,6 +266,7 @@ public function testOnCardChanged($expectedOp): void { [1234, 'default-gump.vcf-anniversary.ics', "BEGIN:VCALENDAR\r\nVERSION:2.0\r\nCALSCALE:GREGORIAN\r\nPRODID:-//Nextcloud testing//mocked object//\r\nEND:VCALENDAR\r\n"] ); } + if ($expectedOp === 'update') { $vCal = new VCalendar(); $vCal->PRODID = '-//Nextcloud testing//mocked object//'; diff --git a/apps/dav/tests/unit/CardDAV/CardDavBackendTest.php b/apps/dav/tests/unit/CardDAV/CardDavBackendTest.php index 91d7cc5f49e86..96968909d1cc6 100644 --- a/apps/dav/tests/unit/CardDAV/CardDavBackendTest.php +++ b/apps/dav/tests/unit/CardDAV/CardDavBackendTest.php @@ -72,35 +72,35 @@ class CardDavBackendTest extends TestCase { public const UNIT_TEST_USER1 = 'principals/users/carddav-unit-test1'; public const UNIT_TEST_GROUP = 'principals/groups/carddav-unit-test-group'; - private $vcardTest0 = 'BEGIN:VCARD'.PHP_EOL. - 'VERSION:3.0'.PHP_EOL. - 'PRODID:-//Sabre//Sabre VObject 4.1.2//EN'.PHP_EOL. - 'UID:Test'.PHP_EOL. - 'FN:Test'.PHP_EOL. - 'N:Test;;;;'.PHP_EOL. + private $vcardTest0 = 'BEGIN:VCARD' . PHP_EOL . + 'VERSION:3.0' . PHP_EOL . + 'PRODID:-//Sabre//Sabre VObject 4.1.2//EN' . PHP_EOL . + 'UID:Test' . PHP_EOL . + 'FN:Test' . PHP_EOL . + 'N:Test;;;;' . PHP_EOL . 'END:VCARD'; - private $vcardTest1 = 'BEGIN:VCARD'.PHP_EOL. - 'VERSION:3.0'.PHP_EOL. - 'PRODID:-//Sabre//Sabre VObject 4.1.2//EN'.PHP_EOL. - 'UID:Test2'.PHP_EOL. - 'FN:Test2'.PHP_EOL. - 'N:Test2;;;;'.PHP_EOL. + private $vcardTest1 = 'BEGIN:VCARD' . PHP_EOL . + 'VERSION:3.0' . PHP_EOL . + 'PRODID:-//Sabre//Sabre VObject 4.1.2//EN' . PHP_EOL . + 'UID:Test2' . PHP_EOL . + 'FN:Test2' . PHP_EOL . + 'N:Test2;;;;' . PHP_EOL . 'END:VCARD'; - private $vcardTest2 = 'BEGIN:VCARD'.PHP_EOL. - 'VERSION:3.0'.PHP_EOL. - 'PRODID:-//Sabre//Sabre VObject 4.1.2//EN'.PHP_EOL. - 'UID:Test3'.PHP_EOL. - 'FN:Test3'.PHP_EOL. - 'N:Test3;;;;'.PHP_EOL. + private $vcardTest2 = 'BEGIN:VCARD' . PHP_EOL . + 'VERSION:3.0' . PHP_EOL . + 'PRODID:-//Sabre//Sabre VObject 4.1.2//EN' . PHP_EOL . + 'UID:Test3' . PHP_EOL . + 'FN:Test3' . PHP_EOL . + 'N:Test3;;;;' . PHP_EOL . 'END:VCARD'; - private $vcardTestNoUID = 'BEGIN:VCARD'.PHP_EOL. - 'VERSION:3.0'.PHP_EOL. - 'PRODID:-//Sabre//Sabre VObject 4.1.2//EN'.PHP_EOL. - 'FN:TestNoUID'.PHP_EOL. - 'N:TestNoUID;;;;'.PHP_EOL. + private $vcardTestNoUID = 'BEGIN:VCARD' . PHP_EOL . + 'VERSION:3.0' . PHP_EOL . + 'PRODID:-//Sabre//Sabre VObject 4.1.2//EN' . PHP_EOL . + 'FN:TestNoUID' . PHP_EOL . + 'N:TestNoUID;;;;' . PHP_EOL . 'END:VCARD'; protected function setUp(): void { @@ -332,7 +332,7 @@ public function testMultiCard(): void { $this->assertArrayHasKey('lastmodified', $card); $this->assertArrayHasKey('etag', $card); $this->assertArrayHasKey('size', $card); - $this->assertEquals($this->{ 'vcardTest'.($index + 1) }, $card['carddata']); + $this->assertEquals($this->{ 'vcardTest' . ($index + 1) }, $card['carddata']); } // delete the card diff --git a/apps/dav/tests/unit/CardDAV/ConverterTest.php b/apps/dav/tests/unit/CardDAV/ConverterTest.php index c29e0db507097..71ef71d8ece6d 100644 --- a/apps/dav/tests/unit/CardDAV/ConverterTest.php +++ b/apps/dav/tests/unit/CardDAV/ConverterTest.php @@ -60,6 +60,7 @@ protected function getAccountPropertyMock(string $name, ?string $value, string $ $property->expects($this->any()) ->method('getVerified') ->willReturn(IAccountManager::NOT_VERIFIED); + return $property; } @@ -135,6 +136,7 @@ protected function compareData($expected, $data) { break; } } + if (!$found) { $this->assertTrue(false, 'Expected data: ' . $key . ' not found.'); } @@ -231,6 +233,7 @@ protected function getUserMock(string $displayName, ?string $eMailAddress, ?stri $user->method('getEMailAddress')->willReturn($eMailAddress); $user->method('getCloudId')->willReturn($cloudId); $user->method('getAvatarImage')->willReturn($image0); + return $user; } } diff --git a/apps/dav/tests/unit/CardDAV/ImageExportPluginTest.php b/apps/dav/tests/unit/CardDAV/ImageExportPluginTest.php index 6718153f91041..98c260b789fe9 100644 --- a/apps/dav/tests/unit/CardDAV/ImageExportPluginTest.php +++ b/apps/dav/tests/unit/CardDAV/ImageExportPluginTest.php @@ -128,6 +128,7 @@ public function testCard($size, $photo): void { } elseif ($path === 'user/book') { return $book; } + $this->fail(); }); diff --git a/apps/dav/tests/unit/Command/DeleteCalendarTest.php b/apps/dav/tests/unit/Command/DeleteCalendarTest.php index 583673c9d3086..b621e6737d546 100644 --- a/apps/dav/tests/unit/Command/DeleteCalendarTest.php +++ b/apps/dav/tests/unit/Command/DeleteCalendarTest.php @@ -100,7 +100,7 @@ public function testNoCalendarName(): void { public function testInvalidCalendar(): void { $this->expectException(\InvalidArgumentException::class); $this->expectExceptionMessage( - 'User <' . self::USER . '> has no calendar named <' . self::NAME . '>.'); + 'User <' . self::USER . '> has no calendar named <' . self::NAME . '>.'); $this->userManager->expects($this->once()) ->method('userExists') diff --git a/apps/dav/tests/unit/Comments/CommentsNodeTest.php b/apps/dav/tests/unit/Comments/CommentsNodeTest.php index c253c59df0f93..9e79352b9da11 100644 --- a/apps/dav/tests/unit/Comments/CommentsNodeTest.php +++ b/apps/dav/tests/unit/Comments/CommentsNodeTest.php @@ -488,6 +488,7 @@ public function testGetProperties(): void { $this->assertSame($expected[$name], $value); unset($expected[$name]); } + $this->assertTrue(empty($expected)); } @@ -498,6 +499,7 @@ public function readCommentProvider() { $readDT1->sub($diff); $readDT2 = clone $creationDT; $readDT2->add($diff); + return [ [$creationDT, $readDT1, 'true'], [$creationDT, $readDT2, 'false'], diff --git a/apps/dav/tests/unit/Connector/Sabre/FileTest.php b/apps/dav/tests/unit/Connector/Sabre/FileTest.php index 55a6783225d8e..f63a4430d3154 100644 --- a/apps/dav/tests/unit/Connector/Sabre/FileTest.php +++ b/apps/dav/tests/unit/Connector/Sabre/FileTest.php @@ -78,6 +78,7 @@ private function getMockStorage(): MockObject&IStorage { ->getMock(); $storage->method('getId') ->willReturn('home::someuser'); + return $storage; } @@ -85,6 +86,7 @@ private function getStream(string $string) { $stream = fopen('php://temp', 'r+'); fwrite($stream, $string); fseek($stream, 0); + return $stream; } @@ -872,6 +874,7 @@ private function listPartFiles(?\OC\Files\View $userView = null, $path = '') { if ($userView === null) { $userView = \OC\Files\Filesystem::getView(); } + $files = []; [$storage, $internalPath] = $userView->resolvePath($path); if ($storage instanceof Local) { @@ -882,8 +885,10 @@ private function listPartFiles(?\OC\Files\View $userView = null, $path = '') { $files[] = $file; } } + closedir($dh); } + return $files; } @@ -898,6 +903,7 @@ private function getFileInfos($path = '', ?View $userView = null) { if ($userView === null) { $userView = Filesystem::getView(); } + return [ 'filesize' => $userView->filesize($path), 'mtime' => $userView->filemtime($path), diff --git a/apps/dav/tests/unit/Connector/Sabre/NodeTest.php b/apps/dav/tests/unit/Connector/Sabre/NodeTest.php index c5e2b03d8b481..d589e71fd5dba 100644 --- a/apps/dav/tests/unit/Connector/Sabre/NodeTest.php +++ b/apps/dav/tests/unit/Connector/Sabre/NodeTest.php @@ -91,6 +91,7 @@ public function testDavPermissions($permissions, $type, $shared, $shareRootPermi $storage->method('instanceOfStorage') ->willReturn(false); } + $info->method('getStorage') ->willReturn($storage); $view = $this->getMockBuilder(View::class) diff --git a/apps/dav/tests/unit/Connector/Sabre/ObjectTreeTest.php b/apps/dav/tests/unit/Connector/Sabre/ObjectTreeTest.php index 5010f7698b5cd..4f2e5174325db 100644 --- a/apps/dav/tests/unit/Connector/Sabre/ObjectTreeTest.php +++ b/apps/dav/tests/unit/Connector/Sabre/ObjectTreeTest.php @@ -127,7 +127,7 @@ public function testGetNodeForPath( $inputFileName, $fileInfoQueryPath, $outputFileName, - $type + $type, ): void { $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 30e2c995d1811..27c4efdba203c 100644 --- a/apps/dav/tests/unit/Connector/Sabre/PrincipalTest.php +++ b/apps/dav/tests/unit/Connector/Sabre/PrincipalTest.php @@ -453,9 +453,11 @@ public function testSetGroupMembershipProxy(): void { if ($proxy->getOwnerId() !== 'principals/users/foo') { return false; } + if ($proxy->getProxyId() !== 'principals/users/bar') { return false; } + if ($proxy->getPermissions() !== 3) { return false; } diff --git a/apps/dav/tests/unit/Connector/Sabre/RequestTest/Auth.php b/apps/dav/tests/unit/Connector/Sabre/RequestTest/Auth.php index cf1ea4c6bae02..9b3aef991d11e 100644 --- a/apps/dav/tests/unit/Connector/Sabre/RequestTest/Auth.php +++ b/apps/dav/tests/unit/Connector/Sabre/RequestTest/Auth.php @@ -70,8 +70,10 @@ public function check(RequestInterface $request, ResponseInterface $response) { \OC_Util::setupFS($user); //trigger creation of user home and /files folder \OC::$server->getUserFolder($user); + return [true, "principals/$user"]; } + return [false, 'login failed']; } diff --git a/apps/dav/tests/unit/Connector/Sabre/RequestTest/EncryptionMasterKeyUploadTest.php b/apps/dav/tests/unit/Connector/Sabre/RequestTest/EncryptionMasterKeyUploadTest.php index cbaa0c3101b57..6f93a89312ba4 100644 --- a/apps/dav/tests/unit/Connector/Sabre/RequestTest/EncryptionMasterKeyUploadTest.php +++ b/apps/dav/tests/unit/Connector/Sabre/RequestTest/EncryptionMasterKeyUploadTest.php @@ -28,6 +28,7 @@ protected function setupUser($name, $password) { \OC::$server->getConfig()->setAppValue('encryption', 'useMasterKey', '1'); $this->setupForUser($name, $password); $this->loginWithEncryption($name); + return new View('/' . $name . '/files'); } } diff --git a/apps/dav/tests/unit/Connector/Sabre/RequestTest/EncryptionUploadTest.php b/apps/dav/tests/unit/Connector/Sabre/RequestTest/EncryptionUploadTest.php index f830c54fd0d29..b892348f46ec6 100644 --- a/apps/dav/tests/unit/Connector/Sabre/RequestTest/EncryptionUploadTest.php +++ b/apps/dav/tests/unit/Connector/Sabre/RequestTest/EncryptionUploadTest.php @@ -28,6 +28,7 @@ protected function setupUser($name, $password) { \OC::$server->getConfig()->setAppValue('encryption', 'useMasterKey', '0'); $this->setupForUser($name, $password); $this->loginWithEncryption($name); + return new View('/' . $name . '/files'); } } diff --git a/apps/dav/tests/unit/Connector/Sabre/RequestTest/RequestTestCase.php b/apps/dav/tests/unit/Connector/Sabre/RequestTest/RequestTestCase.php index 29574d53bca25..1aab6377a434b 100644 --- a/apps/dav/tests/unit/Connector/Sabre/RequestTest/RequestTestCase.php +++ b/apps/dav/tests/unit/Connector/Sabre/RequestTest/RequestTestCase.php @@ -33,6 +33,7 @@ protected function getStream($string) { $stream = fopen('php://temp', 'r+'); fwrite($stream, $string); fseek($stream, 0); + return $stream; } @@ -60,6 +61,7 @@ protected function setupUser($name, $password) { $tmpFolder = \OC::$server->getTempManager()->getTemporaryFolder(); $this->registerMount($name, '\OC\Files\Storage\Local', '/' . $name, ['datadir' => $tmpFolder]); $this->loginAsUser($name); + return new View('/' . $name . '/files'); } @@ -78,6 +80,7 @@ protected function request($view, $user, $password, $method, $url, $body = null, if (is_string($body)) { $body = $this->getStream($body); } + $this->logout(); $exceptionPlugin = new ExceptionPlugin('webdav', \OC::$server->get(LoggerInterface::class)); $server = $this->getSabreServer($view, $user, $password, $exceptionPlugin); @@ -91,6 +94,7 @@ protected function request($view, $user, $password, $method, $url, $body = null, $serverParams['HTTP_' . strtoupper(str_replace('-', '_', $header))] = $value; } } + $ncRequest = new \OC\AppFramework\Http\Request([ 'server' => $serverParams ], $this->createMock(IRequestId::class), $this->createMock(IConfig::class), null); @@ -104,6 +108,7 @@ protected function request($view, $user, $password, $method, $url, $body = null, foreach ($exceptionPlugin->getExceptions() as $exception) { throw $exception; } + return $result; } @@ -117,6 +122,7 @@ protected function makeRequest(Server $server, Request $request) { $server->sapi = $sapi; $server->httpRequest = $request; $server->exec(); + return $sapi->getResponse(); } diff --git a/apps/dav/tests/unit/Connector/Sabre/RequestTest/Sapi.php b/apps/dav/tests/unit/Connector/Sabre/RequestTest/Sapi.php index f7bcdd930cad6..1f7805dc9e09c 100644 --- a/apps/dav/tests/unit/Connector/Sabre/RequestTest/Sapi.php +++ b/apps/dav/tests/unit/Connector/Sabre/RequestTest/Sapi.php @@ -47,6 +47,7 @@ public function sendResponse(Response $response): void { } elseif (is_resource($response->getBody())) { stream_copy_to_stream($response->getBody(), $copyStream); } + rewind($copyStream); $this->response = new Response($response->getStatus(), $response->getHeaders(), $copyStream); } diff --git a/apps/dav/tests/unit/Connector/Sabre/SharesPluginTest.php b/apps/dav/tests/unit/Connector/Sabre/SharesPluginTest.php index 546be840cd8f9..2074507e3b99e 100644 --- a/apps/dav/tests/unit/Connector/Sabre/SharesPluginTest.php +++ b/apps/dav/tests/unit/Connector/Sabre/SharesPluginTest.php @@ -106,8 +106,10 @@ public function testGetProperties($shareTypes): void { $share = $this->createMock(IShare::class); $share->method('getShareType') ->willReturn($requestedShareType); + return [$share]; } + return []; }); @@ -185,6 +187,7 @@ public function testPreloadThenGetProperties($shareTypes): void { $share->expects($this->any()) ->method('getShareType') ->willReturn($type); + return $share; }, $shareTypes); diff --git a/apps/dav/tests/unit/Controller/DirectControllerTest.php b/apps/dav/tests/unit/Controller/DirectControllerTest.php index 2476681251c70..faaf67d266b24 100644 --- a/apps/dav/tests/unit/Controller/DirectControllerTest.php +++ b/apps/dav/tests/unit/Controller/DirectControllerTest.php @@ -136,7 +136,7 @@ public function testGetUrlValid(): void { $this->urlGenerator->method('getAbsoluteURL') ->willReturnCallback(function (string $url) { - return 'https://my.nextcloud/'.$url; + return 'https://my.nextcloud/' . $url; }); $result = $this->controller->getUrl(101); diff --git a/apps/dav/tests/unit/DAV/AnonymousOptionsTest.php b/apps/dav/tests/unit/DAV/AnonymousOptionsTest.php index ea5450391e8ca..96577289acbff 100644 --- a/apps/dav/tests/unit/DAV/AnonymousOptionsTest.php +++ b/apps/dav/tests/unit/DAV/AnonymousOptionsTest.php @@ -27,6 +27,7 @@ private function sendRequest($method, $path, $userAgent = '') { $server->sapi = new SapiMock(); $server->exec(); + return $server->httpResponse; } diff --git a/apps/dav/tests/unit/DAV/CustomPropertiesBackendTest.php b/apps/dav/tests/unit/DAV/CustomPropertiesBackendTest.php index 6fc87437fe058..ee074ecc88363 100644 --- a/apps/dav/tests/unit/DAV/CustomPropertiesBackendTest.php +++ b/apps/dav/tests/unit/DAV/CustomPropertiesBackendTest.php @@ -123,8 +123,10 @@ protected function getProps(string $user, string $path) { if ((int)$row['valuetype'] === CustomPropertiesBackend::PROPERTY_TYPE_HREF) { $value = new Href($value); } + $data[$row['propertyname']] = $value; } + $result->closeCursor(); return $data; @@ -205,6 +207,7 @@ public function testPropFindPrincipalCall(): void { $node = $this->createMock(Calendar::class); $node->method('getOwner') ->willReturn('principals/users/dummy_user_42'); + return $node; }); @@ -314,6 +317,7 @@ public function testPropFindPrincipalScheduleDefaultCalendarUrl( if (!str_starts_with($uri, self::BASE_URI)) { return trim(substr($uri, strlen(self::BASE_URI)), '/'); } + return null; }); $this->tree->method('getNodeForPath') @@ -321,13 +325,16 @@ public function testPropFindPrincipalScheduleDefaultCalendarUrl( if (str_starts_with($uri, 'principals/')) { return $this->createMock(IPrincipal::class); } + if (array_key_exists($uri, $nodes)) { $owner = explode('/', $uri)[1]; $node = $this->createMock($nodes[$uri]); $node->method('getOwner') ->willReturn("principals/users/$owner"); + return $node; } + throw new NotFound('Node not found'); }); @@ -352,6 +359,7 @@ public function testPropPatch(string $path, array $existing, array $props, array if (str_starts_with($uri, self::BASE_URI)) { return trim(substr($uri, strlen(self::BASE_URI)), '/'); } + return null; }); $this->tree->method('getNodeForPath') @@ -359,6 +367,7 @@ public function testPropPatch(string $path, array $existing, array $props, array $node = $this->createMock(Calendar::class); $node->method('getOwner') ->willReturn('principals/users/' . $this->user->getUID()); + return $node; }); @@ -402,6 +411,7 @@ public function testPropPatchWithUnsuitableCalendar(): void { if (str_starts_with($uri, self::BASE_URI)) { return trim(substr($uri, strlen(self::BASE_URI)), '/'); } + return null; }); $this->tree->expects(self::once()) diff --git a/apps/dav/tests/unit/DAV/GroupPrincipalTest.php b/apps/dav/tests/unit/DAV/GroupPrincipalTest.php index 92c89fc62f83b..1a8bf98173988 100644 --- a/apps/dav/tests/unit/DAV/GroupPrincipalTest.php +++ b/apps/dav/tests/unit/DAV/GroupPrincipalTest.php @@ -349,7 +349,8 @@ private function mockGroup($gid) { $fooGroup ->expects($this->exactly(1)) ->method('getDisplayName') - ->willReturn('Group '.$gid); + ->willReturn('Group ' . $gid); + return $fooGroup; } } diff --git a/apps/dav/tests/unit/DAV/ViewOnlyPluginTest.php b/apps/dav/tests/unit/DAV/ViewOnlyPluginTest.php index 7a4828dd2de53..27574088b1076 100644 --- a/apps/dav/tests/unit/DAV/ViewOnlyPluginTest.php +++ b/apps/dav/tests/unit/DAV/ViewOnlyPluginTest.php @@ -154,6 +154,7 @@ public function testCanGet(bool $isVersion, ?bool $attrEnabled, bool $expectCanD if (!$expectCanDownloadFile) { $this->expectException(Forbidden::class); } + $this->plugin->checkViewOnly($this->request); } } diff --git a/apps/dav/tests/unit/Files/FileSearchBackendTest.php b/apps/dav/tests/unit/Files/FileSearchBackendTest.php index f6fe8b1c1160a..e51e1d0bdcec4 100644 --- a/apps/dav/tests/unit/Files/FileSearchBackendTest.php +++ b/apps/dav/tests/unit/Files/FileSearchBackendTest.php @@ -276,6 +276,7 @@ private function getBasicQuery($type, $property, $value = null) { [new SearchPropertyDefinition($property, true, true, true), new \SearchDAV\Query\Literal($value)] ); } + $limit = new Limit(); return new Query($select, $from, $where, $orderBy, $limit); diff --git a/apps/dav/tests/unit/Files/MultipartRequestParserTest.php b/apps/dav/tests/unit/Files/MultipartRequestParserTest.php index ebe2a0b172e87..e6325ab8ad1e0 100644 --- a/apps/dav/tests/unit/Files/MultipartRequestParserTest.php +++ b/apps/dav/tests/unit/Files/MultipartRequestParserTest.php @@ -36,7 +36,7 @@ private function getMultipartParser(array $parts, array $headers = [], string $b ->disableOriginalConstructor() ->getMock(); - $headers = array_merge(['Content-Type' => 'multipart/related; boundary='.$boundary], $headers); + $headers = array_merge(['Content-Type' => 'multipart/related; boundary=' . $boundary], $headers); $request->expects($this->any()) ->method('getHeader') ->willReturnCallback(function (string $key) use (&$headers) { @@ -45,17 +45,17 @@ private function getMultipartParser(array $parts, array $headers = [], string $b $body = ''; foreach ($parts as $part) { - $body .= '--'.$boundary."\r\n"; + $body .= '--' . $boundary . "\r\n"; foreach ($part['headers'] as $headerKey => $headerPart) { - $body .= $headerKey.': '.$headerPart."\r\n"; + $body .= $headerKey . ': ' . $headerPart . "\r\n"; } $body .= "\r\n"; - $body .= $part['content']."\r\n"; + $body .= $part['content'] . "\r\n"; } - $body .= '--'.$boundary.'--'; + $body .= '--' . $boundary . '--'; $stream = fopen('php://temp', 'r+'); fwrite($stream, $body); diff --git a/apps/dav/tests/unit/Listener/OutOfOfficeListenerTest.php b/apps/dav/tests/unit/Listener/OutOfOfficeListenerTest.php index e1f474678b0d9..db632fe614c17 100644 --- a/apps/dav/tests/unit/Listener/OutOfOfficeListenerTest.php +++ b/apps/dav/tests/unit/Listener/OutOfOfficeListenerTest.php @@ -207,10 +207,12 @@ public function testHandleSchedulingWithDefaultTimezone(): void { if (!($vcalendar instanceof VCalendar)) { throw new InvalidArgumentException('Calendar data should be a VCALENDAR'); } + $vevent = $vcalendar->VEVENT; if ($vevent === null || !($vevent instanceof VEvent)) { throw new InvalidArgumentException('Calendar data should contain a VEVENT'); } + self::assertSame('Europe/Prague', $vevent->DTSTART['TZID']?->getValue()); self::assertSame('Europe/Prague', $vevent->DTEND['TZID']?->getValue()); }); @@ -357,10 +359,12 @@ public function testHandleChangeRecreate(): void { if (!($vcalendar instanceof VCalendar)) { throw new InvalidArgumentException('Calendar data should be a VCALENDAR'); } + $vevent = $vcalendar->VEVENT; if ($vevent === null || !($vevent instanceof VEvent)) { throw new InvalidArgumentException('Calendar data should contain a VEVENT'); } + self::assertSame('Europe/Berlin', $vevent->DTSTART['TZID']?->getValue()); self::assertSame('Europe/Berlin', $vevent->DTEND['TZID']?->getValue()); }); @@ -424,10 +428,12 @@ public function testHandleChangeWithoutTimezone(): void { if (!($vcalendar instanceof VCalendar)) { throw new InvalidArgumentException('Calendar data should be a VCALENDAR'); } + $vevent = $vcalendar->VEVENT; if ($vevent === null || !($vevent instanceof VEvent)) { throw new InvalidArgumentException('Calendar data should contain a VEVENT'); } + // UTC datetimes are stored without a TZID self::assertSame(null, $vevent->DTSTART['TZID']?->getValue()); self::assertSame(null, $vevent->DTEND['TZID']?->getValue()); diff --git a/apps/dav/tests/unit/Migration/RemoveDeletedUsersCalendarSubscriptionsTest.php b/apps/dav/tests/unit/Migration/RemoveDeletedUsersCalendarSubscriptionsTest.php index a3daf1c918a83..09538cec33f9f 100644 --- a/apps/dav/tests/unit/Migration/RemoveDeletedUsersCalendarSubscriptionsTest.php +++ b/apps/dav/tests/unit/Migration/RemoveDeletedUsersCalendarSubscriptionsTest.php @@ -126,6 +126,7 @@ public function testRun(array $subscriptions, array $userExists, int $deletions) return $userExists[$username]; }); } + $this->output->expects($this->once())->method('finishProgress'); $this->output->expects($this->once())->method('info')->with(sprintf('%d calendar subscriptions without an user have been cleaned up', $deletions)); diff --git a/apps/dav/tests/unit/Search/ContactsSearchProviderTest.php b/apps/dav/tests/unit/Search/ContactsSearchProviderTest.php index bfc57dc61d70c..0a83d238f0f5d 100644 --- a/apps/dav/tests/unit/Search/ContactsSearchProviderTest.php +++ b/apps/dav/tests/unit/Search/ContactsSearchProviderTest.php @@ -37,22 +37,22 @@ class ContactsSearchProviderTest extends TestCase { /** @var ContactsSearchProvider */ private $provider; - private $vcardTest0 = 'BEGIN:VCARD'.PHP_EOL. - 'VERSION:3.0'.PHP_EOL. - 'PRODID:-//Sabre//Sabre VObject 4.1.2//EN'.PHP_EOL. - 'UID:Test'.PHP_EOL. - 'FN:FN of Test'.PHP_EOL. - 'N:Test;;;;'.PHP_EOL. - 'EMAIL:forrestgump@example.com'.PHP_EOL. + private $vcardTest0 = 'BEGIN:VCARD' . PHP_EOL . + 'VERSION:3.0' . PHP_EOL . + 'PRODID:-//Sabre//Sabre VObject 4.1.2//EN' . PHP_EOL . + 'UID:Test' . PHP_EOL . + 'FN:FN of Test' . PHP_EOL . + 'N:Test;;;;' . PHP_EOL . + 'EMAIL:forrestgump@example.com' . PHP_EOL . 'END:VCARD'; - private $vcardTest1 = 'BEGIN:VCARD'.PHP_EOL. - 'VERSION:3.0'.PHP_EOL. - 'PRODID:-//Sabre//Sabre VObject 4.1.2//EN'.PHP_EOL. - 'PHOTO;ENCODING=b;TYPE=image/jpeg:'.PHP_EOL. - 'UID:Test2'.PHP_EOL. - 'FN:FN of Test2'.PHP_EOL. - 'N:Test2;;;;'.PHP_EOL. + private $vcardTest1 = 'BEGIN:VCARD' . PHP_EOL . + 'VERSION:3.0' . PHP_EOL . + 'PRODID:-//Sabre//Sabre VObject 4.1.2//EN' . PHP_EOL . + 'PHOTO;ENCODING=b;TYPE=image/jpeg:' . PHP_EOL . + 'UID:Test2' . PHP_EOL . + 'FN:FN of Test2' . PHP_EOL . + 'N:Test2;;;;' . PHP_EOL . 'END:VCARD'; protected function setUp(): void { diff --git a/apps/dav/tests/unit/Search/EventsSearchProviderTest.php b/apps/dav/tests/unit/Search/EventsSearchProviderTest.php index d194b7fa7c659..0eafe0782e5a9 100644 --- a/apps/dav/tests/unit/Search/EventsSearchProviderTest.php +++ b/apps/dav/tests/unit/Search/EventsSearchProviderTest.php @@ -38,183 +38,183 @@ class EventsSearchProviderTest extends TestCase { private $provider; // NO SUMMARY - private $vEvent0 = 'BEGIN:VCALENDAR'.PHP_EOL. - 'VERSION:2.0'.PHP_EOL. - 'PRODID:-//Apple Inc.//Mac OS X 10.11.6//EN'.PHP_EOL. - 'CALSCALE:GREGORIAN'.PHP_EOL. - 'BEGIN:VEVENT'.PHP_EOL. - 'CREATED:20161004T144433Z'.PHP_EOL. - 'UID:85560E76-1B0D-47E1-A735-21625767FCA4'.PHP_EOL. - 'DTEND;VALUE=DATE:20161008'.PHP_EOL. - 'TRANSP:TRANSPARENT'.PHP_EOL. - 'DTSTART;VALUE=DATE:20161005'.PHP_EOL. - 'DTSTAMP:20161004T144437Z'.PHP_EOL. - 'SEQUENCE:0'.PHP_EOL. - 'END:VEVENT'.PHP_EOL. + private $vEvent0 = 'BEGIN:VCALENDAR' . PHP_EOL . + 'VERSION:2.0' . PHP_EOL . + 'PRODID:-//Apple Inc.//Mac OS X 10.11.6//EN' . PHP_EOL . + 'CALSCALE:GREGORIAN' . PHP_EOL . + 'BEGIN:VEVENT' . PHP_EOL . + 'CREATED:20161004T144433Z' . PHP_EOL . + 'UID:85560E76-1B0D-47E1-A735-21625767FCA4' . PHP_EOL . + 'DTEND;VALUE=DATE:20161008' . PHP_EOL . + 'TRANSP:TRANSPARENT' . PHP_EOL . + 'DTSTART;VALUE=DATE:20161005' . PHP_EOL . + 'DTSTAMP:20161004T144437Z' . PHP_EOL . + 'SEQUENCE:0' . PHP_EOL . + 'END:VEVENT' . PHP_EOL . 'END:VCALENDAR'; // TIMED SAME DAY - private $vEvent1 = 'BEGIN:VCALENDAR'.PHP_EOL. - 'VERSION:2.0'.PHP_EOL. - 'PRODID:-//Tests//'.PHP_EOL. - 'CALSCALE:GREGORIAN'.PHP_EOL. - 'BEGIN:VTIMEZONE'.PHP_EOL. - 'TZID:Europe/Berlin'.PHP_EOL. - 'BEGIN:DAYLIGHT'.PHP_EOL. - 'TZOFFSETFROM:+0100'.PHP_EOL. - 'RRULE:FREQ=YEARLY;BYMONTH=3;BYDAY=-1SU'.PHP_EOL. - 'DTSTART:19810329T020000'.PHP_EOL. - 'TZNAME:GMT+2'.PHP_EOL. - 'TZOFFSETTO:+0200'.PHP_EOL. - 'END:DAYLIGHT'.PHP_EOL. - 'BEGIN:STANDARD'.PHP_EOL. - 'TZOFFSETFROM:+0200'.PHP_EOL. - 'RRULE:FREQ=YEARLY;BYMONTH=10;BYDAY=-1SU'.PHP_EOL. - 'DTSTART:19961027T030000'.PHP_EOL. - 'TZNAME:GMT+1'.PHP_EOL. - 'TZOFFSETTO:+0100'.PHP_EOL. - 'END:STANDARD'.PHP_EOL. - 'END:VTIMEZONE'.PHP_EOL. - 'BEGIN:VEVENT'.PHP_EOL. - 'CREATED:20160809T163629Z'.PHP_EOL. - 'UID:0AD16F58-01B3-463B-A215-FD09FC729A02'.PHP_EOL. - 'DTEND;TZID=Europe/Berlin:20160816T100000'.PHP_EOL. - 'TRANSP:OPAQUE'.PHP_EOL. - 'SUMMARY:Test Europe Berlin'.PHP_EOL. - 'DTSTART;TZID=Europe/Berlin:20160816T090000'.PHP_EOL. - 'DTSTAMP:20160809T163632Z'.PHP_EOL. - 'SEQUENCE:0'.PHP_EOL. - 'END:VEVENT'.PHP_EOL. + private $vEvent1 = 'BEGIN:VCALENDAR' . PHP_EOL . + 'VERSION:2.0' . PHP_EOL . + 'PRODID:-//Tests//' . PHP_EOL . + 'CALSCALE:GREGORIAN' . PHP_EOL . + 'BEGIN:VTIMEZONE' . PHP_EOL . + 'TZID:Europe/Berlin' . PHP_EOL . + 'BEGIN:DAYLIGHT' . PHP_EOL . + 'TZOFFSETFROM:+0100' . PHP_EOL . + 'RRULE:FREQ=YEARLY;BYMONTH=3;BYDAY=-1SU' . PHP_EOL . + 'DTSTART:19810329T020000' . PHP_EOL . + 'TZNAME:GMT+2' . PHP_EOL . + 'TZOFFSETTO:+0200' . PHP_EOL . + 'END:DAYLIGHT' . PHP_EOL . + 'BEGIN:STANDARD' . PHP_EOL . + 'TZOFFSETFROM:+0200' . PHP_EOL . + 'RRULE:FREQ=YEARLY;BYMONTH=10;BYDAY=-1SU' . PHP_EOL . + 'DTSTART:19961027T030000' . PHP_EOL . + 'TZNAME:GMT+1' . PHP_EOL . + 'TZOFFSETTO:+0100' . PHP_EOL . + 'END:STANDARD' . PHP_EOL . + 'END:VTIMEZONE' . PHP_EOL . + 'BEGIN:VEVENT' . PHP_EOL . + 'CREATED:20160809T163629Z' . PHP_EOL . + 'UID:0AD16F58-01B3-463B-A215-FD09FC729A02' . PHP_EOL . + 'DTEND;TZID=Europe/Berlin:20160816T100000' . PHP_EOL . + 'TRANSP:OPAQUE' . PHP_EOL . + 'SUMMARY:Test Europe Berlin' . PHP_EOL . + 'DTSTART;TZID=Europe/Berlin:20160816T090000' . PHP_EOL . + 'DTSTAMP:20160809T163632Z' . PHP_EOL . + 'SEQUENCE:0' . PHP_EOL . + 'END:VEVENT' . PHP_EOL . 'END:VCALENDAR'; // TIMED DIFFERENT DAY - private $vEvent2 = 'BEGIN:VCALENDAR'.PHP_EOL. - 'VERSION:2.0'.PHP_EOL. - 'PRODID:-//Tests//'.PHP_EOL. - 'CALSCALE:GREGORIAN'.PHP_EOL. - 'BEGIN:VTIMEZONE'.PHP_EOL. - 'TZID:Europe/Berlin'.PHP_EOL. - 'BEGIN:DAYLIGHT'.PHP_EOL. - 'TZOFFSETFROM:+0100'.PHP_EOL. - 'RRULE:FREQ=YEARLY;BYMONTH=3;BYDAY=-1SU'.PHP_EOL. - 'DTSTART:19810329T020000'.PHP_EOL. - 'TZNAME:GMT+2'.PHP_EOL. - 'TZOFFSETTO:+0200'.PHP_EOL. - 'END:DAYLIGHT'.PHP_EOL. - 'BEGIN:STANDARD'.PHP_EOL. - 'TZOFFSETFROM:+0200'.PHP_EOL. - 'RRULE:FREQ=YEARLY;BYMONTH=10;BYDAY=-1SU'.PHP_EOL. - 'DTSTART:19961027T030000'.PHP_EOL. - 'TZNAME:GMT+1'.PHP_EOL. - 'TZOFFSETTO:+0100'.PHP_EOL. - 'END:STANDARD'.PHP_EOL. - 'END:VTIMEZONE'.PHP_EOL. - 'BEGIN:VEVENT'.PHP_EOL. - 'CREATED:20160809T163629Z'.PHP_EOL. - 'UID:0AD16F58-01B3-463B-A215-FD09FC729A02'.PHP_EOL. - 'DTEND;TZID=Europe/Berlin:20160817T100000'.PHP_EOL. - 'TRANSP:OPAQUE'.PHP_EOL. - 'SUMMARY:Test Europe Berlin'.PHP_EOL. - 'DTSTART;TZID=Europe/Berlin:20160816T090000'.PHP_EOL. - 'DTSTAMP:20160809T163632Z'.PHP_EOL. - 'SEQUENCE:0'.PHP_EOL. - 'END:VEVENT'.PHP_EOL. + private $vEvent2 = 'BEGIN:VCALENDAR' . PHP_EOL . + 'VERSION:2.0' . PHP_EOL . + 'PRODID:-//Tests//' . PHP_EOL . + 'CALSCALE:GREGORIAN' . PHP_EOL . + 'BEGIN:VTIMEZONE' . PHP_EOL . + 'TZID:Europe/Berlin' . PHP_EOL . + 'BEGIN:DAYLIGHT' . PHP_EOL . + 'TZOFFSETFROM:+0100' . PHP_EOL . + 'RRULE:FREQ=YEARLY;BYMONTH=3;BYDAY=-1SU' . PHP_EOL . + 'DTSTART:19810329T020000' . PHP_EOL . + 'TZNAME:GMT+2' . PHP_EOL . + 'TZOFFSETTO:+0200' . PHP_EOL . + 'END:DAYLIGHT' . PHP_EOL . + 'BEGIN:STANDARD' . PHP_EOL . + 'TZOFFSETFROM:+0200' . PHP_EOL . + 'RRULE:FREQ=YEARLY;BYMONTH=10;BYDAY=-1SU' . PHP_EOL . + 'DTSTART:19961027T030000' . PHP_EOL . + 'TZNAME:GMT+1' . PHP_EOL . + 'TZOFFSETTO:+0100' . PHP_EOL . + 'END:STANDARD' . PHP_EOL . + 'END:VTIMEZONE' . PHP_EOL . + 'BEGIN:VEVENT' . PHP_EOL . + 'CREATED:20160809T163629Z' . PHP_EOL . + 'UID:0AD16F58-01B3-463B-A215-FD09FC729A02' . PHP_EOL . + 'DTEND;TZID=Europe/Berlin:20160817T100000' . PHP_EOL . + 'TRANSP:OPAQUE' . PHP_EOL . + 'SUMMARY:Test Europe Berlin' . PHP_EOL . + 'DTSTART;TZID=Europe/Berlin:20160816T090000' . PHP_EOL . + 'DTSTAMP:20160809T163632Z' . PHP_EOL . + 'SEQUENCE:0' . PHP_EOL . + 'END:VEVENT' . PHP_EOL . 'END:VCALENDAR'; // ALL-DAY ONE-DAY - private $vEvent3 = 'BEGIN:VCALENDAR'.PHP_EOL. - 'VERSION:2.0'.PHP_EOL. - 'PRODID:-//Apple Inc.//Mac OS X 10.11.6//EN'.PHP_EOL. - 'CALSCALE:GREGORIAN'.PHP_EOL. - 'BEGIN:VEVENT'.PHP_EOL. - 'CREATED:20161004T144433Z'.PHP_EOL. - 'UID:85560E76-1B0D-47E1-A735-21625767FCA4'.PHP_EOL. - 'DTEND;VALUE=DATE:20161006'.PHP_EOL. - 'TRANSP:TRANSPARENT'.PHP_EOL. - 'DTSTART;VALUE=DATE:20161005'.PHP_EOL. - 'DTSTAMP:20161004T144437Z'.PHP_EOL. - 'SEQUENCE:0'.PHP_EOL. - 'END:VEVENT'.PHP_EOL. + private $vEvent3 = 'BEGIN:VCALENDAR' . PHP_EOL . + 'VERSION:2.0' . PHP_EOL . + 'PRODID:-//Apple Inc.//Mac OS X 10.11.6//EN' . PHP_EOL . + 'CALSCALE:GREGORIAN' . PHP_EOL . + 'BEGIN:VEVENT' . PHP_EOL . + 'CREATED:20161004T144433Z' . PHP_EOL . + 'UID:85560E76-1B0D-47E1-A735-21625767FCA4' . PHP_EOL . + 'DTEND;VALUE=DATE:20161006' . PHP_EOL . + 'TRANSP:TRANSPARENT' . PHP_EOL . + 'DTSTART;VALUE=DATE:20161005' . PHP_EOL . + 'DTSTAMP:20161004T144437Z' . PHP_EOL . + 'SEQUENCE:0' . PHP_EOL . + 'END:VEVENT' . PHP_EOL . 'END:VCALENDAR'; // ALL-DAY MULTIPLE DAYS - private $vEvent4 = 'BEGIN:VCALENDAR'.PHP_EOL. - 'VERSION:2.0'.PHP_EOL. - 'PRODID:-//Apple Inc.//Mac OS X 10.11.6//EN'.PHP_EOL. - 'CALSCALE:GREGORIAN'.PHP_EOL. - 'BEGIN:VEVENT'.PHP_EOL. - 'CREATED:20161004T144433Z'.PHP_EOL. - 'UID:85560E76-1B0D-47E1-A735-21625767FCA4'.PHP_EOL. - 'DTEND;VALUE=DATE:20161008'.PHP_EOL. - 'TRANSP:TRANSPARENT'.PHP_EOL. - 'DTSTART;VALUE=DATE:20161005'.PHP_EOL. - 'DTSTAMP:20161004T144437Z'.PHP_EOL. - 'SEQUENCE:0'.PHP_EOL. - 'END:VEVENT'.PHP_EOL. + private $vEvent4 = 'BEGIN:VCALENDAR' . PHP_EOL . + 'VERSION:2.0' . PHP_EOL . + 'PRODID:-//Apple Inc.//Mac OS X 10.11.6//EN' . PHP_EOL . + 'CALSCALE:GREGORIAN' . PHP_EOL . + 'BEGIN:VEVENT' . PHP_EOL . + 'CREATED:20161004T144433Z' . PHP_EOL . + 'UID:85560E76-1B0D-47E1-A735-21625767FCA4' . PHP_EOL . + 'DTEND;VALUE=DATE:20161008' . PHP_EOL . + 'TRANSP:TRANSPARENT' . PHP_EOL . + 'DTSTART;VALUE=DATE:20161005' . PHP_EOL . + 'DTSTAMP:20161004T144437Z' . PHP_EOL . + 'SEQUENCE:0' . PHP_EOL . + 'END:VEVENT' . PHP_EOL . 'END:VCALENDAR'; // DURATION - private $vEvent5 = 'BEGIN:VCALENDAR'.PHP_EOL. - 'VERSION:2.0'.PHP_EOL. - 'PRODID:-//Apple Inc.//Mac OS X 10.11.6//EN'.PHP_EOL. - 'CALSCALE:GREGORIAN'.PHP_EOL. - 'BEGIN:VEVENT'.PHP_EOL. - 'CREATED:20161004T144433Z'.PHP_EOL. - 'UID:85560E76-1B0D-47E1-A735-21625767FCA4'.PHP_EOL. - 'DURATION:P5D'.PHP_EOL. - 'TRANSP:TRANSPARENT'.PHP_EOL. - 'DTSTART;VALUE=DATE:20161005'.PHP_EOL. - 'DTSTAMP:20161004T144437Z'.PHP_EOL. - 'SEQUENCE:0'.PHP_EOL. - 'END:VEVENT'.PHP_EOL. + private $vEvent5 = 'BEGIN:VCALENDAR' . PHP_EOL . + 'VERSION:2.0' . PHP_EOL . + 'PRODID:-//Apple Inc.//Mac OS X 10.11.6//EN' . PHP_EOL . + 'CALSCALE:GREGORIAN' . PHP_EOL . + 'BEGIN:VEVENT' . PHP_EOL . + 'CREATED:20161004T144433Z' . PHP_EOL . + 'UID:85560E76-1B0D-47E1-A735-21625767FCA4' . PHP_EOL . + 'DURATION:P5D' . PHP_EOL . + 'TRANSP:TRANSPARENT' . PHP_EOL . + 'DTSTART;VALUE=DATE:20161005' . PHP_EOL . + 'DTSTAMP:20161004T144437Z' . PHP_EOL . + 'SEQUENCE:0' . PHP_EOL . + 'END:VEVENT' . PHP_EOL . 'END:VCALENDAR'; // NO DTEND - DATE - private $vEvent6 = 'BEGIN:VCALENDAR'.PHP_EOL. - 'VERSION:2.0'.PHP_EOL. - 'PRODID:-//Apple Inc.//Mac OS X 10.11.6//EN'.PHP_EOL. - 'CALSCALE:GREGORIAN'.PHP_EOL. - 'BEGIN:VEVENT'.PHP_EOL. - 'CREATED:20161004T144433Z'.PHP_EOL. - 'UID:85560E76-1B0D-47E1-A735-21625767FCA4'.PHP_EOL. - 'TRANSP:TRANSPARENT'.PHP_EOL. - 'DTSTART;VALUE=DATE:20161005'.PHP_EOL. - 'DTSTAMP:20161004T144437Z'.PHP_EOL. - 'SEQUENCE:0'.PHP_EOL. - 'END:VEVENT'.PHP_EOL. + private $vEvent6 = 'BEGIN:VCALENDAR' . PHP_EOL . + 'VERSION:2.0' . PHP_EOL . + 'PRODID:-//Apple Inc.//Mac OS X 10.11.6//EN' . PHP_EOL . + 'CALSCALE:GREGORIAN' . PHP_EOL . + 'BEGIN:VEVENT' . PHP_EOL . + 'CREATED:20161004T144433Z' . PHP_EOL . + 'UID:85560E76-1B0D-47E1-A735-21625767FCA4' . PHP_EOL . + 'TRANSP:TRANSPARENT' . PHP_EOL . + 'DTSTART;VALUE=DATE:20161005' . PHP_EOL . + 'DTSTAMP:20161004T144437Z' . PHP_EOL . + 'SEQUENCE:0' . PHP_EOL . + 'END:VEVENT' . PHP_EOL . 'END:VCALENDAR'; // NO DTEND - DATE-TIME - private $vEvent7 = 'BEGIN:VCALENDAR'.PHP_EOL. - 'VERSION:2.0'.PHP_EOL. - 'PRODID:-//Tests//'.PHP_EOL. - 'CALSCALE:GREGORIAN'.PHP_EOL. - 'BEGIN:VTIMEZONE'.PHP_EOL. - 'TZID:Europe/Berlin'.PHP_EOL. - 'BEGIN:DAYLIGHT'.PHP_EOL. - 'TZOFFSETFROM:+0100'.PHP_EOL. - 'RRULE:FREQ=YEARLY;BYMONTH=3;BYDAY=-1SU'.PHP_EOL. - 'DTSTART:19810329T020000'.PHP_EOL. - 'TZNAME:GMT+2'.PHP_EOL. - 'TZOFFSETTO:+0200'.PHP_EOL. - 'END:DAYLIGHT'.PHP_EOL. - 'BEGIN:STANDARD'.PHP_EOL. - 'TZOFFSETFROM:+0200'.PHP_EOL. - 'RRULE:FREQ=YEARLY;BYMONTH=10;BYDAY=-1SU'.PHP_EOL. - 'DTSTART:19961027T030000'.PHP_EOL. - 'TZNAME:GMT+1'.PHP_EOL. - 'TZOFFSETTO:+0100'.PHP_EOL. - 'END:STANDARD'.PHP_EOL. - 'END:VTIMEZONE'.PHP_EOL. - 'BEGIN:VEVENT'.PHP_EOL. - 'CREATED:20160809T163629Z'.PHP_EOL. - 'UID:0AD16F58-01B3-463B-A215-FD09FC729A02'.PHP_EOL. - 'TRANSP:OPAQUE'.PHP_EOL. - 'SUMMARY:Test Europe Berlin'.PHP_EOL. - 'DTSTART;TZID=Europe/Berlin:20160816T090000'.PHP_EOL. - 'DTSTAMP:20160809T163632Z'.PHP_EOL. - 'SEQUENCE:0'.PHP_EOL. - 'END:VEVENT'.PHP_EOL. + private $vEvent7 = 'BEGIN:VCALENDAR' . PHP_EOL . + 'VERSION:2.0' . PHP_EOL . + 'PRODID:-//Tests//' . PHP_EOL . + 'CALSCALE:GREGORIAN' . PHP_EOL . + 'BEGIN:VTIMEZONE' . PHP_EOL . + 'TZID:Europe/Berlin' . PHP_EOL . + 'BEGIN:DAYLIGHT' . PHP_EOL . + 'TZOFFSETFROM:+0100' . PHP_EOL . + 'RRULE:FREQ=YEARLY;BYMONTH=3;BYDAY=-1SU' . PHP_EOL . + 'DTSTART:19810329T020000' . PHP_EOL . + 'TZNAME:GMT+2' . PHP_EOL . + 'TZOFFSETTO:+0200' . PHP_EOL . + 'END:DAYLIGHT' . PHP_EOL . + 'BEGIN:STANDARD' . PHP_EOL . + 'TZOFFSETFROM:+0200' . PHP_EOL . + 'RRULE:FREQ=YEARLY;BYMONTH=10;BYDAY=-1SU' . PHP_EOL . + 'DTSTART:19961027T030000' . PHP_EOL . + 'TZNAME:GMT+1' . PHP_EOL . + 'TZOFFSETTO:+0100' . PHP_EOL . + 'END:STANDARD' . PHP_EOL . + 'END:VTIMEZONE' . PHP_EOL . + 'BEGIN:VEVENT' . PHP_EOL . + 'CREATED:20160809T163629Z' . PHP_EOL . + 'UID:0AD16F58-01B3-463B-A215-FD09FC729A02' . PHP_EOL . + 'TRANSP:OPAQUE' . PHP_EOL . + 'SUMMARY:Test Europe Berlin' . PHP_EOL . + 'DTSTART;TZID=Europe/Berlin:20160816T090000' . PHP_EOL . + 'DTSTAMP:20160809T163632Z' . PHP_EOL . + 'SEQUENCE:0' . PHP_EOL . + 'END:VEVENT' . PHP_EOL . 'END:VCALENDAR'; protected function setUp(): void { diff --git a/apps/dav/tests/unit/Search/TasksSearchProviderTest.php b/apps/dav/tests/unit/Search/TasksSearchProviderTest.php index 18b6f0a593019..0b1bf1ba0d79c 100644 --- a/apps/dav/tests/unit/Search/TasksSearchProviderTest.php +++ b/apps/dav/tests/unit/Search/TasksSearchProviderTest.php @@ -38,67 +38,67 @@ class TasksSearchProviderTest extends TestCase { private $provider; // NO DUE NOR COMPLETED NOR SUMMARY - private $vTodo0 = 'BEGIN:VCALENDAR'.PHP_EOL. - 'PRODID:TEST'.PHP_EOL. - 'VERSION:2.0'.PHP_EOL. - 'BEGIN:VTODO'.PHP_EOL. - 'UID:20070313T123432Z-456553@example.com'.PHP_EOL. - 'DTSTAMP:20070313T123432Z'.PHP_EOL. - 'STATUS:NEEDS-ACTION'.PHP_EOL. - 'END:VTODO'.PHP_EOL. + private $vTodo0 = 'BEGIN:VCALENDAR' . PHP_EOL . + 'PRODID:TEST' . PHP_EOL . + 'VERSION:2.0' . PHP_EOL . + 'BEGIN:VTODO' . PHP_EOL . + 'UID:20070313T123432Z-456553@example.com' . PHP_EOL . + 'DTSTAMP:20070313T123432Z' . PHP_EOL . + 'STATUS:NEEDS-ACTION' . PHP_EOL . + 'END:VTODO' . PHP_EOL . 'END:VCALENDAR'; // DUE AND COMPLETED - private $vTodo1 = 'BEGIN:VCALENDAR'.PHP_EOL. - 'PRODID:TEST'.PHP_EOL. - 'VERSION:2.0'.PHP_EOL. - 'BEGIN:VTODO'.PHP_EOL. - 'UID:20070313T123432Z-456553@example.com'.PHP_EOL. - 'DTSTAMP:20070313T123432Z'.PHP_EOL. - 'COMPLETED:20070707T100000Z'.PHP_EOL. - 'DUE;VALUE=DATE:20070501'.PHP_EOL. - 'SUMMARY:Task title'.PHP_EOL. - 'STATUS:NEEDS-ACTION'.PHP_EOL. - 'END:VTODO'.PHP_EOL. + private $vTodo1 = 'BEGIN:VCALENDAR' . PHP_EOL . + 'PRODID:TEST' . PHP_EOL . + 'VERSION:2.0' . PHP_EOL . + 'BEGIN:VTODO' . PHP_EOL . + 'UID:20070313T123432Z-456553@example.com' . PHP_EOL . + 'DTSTAMP:20070313T123432Z' . PHP_EOL . + 'COMPLETED:20070707T100000Z' . PHP_EOL . + 'DUE;VALUE=DATE:20070501' . PHP_EOL . + 'SUMMARY:Task title' . PHP_EOL . + 'STATUS:NEEDS-ACTION' . PHP_EOL . + 'END:VTODO' . PHP_EOL . 'END:VCALENDAR'; // COMPLETED ONLY - private $vTodo2 = 'BEGIN:VCALENDAR'.PHP_EOL. - 'PRODID:TEST'.PHP_EOL. - 'VERSION:2.0'.PHP_EOL. - 'BEGIN:VTODO'.PHP_EOL. - 'UID:20070313T123432Z-456553@example.com'.PHP_EOL. - 'DTSTAMP:20070313T123432Z'.PHP_EOL. - 'COMPLETED:20070707T100000Z'.PHP_EOL. - 'SUMMARY:Task title'.PHP_EOL. - 'STATUS:NEEDS-ACTION'.PHP_EOL. - 'END:VTODO'.PHP_EOL. + private $vTodo2 = 'BEGIN:VCALENDAR' . PHP_EOL . + 'PRODID:TEST' . PHP_EOL . + 'VERSION:2.0' . PHP_EOL . + 'BEGIN:VTODO' . PHP_EOL . + 'UID:20070313T123432Z-456553@example.com' . PHP_EOL . + 'DTSTAMP:20070313T123432Z' . PHP_EOL . + 'COMPLETED:20070707T100000Z' . PHP_EOL . + 'SUMMARY:Task title' . PHP_EOL . + 'STATUS:NEEDS-ACTION' . PHP_EOL . + 'END:VTODO' . PHP_EOL . 'END:VCALENDAR'; // DUE DATE - private $vTodo3 = 'BEGIN:VCALENDAR'.PHP_EOL. - 'PRODID:TEST'.PHP_EOL. - 'VERSION:2.0'.PHP_EOL. - 'BEGIN:VTODO'.PHP_EOL. - 'UID:20070313T123432Z-456553@example.com'.PHP_EOL. - 'DTSTAMP:20070313T123432Z'.PHP_EOL. - 'DUE;VALUE=DATE:20070501'.PHP_EOL. - 'SUMMARY:Task title'.PHP_EOL. - 'STATUS:NEEDS-ACTION'.PHP_EOL. - 'END:VTODO'.PHP_EOL. + private $vTodo3 = 'BEGIN:VCALENDAR' . PHP_EOL . + 'PRODID:TEST' . PHP_EOL . + 'VERSION:2.0' . PHP_EOL . + 'BEGIN:VTODO' . PHP_EOL . + 'UID:20070313T123432Z-456553@example.com' . PHP_EOL . + 'DTSTAMP:20070313T123432Z' . PHP_EOL . + 'DUE;VALUE=DATE:20070501' . PHP_EOL . + 'SUMMARY:Task title' . PHP_EOL . + 'STATUS:NEEDS-ACTION' . PHP_EOL . + 'END:VTODO' . PHP_EOL . 'END:VCALENDAR'; // DUE DATETIME - private $vTodo4 = 'BEGIN:VCALENDAR'.PHP_EOL. - 'PRODID:TEST'.PHP_EOL. - 'VERSION:2.0'.PHP_EOL. - 'BEGIN:VTODO'.PHP_EOL. - 'UID:20070313T123432Z-456553@example.com'.PHP_EOL. - 'DTSTAMP:20070313T123432Z'.PHP_EOL. - 'DUE:20070709T130000Z'.PHP_EOL. - 'SUMMARY:Task title'.PHP_EOL. - 'STATUS:NEEDS-ACTION'.PHP_EOL. - 'END:VTODO'.PHP_EOL. + private $vTodo4 = 'BEGIN:VCALENDAR' . PHP_EOL . + 'PRODID:TEST' . PHP_EOL . + 'VERSION:2.0' . PHP_EOL . + 'BEGIN:VTODO' . PHP_EOL . + 'UID:20070313T123432Z-456553@example.com' . PHP_EOL . + 'DTSTAMP:20070313T123432Z' . PHP_EOL . + 'DUE:20070709T130000Z' . PHP_EOL . + 'SUMMARY:Task title' . PHP_EOL . + 'STATUS:NEEDS-ACTION' . PHP_EOL . + 'END:VTODO' . PHP_EOL . 'END:VCALENDAR'; protected function setUp(): void { diff --git a/apps/dav/tests/unit/Service/AbsenceServiceTest.php b/apps/dav/tests/unit/Service/AbsenceServiceTest.php index 5cff29a6f61ac..ce7764a44d3b0 100644 --- a/apps/dav/tests/unit/Service/AbsenceServiceTest.php +++ b/apps/dav/tests/unit/Service/AbsenceServiceTest.php @@ -100,6 +100,7 @@ public function testCreateAbsenceEmitsScheduledEvent(): void { ); self::assertEquals('status', $data->getShortMessage()); self::assertEquals('message', $data->getMessage()); + return true; })); $this->timeFactory->expects(self::once()) @@ -140,6 +141,7 @@ public function testUpdateAbsenceEmitsChangedEvent(): void { self::assertEquals('2023-01-10', $absence->getLastDay()); self::assertEquals('status', $absence->getStatus()); self::assertEquals('message', $absence->getMessage()); + return $absence; }); $this->timezoneService->expects(self::once()) @@ -164,6 +166,7 @@ public function testUpdateAbsenceEmitsChangedEvent(): void { ); self::assertEquals('status', $data->getShortMessage()); self::assertEquals('message', $data->getMessage()); + return true; })); $this->timeFactory->expects(self::once()) @@ -331,6 +334,7 @@ public function testUpdateAbsenceSchedulesBothJobs(): void { ->willReturnCallback(static function (Absence $absence) use ($startDateString, $endDateString): Absence { self::assertEquals($startDateString, $absence->getFirstDay()); self::assertEquals($endDateString, $absence->getLastDay()); + return $absence; }); $this->timezoneService->expects(self::once()) @@ -385,6 +389,7 @@ public function testUpdateSchedulesOnlyEndJob(): void { ->willReturnCallback(static function (Absence $absence) use ($endDateString): Absence { self::assertEquals('2023-01-05', $absence->getFirstDay()); self::assertEquals($endDateString, $absence->getLastDay()); + return $absence; }); $this->timezoneService->expects(self::once()) @@ -431,6 +436,7 @@ public function testUpdateAbsenceSchedulesNoJob(): void { ->willReturnCallback(static function (Absence $absence): Absence { self::assertEquals('2023-01-05', $absence->getFirstDay()); self::assertEquals('2023-01-10', $absence->getLastDay()); + return $absence; }); $this->timezoneService->expects(self::once()) diff --git a/apps/dav/tests/unit/SystemTag/SystemTagMappingNodeTest.php b/apps/dav/tests/unit/SystemTag/SystemTagMappingNodeTest.php index 308950cef341f..9091f46eb545d 100644 --- a/apps/dav/tests/unit/SystemTag/SystemTagMappingNodeTest.php +++ b/apps/dav/tests/unit/SystemTag/SystemTagMappingNodeTest.php @@ -34,6 +34,7 @@ public function getMappingNode($tag = null, array $writableNodeIds = []) { if ($tag === null) { $tag = new SystemTag(1, 'Test', true, true); } + return new \OCA\DAV\SystemTag\SystemTagMappingNode( $tag, 123, diff --git a/apps/dav/tests/unit/SystemTag/SystemTagNodeTest.php b/apps/dav/tests/unit/SystemTag/SystemTagNodeTest.php index 82aa81674dfa2..46feef60e031b 100644 --- a/apps/dav/tests/unit/SystemTag/SystemTagNodeTest.php +++ b/apps/dav/tests/unit/SystemTag/SystemTagNodeTest.php @@ -40,6 +40,7 @@ protected function getTagNode($isAdmin = true, $tag = null) { if ($tag === null) { $tag = new SystemTag(1, 'Test', true, true); } + return new \OCA\DAV\SystemTag\SystemTagNode( $tag, $this->user, @@ -234,6 +235,7 @@ public function testDeleteTag($isAdmin): void { if (!$isAdmin) { $this->expectException(Forbidden::class); } + $this->getTagNode($isAdmin, $tag)->delete(); } diff --git a/apps/dav/tests/unit/SystemTag/SystemTagPluginTest.php b/apps/dav/tests/unit/SystemTag/SystemTagPluginTest.php index 67e7afa9c548a..9fdbf625eb55d 100644 --- a/apps/dav/tests/unit/SystemTag/SystemTagPluginTest.php +++ b/apps/dav/tests/unit/SystemTag/SystemTagPluginTest.php @@ -395,6 +395,7 @@ public function testCreateNotAssignableTagAsRegularUser($userVisible, $userAssig if (!empty($groups)) { $requestData['groups'] = $groups; } + $requestData = json_encode($requestData); $node = $this->getMockBuilder(SystemTagsByIdCollection::class) @@ -517,6 +518,7 @@ public function testCreateTagInByIdCollection($userVisible, $userAssignable, $gr if (!empty($groups)) { $requestData['groups'] = $groups; } + $requestData = json_encode($requestData); $node = $this->getMockBuilder(SystemTagsByIdCollection::class) diff --git a/apps/dav/tests/unit/SystemTag/SystemTagsByIdCollectionTest.php b/apps/dav/tests/unit/SystemTag/SystemTagsByIdCollectionTest.php index db55d82adc98a..d2fde989e021f 100644 --- a/apps/dav/tests/unit/SystemTag/SystemTagsByIdCollectionTest.php +++ b/apps/dav/tests/unit/SystemTag/SystemTagsByIdCollectionTest.php @@ -50,6 +50,7 @@ public function getNode($isAdmin = true) { ->method('isAdmin') ->with('testuser') ->willReturn($isAdmin); + return new \OCA\DAV\SystemTag\SystemTagsByIdCollection( $this->tagManager, $userSession, diff --git a/apps/dav/tests/unit/SystemTag/SystemTagsObjectTypeCollectionTest.php b/apps/dav/tests/unit/SystemTag/SystemTagsObjectTypeCollectionTest.php index b202f340e328f..061e9b28234b1 100644 --- a/apps/dav/tests/unit/SystemTag/SystemTagsObjectTypeCollectionTest.php +++ b/apps/dav/tests/unit/SystemTag/SystemTagsObjectTypeCollectionTest.php @@ -76,6 +76,7 @@ protected function setUp(): void { return true; } } + return false; }; diff --git a/apps/dav/tests/unit/Upload/AssemblyStreamTest.php b/apps/dav/tests/unit/Upload/AssemblyStreamTest.php index a8517bf757c78..f23f29e98763d 100644 --- a/apps/dav/tests/unit/Upload/AssemblyStreamTest.php +++ b/apps/dav/tests/unit/Upload/AssemblyStreamTest.php @@ -117,6 +117,7 @@ private function makeData($count) { $j = 0; } } + return $data; } diff --git a/apps/dav/tests/unit/bootstrap.php b/apps/dav/tests/unit/bootstrap.php index 61dbda35ae252..886a7f0b859f2 100644 --- a/apps/dav/tests/unit/bootstrap.php +++ b/apps/dav/tests/unit/bootstrap.php @@ -9,7 +9,7 @@ define('PHPUNIT_RUN', 1); } -require_once __DIR__.'/../../../../lib/base.php'; +require_once __DIR__ . '/../../../../lib/base.php'; \OC::$composerAutoloader->addPsr4('Test\\', OC::$SERVERROOT . '/tests/lib/', true); diff --git a/apps/encryption/lib/Command/DisableMasterKey.php b/apps/encryption/lib/Command/DisableMasterKey.php index 1912d09728d01..f613f14b71973 100644 --- a/apps/encryption/lib/Command/DisableMasterKey.php +++ b/apps/encryption/lib/Command/DisableMasterKey.php @@ -46,10 +46,12 @@ protected function execute(InputInterface $input, OutputInterface $output): int if ($this->questionHelper->ask($input, $output, $question)) { $this->config->setAppValue('encryption', 'useMasterKey', '0'); $output->writeln('Master key successfully disabled.'); + return self::SUCCESS; } $output->writeln('aborted.'); + return self::FAILURE; } } diff --git a/apps/encryption/lib/Command/DropLegacyFileKey.php b/apps/encryption/lib/Command/DropLegacyFileKey.php index 03c24fe8a22af..3a6299712e1da 100644 --- a/apps/encryption/lib/Command/DropLegacyFileKey.php +++ b/apps/encryption/lib/Command/DropLegacyFileKey.php @@ -52,6 +52,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int $this->setupUserFS($user); $result = $result && $this->scanFolder($output, '/' . $user); } + $offset += $limit; } while (count($users) >= $limit); } @@ -94,6 +95,7 @@ private function scanFolder(OutputInterface $output, string $folder): bool { $output->writeln('Got a decryption error for legacy filekey for ' . $path . ', continuing', OutputInterface::VERBOSITY_VERBOSE); continue; } + /* If that did not throw and filekey is not empty, a legacy filekey is used */ $clean = false; $output->writeln($path . ' is using a legacy filekey, migrating'); @@ -114,13 +116,16 @@ private function migrateSinglefile(string $path, FileInfo $fileInfo, OutputInter $copyResource = $this->rootView->fopen($target, 'r'); $sourceResource = $this->rootView->fopen($source, 'w'); if ($copyResource === false || $sourceResource === false) { - throw new DecryptionFailedException('Failed to open '.$source.' or '.$target); + throw new DecryptionFailedException('Failed to open ' . $source . ' or ' . $target); } + if (stream_copy_to_stream($copyResource, $sourceResource) === false) { - $output->writeln('