* @package OCA\DAV\Tests\Unit\AppInfo
*/
class ApplicationTest extends TestCase {
- public function test() {
+ public function test(): void {
$app = new Application();
$c = $app->getContainer();
* @package OCA\DAV\Tests\Unit\AppInfo
*/
class PluginManagerTest extends TestCase {
- public function test() {
+ public function test(): void {
$server = $this->createMock(ServerContainer::class);
/**
* @dataProvider providesForbiddenMethods
*/
- public function testForbiddenMethods($method) {
+ public function testForbiddenMethods($method): void {
$this->expectException(\Sabre\DAV\Exception\Forbidden::class);
$this->home->$method('');
];
}
- public function testGetName() {
+ public function testGetName(): void {
$n = $this->home->getName();
self::assertEquals('admin', $n);
}
/**
* @dataProvider providesTestGetChild
*/
- public function testGetChild($expectedException, $hasAvatar, $path) {
+ public function testGetChild($expectedException, $hasAvatar, $path): void {
if ($expectedException !== null) {
$this->expectException($expectedException);
}
$this->assertInstanceOf(AvatarNode::class, $avatarNode);
}
- public function testGetChildren() {
+ public function testGetChildren(): void {
$avatarNodes = $this->home->getChildren();
self::assertEquals(0, count($avatarNodes));
/**
* @dataProvider providesTestGetChild
*/
- public function testChildExists($expectedException, $hasAvatar, $path) {
+ public function testChildExists($expectedException, $hasAvatar, $path): void {
$avatar = $this->createMock(IAvatar::class);
$avatar->method('exists')->willReturn($hasAvatar);
$this->assertEquals($hasAvatar, $childExists);
}
- public function testGetLastModified() {
+ public function testGetLastModified(): void {
self::assertNull($this->home->getLastModified());
}
}
use Test\TestCase;
class AvatarNodeTest extends TestCase {
- public function testGetName() {
+ public function testGetName(): void {
/** @var IAvatar | \PHPUnit\Framework\MockObject\MockObject $a */
$a = $this->createMock(IAvatar::class);
$n = new AvatarNode(1024, 'png', $a);
$this->assertEquals('1024.png', $n->getName());
}
- public function testGetContentType() {
+ public function testGetContentType(): void {
/** @var IAvatar | \PHPUnit\Framework\MockObject\MockObject $a */
$a = $this->createMock(IAvatar::class);
$n = new AvatarNode(1024, 'png', $a);
$this->dbConnection, $this->timeFactory);
}
- public function testRun() {
+ public function testRun(): void {
$this->timeFactory->expects($this->once())
->method('getTime')
->with()
);
}
- public function testRun() {
+ public function testRun(): void {
$this->config->expects($this->once())
->method('getAppValue')
->with('dav', 'generateBirthdayCalendar', 'yes')
$this->backgroundJob->run(['userId' => 'user123']);
}
- public function testRunAndReset() {
+ public function testRunAndReset(): void {
$this->config->expects($this->once())
->method('getAppValue')
->with('dav', 'generateBirthdayCalendar', 'yes')
$this->backgroundJob->run(['userId' => 'user123', 'purgeBeforeGenerating' => true]);
}
- public function testRunGloballyDisabled() {
+ public function testRunGloballyDisabled(): void {
$this->config->expects($this->once())
->method('getAppValue')
->with('dav', 'generateBirthdayCalendar', 'yes')
$this->backgroundJob->run(['userId' => 'user123']);
}
- public function testRunUserDisabled() {
+ public function testRunUserDisabled(): void {
$this->config->expects($this->once())
->method('getAppValue')
->with('dav', 'generateBirthdayCalendar', 'yes')
/**
* @dataProvider dataForTestRun
*/
- public function testRun(string $configValue, int $actualLimit, int $deletedCalendarSyncTokens, int $deletedAddressBookSyncTokens) {
+ public function testRun(string $configValue, int $actualLimit, int $deletedCalendarSyncTokens, int $deletedAddressBookSyncTokens): void {
$this->config->expects($this->once())
->method('getAppValue')
->with(Application::APP_ID, 'totalNumberOfSyncTokensToKeep', '10000')
*
* @dataProvider runDataProvider
*/
- public function testRun(int $lastRun, int $time, bool $process) {
+ public function testRun(int $lastRun, int $time, bool $process): void {
$backgroundJob = new RefreshWebcalJob($this->refreshWebcalService, $this->config, $this->logger, $this->timeFactory);
$backgroundJob->setId(42);
);
}
- public function testRun() {
+ public function testRun(): void {
$this->userManager->expects($this->once())
->method('callForSeenUsers')
- ->willReturnCallback(function ($closure) {
+ ->willReturnCallback(function ($closure): void {
$user1 = $this->createMock(IUser::class);
$user1->method('getUID')->willReturn('uid1');
$user2 = $this->createMock(IUser::class);
* [backend4, res9, Beamer2, {}] - []
*/
- public function testRun() {
+ public function testRun(): void {
$this->createTestResourcesInCache();
$backend2 = $this->createMock(IBackend::class);
parent::tearDown();
}
- public function cleanUpBackend() {
+ public function cleanUpBackend(): void {
if (is_null($this->backend)) {
return;
}
* @param string $expectedSubject
* @param array $expectedPayload
*/
- public function testCallTriggerCalendarActivity($method, array $payload, $expectedSubject, array $expectedPayload) {
+ public function testCallTriggerCalendarActivity($method, array $payload, $expectedSubject, array $expectedPayload): void {
$backend = $this->getBackend(['triggerCalendarActivity']);
$backend->expects($this->once())
->method('triggerCalendarActivity')
- ->willReturnCallback(function () use ($expectedPayload, $expectedSubject) {
+ ->willReturnCallback(function () use ($expectedPayload, $expectedSubject): void {
$arguments = func_get_args();
$this->assertSame($expectedSubject, array_shift($arguments));
$this->assertEquals($expectedPayload, $arguments);
* @param string[]|null $shareUsers
* @param string[] $users
*/
- public function testTriggerCalendarActivity($action, array $data, array $shares, array $changedProperties, $currentUser, $author, $shareUsers, array $users) {
+ public function testTriggerCalendarActivity($action, array $data, array $shares, array $changedProperties, $currentUser, $author, $shareUsers, array $users): void {
$backend = $this->getBackend(['getUsersForShares']);
if ($shareUsers === null) {
$this->invokePrivate($backend, 'triggerCalendarActivity', [$action, $data, $shares, $changedProperties]);
}
- public function testUserDeletionDoesNotCreateActivity() {
+ public function testUserDeletionDoesNotCreateActivity(): void {
$backend = $this->getBackend();
$this->userManager->expects($this->once())
* @param array $groups
* @param array $expected
*/
- public function testGetUsersForShares(array $shares, array $groups, array $expected) {
+ public function testGetUsersForShares(array $shares, array $groups, array $expected): void {
$backend = $this->getBackend();
$getGroups = [];
);
}
- public function testGetIcon() {
+ public function testGetIcon(): void {
$this->url->expects($this->once())
->method('imagePath')
->with('core', 'places/calendar.svg')
* @param string[] $types
* @param string[] $expected
*/
- public function testFilterTypes($types, $expected) {
+ public function testFilterTypes($types, $expected): void {
$this->assertEquals($expected, $this->filter->filterTypes($types));
}
}
* @dataProvider dataFilters
* @param string $filterClass
*/
- public function testImplementsInterface($filterClass) {
+ public function testImplementsInterface($filterClass): void {
$filter = \OC::$server->query($filterClass);
$this->assertInstanceOf(IFilter::class, $filter);
}
* @dataProvider dataFilters
* @param string $filterClass
*/
- public function testGetIdentifier($filterClass) {
+ public function testGetIdentifier($filterClass): void {
/** @var IFilter $filter */
$filter = \OC::$server->query($filterClass);
$this->assertIsString($filter->getIdentifier());
* @dataProvider dataFilters
* @param string $filterClass
*/
- public function testGetName($filterClass) {
+ public function testGetName($filterClass): void {
/** @var IFilter $filter */
$filter = \OC::$server->query($filterClass);
$this->assertIsString($filter->getName());
* @dataProvider dataFilters
* @param string $filterClass
*/
- public function testGetPriority($filterClass) {
+ public function testGetPriority($filterClass): void {
/** @var IFilter $filter */
$filter = \OC::$server->query($filterClass);
$priority = $filter->getPriority();
* @dataProvider dataFilters
* @param string $filterClass
*/
- public function testGetIcon($filterClass) {
+ public function testGetIcon($filterClass): void {
/** @var IFilter $filter */
$filter = \OC::$server->query($filterClass);
$this->assertIsString($filter->getIcon());
* @dataProvider dataFilters
* @param string $filterClass
*/
- public function testFilterTypes($filterClass) {
+ public function testFilterTypes($filterClass): void {
/** @var IFilter $filter */
$filter = \OC::$server->query($filterClass);
$this->assertIsArray($filter->filterTypes([]));
* @dataProvider dataFilters
* @param string $filterClass
*/
- public function testAllowedApps($filterClass) {
+ public function testAllowedApps($filterClass): void {
/** @var IFilter $filter */
$filter = \OC::$server->query($filterClass);
$this->assertIsArray($filter->allowedApps());
);
}
- public function testGetIcon() {
+ public function testGetIcon(): void {
$this->url->expects($this->once())
->method('imagePath')
->with('core', 'actions/checkmark.svg')
* @param string[] $types
* @param string[] $expected
*/
- public function testFilterTypes($types, $expected) {
+ public function testFilterTypes($types, $expected): void {
$this->assertEquals($expected, $this->filter->filterTypes($types));
}
}
* @param array $parameters
* @param string $parsedSubject
*/
- public function testSetSubjects(string $subject, array $parameters, string $parsedSubject) {
+ public function testSetSubjects(string $subject, array $parameters, string $parsedSubject): void {
$event = $this->createMock(IEvent::class);
$event->expects($this->once())
->method('setRichSubject')
* @param array $data
* @param string $name
*/
- public function testGenerateCalendarParameter(array $data, string $name) {
+ public function testGenerateCalendarParameter(array $data, string $name): void {
$l = $this->createMock(IL10N::class);
$l->expects($this->any())
->method('t')
* @param int $id
* @param string $name
*/
- public function testGenerateLegacyCalendarParameter(int $id, string $name) {
+ public function testGenerateLegacyCalendarParameter(int $id, string $name): void {
$this->assertEquals([
'type' => 'calendar',
'id' => $id,
* @dataProvider dataGenerateGroupParameter
* @param string $gid
*/
- public function testGenerateGroupParameter(string $gid) {
+ public function testGenerateGroupParameter(string $gid): void {
$this->assertEquals([
'type' => 'user-group',
'id' => $gid,
* @param array|null $link
* @param bool $calendarAppEnabled
*/
- public function testGenerateObjectParameter(int $id, string $name, ?array $link, bool $calendarAppEnabled = true) {
+ public function testGenerateObjectParameter(int $id, string $name, ?array $link, bool $calendarAppEnabled = true): void {
if ($link) {
$generatedLink = [
'view' => 'dayGridMonth',
* @param mixed $eventData
* @param string $exception
*/
- public function testGenerateObjectParameterThrows($eventData, string $exception = InvalidArgumentException::class) {
+ public function testGenerateObjectParameterThrows($eventData, string $exception = InvalidArgumentException::class): void {
$this->expectException($exception);
$this->invokePrivate($this->provider, 'generateObjectParameter', [$eventData]);
* @dataProvider dataSettings
* @param string $settingClass
*/
- public function testImplementsInterface($settingClass) {
+ public function testImplementsInterface($settingClass): void {
$setting = \OC::$server->query($settingClass);
$this->assertInstanceOf(ISetting::class, $setting);
}
* @dataProvider dataSettings
* @param string $settingClass
*/
- public function testGetIdentifier($settingClass) {
+ public function testGetIdentifier($settingClass): void {
/** @var ISetting $setting */
$setting = \OC::$server->query($settingClass);
$this->assertIsString($setting->getIdentifier());
* @dataProvider dataSettings
* @param string $settingClass
*/
- public function testGetName($settingClass) {
+ public function testGetName($settingClass): void {
/** @var ISetting $setting */
$setting = \OC::$server->query($settingClass);
$this->assertIsString($setting->getName());
* @dataProvider dataSettings
* @param string $settingClass
*/
- public function testGetPriority($settingClass) {
+ public function testGetPriority($settingClass): void {
/** @var ISetting $setting */
$setting = \OC::$server->query($settingClass);
$priority = $setting->getPriority();
* @dataProvider dataSettings
* @param string $settingClass
*/
- public function testCanChangeStream($settingClass) {
+ public function testCanChangeStream($settingClass): void {
/** @var ISetting $setting */
$setting = \OC::$server->query($settingClass);
$this->assertIsBool($setting->canChangeStream());
* @dataProvider dataSettings
* @param string $settingClass
*/
- public function testIsDefaultEnabledStream($settingClass) {
+ public function testIsDefaultEnabledStream($settingClass): void {
/** @var ISetting $setting */
$setting = \OC::$server->query($settingClass);
$this->assertIsBool($setting->isDefaultEnabledStream());
* @dataProvider dataSettings
* @param string $settingClass
*/
- public function testCanChangeMail($settingClass) {
+ public function testCanChangeMail($settingClass): void {
/** @var ISetting $setting */
$setting = \OC::$server->query($settingClass);
$this->assertIsBool($setting->canChangeMail());
* @dataProvider dataSettings
* @param string $settingClass
*/
- public function testIsDefaultEnabledMail($settingClass) {
+ public function testIsDefaultEnabledMail($settingClass): void {
/** @var ISetting $setting */
$setting = \OC::$server->query($settingClass);
$this->assertIsBool($setting->isDefaultEnabledMail());
$this->response = $this->createMock(\Sabre\HTTP\ResponseInterface::class);
}
- public function testGetFeatures() {
+ public function testGetFeatures(): void {
$this->assertEquals(['nc-enable-birthday-calendar'], $this->plugin->getFeatures());
}
- public function testGetName() {
+ public function testGetName(): void {
$this->assertEquals('nc-enable-birthday-calendar', $this->plugin->getPluginName());
}
- public function testInitialize() {
+ public function testInitialize(): void {
$server = $this->createMock(\Sabre\DAV\Server::class);
$plugin = new EnablePlugin($this->config, $this->birthdayService);
$plugin->initialize($server);
}
- public function testHttpPostNoCalendarHome() {
+ public function testHttpPostNoCalendarHome(): void {
$calendar = $this->createMock(Calendar::class);
$this->server->expects($this->once())
$this->plugin->httpPost($this->request, $this->response);
}
- public function testHttpPostWrongRequest() {
+ public function testHttpPostWrongRequest(): void {
$calendarHome = $this->createMock(CalendarHome::class);
$this->server->expects($this->once())
$this->server->xml->expects($this->once())
->method('parse')
- ->willReturnCallback(function ($requestBody, $url, &$documentType) {
+ ->willReturnCallback(function ($requestBody, $url, &$documentType): void {
$documentType = '{http://nextcloud.com/ns}disable-birthday-calendar';
});
$this->plugin->httpPost($this->request, $this->response);
}
- public function testHttpPost() {
+ public function testHttpPost(): void {
$calendarHome = $this->createMock(CalendarHome::class);
$this->server->expects($this->once())
$this->server->xml->expects($this->once())
->method('parse')
- ->willReturnCallback(function ($requestBody, $url, &$documentType) {
+ ->willReturnCallback(function ($requestBody, $url, &$documentType): void {
$documentType = '{http://nextcloud.com/ns}enable-birthday-calendar';
});
use OCA\DAV\CalDAV\CalDavBackend;
class CachedSubscriptionObjectTest extends \Test\TestCase {
- public function testGet() {
+ public function testGet(): void {
$backend = $this->createMock(CalDavBackend::class);
$calendarInfo = [
'{http://owncloud.org/ns}owner-principal' => 'user1',
}
- public function testPut() {
+ public function testPut(): void {
$this->expectException(\Sabre\DAV\Exception\MethodNotAllowed::class);
$this->expectExceptionMessage('Creating objects in a cached subscription is not allowed');
}
- public function testDelete() {
+ public function testDelete(): void {
$this->expectException(\Sabre\DAV\Exception\MethodNotAllowed::class);
$this->expectExceptionMessage('Deleting objects in a cached subscription is not allowed');
use Sabre\DAV\PropPatch;
class CachedSubscriptionTest extends \Test\TestCase {
- public function testGetACL() {
+ public function testGetACL(): void {
$backend = $this->createMock(CalDavBackend::class);
$calendarInfo = [
'{http://owncloud.org/ns}owner-principal' => 'user1',
], $calendar->getACL());
}
- public function testGetChildACL() {
+ public function testGetChildACL(): void {
$backend = $this->createMock(CalDavBackend::class);
$calendarInfo = [
'{http://owncloud.org/ns}owner-principal' => 'user1',
], $calendar->getChildACL());
}
- public function testGetOwner() {
+ public function testGetOwner(): void {
$backend = $this->createMock(CalDavBackend::class);
$calendarInfo = [
'{http://owncloud.org/ns}owner-principal' => 'user1',
$this->assertEquals('user1', $calendar->getOwner());
}
- public function testDelete() {
+ public function testDelete(): void {
$backend = $this->createMock(CalDavBackend::class);
$calendarInfo = [
'{http://owncloud.org/ns}owner-principal' => 'user1',
$calendar->delete();
}
- public function testPropPatch() {
+ public function testPropPatch(): void {
$backend = $this->createMock(CalDavBackend::class);
$calendarInfo = [
'{http://owncloud.org/ns}owner-principal' => 'user1',
}
- public function testGetChild() {
+ public function testGetChild(): void {
$this->expectException(\Sabre\DAV\Exception\NotFound::class);
$this->expectExceptionMessage('Calendar object not found');
$calendar->getChild('foo2');
}
- public function testGetChildren() {
+ public function testGetChildren(): void {
$backend = $this->createMock(CalDavBackend::class);
$calendarInfo = [
'{http://owncloud.org/ns}owner-principal' => 'user1',
$this->assertInstanceOf(CachedSubscriptionObject::class, $res[1]);
}
- public function testGetMultipleChildren() {
+ public function testGetMultipleChildren(): void {
$backend = $this->createMock(CalDavBackend::class);
$calendarInfo = [
'{http://owncloud.org/ns}owner-principal' => 'user1',
}
- public function testCreateFile() {
+ public function testCreateFile(): void {
$this->expectException(\Sabre\DAV\Exception\MethodNotAllowed::class);
$this->expectExceptionMessage('Creating objects in cached subscription is not allowed');
$calendar->createFile('foo', []);
}
- public function testChildExists() {
+ public function testChildExists(): void {
$backend = $this->createMock(CalDavBackend::class);
$calendarInfo = [
'{http://owncloud.org/ns}owner-principal' => 'user1',
$this->assertEquals(false, $calendar->childExists('foo2'));
}
- public function testCalendarQuery() {
+ public function testCalendarQuery(): void {
$backend = $this->createMock(CalDavBackend::class);
$calendarInfo = [
'{http://owncloud.org/ns}owner-principal' => 'user1',
* @package OCA\DAV\Tests\unit\CalDAV
*/
class CalDavBackendTest extends AbstractCalDavBackend {
- public function testCalendarOperations() {
+ public function testCalendarOperations(): void {
$calendarId = $this->createTestCalendar();
// update its display name
/**
* @dataProvider providesSharingData
*/
- public function testCalendarSharing($userCanRead, $userCanWrite, $groupCanRead, $groupCanWrite, $add) {
+ public function testCalendarSharing($userCanRead, $userCanWrite, $groupCanRead, $groupCanWrite, $add): void {
/** @var IL10N|\PHPUnit\Framework\MockObject\MockObject $l10n */
$l10n = $this->createMock(IL10N::class);
self::assertEmpty($calendars);
}
- public function testCalendarObjectsOperations() {
+ public function testCalendarObjectsOperations(): void {
$calendarId = $this->createTestCalendar();
// create a card
}
- public function testMultipleCalendarObjectsWithSameUID() {
+ public function testMultipleCalendarObjectsWithSameUID(): void {
$this->expectException(\Sabre\DAV\Exception\BadRequest::class);
$this->expectExceptionMessage('Calendar object with uid already exists in this calendar collection.');
$this->backend->createCalendarObject($calendarId, $uri1, $calData);
}
- public function testMultiCalendarObjects() {
+ public function testMultiCalendarObjects(): void {
$calendarId = $this->createTestCalendar();
// create an event
/**
* @dataProvider providesCalendarQueryParameters
*/
- public function testCalendarQuery($expectedEventsInResult, $propFilters, $compFilter) {
+ public function testCalendarQuery($expectedEventsInResult, $propFilters, $compFilter): void {
$calendarId = $this->createTestCalendar();
$events = [];
$events[0] = $this->createEvent($calendarId, '20130912T130000Z', '20130912T140000Z');
$this->assertEqualsCanonicalizing($expectedEventsInResult, $result);
}
- public function testGetCalendarObjectByUID() {
+ public function testGetCalendarObjectByUID(): void {
$calendarId = $this->createTestCalendar();
$uri = static::getUniqueID('calobj');
$calData = <<<'EOD'
];
}
- public function testSyncSupport() {
+ public function testSyncSupport(): void {
$calendarId = $this->createTestCalendar();
// fist call without synctoken
$this->assertEquals($event, $changes['added'][0]);
}
- public function testPublications() {
+ public function testPublications(): void {
$this->dispatcher->expects(self::atLeastOnce())
->method('dispatchTyped');
$this->backend->getPublicCalendar($publicCalendarURI);
}
- public function testSubscriptions() {
+ public function testSubscriptions(): void {
$id = $this->backend->createSubscription(self::UNIT_TEST_USER, 'Subscription', [
'{http://calendarserver.org/ns/}source' => new Href('test-source'),
'{http://apple.com/ns/ical/}calendar-color' => '#1C4587',
* @dataProvider providesSchedulingData
* @param $objectData
*/
- public function testScheduling($objectData) {
+ public function testScheduling($objectData): void {
$this->backend->createSchedulingObject(self::UNIT_TEST_USER, 'Sample Schedule', $objectData);
$sos = $this->backend->getSchedulingObjects(self::UNIT_TEST_USER);
/**
* @dataProvider providesCalDataForGetDenormalizedData
*/
- public function testGetDenormalizedData($expected, $key, $calData) {
+ public function testGetDenormalizedData($expected, $key, $calData): void {
$actual = $this->backend->getDenormalizedData($calData);
$this->assertEquals($expected, $actual[$key]);
}
];
}
- public function testCalendarSearch() {
+ public function testCalendarSearch(): void {
$calendarId = $this->createTestCalendar();
$uri = static::getUniqueID('calobj');
/**
* @dataProvider searchDataProvider
*/
- public function testSearch(bool $isShared, array $searchOptions, int $count) {
+ public function testSearch(bool $isShared, array $searchOptions, int $count): void {
$calendarId = $this->createTestCalendar();
$uris = [];
];
}
- public function testSameUriSameIdForDifferentCalendarTypes() {
+ public function testSameUriSameIdForDifferentCalendarTypes(): void {
$calendarId = $this->createTestCalendar();
$subscriptionId = $this->createTestSubscription();
$this->assertEquals($calData2, $this->backend->getCalendarObject($subscriptionId, $uri, CalDavBackend::CALENDAR_TYPE_SUBSCRIPTION)['calendardata']);
}
- public function testPurgeAllCachedEventsForSubscription() {
+ public function testPurgeAllCachedEventsForSubscription(): void {
$subscriptionId = $this->createTestSubscription();
$uri = static::getUniqueID('calobj');
$calData = <<<EOD
$this->assertEquals(null, $this->backend->getCalendarObject($subscriptionId, $uri, CalDavBackend::CALENDAR_TYPE_SUBSCRIPTION));
}
- public function testCalendarMovement() {
+ public function testCalendarMovement(): void {
$this->backend->createCalendar(self::UNIT_TEST_USER, 'Example', []);
$this->assertCount(1, $this->backend->getCalendarsForUser(self::UNIT_TEST_USER));
$reflectionProperty->setValue($this->calendarHome, $this->pluginManager);
}
- public function testCreateCalendarValidName() {
+ public function testCreateCalendarValidName(): void {
/** @var MkCol | MockObject $mkCol */
$mkCol = $this->createMock(MkCol::class);
$this->calendarHome->createExtendedCollection('name123', $mkCol);
}
- public function testCreateCalendarReservedName() {
+ public function testCreateCalendarReservedName(): void {
$this->expectException(\Sabre\DAV\Exception\MethodNotAllowed::class);
$this->expectExceptionMessage('The resource you tried to create has a reserved name');
$this->calendarHome->createExtendedCollection('contact_birthdays', $mkCol);
}
- public function testCreateCalendarReservedNameAppGenerated() {
+ public function testCreateCalendarReservedNameAppGenerated(): void {
$this->expectException(\Sabre\DAV\Exception\MethodNotAllowed::class);
$this->expectExceptionMessage('The resource you tried to create has a reserved name');
}
- public function testGetKey() {
+ public function testGetKey(): void {
$this->assertEquals($this->calendarImpl->getKey(), 'fancy_id_123');
}
- public function testGetDisplayname() {
+ public function testGetDisplayname(): void {
$this->assertEquals($this->calendarImpl->getDisplayName(), 'user readable name 123');
}
- public function testGetDisplayColor() {
+ public function testGetDisplayColor(): void {
$this->assertEquals($this->calendarImpl->getDisplayColor(), '#AABBCC');
}
- public function testSearch() {
+ public function testSearch(): void {
$this->backend->expects($this->once())
->method('search')
->with($this->calendarInfo, 'abc', ['def'], ['ghi'], 42, 1337)
$this->assertEquals($result, ['SEARCHRESULTS']);
}
- public function testGetPermissionRead() {
+ public function testGetPermissionRead(): void {
$this->calendar->expects($this->once())
->method('getACL')
->with()
$this->assertEquals(1, $this->calendarImpl->getPermissions());
}
- public function testGetPermissionWrite() {
+ public function testGetPermissionWrite(): void {
$this->calendar->expects($this->once())
->method('getACL')
->with()
$this->assertEquals(6, $this->calendarImpl->getPermissions());
}
- public function testGetPermissionReadWrite() {
+ public function testGetPermissionReadWrite(): void {
$this->calendar->expects($this->once())
->method('getACL')
->with()
$this->assertEquals(7, $this->calendarImpl->getPermissions());
}
- public function testGetPermissionAll() {
+ public function testGetPermissionAll(): void {
$this->calendar->expects($this->once())
->method('getACL')
->with()
);
}
- public function testSetupCalendarProvider() {
+ public function testSetupCalendarProvider(): void {
$this->backend->expects($this->once())
->method('getCalendarsForUser')
->with('principals/users/user123')
$calendarManager = $this->createMock(Manager::class);
$calendarManager->expects($this->at(0))
->method('registerCalendar')
- ->willReturnCallback(function () {
+ ->willReturnCallback(function (): void {
$parameter = func_get_arg(0);
$this->assertInstanceOf(CalendarImpl::class, $parameter);
$this->assertEquals(123, $parameter->getKey());
$calendarManager->expects($this->at(1))
->method('registerCalendar')
- ->willReturnCallback(function () {
+ ->willReturnCallback(function (): void {
$parameter = func_get_arg(0);
$this->assertInstanceOf(CalendarImpl::class, $parameter);
$this->assertEquals(456, $parameter->getKey());
});
}
- public function testDelete() {
+ public function testDelete(): void {
/** @var MockObject | CalDavBackend $backend */
$backend = $this->getMockBuilder(CalDavBackend::class)->disableOriginalConstructor()->getMock();
$backend->expects($this->once())->method('updateShares');
}
- public function testDeleteFromGroup() {
+ public function testDeleteFromGroup(): void {
$this->expectException(\Sabre\DAV\Exception\Forbidden::class);
/** @var MockObject | CalDavBackend $backend */
$c->delete();
}
- public function testDeleteOwn() {
+ public function testDeleteOwn(): void {
/** @var MockObject | CalDavBackend $backend */
$backend = $this->createMock(CalDavBackend::class);
$backend->expects($this->never())->method('updateShares');
$c->delete();
}
- public function testDeleteBirthdayCalendar() {
+ public function testDeleteBirthdayCalendar(): void {
/** @var MockObject | CalDavBackend $backend */
$backend = $this->createMock(CalDavBackend::class);
$backend->expects($this->once())->method('deleteCalendar')
/**
* @dataProvider dataPropPatch
*/
- public function testPropPatch($ownerPrincipal, $principalUri, $mutations, $shared) {
+ public function testPropPatch($ownerPrincipal, $principalUri, $mutations, $shared): void {
/** @var MockObject | CalDavBackend $backend */
$backend = $this->getMockBuilder(CalDavBackend::class)->disableOriginalConstructor()->getMock();
$calendarInfo = [
/**
* @dataProvider providesReadOnlyInfo
*/
- public function testAcl($expectsWrite, $readOnlyValue, $hasOwnerSet, $uri = 'default') {
+ public function testAcl($expectsWrite, $readOnlyValue, $hasOwnerSet, $uri = 'default'): void {
/** @var MockObject | CalDavBackend $backend */
$backend = $this->getMockBuilder(CalDavBackend::class)->disableOriginalConstructor()->getMock();
$backend->expects($this->any())->method('applyShareAcl')->willReturnArgument(1);
* @param int $expectedChildren
* @param bool $isShared
*/
- public function testPrivateClassification($expectedChildren, $isShared) {
+ public function testPrivateClassification($expectedChildren, $isShared): void {
$calObject0 = ['uri' => 'event-0', 'classification' => CalDavBackend::CLASSIFICATION_PUBLIC];
$calObject1 = ['uri' => 'event-1', 'classification' => CalDavBackend::CLASSIFICATION_CONFIDENTIAL];
$calObject2 = ['uri' => 'event-2', 'classification' => CalDavBackend::CLASSIFICATION_PRIVATE];
* @param int $expectedChildren
* @param bool $isShared
*/
- public function testConfidentialClassification($expectedChildren, $isShared) {
+ public function testConfidentialClassification($expectedChildren, $isShared): void {
$start = '20160609';
$end = '20160610';
$this->outbox = new Outbox($this->config, 'user-principal-123');
}
- public function testGetACLFreeBusyEnabled() {
+ public function testGetACLFreeBusyEnabled(): void {
$this->config->expects($this->once())
->method('getAppValue')
->with('dav', 'disableFreeBusy', 'no')
], $this->outbox->getACL());
}
- public function testGetACLFreeBusyDisabled() {
+ public function testGetACLFreeBusyDisabled(): void {
$this->config->expects($this->once())
->method('getAppValue')
->with('dav', 'disableFreeBusy', 'no')
* @param $input
* @param $expected
*/
- public function testGetCalendarHomeForPrincipal($input, $expected) {
+ public function testGetCalendarHomeForPrincipal($input, $expected): void {
$this->assertSame($expected, $this->plugin->getCalendarHomeForPrincipal($input));
}
- public function testGetCalendarHomeForUnknownPrincipal() {
+ public function testGetCalendarHomeForUnknownPrincipal(): void {
$this->assertNull($this->plugin->getCalendarHomeForPrincipal('FOO/BAR/BLUB'));
}
}
}
}
- public function testGetName() {
+ public function testGetName(): void {
$name = $this->publicCalendarRoot->getName();
$this->assertEquals('public-calendars', $name);
}
- public function testGetChild() {
+ public function testGetChild(): void {
$calendar = $this->createPublicCalendar();
$publicCalendars = $this->backend->getPublicCalendars();
$this->assertEquals($calendar, $calendarResult);
}
- public function testGetChildren() {
+ public function testGetChildren(): void {
$this->createPublicCalendar();
$calendarResults = $this->publicCalendarRoot->getChildren();
$this->assertSame([], $calendarResults);
* @param int $expectedChildren
* @param bool $isShared
*/
- public function testPrivateClassification($expectedChildren, $isShared) {
+ public function testPrivateClassification($expectedChildren, $isShared): void {
$calObject0 = ['uri' => 'event-0', 'classification' => CalDavBackend::CLASSIFICATION_PUBLIC];
$calObject1 = ['uri' => 'event-1', 'classification' => CalDavBackend::CLASSIFICATION_CONFIDENTIAL];
$calObject2 = ['uri' => 'event-2', 'classification' => CalDavBackend::CLASSIFICATION_PRIVATE];
* @param int $expectedChildren
* @param bool $isShared
*/
- public function testConfidentialClassification($expectedChildren, $isShared) {
+ public function testConfidentialClassification($expectedChildren, $isShared): void {
$start = '20160609';
$end = '20160610';
class PublisherTest extends TestCase {
public const NS_CALENDARSERVER = 'http://calendarserver.org/ns/';
- public function testSerializePublished() {
+ public function testSerializePublished(): void {
$publish = new Publisher('urltopublish', true);
$xml = $this->write([
</x1:publish-url>', $xml);
}
- public function testSerializeNotPublished() {
+ public function testSerializeNotPublished(): void {
$publish = new Publisher('urltopublish', false);
$xml = $this->write([
$this->plugin->initialize($this->server);
}
- public function testPublishing() {
+ public function testPublishing(): void {
$this->book->expects($this->once())->method('setPublishStatus')->with(true);
// setup request
$this->plugin->httpPost($request, $response);
}
- public function testUnPublishing() {
+ public function testUnPublishing(): void {
$this->book->expects($this->once())->method('setPublishStatus')->with(false);
// setup request
]);
}
- public function testUpdateReminder() {
+ public function testUpdateReminder(): void {
$query = self::$realDatabase->getQueryBuilder();
$rows = $query->select('*')
->from('calendar_reminders')
}
- public function testPrepareWrongSubject() {
+ public function testPrepareWrongSubject(): void {
$this->expectException(\InvalidArgumentException::class);
$this->expectExceptionMessage('Unknown subject');
$query->delete('calendar_rooms_md')->execute();
}
- public function testGetPrincipalsByPrefix() {
+ public function testGetPrincipalsByPrefix(): void {
$actual = $this->principalBackend->getPrincipalsByPrefix($this->principalPrefix);
$this->assertEquals([
], $actual);
}
- public function testGetNoPrincipalsByPrefixForWrongPrincipalPrefix() {
+ public function testGetNoPrincipalsByPrefixForWrongPrincipalPrefix(): void {
$actual = $this->principalBackend->getPrincipalsByPrefix('principals/users');
$this->assertEquals([], $actual);
}
- public function testGetPrincipalByPath() {
+ public function testGetPrincipalByPath(): void {
$actual = $this->principalBackend->getPrincipalByPath($this->principalPrefix . '/backend2-res3');
$this->assertEquals([
'uri' => $this->principalPrefix . '/backend2-res3',
], $actual);
}
- public function testGetPrincipalByPathNotFound() {
+ public function testGetPrincipalByPathNotFound(): void {
$actual = $this->principalBackend->getPrincipalByPath($this->principalPrefix . '/db-123');
$this->assertEquals(null, $actual);
}
- public function testGetPrincipalByPathWrongPrefix() {
+ public function testGetPrincipalByPathWrongPrefix(): void {
$actual = $this->principalBackend->getPrincipalByPath('principals/users/foo-bar');
$this->assertEquals(null, $actual);
}
- public function testGetGroupMemberSet() {
+ public function testGetGroupMemberSet(): void {
$actual = $this->principalBackend->getGroupMemberSet($this->principalPrefix . '/backend1-res1');
$this->assertEquals([], $actual);
}
- public function testGetGroupMemberSetProxyRead() {
+ public function testGetGroupMemberSetProxyRead(): void {
$proxy1 = new Proxy();
$proxy1->setProxyId('proxyId1');
$proxy1->setPermissions(1);
$this->assertEquals(['proxyId1'], $actual);
}
- public function testGetGroupMemberSetProxyWrite() {
+ public function testGetGroupMemberSetProxyWrite(): void {
$proxy1 = new Proxy();
$proxy1->setProxyId('proxyId1');
$proxy1->setPermissions(1);
$this->assertEquals(['proxyId2', 'proxyId3'], $actual);
}
- public function testGetGroupMembership() {
+ public function testGetGroupMembership(): void {
$proxy1 = new Proxy();
$proxy1->setOwnerId('proxyId1');
$proxy1->setPermissions(1);
$this->assertEquals(['proxyId1/calendar-proxy-read', 'proxyId2/calendar-proxy-write'], $actual);
}
- public function testSetGroupMemberSet() {
+ public function testSetGroupMemberSet(): void {
$this->proxyMapper->expects($this->once())
->method('getProxiesOf')
->with($this->principalPrefix . '/backend1-res1')
$this->principalBackend->setGroupMemberSet($this->principalPrefix . '/backend1-res1/calendar-proxy-write', [$this->principalPrefix . '/backend1-res2', $this->principalPrefix . '/backend2-res3']);
}
- public function testUpdatePrincipal() {
+ public function testUpdatePrincipal(): void {
$propPatch = $this->createMock(PropPatch::class);
$actual = $this->principalBackend->updatePrincipal($this->principalPrefix . '/foo-bar', $propPatch);
/**
* @dataProvider dataSearchPrincipals
*/
- public function testSearchPrincipals($expected, $test) {
+ public function testSearchPrincipals($expected, $test): void {
$user = $this->createMock(IUser::class);
$this->userSession->expects($this->once())
->method('getUser')
];
}
- public function testSearchPrincipalsByMetadataKey() {
+ public function testSearchPrincipalsByMetadataKey(): void {
$user = $this->createMock(IUser::class);
$this->userSession->expects($this->once())
->method('getUser')
], $actual);
}
- public function testSearchPrincipalsByCalendarUserAddressSet() {
+ public function testSearchPrincipalsByCalendarUserAddressSet(): void {
$user = $this->createMock(IUser::class);
$this->userSession->method('getUser')
->with()
$actual);
}
- public function testSearchPrincipalsEmptySearchProperties() {
+ public function testSearchPrincipalsEmptySearchProperties(): void {
$this->userSession->expects($this->never())
->method('getUser');
$this->groupManager->expects($this->never())
$this->principalBackend->searchPrincipals($this->principalPrefix, []);
}
- public function testSearchPrincipalsWrongPrincipalPrefix() {
+ public function testSearchPrincipalsWrongPrincipalPrefix(): void {
$this->userSession->expects($this->never())
->method('getUser');
$this->groupManager->expects($this->never())
]);
}
- public function testFindByUriByEmail() {
+ public function testFindByUriByEmail(): void {
$user = $this->createMock(IUser::class);
$this->userSession->expects($this->once())
->method('getUser')
$this->assertEquals($this->principalPrefix . '/backend1-res1', $actual);
}
- public function testFindByUriByEmailForbiddenResource() {
+ public function testFindByUriByEmailForbiddenResource(): void {
$user = $this->createMock(IUser::class);
$this->userSession->expects($this->once())
->method('getUser')
$this->assertEquals(null, $actual);
}
- public function testFindByUriByEmailNotFound() {
+ public function testFindByUriByEmailNotFound(): void {
$user = $this->createMock(IUser::class);
$this->userSession->expects($this->once())
->method('getUser')
$this->assertEquals(null, $actual);
}
- public function testFindByUriByPrincipal() {
+ public function testFindByUriByPrincipal(): void {
$user = $this->createMock(IUser::class);
$this->userSession->expects($this->once())
->method('getUser')
$this->assertEquals($this->principalPrefix . '/backend3-res6', $actual);
}
- public function testFindByUriByPrincipalForbiddenResource() {
+ public function testFindByUriByPrincipalForbiddenResource(): void {
$user = $this->createMock(IUser::class);
$this->userSession->expects($this->once())
->method('getUser')
$this->assertEquals(null, $actual);
}
- public function testFindByUriByPrincipalNotFound() {
+ public function testFindByUriByPrincipalNotFound(): void {
$user = $this->createMock(IUser::class);
$this->userSession->expects($this->once())
->method('getUser')
$this->assertEquals(null, $actual);
}
- public function testFindByUriByUnknownUri() {
+ public function testFindByUriByUnknownUri(): void {
$user = $this->createMock(IUser::class);
$this->userSession->expects($this->once())
->method('getUser')
$this->plugin = new IMipPlugin($this->config, $this->mailer, $logger, $this->timeFactory, $l10nFactory, $urlGenerator, $defaults, $random, $db, $this->userManager, 'user123');
}
- public function testDelivery() {
+ public function testDelivery(): void {
$this->config
->expects($this->any())
->method('getAppValue')
$this->assertEquals('1.1', $message->getScheduleStatus());
}
- public function testFailedDelivery() {
+ public function testFailedDelivery(): void {
$this->config
->expects($this->any())
->method('getAppValue')
$this->assertEquals('5.0', $message->getScheduleStatus());
}
- public function testInvalidEmailDelivery() {
+ public function testInvalidEmailDelivery(): void {
$this->mailer->method('validateMailAddress')->willReturn(false);
$message = $this->_testMessage();
$this->assertEquals('5.0', $message->getScheduleStatus());
}
- public function testDeliveryWithNoCommonName() {
+ public function testDeliveryWithNoCommonName(): void {
$this->config
->expects($this->any())
->method('getAppValue')
/**
* @dataProvider dataNoMessageSendForPastEvents
*/
- public function testNoMessageSendForPastEvents(array $veventParams, bool $expectsMail) {
+ public function testNoMessageSendForPastEvents(array $veventParams, bool $expectsMail): void {
$this->config
->method('getAppValue')
->willReturn('yes');
/**
* @dataProvider dataIncludeResponseButtons
*/
- public function testIncludeResponseButtons(string $config_setting, string $recipient, bool $has_buttons) {
+ public function testIncludeResponseButtons(string $config_setting, string $recipient, bool $has_buttons): void {
$message = $this->_testMessage([], $recipient);
$this->mailer->method('validateMailAddress')->willReturn(true);
];
}
- public function testMessageSendWhenEventWithoutName() {
+ public function testMessageSendWhenEventWithoutName(): void {
$this->config
->method('getAppValue')
->willReturn('yes');
}
- private function _expectSend(string $recipient = 'frodo@hobb.it', bool $expectSend = true, bool $expectButtons = true, string $subject = 'Invitation: Fellowship meeting') {
+ private function _expectSend(string $recipient = 'frodo@hobb.it', bool $expectSend = true, bool $expectButtons = true, string $subject = 'Invitation: Fellowship meeting'): void {
// if the event is in the past, we skip out
if (!$expectSend) {
$this->mailer
$this->plugin->initialize($this->server);
}
- public function testInitialize() {
+ public function testInitialize(): void {
$plugin = new Plugin($this->config, $this->logger);
$this->server->expects($this->exactly(10))
$plugin->initialize($this->server);
}
- public function testGetAddressesForPrincipal() {
+ public function testGetAddressesForPrincipal(): void {
$href = $this->createMock(Href::class);
$href
->expects($this->once())
}
- public function testGetAddressesForPrincipalEmpty() {
+ public function testGetAddressesForPrincipalEmpty(): void {
$this->server
->expects($this->once())
->method('getProperties')
$this->assertSame([], $result);
}
- public function testStripOffMailTo() {
+ public function testStripOffMailTo(): void {
$this->assertEquals('test@example.com', $this->invokePrivate($this->plugin, 'stripOffMailTo', ['test@example.com']));
$this->assertEquals('test@example.com', $this->invokePrivate($this->plugin, 'stripOffMailTo', ['mailto:test@example.com']));
}
- public function testGetAttendeeRSVP() {
+ public function testGetAttendeeRSVP(): void {
$property1 = $this->createMock(CalAddress::class);
$parameter1 = $this->createMock(Parameter::class);
$property1->expects($this->once())
* @param bool $exists
* @param bool $propertiesForPath
*/
- public function testPropFindDefaultCalendarUrl(string $principalUri, ?string $calendarHome, bool $isResource, string $calendarUri, string $displayName, bool $exists, bool $hasExistingCalendars = false, bool $propertiesForPath = true) {
+ public function testPropFindDefaultCalendarUrl(string $principalUri, ?string $calendarHome, bool $isResource, string $calendarUri, string $displayName, bool $exists, bool $hasExistingCalendars = false, bool $propertiesForPath = true): void {
/** @var PropFind $propFind */
$propFind = new PropFind(
$principalUri,
'OCA\\DAV\\CalDAV\\Search\\Xml\\Request\\CalendarSearchReport',
];
- public function testFoo() {
+ public function testFoo(): void {
$xml = <<<XML
<?xml version="1.0" encoding="UTF-8"?>
<nc:calendar-search xmlns:nc="http://nextcloud.com/ns" xmlns:c="urn:ietf:params:xml:ns:caldav" xmlns:d="DAV:">
);
}
- public function testNoLimitOffset() {
+ public function testNoLimitOffset(): void {
$xml = <<<XML
<?xml version="1.0" encoding="UTF-8"?>
<nc:calendar-search xmlns:nc="http://nextcloud.com/ns" xmlns:c="urn:ietf:params:xml:ns:caldav" xmlns:d="DAV:">
}
- public function testRequiresCompFilter() {
+ public function testRequiresCompFilter(): void {
$this->expectException(\Sabre\DAV\Exception\BadRequest::class);
$this->expectExceptionMessage('{http://nextcloud.com/ns}prop-filter or {http://nextcloud.com/ns}param-filter given without any {http://nextcloud.com/ns}comp-filter');
}
- public function testRequiresFilter() {
+ public function testRequiresFilter(): void {
$this->expectException(\Sabre\DAV\Exception\BadRequest::class);
$this->expectExceptionMessage('The {http://nextcloud.com/ns}filter element is required for this request');
}
- public function testNoSearchTerm() {
+ public function testNoSearchTerm(): void {
$this->expectException(\Sabre\DAV\Exception\BadRequest::class);
$this->expectExceptionMessage('{http://nextcloud.com/ns}search-term is required for this request');
}
- public function testCompOnly() {
+ public function testCompOnly(): void {
$this->expectException(\Sabre\DAV\Exception\BadRequest::class);
$this->expectExceptionMessage('At least one{http://nextcloud.com/ns}prop-filter or {http://nextcloud.com/ns}param-filter is required for this request');
);
}
- public function testPropOnly() {
+ public function testPropOnly(): void {
$xml = <<<XML
<?xml version="1.0" encoding="UTF-8"?>
<nc:calendar-search xmlns:nc="http://nextcloud.com/ns" xmlns:c="urn:ietf:params:xml:ns:caldav" xmlns:d="DAV:">
);
}
- public function testParamOnly() {
+ public function testParamOnly(): void {
$xml = <<<XML
<?xml version="1.0" encoding="UTF-8"?>
<nc:calendar-search xmlns:nc="http://nextcloud.com/ns" xmlns:c="urn:ietf:params:xml:ns:caldav" xmlns:d="DAV:">
$this->plugin->initialize($this->server);
}
- public function testGetFeatures() {
+ public function testGetFeatures(): void {
$this->assertEquals(['nc-calendar-search'], $this->plugin->getFeatures());
}
- public function testGetName() {
+ public function testGetName(): void {
$this->assertEquals('nc-calendar-search', $this->plugin->getPluginName());
}
- public function testInitialize() {
+ public function testInitialize(): void {
$server = $this->createMock(\Sabre\DAV\Server::class);
$plugin = new SearchPlugin();
);
}
- public function testReportUnknown() {
+ public function testReportUnknown(): void {
$result = $this->plugin->report('{urn:ietf:params:xml:ns:caldav}calendar-query', 'REPORT', null);
$this->assertEquals($result, null);
$this->assertNotEquals($this->server->transactionType, 'report-nc-calendar-search');
}
- public function testReport() {
+ public function testReport(): void {
$report = $this->createMock(CalendarSearchReport::class);
$report->filters = [];
$calendarHome = $this->createMock(CalendarHome::class);
$this->plugin->report('{http://nextcloud.com/ns}calendar-search', $report, '');
}
- public function testSupportedReportSetNoCalendarHome() {
+ public function testSupportedReportSetNoCalendarHome(): void {
$this->server->tree->expects($this->once())
->method('getNodeForPath')
->with('/foo/bar')
$this->assertEquals([], $reports);
}
- public function testSupportedReportSet() {
+ public function testSupportedReportSet(): void {
$calendarHome = $this->createMock(CalendarHome::class);
$this->server->tree->expects($this->once())
use OCP\IRequest;
class PluginTest extends \Test\TestCase {
- public function testDisabled() {
+ public function testDisabled(): void {
$request = $this->createMock(IRequest::class);
$request->expects($this->once())
->method('isUserAgent')
$this->assertEquals(false, $plugin->isCachingEnabledForThisRequest());
}
- public function testEnabled() {
+ public function testEnabled(): void {
$request = $this->createMock(IRequest::class);
$request->expects($this->once())
->method('isUserAgent')
*
* @dataProvider runDataProvider
*/
- public function testRun(string $body, string $contentType, string $result) {
+ public function testRun(string $body, string $contentType, string $result): void {
$refreshWebcalService = $this->getMockBuilder(RefreshWebcalService::class)
->onlyMethods(['getRandomCalendarObjectUri'])
->setConstructorArgs([$this->caldavBackend, $this->clientService, $this->config, $this->logger])
*
* @dataProvider runDataProvider
*/
- public function testRunCreateCalendarNoException(string $body, string $contentType, string $result) {
+ public function testRunCreateCalendarNoException(string $body, string $contentType, string $result): void {
$client = $this->createMock(IClient::class);
$response = $this->createMock(IResponse::class);
$refreshWebcalService = $this->getMockBuilder(RefreshWebcalService::class)
*
* @dataProvider runDataProvider
*/
- public function testRunCreateCalendarBadRequest(string $body, string $contentType, string $result) {
+ public function testRunCreateCalendarBadRequest(string $body, string $contentType, string $result): void {
$client = $this->createMock(IClient::class);
$response = $this->createMock(IResponse::class);
$refreshWebcalService = $this->getMockBuilder(RefreshWebcalService::class)
/**
* @dataProvider runLocalURLDataProvider
*/
- public function testRunLocalURL(string $source) {
+ public function testRunLocalURL(string $source): void {
$refreshWebcalService = new RefreshWebcalService(
$this->caldavBackend,
$this->clientService,
];
}
- public function testInvalidUrl() {
+ public function testInvalidUrl(): void {
$refreshWebcalService = new RefreshWebcalService($this->caldavBackend,
$this->clientService, $this->config, $this->logger);
* @package OCA\DAV\Tests\unit
*/
class CapabilitiesTest extends TestCase {
- public function testGetCapabilities() {
+ public function testGetCapabilities(): void {
$config = $this->createMock(IConfig::class);
$config->expects($this->once())
->method('getSystemValueBool')
$this->assertSame($expected, $capabilities->getCapabilities());
}
- public function testGetCapabilitiesWithBulkUpload() {
+ public function testGetCapabilitiesWithBulkUpload(): void {
$config = $this->createMock(IConfig::class);
$config->expects($this->once())
->method('getSystemValueBool')
/**
* @dataProvider dataCallTriggerAddressBookActivity
*/
- public function testCallTriggerAddressBookActivity(string $method, array $payload, string $expectedSubject, array $expectedPayload) {
+ public function testCallTriggerAddressBookActivity(string $method, array $payload, string $expectedSubject, array $expectedPayload): void {
$backend = $this->getBackend(['triggerAddressbookActivity']);
$backend->expects($this->once())
->method('triggerAddressbookActivity')
- ->willReturnCallback(function () use ($expectedPayload, $expectedSubject) {
+ ->willReturnCallback(function () use ($expectedPayload, $expectedSubject): void {
$arguments = func_get_args();
$this->assertSame($expectedSubject, array_shift($arguments));
$this->assertEquals($expectedPayload, $arguments);
* @param string[]|null $shareUsers
* @param string[] $users
*/
- public function testTriggerAddressBookActivity(string $action, array $data, array $shares, array $changedProperties, string $currentUser, string $author, ?array $shareUsers, array $users) {
+ public function testTriggerAddressBookActivity(string $action, array $data, array $shares, array $changedProperties, string $currentUser, string $author, ?array $shareUsers, array $users): void {
$backend = $this->getBackend(['getUsersForShares']);
if ($shareUsers === null) {
$this->assertEmpty($this->invokePrivate($backend, 'triggerAddressbookActivity', [Addressbook::SUBJECT_ADD, ['principaluri' => 'principals/system/system'], [], [], '', '', null, []]));
}
- public function testUserDeletionDoesNotCreateActivity() {
+ public function testUserDeletionDoesNotCreateActivity(): void {
$backend = $this->getBackend();
$this->userManager->expects($this->once())
* @param string[]|null $shareUsers
* @param string[] $users
*/
- public function testTriggerCardActivity(string $action, array $addressBookData, array $shares, array $cardData, string $currentUser, string $author, ?array $shareUsers, array $users) {
+ public function testTriggerCardActivity(string $action, array $addressBookData, array $shares, array $cardData, string $currentUser, string $author, ?array $shareUsers, array $users): void {
$backend = $this->getBackend(['getUsersForShares']);
if ($shareUsers === null) {
* @param array $groups
* @param array $expected
*/
- public function testGetUsersForShares(array $shares, array $groups, array $expected) {
+ public function testGetUsersForShares(array $shares, array $groups, array $expected): void {
$backend = $this->getBackend();
$getGroups = [];
);
}
- public function testGetKey() {
+ public function testGetKey(): void {
$this->assertSame($this->addressBookInfo['id'],
$this->addressBookImpl->getKey());
}
- public function testGetDisplayName() {
+ public function testGetDisplayName(): void {
$this->assertSame($this->addressBookInfo['{DAV:}displayname'],
$this->addressBookImpl->getDisplayName());
}
- public function testSearch() {
+ public function testSearch(): void {
/** @var \PHPUnit\Framework\MockObject\MockObject | AddressBookImpl $addressBookImpl */
$addressBookImpl = $this->getMockBuilder(AddressBookImpl::class)
->setConstructorArgs(
*
* @param array $properties
*/
- public function testCreate($properties) {
+ public function testCreate($properties): void {
$uid = 'uid';
/** @var \PHPUnit\Framework\MockObject\MockObject | AddressBookImpl $addressBookImpl */
];
}
- public function testUpdate() {
+ public function testUpdate(): void {
$uid = 'uid';
$uri = 'bla.vcf';
$properties = ['URI' => $uri, 'UID' => $uid, 'FN' => 'John Doe'];
$this->assertTrue($addressBookImpl->createOrUpdate($properties));
}
- public function testUpdateWithTypes() {
+ public function testUpdateWithTypes(): void {
$uid = 'uid';
$uri = 'bla.vcf';
$properties = ['URI' => $uri, 'UID' => $uid, 'FN' => 'John Doe', 'ADR' => [['type' => 'HOME', 'value' => ';;street;city;;;country']]];
* @param array $permissions
* @param int $expected
*/
- public function testGetPermissions($permissions, $expected) {
+ public function testGetPermissions($permissions, $expected): void {
$this->addressBook->expects($this->once())->method('getACL')
->willReturn($permissions);
];
}
- public function testDelete() {
+ public function testDelete(): void {
$cardId = 1;
$cardUri = 'cardUri';
$this->backend->expects($this->once())->method('getCardUri')
$this->assertTrue($this->addressBookImpl->delete($cardId));
}
- public function testReadCard() {
+ public function testReadCard(): void {
$vCard = new VCard();
$vCard->add(new Text($vCard, 'UID', 'uid'));
$vCardSerialized = $vCard->serialize();
$this->assertSame($vCardSerialized, $resultSerialized);
}
- public function testCreateUid() {
+ public function testCreateUid(): void {
/** @var \PHPUnit\Framework\MockObject\MockObject | AddressBookImpl $addressBookImpl */
$addressBookImpl = $this->getMockBuilder(AddressBookImpl::class)
->setConstructorArgs(
);
}
- public function testCreateEmptyVCard() {
+ public function testCreateEmptyVCard(): void {
$uid = 'uid';
$expectedVCard = new VCard();
$expectedVCard->UID = $uid;
$this->assertSame($expectedVCardSerialized, $resultSerialized);
}
- public function testVCard2Array() {
+ public function testVCard2Array(): void {
$vCard = new VCard();
$vCard->add($vCard->createProperty('FN', 'Full Name'));
], $array);
}
- public function testVCard2ArrayWithTypes() {
+ public function testVCard2ArrayWithTypes(): void {
$vCard = new VCard();
$vCard->add($vCard->createProperty('FN', 'Full Name'));
use Test\TestCase;
class AddressBookTest extends TestCase {
- public function testDelete() {
+ public function testDelete(): void {
/** @var \PHPUnit\Framework\MockObject\MockObject | CardDavBackend $backend */
$backend = $this->getMockBuilder(CardDavBackend::class)->disableOriginalConstructor()->getMock();
$backend->expects($this->once())->method('updateShares');
}
- public function testDeleteFromGroup() {
+ public function testDeleteFromGroup(): void {
$this->expectException(\Sabre\DAV\Exception\Forbidden::class);
/** @var \PHPUnit\Framework\MockObject\MockObject | CardDavBackend $backend */
}
- public function testPropPatch() {
+ public function testPropPatch(): void {
$this->expectException(\Sabre\DAV\Exception\Forbidden::class);
/** @var \PHPUnit\Framework\MockObject\MockObject | CardDavBackend $backend */
/**
* @dataProvider providesReadOnlyInfo
*/
- public function testAcl($expectsWrite, $readOnlyValue, $hasOwnerSet) {
+ public function testAcl($expectsWrite, $readOnlyValue, $hasOwnerSet): void {
/** @var \PHPUnit\Framework\MockObject\MockObject | CardDavBackend $backend */
$backend = $this->getMockBuilder(CardDavBackend::class)->disableOriginalConstructor()->getMock();
$backend->expects($this->any())->method('applyShareAcl')->willReturnArgument(1);
* @param string|null $expectedReminder
* @param string | null $data
*/
- public function testBuildBirthdayFromContact($expectedSummary, $expectedDTStart, $expectedFieldType, $expectedUnknownYear, $expectedOriginalYear, $expectedReminder, $data, $fieldType, $prefix, $supports4Bytes, $configuredReminder) {
+ public function testBuildBirthdayFromContact($expectedSummary, $expectedDTStart, $expectedFieldType, $expectedUnknownYear, $expectedOriginalYear, $expectedReminder, $data, $fieldType, $prefix, $supports4Bytes, $configuredReminder): void {
$this->dbConnection->method('supports4ByteText')->willReturn($supports4Bytes);
$cal = $this->service->buildDateFromContact($data, $fieldType, $prefix, $configuredReminder);
}
}
- public function testOnCardDeleteGloballyDisabled() {
+ public function testOnCardDeleteGloballyDisabled(): void {
$this->config->expects($this->once())
->method('getAppValue')
->with('dav', 'generateBirthdayCalendar', 'yes')
$this->service->onCardDeleted(666, 'gump.vcf');
}
- public function testOnCardDeleteUserDisabled() {
+ public function testOnCardDeleteUserDisabled(): void {
$this->config->expects($this->once())
->method('getAppValue')
->with('dav', 'generateBirthdayCalendar', 'yes')
$this->service->onCardDeleted(666, 'gump.vcf');
}
- public function testOnCardDeleted() {
+ public function testOnCardDeleted(): void {
$this->config->expects($this->once())
->method('getAppValue')
->with('dav', 'generateBirthdayCalendar', 'yes')
$this->service->onCardDeleted(666, 'gump.vcf');
}
- public function testOnCardChangedGloballyDisabled() {
+ public function testOnCardChangedGloballyDisabled(): void {
$this->config->expects($this->once())
->method('getAppValue')
->with('dav', 'generateBirthdayCalendar', 'yes')
$service->onCardChanged(666, 'gump.vcf', '');
}
- public function testOnCardChangedUserDisabled() {
+ public function testOnCardChangedUserDisabled(): void {
$this->config->expects($this->once())
->method('getAppValue')
->with('dav', 'generateBirthdayCalendar', 'yes')
/**
* @dataProvider providesCardChanges
*/
- public function testOnCardChanged($expectedOp) {
+ public function testOnCardChanged($expectedOp): void {
$this->config->expects($this->once())
->method('getAppValue')
->with('dav', 'generateBirthdayCalendar', 'yes')
* @param $old
* @param $new
*/
- public function testBirthdayEvenChanged($expected, $old, $new) {
+ public function testBirthdayEvenChanged($expected, $old, $new): void {
$new = Reader::read($new);
$this->assertEquals($expected, $this->service->birthdayEvenChanged($old, $new));
}
- public function testGetAllAffectedPrincipals() {
+ public function testGetAllAffectedPrincipals(): void {
$this->cardDav->expects($this->once())->method('getShares')->willReturn([
[
'{http://owncloud.org/ns}group-share' => false,
], $users);
}
- public function testBirthdayCalendarHasComponentEvent() {
+ public function testBirthdayCalendarHasComponentEvent(): void {
$this->calDav->expects($this->once())
->method('createCalendar')
->with('principal001', 'contact_birthdays', [
$this->service->ensureCalendarExists('principal001');
}
- public function testResetForUser() {
+ public function testResetForUser(): void {
$this->calDav->expects($this->once())
->method('getCalendarByUri')
->with('principals/users/user123', 'contact_birthdays')
}
}
- public function testAddressBookOperations() {
+ public function testAddressBookOperations(): void {
// create a new address book
$this->backend->createAddressBook(self::UNIT_TEST_USER, 'Example', []);
$this->assertEquals(0, count($books));
}
- public function testAddressBookSharing() {
+ public function testAddressBookSharing(): void {
$this->userManager->expects($this->any())
->method('userExists')
->willReturn(true);
$this->assertEquals(0, count($books));
}
- public function testCardOperations() {
+ public function testCardOperations(): void {
/** @var CardDavBackend | \PHPUnit\Framework\MockObject\MockObject $backend */
$backend = $this->getMockBuilder(CardDavBackend::class)
->setConstructorArgs([$this->db, $this->principal, $this->userManager, $this->groupManager, $this->dispatcher])
$this->assertEquals(0, count($cards));
}
- public function testMultiCard() {
+ public function testMultiCard(): void {
$this->backend = $this->getMockBuilder(CardDavBackend::class)
->setConstructorArgs([$this->db, $this->principal, $this->userManager, $this->groupManager, $this->dispatcher])
->setMethods(['updateProperties'])->getMock();
$this->assertEquals(0, count($cards));
}
- public function testMultipleUIDOnDifferentAddressbooks() {
+ public function testMultipleUIDOnDifferentAddressbooks(): void {
$this->backend = $this->getMockBuilder(CardDavBackend::class)
->setConstructorArgs([$this->db, $this->principal, $this->userManager, $this->groupManager, $this->dispatcher])
->onlyMethods(['updateProperties'])->getMock();
$this->backend->createCard($bookId1, $uri1, $this->vcardTest0);
}
- public function testMultipleUIDDenied() {
+ public function testMultipleUIDDenied(): void {
$this->backend = $this->getMockBuilder(CardDavBackend::class)
->setConstructorArgs([$this->db, $this->principal, $this->userManager, $this->groupManager, $this->dispatcher])
->setMethods(['updateProperties'])->getMock();
$test = $this->backend->createCard($bookId, $uri1, $this->vcardTest0);
}
- public function testNoValidUID() {
+ public function testNoValidUID(): void {
$this->backend = $this->getMockBuilder(CardDavBackend::class)
->setConstructorArgs([$this->db, $this->principal, $this->userManager, $this->groupManager, $this->dispatcher])
->setMethods(['updateProperties'])->getMock();
$test = $this->backend->createCard($bookId, $uri1, $this->vcardTestNoUID);
}
- public function testDeleteWithoutCard() {
+ public function testDeleteWithoutCard(): void {
$this->backend = $this->getMockBuilder(CardDavBackend::class)
->setConstructorArgs([$this->db, $this->principal, $this->userManager, $this->groupManager, $this->dispatcher])
->onlyMethods([
$this->assertTrue($this->backend->deleteCard($bookId, $uri));
}
- public function testSyncSupport() {
+ public function testSyncSupport(): void {
$this->backend = $this->getMockBuilder(CardDavBackend::class)
->setConstructorArgs([$this->db, $this->principal, $this->userManager, $this->groupManager, $this->dispatcher])
->setMethods(['updateProperties'])->getMock();
$this->assertEquals($uri0, $changes['added'][0]);
}
- public function testSharing() {
+ public function testSharing(): void {
$this->userManager->expects($this->any())
->method('userExists')
->willReturn(true);
$this->assertEquals(0, count($books));
}
- public function testUpdateProperties() {
+ public function testUpdateProperties(): void {
$bookId = 42;
$cardUri = 'card-uri';
$cardId = 2;
$this->assertSame($cardId, (int)$result[0]['cardid']);
}
- public function testPurgeProperties() {
+ public function testPurgeProperties(): void {
$query = $this->db->getQueryBuilder();
$query->insert('cards_properties')
->values(
$this->assertSame(2, (int)$result[0]['cardid']);
}
- public function testGetCardId() {
+ public function testGetCardId(): void {
$query = $this->db->getQueryBuilder();
$query->insert('cards')
}
- public function testGetCardIdFailed() {
+ public function testGetCardIdFailed(): void {
$this->expectException(\InvalidArgumentException::class);
$this->invokePrivate($this->backend, 'getCardId', [1, 'uri']);
* @param array $options
* @param array $expected
*/
- public function testSearch($pattern, $properties, $options, $expected) {
+ public function testSearch($pattern, $properties, $options, $expected): void {
/** @var VCard $vCards */
$vCards = [];
$vCards[0] = new VCard();
];
}
- public function testGetCardUri() {
+ public function testGetCardUri(): void {
$query = $this->db->getQueryBuilder();
$query->insert($this->dbCardsTable)
->values(
}
- public function testGetCardUriFailed() {
+ public function testGetCardUriFailed(): void {
$this->expectException(\InvalidArgumentException::class);
$this->backend->getCardUri(1);
}
- public function testGetContact() {
+ public function testGetContact(): void {
$query = $this->db->getQueryBuilder();
for ($i = 0; $i < 2; $i++) {
$query->insert($this->dbCardsTable)
$this->assertEmpty($result);
}
- public function testGetContactFail() {
+ public function testGetContactFail(): void {
$this->assertEmpty($this->backend->getContact(0, 'uri'));
}
- public function testCollectCardProperties() {
+ public function testCollectCardProperties(): void {
$query = $this->db->getQueryBuilder();
$query->insert($this->dbCardsPropertiesTable)
->values(
use Test\TestCase;
class ContactsManagerTest extends TestCase {
- public function test() {
+ public function test(): void {
/** @var IManager | \PHPUnit\Framework\MockObject\MockObject $cm */
$cm = $this->getMockBuilder(IManager::class)->disableOriginalConstructor()->getMock();
$cm->expects($this->exactly(2))->method('registerAddressBook');
/**
* @dataProvider providesNewUsers
*/
- public function testCreation($expectedVCard, $displayName = null, $eMailAddress = null, $cloudId = null) {
+ public function testCreation($expectedVCard, $displayName = null, $eMailAddress = null, $cloudId = null): void {
$user = $this->getUserMock((string)$displayName, $eMailAddress, $cloudId);
$accountManager = $this->getAccountManager($user);
* @param $expected
* @param $fullName
*/
- public function testNameSplitter($expected, $fullName) {
+ public function testNameSplitter($expected, $fullName): void {
$converter = new Converter($this->accountManager);
$r = $converter->splitFullName($fullName);
$r = implode(';', $r);
* @dataProvider providesQueryParams
* @param $param
*/
- public function testQueryParams($param) {
+ public function testQueryParams($param): void {
$this->request->expects($this->once())->method('getQueryParameters')->willReturn($param);
$result = $this->plugin->httpGet($this->request, $this->response);
$this->assertTrue($result);
];
}
- public function testNoCard() {
+ public function testNoCard(): void {
$this->request->method('getQueryParameters')
->willReturn([
'photo'
* @param $size
* @param bool $photo
*/
- public function testCard($size, $photo) {
+ public function testCard($size, $photo): void {
$query = ['photo' => null];
if ($size !== null) {
$query['size'] = $size;
$this->plugin->initialize($this->server);
}
- public function testSharing() {
+ public function testSharing(): void {
$this->book->expects($this->once())->method('updateShares')->with([[
'href' => 'principal:principals/admin',
'commonName' => null,
use Test\TestCase;
class SyncServiceTest extends TestCase {
- public function testEmptySync() {
+ public function testEmptySync(): void {
$backend = $this->getBackendMock(0, 0, 0);
$ss = $this->getSyncServiceMock($backend, []);
$this->assertEquals('sync-token-1', $return);
}
- public function testSyncWithNewElement() {
+ public function testSyncWithNewElement(): void {
$backend = $this->getBackendMock(1, 0, 0);
$backend->method('getCard')->willReturn(false);
$this->assertEquals('sync-token-1', $return);
}
- public function testSyncWithUpdatedElement() {
+ public function testSyncWithUpdatedElement(): void {
$backend = $this->getBackendMock(0, 1, 0);
$backend->method('getCard')->willReturn(true);
$this->assertEquals('sync-token-1', $return);
}
- public function testSyncWithDeletedElement() {
+ public function testSyncWithDeletedElement(): void {
$backend = $this->getBackendMock(0, 0, 1);
$ss = $this->getSyncServiceMock($backend, ['0' => [404 => '']]);
$this->assertEquals('sync-token-1', $return);
}
- public function testEnsureSystemAddressBookExists() {
+ public function testEnsureSystemAddressBookExists(): void {
/** @var CardDavBackend | \PHPUnit\Framework\MockObject\MockObject $backend */
$backend = $this->getMockBuilder(CardDavBackend::class)->disableOriginalConstructor()->getMock();
$backend->expects($this->exactly(1))->method('createAddressBook');
* @param integer $deleteCalls
* @return void
*/
- public function testUpdateAndDeleteUser($activated, $createCalls, $updateCalls, $deleteCalls) {
+ public function testUpdateAndDeleteUser($activated, $createCalls, $updateCalls, $deleteCalls): void {
/** @var CardDavBackend | \PHPUnit\Framework\MockObject\MockObject $backend */
$backend = $this->getMockBuilder(CardDavBackend::class)->disableOriginalConstructor()->getMock();
$logger = $this->getMockBuilder(LoggerInterface::class)->disableOriginalConstructor()->getMock();
);
}
- public function testInvalidUser() {
+ public function testInvalidUser(): void {
$this->expectException(\InvalidArgumentException::class);
$this->expectExceptionMessage(
'User <' . self::USER . '> is unknown.');
]);
}
- public function testNoCalendarName() {
+ public function testNoCalendarName(): void {
$this->expectException(\InvalidArgumentException::class);
$this->expectExceptionMessage(
'Please specify a calendar name or --birthday');
]);
}
- public function testInvalidCalendar() {
+ public function testInvalidCalendar(): void {
$this->expectException(\InvalidArgumentException::class);
$this->expectExceptionMessage(
'User <' . self::USER . '> has no calendar named <' . self::NAME . '>.');
]);
}
- public function testDelete() {
+ public function testDelete(): void {
$id = 1234;
$calendar = [
'id' => $id,
]);
}
- public function testForceDelete() {
+ public function testForceDelete(): void {
$id = 1234;
$calendar = [
'id' => $id,
]);
}
- public function testDeleteBirthday() {
+ public function testDeleteBirthday(): void {
$id = 1234;
$calendar = [
'id' => $id,
]);
}
- public function testBirthdayHasPrecedence() {
+ public function testBirthdayHasPrecedence(): void {
$calendar = [
'id' => 1234,
'principaluri' => 'principals/users/' . self::USER,
);
}
- public function testWithBadUser() {
+ public function testWithBadUser(): void {
$this->expectException(\InvalidArgumentException::class);
$this->userManager->expects($this->once())
$this->assertStringContainsString("User <" . self::USERNAME . "> in unknown", $commandTester->getDisplay());
}
- public function testWithCorrectUserWithNoCalendars() {
+ public function testWithCorrectUserWithNoCalendars(): void {
$this->userManager->expects($this->once())
->method('userExists')
->with(self::USERNAME)
/**
* @dataProvider dataExecute
*/
- public function testWithCorrectUser(bool $readOnly, string $output) {
+ public function testWithCorrectUser(bool $readOnly, string $output): void {
$this->userManager->expects($this->once())
->method('userExists')
->with(self::USERNAME)
* @param $userOriginExists
* @param $userDestinationExists
*/
- public function testWithBadUserOrigin($userOriginExists, $userDestinationExists) {
+ public function testWithBadUserOrigin($userOriginExists, $userDestinationExists): void {
$this->expectException(\InvalidArgumentException::class);
$this->userManager->expects($this->exactly($userOriginExists ? 2 : 1))
}
- public function testMoveWithInexistantCalendar() {
+ public function testMoveWithInexistantCalendar(): void {
$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.');
}
- public function testMoveWithExistingDestinationCalendar() {
+ public function testMoveWithExistingDestinationCalendar(): void {
$this->expectException(\InvalidArgumentException::class);
$this->expectExceptionMessage('User <user2> already has a calendar named <personal>.');
]);
}
- public function testMove() {
+ public function testMove(): void {
$this->userManager->expects($this->exactly(2))
->method('userExists')
->withConsecutive(
/**
* @dataProvider dataTestMoveWithDestinationNotPartOfGroup
*/
- public function testMoveWithDestinationNotPartOfGroup(bool $shareWithGroupMembersOnly) {
+ public function testMoveWithDestinationNotPartOfGroup(bool $shareWithGroupMembersOnly): void {
$this->userManager->expects($this->exactly(2))
->method('userExists')
->withConsecutive(
]);
}
- public function testMoveWithDestinationPartOfGroup() {
+ public function testMoveWithDestinationPartOfGroup(): void {
$this->userManager->expects($this->exactly(2))
->method('userExists')
->withConsecutive(
$this->assertStringContainsString("[OK] Calendar <personal> was moved from user <user> to <user2>", $commandTester->getDisplay());
}
- public function testMoveWithDestinationNotPartOfGroupAndForce() {
+ public function testMoveWithDestinationNotPartOfGroupAndForce(): void {
$this->userManager->expects($this->exactly(2))
->method('userExists')
->withConsecutive(
/**
* @dataProvider dataTestMoveWithCalendarAlreadySharedToDestination
*/
- public function testMoveWithCalendarAlreadySharedToDestination(bool $force) {
+ public function testMoveWithCalendarAlreadySharedToDestination(bool $force): void {
$this->userManager->expects($this->exactly(2))
->method('userExists')
->withConsecutive(
]);
}
- public function test() {
+ public function test(): void {
$db = \OC::$server->getDatabaseConnection();
/** @var Principal | \PHPUnit\Framework\MockObject\MockObject $principal */
$principal = $this->createMock(Principal::class);
);
}
- public function testDelete() {
+ public function testDelete(): void {
$user = $this->getMockBuilder(IUser::class)
->disableOriginalConstructor()
->getMock();
}
- public function testDeleteForbidden() {
+ public function testDeleteForbidden(): void {
$this->expectException(\Sabre\DAV\Exception\Forbidden::class);
$user = $this->getMockBuilder(IUser::class)
$this->node->delete();
}
- public function testGetName() {
+ public function testGetName(): void {
$id = '19';
$this->comment->expects($this->once())
->method('getId')
}
- public function testSetName() {
+ public function testSetName(): void {
$this->expectException(\Sabre\DAV\Exception\MethodNotAllowed::class);
$this->node->setName('666');
}
- public function testGetLastModified() {
+ public function testGetLastModified(): void {
$this->assertSame($this->node->getLastModified(), null);
}
- public function testUpdateComment() {
+ public function testUpdateComment(): void {
$msg = 'Hello Earth';
$user = $this->getMockBuilder(IUser::class)
}
- public function testUpdateCommentLogException() {
+ public function testUpdateCommentLogException(): void {
$this->expectException(\Exception::class);
$this->expectExceptionMessage('buh!');
}
- public function testUpdateCommentMessageTooLongException() {
+ public function testUpdateCommentMessageTooLongException(): void {
$this->expectException(\Sabre\DAV\Exception\BadRequest::class);
$this->expectExceptionMessage('Message exceeds allowed character limit of');
}
- public function testUpdateForbiddenByUser() {
+ public function testUpdateForbiddenByUser(): void {
$this->expectException(\Sabre\DAV\Exception\Forbidden::class);
$msg = 'HaXX0r';
}
- public function testUpdateForbiddenByType() {
+ public function testUpdateForbiddenByType(): void {
$this->expectException(\Sabre\DAV\Exception\Forbidden::class);
$msg = 'HaXX0r';
}
- public function testUpdateForbiddenByNotLoggedIn() {
+ public function testUpdateForbiddenByNotLoggedIn(): void {
$this->expectException(\Sabre\DAV\Exception\Forbidden::class);
$msg = 'HaXX0r';
$this->node->updateComment($msg);
}
- public function testPropPatch() {
+ public function testPropPatch(): void {
$propPatch = $this->getMockBuilder(PropPatch::class)
->disableOriginalConstructor()
->getMock();
$this->node->propPatch($propPatch);
}
- public function testGetProperties() {
+ public function testGetProperties(): void {
$ns = '{http://owncloud.org/ns}';
$expected = [
$ns . 'id' => '123',
* @dataProvider readCommentProvider
* @param $expected
*/
- public function testGetPropertiesUnreadProperty($creationDT, $readDT, $expected) {
+ public function testGetPropertiesUnreadProperty($creationDT, $readDT, $expected): void {
$this->comment->expects($this->any())
->method('getCreationDateTime')
->willReturn($creationDT);
$this->plugin = new CommentsPluginImplementation($this->commentsManager, $this->userSession);
}
- public function testCreateComment() {
+ public function testCreateComment(): void {
$commentData = [
'actorType' => 'users',
'verb' => 'comment',
}
- public function testCreateCommentInvalidObject() {
+ public function testCreateCommentInvalidObject(): void {
$this->expectException(\Sabre\DAV\Exception\NotFound::class);
$commentData = [
}
- public function testCreateCommentInvalidActor() {
+ public function testCreateCommentInvalidActor(): void {
$this->expectException(\Sabre\DAV\Exception\BadRequest::class);
$commentData = [
}
- public function testCreateCommentUnsupportedMediaType() {
+ public function testCreateCommentUnsupportedMediaType(): void {
$this->expectException(\Sabre\DAV\Exception\UnsupportedMediaType::class);
$commentData = [
}
- public function testCreateCommentInvalidPayload() {
+ public function testCreateCommentInvalidPayload(): void {
$this->expectException(\Sabre\DAV\Exception\BadRequest::class);
$commentData = [
}
- public function testCreateCommentMessageTooLong() {
+ public function testCreateCommentMessageTooLong(): void {
$this->expectException(\Sabre\DAV\Exception\BadRequest::class);
$this->expectExceptionMessage('Message exceeds allowed character limit of');
}
- public function testOnReportInvalidNode() {
+ public function testOnReportInvalidNode(): void {
$this->expectException(\Sabre\DAV\Exception\ReportNotSupported::class);
$path = 'totally/unrelated/13';
}
- public function testOnReportInvalidReportName() {
+ public function testOnReportInvalidReportName(): void {
$this->expectException(\Sabre\DAV\Exception\ReportNotSupported::class);
$path = 'comments/files/42';
$this->plugin->onReport('{whoever}whatever', [], '/' . $path);
}
- public function testOnReportDateTimeEmpty() {
+ public function testOnReportDateTimeEmpty(): void {
$path = 'comments/files/42';
$parameters = [
$this->plugin->onReport(CommentsPluginImplementation::REPORT_NAME, $parameters, '/' . $path);
}
- public function testOnReport() {
+ public function testOnReport(): void {
$path = 'comments/files/42';
$parameters = [
);
}
- public function testGetId() {
+ public function testGetId(): void {
$this->assertSame($this->collection->getId(), '19');
}
- public function testGetChild() {
+ public function testGetChild(): void {
$this->commentsManager->expects($this->once())
->method('get')
->with('55')
}
- public function testGetChildException() {
+ public function testGetChildException(): void {
$this->expectException(\Sabre\DAV\Exception\NotFound::class);
$this->commentsManager->expects($this->once())
$this->collection->getChild('55');
}
- public function testGetChildren() {
+ public function testGetChildren(): void {
$this->commentsManager->expects($this->once())
->method('getForObject')
->with('files', '19')
$this->assertTrue($result[0] instanceof \OCA\DAV\Comments\CommentNode);
}
- public function testFindChildren() {
+ public function testFindChildren(): void {
$dt = new \DateTime('2016-01-10 18:48:00');
$this->commentsManager->expects($this->once())
->method('getForObject')
$this->assertTrue($result[0] instanceof \OCA\DAV\Comments\CommentNode);
}
- public function testChildExistsTrue() {
+ public function testChildExistsTrue(): void {
$this->assertTrue($this->collection->childExists('44'));
}
- public function testChildExistsFalse() {
+ public function testChildExistsFalse(): void {
$this->commentsManager->expects($this->once())
->method('get')
->with('44')
);
}
- public function testChildExistsYes() {
+ public function testChildExistsYes(): void {
$this->childMap[17] = true;
$this->assertTrue($this->collection->childExists('17'));
}
- public function testChildExistsNo() {
+ public function testChildExistsNo(): void {
$this->assertFalse($this->collection->childExists('17'));
}
- public function testGetChild() {
+ public function testGetChild(): void {
$this->childMap[17] = true;
$ec = $this->collection->getChild('17');
}
- public function testGetChildException() {
+ public function testGetChildException(): void {
$this->expectException(\Sabre\DAV\Exception\NotFound::class);
$this->collection->getChild('17');
}
- public function testGetChildren() {
+ public function testGetChildren(): void {
$this->expectException(\Sabre\DAV\Exception\MethodNotAllowed::class);
$this->collection->getChildren();
->method('getUser')
->willReturn($this->user);
- $this->dispatcher->addListener(CommentsEntityEvent::EVENT_ENTITY, function (CommentsEntityEvent $event) {
+ $this->dispatcher->addListener(CommentsEntityEvent::EVENT_ENTITY, function (CommentsEntityEvent $event): void {
$event->addEntityCollection('files', function () {
return true;
});
}
- public function testCreateFile() {
+ public function testCreateFile(): void {
$this->expectException(\Sabre\DAV\Exception\Forbidden::class);
$this->collection->createFile('foo');
}
- public function testCreateDirectory() {
+ public function testCreateDirectory(): void {
$this->expectException(\Sabre\DAV\Exception\Forbidden::class);
$this->collection->createDirectory('foo');
}
- public function testGetChild() {
+ public function testGetChild(): void {
$this->prepareForInitCollections();
$etc = $this->collection->getChild('files');
$this->assertTrue($etc instanceof EntityTypeCollectionImplementation);
}
- public function testGetChildInvalid() {
+ public function testGetChildInvalid(): void {
$this->expectException(\Sabre\DAV\Exception\NotFound::class);
$this->prepareForInitCollections();
}
- public function testGetChildNoAuth() {
+ public function testGetChildNoAuth(): void {
$this->expectException(\Sabre\DAV\Exception\NotAuthenticated::class);
$this->collection->getChild('files');
}
- public function testGetChildren() {
+ public function testGetChildren(): void {
$this->prepareForInitCollections();
$children = $this->collection->getChildren();
$this->assertFalse(empty($children));
}
- public function testGetChildrenNoAuth() {
+ public function testGetChildrenNoAuth(): void {
$this->expectException(\Sabre\DAV\Exception\NotAuthenticated::class);
$this->collection->getChildren();
}
- public function testChildExistsYes() {
+ public function testChildExistsYes(): void {
$this->prepareForInitCollections();
$this->assertTrue($this->collection->childExists('files'));
}
- public function testChildExistsNo() {
+ public function testChildExistsNo(): void {
$this->prepareForInitCollections();
$this->assertFalse($this->collection->childExists('robots'));
}
- public function testChildExistsNoAuth() {
+ public function testChildExistsNoAuth(): void {
$this->expectException(\Sabre\DAV\Exception\NotAuthenticated::class);
$this->collection->childExists('files');
}
- public function testDelete() {
+ public function testDelete(): void {
$this->expectException(\Sabre\DAV\Exception\Forbidden::class);
$this->collection->delete();
}
- public function testGetName() {
+ public function testGetName(): void {
$this->assertSame('comments', $this->collection->getName());
}
- public function testSetName() {
+ public function testSetName(): void {
$this->expectException(\Sabre\DAV\Exception\Forbidden::class);
$this->collection->setName('foobar');
}
- public function testGetLastModified() {
+ public function testGetLastModified(): void {
$this->assertSame(null, $this->collection->getLastModified());
}
}
parent::tearDown();
}
- public function testNoShare() {
+ public function testNoShare(): void {
$this->shareManager->expects($this->once())
->method('getShareByToken')
->willThrowException(new ShareNotFound());
$this->assertFalse($result);
}
- public function testShareNoPassword() {
+ public function testShareNoPassword(): void {
$share = $this->getMockBuilder(IShare::class)
->disableOriginalConstructor()
->getMock();
$this->assertTrue($result);
}
- public function testSharePasswordFancyShareType() {
+ public function testSharePasswordFancyShareType(): void {
$share = $this->getMockBuilder(IShare::class)
->disableOriginalConstructor()
->getMock();
}
- public function testSharePasswordRemote() {
+ public function testSharePasswordRemote(): void {
$share = $this->getMockBuilder(IShare::class)
->disableOriginalConstructor()
->getMock();
$this->assertTrue($result);
}
- public function testSharePasswordLinkValidPassword() {
+ public function testSharePasswordLinkValidPassword(): void {
$share = $this->getMockBuilder(IShare::class)
->disableOriginalConstructor()
->getMock();
$this->assertTrue($result);
}
- public function testSharePasswordMailValidPassword() {
+ public function testSharePasswordMailValidPassword(): void {
$share = $this->getMockBuilder(IShare::class)
->disableOriginalConstructor()
->getMock();
$this->assertTrue($result);
}
- public function testSharePasswordLinkValidSession() {
+ public function testSharePasswordLinkValidSession(): void {
$share = $this->getMockBuilder(IShare::class)
->disableOriginalConstructor()
->getMock();
$this->assertTrue($result);
}
- public function testSharePasswordLinkInvalidSession() {
+ public function testSharePasswordLinkInvalidSession(): void {
$share = $this->getMockBuilder(IShare::class)
->disableOriginalConstructor()
->getMock();
}
- public function testSharePasswordMailInvalidSession() {
+ public function testSharePasswordMailInvalidSession(): void {
$share = $this->getMockBuilder(IShare::class)
->disableOriginalConstructor()
->getMock();
);
}
- public function testIsDavAuthenticatedWithoutDavSession() {
+ public function testIsDavAuthenticatedWithoutDavSession(): void {
$this->session
->expects($this->once())
->method('get')
$this->assertFalse($this->invokePrivate($this->auth, 'isDavAuthenticated', ['MyTestUser']));
}
- public function testIsDavAuthenticatedWithWrongDavSession() {
+ public function testIsDavAuthenticatedWithWrongDavSession(): void {
$this->session
->expects($this->exactly(2))
->method('get')
$this->assertFalse($this->invokePrivate($this->auth, 'isDavAuthenticated', ['MyTestUser']));
}
- public function testIsDavAuthenticatedWithCorrectDavSession() {
+ public function testIsDavAuthenticatedWithCorrectDavSession(): void {
$this->session
->expects($this->exactly(2))
->method('get')
$this->assertTrue($this->invokePrivate($this->auth, 'isDavAuthenticated', ['MyTestUser']));
}
- public function testValidateUserPassOfAlreadyDAVAuthenticatedUser() {
+ public function testValidateUserPassOfAlreadyDAVAuthenticatedUser(): void {
$user = $this->getMockBuilder(IUser::class)
->disableOriginalConstructor()
->getMock();
$this->assertTrue($this->invokePrivate($this->auth, 'validateUserPass', ['MyTestUser', 'MyTestPassword']));
}
- public function testValidateUserPassOfInvalidDAVAuthenticatedUser() {
+ public function testValidateUserPassOfInvalidDAVAuthenticatedUser(): void {
$user = $this->getMockBuilder(IUser::class)
->disableOriginalConstructor()
->getMock();
$this->assertFalse($this->invokePrivate($this->auth, 'validateUserPass', ['MyTestUser', 'MyTestPassword']));
}
- public function testValidateUserPassOfInvalidDAVAuthenticatedUserWithValidPassword() {
+ public function testValidateUserPassOfInvalidDAVAuthenticatedUserWithValidPassword(): void {
$user = $this->getMockBuilder(IUser::class)
->disableOriginalConstructor()
->getMock();
$this->assertTrue($this->invokePrivate($this->auth, 'validateUserPass', ['MyTestUser', 'MyTestPassword']));
}
- public function testValidateUserPassWithInvalidPassword() {
+ public function testValidateUserPassWithInvalidPassword(): void {
$this->userSession
->expects($this->once())
->method('isLoggedIn')
}
- public function testValidateUserPassWithPasswordLoginForbidden() {
+ public function testValidateUserPassWithPasswordLoginForbidden(): void {
$this->expectException(\OCA\DAV\Connector\Sabre\Exception\PasswordLoginForbidden::class);
$this->userSession
$this->invokePrivate($this->auth, 'validateUserPass', ['MyTestUser', 'MyTestPassword']);
}
- public function testAuthenticateAlreadyLoggedInWithoutCsrfTokenForNonGet() {
+ public function testAuthenticateAlreadyLoggedInWithoutCsrfTokenForNonGet(): void {
$request = $this->getMockBuilder(RequestInterface::class)
->disableOriginalConstructor()
->getMock();
$this->assertSame($expectedResponse, $response);
}
- public function testAuthenticateAlreadyLoggedInWithoutCsrfTokenAndCorrectlyDavAuthenticated() {
+ public function testAuthenticateAlreadyLoggedInWithoutCsrfTokenAndCorrectlyDavAuthenticated(): void {
$request = $this->getMockBuilder(RequestInterface::class)
->disableOriginalConstructor()
->getMock();
}
- public function testAuthenticateAlreadyLoggedInWithoutTwoFactorChallengePassed() {
+ public function testAuthenticateAlreadyLoggedInWithoutTwoFactorChallengePassed(): void {
$this->expectException(\Sabre\DAV\Exception\NotAuthenticated::class);
$this->expectExceptionMessage('2FA challenge not passed.');
}
- public function testAuthenticateAlreadyLoggedInWithoutCsrfTokenAndIncorrectlyDavAuthenticated() {
+ public function testAuthenticateAlreadyLoggedInWithoutCsrfTokenAndIncorrectlyDavAuthenticated(): void {
$this->expectException(\Sabre\DAV\Exception\NotAuthenticated::class);
$this->expectExceptionMessage('CSRF check not passed.');
$this->auth->check($request, $response);
}
- public function testAuthenticateAlreadyLoggedInWithoutCsrfTokenForNonGetAndDesktopClient() {
+ public function testAuthenticateAlreadyLoggedInWithoutCsrfTokenForNonGetAndDesktopClient(): void {
$request = $this->getMockBuilder(RequestInterface::class)
->disableOriginalConstructor()
->getMock();
$this->auth->check($request, $response);
}
- public function testAuthenticateAlreadyLoggedInWithoutCsrfTokenForGet() {
+ public function testAuthenticateAlreadyLoggedInWithoutCsrfTokenForGet(): void {
$request = $this->getMockBuilder(RequestInterface::class)
->disableOriginalConstructor()
->getMock();
$this->assertEquals([true, 'principals/users/MyWrongDavUser'], $response);
}
- public function testAuthenticateAlreadyLoggedInWithCsrfTokenForGet() {
+ public function testAuthenticateAlreadyLoggedInWithCsrfTokenForGet(): void {
$request = $this->getMockBuilder(RequestInterface::class)
->disableOriginalConstructor()
->getMock();
$this->assertEquals([true, 'principals/users/MyWrongDavUser'], $response);
}
- public function testAuthenticateNoBasicAuthenticateHeadersProvided() {
+ public function testAuthenticateNoBasicAuthenticateHeadersProvided(): void {
$server = $this->getMockBuilder(Server::class)
->disableOriginalConstructor()
->getMock();
}
- public function testAuthenticateNoBasicAuthenticateHeadersProvidedWithAjax() {
+ public function testAuthenticateNoBasicAuthenticateHeadersProvidedWithAjax(): void {
$this->expectException(\Sabre\DAV\Exception\NotAuthenticated::class);
$this->expectExceptionMessage('Cannot authenticate over ajax calls');
$this->auth->check($httpRequest, $httpResponse);
}
- public function testAuthenticateNoBasicAuthenticateHeadersProvidedWithAjaxButUserIsStillLoggedIn() {
+ public function testAuthenticateNoBasicAuthenticateHeadersProvidedWithAjaxButUserIsStillLoggedIn(): void {
/** @var \Sabre\HTTP\RequestInterface $httpRequest */
$httpRequest = $this->getMockBuilder(RequestInterface::class)
->disableOriginalConstructor()
);
}
- public function testAuthenticateValidCredentials() {
+ public function testAuthenticateValidCredentials(): void {
$server = $this->getMockBuilder(Server::class)
->disableOriginalConstructor()
->getMock();
$this->assertEquals([true, 'principals/users/MyTestUser'], $response);
}
- public function testAuthenticateInvalidCredentials() {
+ public function testAuthenticateInvalidCredentials(): void {
$server = $this->getMockBuilder(Server::class)
->disableOriginalConstructor()
->getMock();
);
}
- public function testValidateBearerTokenNotLoggedIn() {
+ public function testValidateBearerTokenNotLoggedIn(): void {
$this->assertFalse($this->bearerAuth->validateBearerToken('Token'));
}
- public function testValidateBearerToken() {
+ public function testValidateBearerToken(): void {
$this->userSession
->expects($this->exactly(2))
->method('isLoggedIn')
$this->assertSame('principals/users/admin', $this->bearerAuth->validateBearerToken('Token'));
}
- public function testChallenge() {
+ public function testChallenge(): void {
/** @var \PHPUnit\Framework\MockObject\MockObject|RequestInterface $request */
$request = $this->createMock(RequestInterface::class);
/** @var \PHPUnit\Framework\MockObject\MockObject|ResponseInterface $response */
* @dataProvider oldDesktopClientProvider
* @param string $userAgent
*/
- public function testBeforeHandlerException($userAgent) {
+ public function testBeforeHandlerException($userAgent): void {
$this->expectException(\Sabre\DAV\Exception\Forbidden::class);
$this->expectExceptionMessage('Unsupported client version.');
* @dataProvider newAndAlternateDesktopClientProvider
* @param string $userAgent
*/
- public function testBeforeHandlerSuccess($userAgent) {
+ public function testBeforeHandlerSuccess($userAgent): void {
/** @var \Sabre\HTTP\RequestInterface | \PHPUnit\Framework\MockObject\MockObject $request */
$request = $this->createMock('\Sabre\HTTP\RequestInterface');
$request
$this->blockLegacyClientVersionPlugin->beforeHandler($request);
}
- public function testBeforeHandlerNoUserAgent() {
+ public function testBeforeHandlerNoUserAgent(): void {
/** @var \Sabre\HTTP\RequestInterface | \PHPUnit\Framework\MockObject\MockObject $request */
$request = $this->createMock('\Sabre\HTTP\RequestInterface');
$request
* @param $node
* @param $expectedSuccessful
*/
- public function testHandleGetProperties($node, $expectedSuccessful) {
+ public function testHandleGetProperties($node, $expectedSuccessful): void {
$propFind = $this->getMockBuilder(PropFind::class)
->disableOriginalConstructor()
->getMock();
* @param $fid
* @param $expectedHref
*/
- public function testGetCommentsLink($baseUri, $fid, $expectedHref) {
+ public function testGetCommentsLink($baseUri, $fid, $expectedHref): void {
$node = $this->getMockBuilder(File::class)
->disableOriginalConstructor()
->getMock();
* @dataProvider userProvider
* @param $user
*/
- public function testGetUnreadCount($user) {
+ public function testGetUnreadCount($user): void {
$node = $this->getMockBuilder(File::class)
->disableOriginalConstructor()
->getMock();
$this->plugin->initialize($this->server);
}
- public function testCopyEtag() {
+ public function testCopyEtag(): void {
$request = new \Sabre\Http\Request('GET', 'dummy.file');
$response = new \Sabre\Http\Response();
$response->setHeader('Etag', 'abcd');
$this->assertEquals('abcd', $response->getHeader('OC-Etag'));
}
- public function testNoopWhenEmpty() {
+ public function testNoopWhenEmpty(): void {
$request = new \Sabre\Http\Request('GET', 'dummy.file');
$response = new \Sabre\Http\Response();
// Nothing to assert, we are just testing if the exception is handled
}
- public function testAfterMove() {
+ public function testAfterMove(): void {
$node = $this->getMockBuilder(File::class)
->disableOriginalConstructor()
->getMock();
return $node;
}
- private function applyDefaultProps($path = '/dummypath') {
+ private function applyDefaultProps($path = '/dummypath'): void {
// properties to set
$propPatch = new \Sabre\DAV\PropPatch([
'customprop' => 'value1',
/**
* Test that propFind on a missing file soft fails
*/
- public function testPropFindMissingFileSoftFail() {
+ public function testPropFindMissingFileSoftFail(): void {
$propFind = new \Sabre\DAV\PropFind(
'/dummypath',
[
/**
* Test setting/getting properties
*/
- public function testSetGetPropertiesForFile() {
+ public function testSetGetPropertiesForFile(): void {
$this->applyDefaultProps();
$propFind = new \Sabre\DAV\PropFind(
/**
* Test getting properties from directory
*/
- public function testGetPropertiesForDirectory() {
+ public function testGetPropertiesForDirectory(): void {
$this->applyDefaultProps('/dummypath');
$this->applyDefaultProps('/dummypath/test.txt');
/**
* Test delete property
*/
- public function testDeleteProperty() {
+ public function testDeleteProperty(): void {
$this->applyDefaultProps();
$propPatch = new \Sabre\DAV\PropPatch([
}
- public function testDeleteRootFolderFails() {
+ public function testDeleteRootFolderFails(): void {
$this->expectException(\Sabre\DAV\Exception\Forbidden::class);
$this->info->expects($this->any())
}
- public function testDeleteForbidden() {
+ public function testDeleteForbidden(): void {
$this->expectException(\OCA\DAV\Connector\Sabre\Exception\Forbidden::class);
// deletion allowed
}
- public function testDeleteFolderWhenAllowed() {
+ public function testDeleteFolderWhenAllowed(): void {
// deletion allowed
$this->info->expects($this->once())
->method('isDeletable')
}
- public function testDeleteFolderFailsWhenNotAllowed() {
+ public function testDeleteFolderFailsWhenNotAllowed(): void {
$this->expectException(\Sabre\DAV\Exception\Forbidden::class);
$this->info->expects($this->once())
}
- public function testDeleteFolderThrowsWhenDeletionFailed() {
+ public function testDeleteFolderThrowsWhenDeletionFailed(): void {
$this->expectException(\Sabre\DAV\Exception\Forbidden::class);
// deletion allowed
$dir->delete();
}
- public function testGetChildren() {
+ public function testGetChildren(): void {
$info1 = $this->getMockBuilder(FileInfo::class)
->disableOriginalConstructor()
->getMock();
}
- public function testGetChildrenNoPermission() {
+ public function testGetChildrenNoPermission(): void {
$this->expectException(\Sabre\DAV\Exception\Forbidden::class);
$info = $this->createMock(FileInfo::class);
}
- public function testGetChildNoPermission() {
+ public function testGetChildNoPermission(): void {
$this->expectException(\Sabre\DAV\Exception\NotFound::class);
$this->info->expects($this->any())
}
- public function testGetChildThrowStorageNotAvailableException() {
+ public function testGetChildThrowStorageNotAvailableException(): void {
$this->expectException(\Sabre\DAV\Exception\ServiceUnavailable::class);
$this->view->expects($this->once())
}
- public function testGetChildThrowInvalidPath() {
+ public function testGetChildThrowInvalidPath(): void {
$this->expectException(\OCA\DAV\Connector\Sabre\Exception\InvalidPath::class);
$this->view->expects($this->once())
$dir->getChild('.');
}
- public function testGetQuotaInfoUnlimited() {
+ public function testGetQuotaInfoUnlimited(): void {
self::createUser('user', 'password');
self::loginAsUser('user');
$mountPoint = $this->createMock(IMountPoint::class);
$this->assertEquals([200, -3], $dir->getQuotaInfo()); //200 used, unlimited
}
- public function testGetQuotaInfoSpecific() {
+ public function testGetQuotaInfoSpecific(): void {
self::createUser('user', 'password');
self::loginAsUser('user');
$mountPoint = $this->createMock(IMountPoint::class);
/**
* @dataProvider moveFailedProvider
*/
- public function testMoveFailed($source, $destination, $updatables, $deletables) {
+ public function testMoveFailed($source, $destination, $updatables, $deletables): void {
$this->expectException(\Sabre\DAV\Exception\Forbidden::class);
$this->moveTest($source, $destination, $updatables, $deletables);
/**
* @dataProvider moveSuccessProvider
*/
- public function testMoveSuccess($source, $destination, $updatables, $deletables) {
+ public function testMoveSuccess($source, $destination, $updatables, $deletables): void {
$this->moveTest($source, $destination, $updatables, $deletables);
$this->addToAssertionCount(1);
}
/**
* @dataProvider moveFailedInvalidCharsProvider
*/
- public function testMoveFailedInvalidChars($source, $destination, $updatables, $deletables) {
+ public function testMoveFailedInvalidChars($source, $destination, $updatables, $deletables): void {
$this->expectException(\OCA\DAV\Connector\Sabre\Exception\InvalidPath::class);
$this->moveTest($source, $destination, $updatables, $deletables);
* @param $destination
* @param $updatables
*/
- private function moveTest($source, $destination, $updatables, $deletables) {
+ private function moveTest($source, $destination, $updatables, $deletables): void {
$view = new TestViewDirectory($updatables, $deletables);
$sourceInfo = new FileInfo($source, null, null, [
}
- public function testFailingMove() {
+ public function testFailingMove(): void {
$this->expectException(\Sabre\DAV\Exception\Forbidden::class);
$this->expectExceptionMessage('Could not copy directory b, target exists');
$this->dummyGetResponsePlugin = new DummyGetResponsePlugin();
}
- public function testInitialize() {
+ public function testInitialize(): void {
/** @var Server $server */
$server = $this->getMockBuilder(Server::class)
->disableOriginalConstructor()
}
- public function testHttpGet() {
+ public function testHttpGet(): void {
/** @var \Sabre\HTTP\RequestInterface $request */
$request = $this->getMockBuilder(RequestInterface::class)
->disableOriginalConstructor()
use OCA\DAV\Connector\Sabre\Exception\Forbidden;
class ForbiddenTest extends \Test\TestCase {
- public function testSerialization() {
+ public function testSerialization(): void {
// create xml doc
$DOM = new \DOMDocument('1.0','utf-8');
use OCA\DAV\Connector\Sabre\Exception\InvalidPath;
class InvalidPathTest extends \Test\TestCase {
- public function testSerialization() {
+ public function testSerialization(): void {
// create xml doc
$DOM = new \DOMDocument('1.0','utf-8');
/** @var LoggerInterface | \PHPUnit\Framework\MockObject\MockObject */
private $logger;
- private function init() {
+ private function init(): void {
$config = $this->createMock(SystemConfig::class);
$config->expects($this->any())
->method('getValue')
/**
* @dataProvider providesExceptions
*/
- public function testLogging(string $expectedLogLevel, \Throwable $e) {
+ public function testLogging(string $expectedLogLevel, \Throwable $e): void {
$this->init();
$this->logger->expects($this->once())
$this->fakeLockerPlugin = new FakeLockerPlugin();
}
- public function testInitialize() {
+ public function testInitialize(): void {
/** @var Server $server */
$server = $this->getMockBuilder(Server::class)
->disableOriginalConstructor()
$this->fakeLockerPlugin->initialize($server);
}
- public function testGetHTTPMethods() {
+ public function testGetHTTPMethods(): void {
$expected = [
'LOCK',
'UNLOCK',
$this->assertSame($expected, $this->fakeLockerPlugin->getHTTPMethods('Test'));
}
- public function testGetFeatures() {
+ public function testGetFeatures(): void {
$expected = [
2,
];
$this->assertSame($expected, $this->fakeLockerPlugin->getFeatures());
}
- public function testPropFind() {
+ public function testPropFind(): void {
$propFind = $this->getMockBuilder(PropFind::class)
->disableOriginalConstructor()
->getMock();
* @param array $input
* @param array $expected
*/
- public function testValidateTokens(array $input, array $expected) {
+ public function testValidateTokens(array $input, array $expected): void {
$request = $this->getMockBuilder(RequestInterface::class)
->disableOriginalConstructor()
->getMock();
$this->assertSame($expected, $input);
}
- public function testFakeLockProvider() {
+ public function testFakeLockProvider(): void {
$request = $this->getMockBuilder(RequestInterface::class)
->disableOriginalConstructor()
->getMock();
$this->assertXmlStringEqualsXmlString($expectedXml, $response->getBody());
}
- public function testFakeUnlockProvider() {
+ public function testFakeUnlockProvider(): void {
$request = $this->getMockBuilder(RequestInterface::class)
->disableOriginalConstructor()
->getMock();
/**
* @dataProvider fopenFailuresProvider
*/
- public function testSimplePutFails($thrownException, $expectedException, $checkPreviousClass = true) {
+ public function testSimplePutFails($thrownException, $expectedException, $checkPreviousClass = true): void {
// setup
$storage = $this->getMockBuilder(Local::class)
->setMethods(['writeStream'])
*
* @dataProvider fopenFailuresProvider
*/
- public function testChunkedPutFails($thrownException, $expectedException, $checkPreviousClass = false) {
+ public function testChunkedPutFails($thrownException, $expectedException, $checkPreviousClass = false): void {
// setup
$storage = $this->getMockBuilder(Local::class)
->setMethods(['fopen'])
/**
* Test putting a single file
*/
- public function testPutSingleFile() {
+ public function testPutSingleFile(): void {
$this->assertNotEmpty($this->doPut('/foo.txt'));
}
* Test putting a file with string Mtime
* @dataProvider legalMtimeProvider
*/
- public function testPutSingleFileLegalMtime($requestMtime, $resultMtime) {
+ public function testPutSingleFileLegalMtime($requestMtime, $resultMtime): void {
$request = new Request([
'server' => [
'HTTP_X_OC_MTIME' => $requestMtime,
* Test putting a file with string Mtime using chunking
* @dataProvider legalMtimeProvider
*/
- public function testChunkedPutLegalMtime($requestMtime, $resultMtime) {
+ public function testChunkedPutLegalMtime($requestMtime, $resultMtime): void {
$request = new Request([
'server' => [
'HTTP_X_OC_MTIME' => $requestMtime,
/**
* Test putting a file using chunking
*/
- public function testChunkedPut() {
+ public function testChunkedPut(): void {
$_SERVER['HTTP_OC_CHUNKED'] = true;
$this->assertNull($this->doPut('/test.txt-chunking-12345-2-0'));
$this->assertNotEmpty($this->doPut('/test.txt-chunking-12345-2-1'));
/**
* Test that putting a file triggers create hooks
*/
- public function testPutSingleFileTriggersHooks() {
+ public function testPutSingleFileTriggersHooks(): void {
HookHelper::setUpHooks();
$this->assertNotEmpty($this->doPut('/foo.txt'));
/**
* Test that putting a file triggers update hooks
*/
- public function testPutOverwriteFileTriggersHooks() {
+ public function testPutOverwriteFileTriggersHooks(): void {
$view = \OC\Files\Filesystem::getView();
$view->file_put_contents('/foo.txt', 'some content that will be replaced');
* if the passed view was chrooted (can happen with public webdav
* where the root is the share root)
*/
- public function testPutSingleFileTriggersHooksDifferentRoot() {
+ public function testPutSingleFileTriggersHooksDifferentRoot(): void {
$view = \OC\Files\Filesystem::getView();
$view->mkdir('noderoot');
/**
* Test that putting a file with chunks triggers create hooks
*/
- public function testPutChunkedFileTriggersHooks() {
+ public function testPutChunkedFileTriggersHooks(): void {
HookHelper::setUpHooks();
$_SERVER['HTTP_OC_CHUNKED'] = true;
/**
* Test that putting a chunked file triggers update hooks
*/
- public function testPutOverwriteChunkedFileTriggersHooks() {
+ public function testPutOverwriteChunkedFileTriggersHooks(): void {
$view = \OC\Files\Filesystem::getView();
$view->file_put_contents('/foo.txt', 'some content that will be replaced');
);
}
- public static function cancellingHook($params) {
+ public static function cancellingHook($params): void {
self::$hookCalls[] = [
'signal' => Filesystem::signal_post_create,
'params' => $params
/**
* Test put file with cancelled hook
*/
- public function testPutSingleFileCancelPreHook() {
+ public function testPutSingleFileCancelPreHook(): void {
\OCP\Util::connectHook(
Filesystem::CLASSNAME,
Filesystem::signal_create,
/**
* Test exception when the uploaded size did not match
*/
- public function testSimplePutFailsSizeCheck() {
+ public function testSimplePutFailsSizeCheck(): void {
// setup
$view = $this->getMockBuilder(View::class)
->setMethods(['rename', 'getRelativePath', 'filesize'])
/**
* Test exception during final rename in simple upload mode
*/
- public function testSimplePutFailsMoveFromStorage() {
+ public function testSimplePutFailsMoveFromStorage(): void {
$view = new \OC\Files\View('/' . $this->user . '/files');
// simulate situation where the target file is locked
/**
* Test exception during final rename in chunk upload mode
*/
- public function testChunkedPutFailsFinalRename() {
+ public function testChunkedPutFailsFinalRename(): void {
$view = new \OC\Files\View('/' . $this->user . '/files');
// simulate situation where the target file is locked
/**
* Test put file with invalid chars
*/
- public function testSimplePutInvalidChars() {
+ public function testSimplePutInvalidChars(): void {
// setup
$view = $this->getMockBuilder(View::class)
->setMethods(['getRelativePath'])
* Test setting name with setName() with invalid chars
*
*/
- public function testSetNameInvalidChars() {
+ public function testSetNameInvalidChars(): void {
$this->expectException(\OCA\DAV\Connector\Sabre\Exception\InvalidPath::class);
// setup
}
- public function testUploadAbort() {
+ public function testUploadAbort(): void {
// setup
$view = $this->getMockBuilder(View::class)
->setMethods(['rename', 'getRelativePath', 'filesize'])
}
- public function testDeleteWhenAllowed() {
+ public function testDeleteWhenAllowed(): void {
// setup
$view = $this->getMockBuilder(View::class)
->getMock();
}
- public function testDeleteThrowsWhenDeletionNotAllowed() {
+ public function testDeleteThrowsWhenDeletionNotAllowed(): void {
$this->expectException(\Sabre\DAV\Exception\Forbidden::class);
// setup
}
- public function testDeleteThrowsWhenDeletionFailed() {
+ public function testDeleteThrowsWhenDeletionFailed(): void {
$this->expectException(\Sabre\DAV\Exception\Forbidden::class);
// setup
}
- public function testDeleteThrowsWhenDeletionThrows() {
+ public function testDeleteThrowsWhenDeletionThrows(): void {
$this->expectException(\OCA\DAV\Connector\Sabre\Exception\Forbidden::class);
// setup
/**
* Test whether locks are set before and after the operation
*/
- public function testPutLocking() {
+ public function testPutLocking(): void {
$view = new \OC\Files\View('/' . $this->user . '/files/');
$path = 'test-locking.txt';
$eventHandler->expects($this->once())
->method('writeCallback')
->willReturnCallback(
- function () use ($view, $path, &$wasLockedPre) {
+ function () use ($view, $path, &$wasLockedPre): void {
$wasLockedPre = $this->isFileLocked($view, $path, \OCP\Lock\ILockingProvider::LOCK_SHARED);
$wasLockedPre = $wasLockedPre && !$this->isFileLocked($view, $path, \OCP\Lock\ILockingProvider::LOCK_EXCLUSIVE);
}
$eventHandler->expects($this->once())
->method('postWriteCallback')
->willReturnCallback(
- function () use ($view, $path, &$wasLockedPost) {
+ function () use ($view, $path, &$wasLockedPost): void {
$wasLockedPost = $this->isFileLocked($view, $path, \OCP\Lock\ILockingProvider::LOCK_SHARED);
$wasLockedPost = $wasLockedPost && !$this->isFileLocked($view, $path, \OCP\Lock\ILockingProvider::LOCK_EXCLUSIVE);
}
}
- public function testGetFopenFails() {
+ public function testGetFopenFails(): void {
$this->expectException(\Sabre\DAV\Exception\ServiceUnavailable::class);
$view = $this->getMockBuilder(View::class)
}
- public function testGetFopenThrows() {
+ public function testGetFopenThrows(): void {
$this->expectException(\OCA\DAV\Connector\Sabre\Exception\Forbidden::class);
$view = $this->getMockBuilder(View::class)
}
- public function testGetThrowsIfNoPermission() {
+ public function testGetThrowsIfNoPermission(): void {
$this->expectException(\Sabre\DAV\Exception\NotFound::class);
$view = $this->getMockBuilder(View::class)
$file->get();
}
- public function testSimplePutNoCreatePermissions() {
+ public function testSimplePutNoCreatePermissions(): void {
$this->logout();
$storage = new Temporary([]);
$this->assertEquals('new content', $view->file_get_contents('root/file.txt'));
}
- public function testPutLockExpired() {
+ public function testPutLockExpired(): void {
$view = new \OC\Files\View('/' . $this->user . '/files/');
$path = 'test-locking.txt';
return $node;
}
- public function testGetPropertiesForFile() {
+ public function testGetPropertiesForFile(): void {
/** @var \OCA\DAV\Connector\Sabre\File | \PHPUnit\Framework\MockObject\MockObject $node */
$node = $this->createTestNode('\OCA\DAV\Connector\Sabre\File');
$this->assertEquals([self::SIZE_PROPERTYNAME], $propFind->get404Properties());
}
- public function testGetPropertiesStorageNotAvailable() {
+ public function testGetPropertiesStorageNotAvailable(): void {
/** @var \OCA\DAV\Connector\Sabre\File | \PHPUnit\Framework\MockObject\MockObject $node */
$node = $this->createTestNode('\OCA\DAV\Connector\Sabre\File');
$this->assertEquals(null, $propFind->get(self::DOWNLOADURL_PROPERTYNAME));
}
- public function testGetPublicPermissions() {
+ public function testGetPublicPermissions(): void {
$this->plugin = new FilesPlugin(
$this->tree,
$this->config,
$this->assertEquals('DWCKR', $propFind->get(self::PERMISSIONS_PROPERTYNAME));
}
- public function testGetPropertiesForDirectory() {
+ public function testGetPropertiesForDirectory(): void {
/** @var \OCA\DAV\Connector\Sabre\Directory | \PHPUnit\Framework\MockObject\MockObject $node */
$node = $this->createTestNode('\OCA\DAV\Connector\Sabre\Directory');
$this->assertEquals([self::DOWNLOADURL_PROPERTYNAME], $propFind->get404Properties());
}
- public function testGetPropertiesForRootDirectory() {
+ public function testGetPropertiesForRootDirectory(): void {
/** @var \OCA\DAV\Connector\Sabre\Directory|\PHPUnit\Framework\MockObject\MockObject $node */
$node = $this->getMockBuilder(Directory::class)
->disableOriginalConstructor()
$this->assertEquals('my_fingerprint', $propFind->get(self::DATA_FINGERPRINT_PROPERTYNAME));
}
- public function testGetPropertiesWhenNoPermission() {
+ public function testGetPropertiesWhenNoPermission(): void {
// No read permissions can be caused by files access control.
// But we still want to load the directory list, so this is okay for us.
// $this->expectException(\Sabre\DAV\Exception\NotFound::class);
$this->addToAssertionCount(1);
}
- public function testUpdateProps() {
+ public function testUpdateProps(): void {
$node = $this->createTestNode('\OCA\DAV\Connector\Sabre\File');
$testDate = 'Fri, 13 Feb 2015 00:01:02 GMT';
$this->assertEquals(200, $result[self::CREATIONDATE_PROPERTYNAME]);
}
- public function testUpdatePropsForbidden() {
+ public function testUpdatePropsForbidden(): void {
$propPatch = new PropPatch([
self::OWNER_ID_PROPERTYNAME => 'user2',
self::OWNER_DISPLAY_NAME_PROPERTYNAME => 'User Two',
* Thus moving /FolderA/test.txt to /test.txt should fail already on that check
*
*/
- public function testMoveSrcNotDeletable() {
+ public function testMoveSrcNotDeletable(): void {
$this->expectException(\Sabre\DAV\Exception\Forbidden::class);
$this->expectExceptionMessage('FolderA/test.txt cannot be deleted');
$this->plugin->checkMove('FolderA/test.txt', 'test.txt');
}
- public function testMoveSrcDeletable() {
+ public function testMoveSrcDeletable(): void {
$fileInfoFolderATestTXT = $this->getMockBuilder(FileInfo::class)
->disableOriginalConstructor()
->getMock();
}
- public function testMoveSrcNotExist() {
+ public function testMoveSrcNotExist(): void {
$this->expectException(\Sabre\DAV\Exception\NotFound::class);
$this->expectExceptionMessage('FolderA/test.txt does not exist');
/**
* @dataProvider downloadHeadersProvider
*/
- public function testDownloadHeaders($isClumsyAgent, $contentDispositionHeader) {
+ public function testDownloadHeaders($isClumsyAgent, $contentDispositionHeader): void {
$request = $this->getMockBuilder(RequestInterface::class)
->disableOriginalConstructor()
->getMock();
$this->plugin->httpGet($request, $response);
}
- public function testHasPreview() {
+ public function testHasPreview(): void {
/** @var \OCA\DAV\Connector\Sabre\Directory | \PHPUnit\Framework\MockObject\MockObject $node */
$node = $this->createTestNode('\OCA\DAV\Connector\Sabre\Directory');
);
}
- public function testOnReportInvalidNode() {
+ public function testOnReportInvalidNode(): void {
$path = 'totally/unrelated/13';
$this->tree->expects($this->any())
$this->assertNull($this->plugin->onReport(FilesReportPluginImplementation::REPORT_NAME, [], '/' . $path));
}
- public function testOnReportInvalidReportName() {
+ public function testOnReportInvalidReportName(): void {
$path = 'test';
$this->tree->expects($this->any())
$this->assertNull($this->plugin->onReport('{whoever}whatever', [], '/' . $path));
}
- public function testOnReport() {
+ public function testOnReport(): void {
$path = 'test';
$parameters = [
$this->assertFalse($this->plugin->onReport(FilesReportPluginImplementation::REPORT_NAME, $parameters, '/' . $path));
}
- public function testFindNodesByFileIdsRoot() {
+ public function testFindNodesByFileIdsRoot(): void {
$filesNode1 = $this->getMockBuilder(Folder::class)
->disableOriginalConstructor()
->getMock();
$this->assertEquals('second node', $result[1]->getName());
}
- public function testFindNodesByFileIdsSubDir() {
+ public function testFindNodesByFileIdsSubDir(): void {
$filesNode1 = $this->getMockBuilder(Folder::class)
->disableOriginalConstructor()
->getMock();
$this->assertEquals('second node', $result[1]->getName());
}
- public function testPrepareResponses() {
+ public function testPrepareResponses(): void {
$requestedProps = ['{DAV:}getcontentlength', '{http://owncloud.org/ns}fileid', '{DAV:}resourcetype'];
$fileInfo = $this->createMock(FileInfo::class);
$this->assertCount(0, $props2[200]['{DAV:}resourcetype']->getValue());
}
- public function testProcessFilterRulesSingle() {
+ public function testProcessFilterRulesSingle(): void {
$this->groupManager->expects($this->any())
->method('isAdmin')
->willReturn(true);
$this->assertEquals(['111', '222'], $this->invokePrivate($this->plugin, 'processFilterRules', [$rules]));
}
- public function testProcessFilterRulesAndCondition() {
+ public function testProcessFilterRulesAndCondition(): void {
$this->groupManager->expects($this->any())
->method('isAdmin')
->willReturn(true);
$this->assertEquals(['222'], array_values($this->invokePrivate($this->plugin, 'processFilterRules', [$rules])));
}
- public function testProcessFilterRulesAndConditionWithOneEmptyResult() {
+ public function testProcessFilterRulesAndConditionWithOneEmptyResult(): void {
$this->groupManager->expects($this->any())
->method('isAdmin')
->willReturn(true);
$this->assertEquals([], array_values($this->invokePrivate($this->plugin, 'processFilterRules', [$rules])));
}
- public function testProcessFilterRulesAndConditionWithFirstEmptyResult() {
+ public function testProcessFilterRulesAndConditionWithFirstEmptyResult(): void {
$this->groupManager->expects($this->any())
->method('isAdmin')
->willReturn(true);
$this->assertEquals([], array_values($this->invokePrivate($this->plugin, 'processFilterRules', [$rules])));
}
- public function testProcessFilterRulesAndConditionWithEmptyMidResult() {
+ public function testProcessFilterRulesAndConditionWithEmptyMidResult(): void {
$this->groupManager->expects($this->any())
->method('isAdmin')
->willReturn(true);
$this->assertEquals([], array_values($this->invokePrivate($this->plugin, 'processFilterRules', [$rules])));
}
- public function testProcessFilterRulesInvisibleTagAsAdmin() {
+ public function testProcessFilterRulesInvisibleTagAsAdmin(): void {
$this->groupManager->expects($this->any())
->method('isAdmin')
->willReturn(true);
}
- public function testProcessFilterRulesInvisibleTagAsUser() {
+ public function testProcessFilterRulesInvisibleTagAsUser(): void {
$this->expectException(\OCP\SystemTag\TagNotFoundException::class);
$this->groupManager->expects($this->any())
$this->invokePrivate($this->plugin, 'processFilterRules', [$rules]);
}
- public function testProcessFilterRulesVisibleTagAsUser() {
+ public function testProcessFilterRulesVisibleTagAsUser(): void {
$this->groupManager->expects($this->any())
->method('isAdmin')
->willReturn(false);
$this->assertEquals(['222'], array_values($this->invokePrivate($this->plugin, 'processFilterRules', [$rules])));
}
- public function testProcessFavoriteFilter() {
+ public function testProcessFavoriteFilter(): void {
$rules = [
['name' => '{http://owncloud.org/ns}favorite', 'value' => '1'],
];
/**
* @dataProvider filesBaseUriProvider
*/
- public function testFilesBaseUri($uri, $reportPath, $expectedUri) {
+ public function testFilesBaseUri($uri, $reportPath, $expectedUri): void {
$this->assertEquals($expectedUri, $this->invokePrivate($this->plugin, 'getFilesBaseUri', [$uri, $reportPath]));
}
}
}
- public function testMaintenanceMode() {
+ public function testMaintenanceMode(): void {
$this->expectException(\Sabre\DAV\Exception\ServiceUnavailable::class);
$this->expectExceptionMessage('System is in maintenance mode.');
/**
* @dataProvider davPermissionsProvider
*/
- public function testDavPermissions($permissions, $type, $shared, $mounted, $expected) {
+ public function testDavPermissions($permissions, $type, $shared, $mounted, $expected): void {
$info = $this->getMockBuilder(FileInfo::class)
->disableOriginalConstructor()
->setMethods(['getPermissions', 'isShared', 'isMounted', 'getType'])
/**
* @dataProvider sharePermissionsProvider
*/
- public function testSharePermissions($type, $user, $permissions, $expected) {
+ public function testSharePermissions($type, $user, $permissions, $expected): void {
$storage = $this->getMockBuilder(Storage::class)
->disableOriginalConstructor()
->getMock();
$this->assertEquals($expected, $node->getSharePermissions($user));
}
- public function testShareAttributes() {
+ public function testShareAttributes(): void {
$storage = $this->getMockBuilder(SharedStorage::class)
->disableOriginalConstructor()
->setMethods(['getShare'])
$this->assertEquals($attributes->toArray(), $node->getShareAttributes());
}
- public function testShareAttributesNonShare() {
+ public function testShareAttributesNonShare(): void {
$storage = $this->getMockBuilder(Storage::class)
->disableOriginalConstructor()
->getMock();
/**
* @dataProvider sanitizeMtimeProvider
*/
- public function testSanitizeMtime($mtime, $expected) {
+ public function testSanitizeMtime($mtime, $expected): void {
$view = $this->getMockBuilder(View::class)
->disableOriginalConstructor()
->getMock();
/**
* @dataProvider invalidSanitizeMtimeProvider
*/
- public function testInvalidSanitizeMtime($mtime) {
+ public function testInvalidSanitizeMtime($mtime): void {
$this->expectException(\InvalidArgumentException::class);
$view = $this->getMockBuilder(View::class)
/**
* @dataProvider copyDataProvider
*/
- public function testCopy($sourcePath, $targetPath, $targetParent) {
+ public function testCopy($sourcePath, $targetPath, $targetParent): void {
$view = $this->createMock(View::class);
$view->expects($this->once())
->method('verifyPath')
/**
* @dataProvider copyDataProvider
*/
- public function testCopyFailNotCreatable($sourcePath, $targetPath, $targetParent) {
+ public function testCopyFailNotCreatable($sourcePath, $targetPath, $targetParent): void {
$this->expectException(\Sabre\DAV\Exception\Forbidden::class);
$view = $this->createMock(View::class);
$outputFileName,
$type,
$enableChunkingHeader
- ) {
+ ): void {
if ($enableChunkingHeader) {
$_SERVER['HTTP_OC_CHUNKED'] = true;
}
}
- public function testGetNodeForPathInvalidPath() {
+ public function testGetNodeForPathInvalidPath(): void {
$this->expectException(\OCA\DAV\Connector\Sabre\Exception\InvalidPath::class);
$path = '/foo\bar';
$tree->getNodeForPath($path);
}
- public function testGetNodeForPathRoot() {
+ public function testGetNodeForPathRoot(): void {
$path = '/';
$this->plugin = new PropfindCompressionPlugin();
}
- public function testNoHeader() {
+ public function testNoHeader(): void {
$request = $this->createMock(Request::class);
$response = $this->createMock(Response::class);
$this->assertSame($response, $result);
}
- public function testHeaderButNoGzip() {
+ public function testHeaderButNoGzip(): void {
$request = $this->createMock(Request::class);
$response = $this->createMock(Response::class);
$this->assertSame($response, $result);
}
- public function testHeaderGzipButNoStringBody() {
+ public function testHeaderGzipButNoStringBody(): void {
$request = $this->createMock(Request::class);
$response = $this->createMock(Response::class);
}
- public function testProperGzip() {
+ public function testProperGzip(): void {
$request = $this->createMock(Request::class);
$response = $this->createMock(Response::class);
/** @var \OCA\DAV\Connector\Sabre\QuotaPlugin | \PHPUnit\Framework\MockObject\MockObject */
private $plugin;
- private function init($quota, $checkedPath = '') {
+ private function init($quota, $checkedPath = ''): void {
$view = $this->buildFileViewMock($quota, $checkedPath);
$this->server = new \Sabre\DAV\Server();
$this->plugin = $this->getMockBuilder(QuotaPlugin::class)
/**
* @dataProvider lengthProvider
*/
- public function testLength($expected, $headers) {
+ public function testLength($expected, $headers): void {
$this->init(0);
$this->plugin->expects($this->never())
->method('getFileChunking');
/**
* @dataProvider quotaOkayProvider
*/
- public function testCheckQuota($quota, $headers) {
+ public function testCheckQuota($quota, $headers): void {
$this->init($quota);
$this->plugin->expects($this->never())
->method('getFileChunking');
/**
* @dataProvider quotaExceededProvider
*/
- public function testCheckExceededQuota($quota, $headers) {
+ public function testCheckExceededQuota($quota, $headers): void {
$this->expectException(\Sabre\DAV\Exception\InsufficientStorage::class);
$this->init($quota);
/**
* @dataProvider quotaOkayProvider
*/
- public function testCheckQuotaOnPath($quota, $headers) {
+ public function testCheckQuotaOnPath($quota, $headers): void {
$this->init($quota, 'sub/test.txt');
$this->plugin->expects($this->never())
->method('getFileChunking');
/**
* @dataProvider quotaChunkedOkProvider
*/
- public function testCheckQuotaChunkedOk($quota, $chunkTotalSize, $headers) {
+ public function testCheckQuotaChunkedOk($quota, $chunkTotalSize, $headers): void {
$this->init($quota, 'sub/test.txt');
$mockChunking = $this->getMockBuilder(\OC_FileChunking::class)
/**
* @dataProvider quotaChunkedFailProvider
*/
- public function testCheckQuotaChunkedFail($quota, $chunkTotalSize, $headers) {
+ public function testCheckQuotaChunkedFail($quota, $chunkTotalSize, $headers): void {
$this->expectException(\Sabre\DAV\Exception\InsufficientStorage::class);
$this->init($quota, 'sub/test.txt');
* @param ResponseInterface $response
* @return void
*/
- public function challenge(RequestInterface $request, ResponseInterface $response) {
+ public function challenge(RequestInterface $request, ResponseInterface $response): void {
// TODO: Implement challenge() method.
}
}
* @package OCA\DAV\Tests\unit\Connector\Sabre\RequestTest
*/
class DeleteTest extends RequestTestCase {
- public function testBasicUpload() {
+ public function testBasicUpload(): void {
$user = $this->getUniqueID();
$view = $this->setupUser($user, 'pass');
* @package OCA\DAV\Tests\unit\Connector\Sabre\RequestTest
*/
class DownloadTest extends RequestTestCase {
- public function testDownload() {
+ public function testDownload(): void {
$user = $this->getUniqueID();
$view = $this->setupUser($user, 'pass');
$this->assertEquals(stream_get_contents($response->getBody()), 'bar');
}
- public function testDownloadWriteLocked() {
+ public function testDownloadWriteLocked(): void {
$user = $this->getUniqueID();
$view = $this->setupUser($user, 'pass');
$this->assertEquals(Http::STATUS_LOCKED, $result->getStatus());
}
- public function testDownloadReadLocked() {
+ public function testDownloadReadLocked(): void {
$user = $this->getUniqueID();
$view = $this->setupUser($user, 'pass');
*/
protected $exceptions = [];
- public function logException(\Throwable $ex) {
+ public function logException(\Throwable $ex): void {
$exceptionClass = get_class($ex);
if (!isset($this->nonFatalExceptions[$exceptionClass])) {
$this->exceptions[] = $ex;
* @param \Sabre\HTTP\Response $response
* @return void
*/
- public function sendResponse(Response $response) {
+ public function sendResponse(Response $response): void {
// we need to copy the body since we close the source stream
$copyStream = fopen('php://temp', 'r+');
if (is_string($response->getBody())) {
* @package OCA\DAV\Tests\unit\Connector\Sabre\RequestTest
*/
class UploadTest extends RequestTestCase {
- public function testBasicUpload() {
+ public function testBasicUpload(): void {
$user = $this->getUniqueID();
$view = $this->setupUser($user, 'pass');
$this->assertEquals(3, $info->getSize());
}
- public function testUploadOverWrite() {
+ public function testUploadOverWrite(): void {
$user = $this->getUniqueID();
$view = $this->setupUser($user, 'pass');
$this->assertEquals(3, $info->getSize());
}
- public function testUploadOverWriteReadLocked() {
+ public function testUploadOverWriteReadLocked(): void {
$user = $this->getUniqueID();
$view = $this->setupUser($user, 'pass');
$this->assertEquals(Http::STATUS_LOCKED, $result->getStatus());
}
- public function testUploadOverWriteWriteLocked() {
+ public function testUploadOverWriteWriteLocked(): void {
$user = $this->getUniqueID();
$view = $this->setupUser($user, 'pass');
$this->loginAsUser($user);
$this->assertEquals(Http::STATUS_LOCKED, $result->getStatus());
}
- public function testChunkedUpload() {
+ public function testChunkedUpload(): void {
$user = $this->getUniqueID();
$view = $this->setupUser($user, 'pass');
$this->assertEquals(6, $info->getSize());
}
- public function testChunkedUploadOverWrite() {
+ public function testChunkedUploadOverWrite(): void {
$user = $this->getUniqueID();
$view = $this->setupUser($user, 'pass');
$this->assertEquals(6, $info->getSize());
}
- public function testChunkedUploadOutOfOrder() {
+ public function testChunkedUploadOutOfOrder(): void {
$user = $this->getUniqueID();
$view = $this->setupUser($user, 'pass');
$this->assertEquals(6, $info->getSize());
}
- public function testChunkedUploadOutOfOrderReadLocked() {
+ public function testChunkedUploadOutOfOrderReadLocked(): void {
$user = $this->getUniqueID();
$view = $this->setupUser($user, 'pass');
$this->assertEquals(Http::STATUS_LOCKED, $result->getStatus());
}
- public function testChunkedUploadOutOfOrderWriteLocked() {
+ public function testChunkedUploadOutOfOrderWriteLocked(): void {
$user = $this->getUniqueID();
$view = $this->setupUser($user, 'pass');
/**
* @dataProvider sharesGetPropertiesDataProvider
*/
- public function testGetProperties($shareTypes) {
+ public function testGetProperties($shareTypes): void {
$sabreNode = $this->getMockBuilder(Node::class)
->disableOriginalConstructor()
->getMock();
/**
* @dataProvider sharesGetPropertiesDataProvider
*/
- public function testPreloadThenGetProperties($shareTypes) {
+ public function testPreloadThenGetProperties($shareTypes): void {
$sabreNode1 = $this->createMock(File::class);
$sabreNode1->method('getId')
->willReturn(111);
/**
* @dataProvider tagsGetPropertiesDataProvider
*/
- public function testGetProperties($tags, $requestedProperties, $expectedProperties) {
+ public function testGetProperties($tags, $requestedProperties, $expectedProperties): void {
$node = $this->getMockBuilder(Node::class)
->disableOriginalConstructor()
->getMock();
/**
* @dataProvider tagsGetPropertiesDataProvider
*/
- public function testPreloadThenGetProperties($tags, $requestedProperties, $expectedProperties) {
+ public function testPreloadThenGetProperties($tags, $requestedProperties, $expectedProperties): void {
$node1 = $this->getMockBuilder(File::class)
->disableOriginalConstructor()
->getMock();
$this->assertCount(2, $result[404]);
}
- public function testUpdateTags() {
+ public function testUpdateTags(): void {
// this test will replace the existing tags "tagremove" with "tag1" and "tag2"
// and keep "tagkeep"
$node = $this->getMockBuilder(Node::class)
$this->assertFalse(isset($result[self::FAVORITE_PROPERTYNAME]));
}
- public function testUpdateTagsFromScratch() {
+ public function testUpdateTagsFromScratch(): void {
$node = $this->getMockBuilder(Node::class)
->disableOriginalConstructor()
->getMock();
$this->assertFalse(false, isset($result[self::FAVORITE_PROPERTYNAME]));
}
- public function testUpdateFav() {
+ public function testUpdateFav(): void {
// this test will replace the existing tags "tagremove" with "tag1" and "tag2"
// and keep "tagkeep"
$node = $this->getMockBuilder(Node::class)
$this->userManager, $this->caldav);
}
- public function testEnable() {
+ public function testEnable(): void {
$this->config->expects($this->once())
->method('setAppValue')
->with('dav', 'generateBirthdayCalendar', 'yes');
$this->userManager->expects($this->once())
->method('callForSeenUsers')
- ->willReturnCallback(function ($closure) {
+ ->willReturnCallback(function ($closure): void {
$user1 = $this->createMock(IUser::class);
$user1->method('getUID')->willReturn('uid1');
$user2 = $this->createMock(IUser::class);
$this->assertInstanceOf('OCP\AppFramework\Http\JSONResponse', $response);
}
- public function testDisable() {
+ public function testDisable(): void {
$this->config->expects($this->once())
->method('setAppValue')
->with('dav', 'generateBirthdayCalendar', 'no');
$called = false;
$this->responseServer->expects($this->once())
->method('handleITipMessage')
- ->willReturnCallback(function (Message $iTipMessage) use (&$called, $isExternalAttendee, $expected) {
+ ->willReturnCallback(function (Message $iTipMessage) use (&$called, $isExternalAttendee, $expected): void {
$called = true;
$this->assertEquals('this-is-the-events-uid', $iTipMessage->uid);
$this->assertEquals('VEVENT', $iTipMessage->component);
$called = false;
$this->responseServer->expects($this->once())
->method('handleITipMessage')
- ->willReturnCallback(function (Message $iTipMessage) use (&$called, $isExternalAttendee, $expected) {
+ ->willReturnCallback(function (Message $iTipMessage) use (&$called, $isExternalAttendee, $expected): void {
$called = true;
$this->assertEquals('this-is-the-events-uid', $iTipMessage->uid);
$this->assertEquals('VEVENT', $iTipMessage->component);
$called = false;
$this->responseServer->expects($this->once())
->method('handleITipMessage')
- ->willReturnCallback(function (Message $iTipMessage) use (&$called, $isExternalAttendee, $expected) {
+ ->willReturnCallback(function (Message $iTipMessage) use (&$called, $isExternalAttendee, $expected): void {
$called = true;
$this->assertEquals('this-is-the-events-uid', $iTipMessage->uid);
$this->assertEquals('VEVENT', $iTipMessage->component);
$this->assertTrue($called);
}
- public function testAcceptTokenNotFound() {
+ public function testAcceptTokenNotFound(): void {
$this->buildQueryExpects('TOKEN123', null, 1337);
$response = $this->controller->accept('TOKEN123');
$this->assertEquals([], $response->getParams());
}
- public function testAcceptExpiredToken() {
+ public function testAcceptExpiredToken(): void {
$this->buildQueryExpects('TOKEN123', [
'id' => 0,
'uid' => 'this-is-the-events-uid',
$called = false;
$this->responseServer->expects($this->once())
->method('handleITipMessage')
- ->willReturnCallback(function (Message $iTipMessage) use (&$called, $isExternalAttendee, $expected) {
+ ->willReturnCallback(function (Message $iTipMessage) use (&$called, $isExternalAttendee, $expected): void {
$called = true;
$this->assertEquals('this-is-the-events-uid', $iTipMessage->uid);
$this->assertEquals('VEVENT', $iTipMessage->component);
$this->assertTrue($called);
}
- public function testOptions() {
+ public function testOptions(): void {
$response = $this->controller->options('TOKEN123');
$this->assertInstanceOf(TemplateResponse::class, $response);
$this->assertEquals('schedule-response-options', $response->getTemplateName());
$called = false;
$this->responseServer->expects($this->once())
->method('handleITipMessage')
- ->willReturnCallback(function (Message $iTipMessage) use (&$called, $isExternalAttendee, $expected) {
+ ->willReturnCallback(function (Message $iTipMessage) use (&$called, $isExternalAttendee, $expected): void {
$called = true;
$this->assertEquals('this-is-the-events-uid', $iTipMessage->uid);
$this->assertEquals('VEVENT', $iTipMessage->component);
$this->assertTrue($called);
}
- private function buildQueryExpects($token, $return, $time) {
+ private function buildQueryExpects($token, $return, $time): void {
$queryBuilder = $this->createMock(IQueryBuilder::class);
$stmt = $this->createMock(IResult::class);
$expr = $this->createMock(IExpressionBuilder::class);
return $server->httpResponse;
}
- public function testAnonymousOptionsRoot() {
+ public function testAnonymousOptionsRoot(): void {
$response = $this->sendRequest('OPTIONS', '');
$this->assertEquals(401, $response->getStatus());
}
- public function testAnonymousOptionsNonRoot() {
+ public function testAnonymousOptionsNonRoot(): void {
$response = $this->sendRequest('OPTIONS', 'foo');
$this->assertEquals(401, $response->getStatus());
}
- public function testAnonymousOptionsNonRootSubDir() {
+ public function testAnonymousOptionsNonRootSubDir(): void {
$response = $this->sendRequest('OPTIONS', 'foo/bar');
$this->assertEquals(401, $response->getStatus());
}
- public function testAnonymousOptionsRootOffice() {
+ public function testAnonymousOptionsRootOffice(): void {
$response = $this->sendRequest('OPTIONS', '', 'Microsoft Office does strange things');
$this->assertEquals(200, $response->getStatus());
}
- public function testAnonymousOptionsNonRootOffice() {
+ public function testAnonymousOptionsNonRootOffice(): void {
$response = $this->sendRequest('OPTIONS', 'foo', 'Microsoft Office does strange things');
$this->assertEquals(200, $response->getStatus());
}
- public function testAnonymousOptionsNonRootSubDirOffice() {
+ public function testAnonymousOptionsNonRootSubDirOffice(): void {
$response = $this->sendRequest('OPTIONS', 'foo/bar', 'Microsoft Office does strange things');
$this->assertEquals(200, $response->getStatus());
}
- public function testAnonymousHead() {
+ public function testAnonymousHead(): void {
$response = $this->sendRequest('HEAD', '', 'Microsoft Office does strange things');
$this->assertEquals(200, $response->getStatus());
}
- public function testAnonymousHeadNoOffice() {
+ public function testAnonymousHeadNoOffice(): void {
$response = $this->sendRequest('HEAD', '');
$this->assertEquals(401, $response->getStatus(), 'curl');
*
* @return void
*/
- public static function sendResponse(ResponseInterface $response) {
+ public static function sendResponse(ResponseInterface $response): void {
}
}
* @param $expectedCode
* @param $exception
*/
- public function test($expectedCode, $exception) {
+ public function test($expectedCode, $exception): void {
/** @var BrowserErrorPagePlugin | \PHPUnit\Framework\MockObject\MockObject $plugin */
$plugin = $this->getMockBuilder(BrowserErrorPagePlugin::class)->setMethods(['sendResponse', 'generateBody'])->getMock();
$plugin->expects($this->once())->method('generateBody')->willReturn(':boom:');
return $data;
}
- public function testPropFindNoDbCalls() {
+ public function testPropFindNoDbCalls(): void {
$db = $this->createMock(IDBConnection::class);
$backend = new CustomPropertiesBackend(
$this->tree,
$backend->propFind('foo_bar_path_1337_0', $propFind);
}
- public function testPropFindCalendarCall() {
+ public function testPropFindCalendarCall(): void {
$propFind = $this->createMock(PropFind::class);
$propFind->method('get404Properties')
->with()
$setProps = [];
$propFind->method('set')
- ->willReturnCallback(function ($name, $value, $status) use (&$setProps) {
+ ->willReturnCallback(function ($name, $value, $status) use (&$setProps): void {
$setProps[$name] = $value;
});
/**
* @dataProvider propPatchProvider
*/
- public function testPropPatch(string $path, array $existing, array $props, array $result) {
+ public function testPropPatch(string $path, array $existing, array $props, array $result): void {
$this->insertProps($this->user->getUID(), $path, $existing);
$propPatch = new PropPatch($props);
/**
* @dataProvider deleteProvider
*/
- public function testDelete(string $path) {
+ public function testDelete(string $path): void {
$this->insertProps('dummy_user_42', $path, ['foo' => 'bar']);
$this->backend->delete($path);
$this->assertEquals([], $this->getProps('dummy_user_42', $path));
/**
* @dataProvider moveProvider
*/
- public function testMove(string $source, string $target) {
+ public function testMove(string $source, string $target): void {
$this->insertProps('dummy_user_42', $source, ['foo' => 'bar']);
$this->backend->move($source, $target);
$this->assertEquals([], $this->getProps('dummy_user_42', $source));
parent::setUp();
}
- public function testGetPrincipalsByPrefixWithoutPrefix() {
+ public function testGetPrincipalsByPrefixWithoutPrefix(): void {
$response = $this->connector->getPrincipalsByPrefix('');
$this->assertSame([], $response);
}
- public function testGetPrincipalsByPrefixWithUsers() {
+ public function testGetPrincipalsByPrefixWithUsers(): void {
$group1 = $this->mockGroup('foo');
$group2 = $this->mockGroup('bar');
$this->groupManager
$this->assertSame($expectedResponse, $response);
}
- public function testGetPrincipalsByPrefixEmpty() {
+ public function testGetPrincipalsByPrefixEmpty(): void {
$this->groupManager
->expects($this->once())
->method('search')
$this->assertSame([], $response);
}
- public function testGetPrincipalsByPathWithoutMail() {
+ public function testGetPrincipalsByPathWithoutMail(): void {
$group1 = $this->mockGroup('foo');
$this->groupManager
->expects($this->once())
$this->assertSame($expectedResponse, $response);
}
- public function testGetPrincipalsByPathWithMail() {
+ public function testGetPrincipalsByPathWithMail(): void {
$fooUser = $this->mockGroup('foo');
$this->groupManager
->expects($this->once())
$this->assertSame($expectedResponse, $response);
}
- public function testGetPrincipalsByPathEmpty() {
+ public function testGetPrincipalsByPathEmpty(): void {
$this->groupManager
->expects($this->once())
->method('get')
$this->assertSame(null, $response);
}
- public function testGetPrincipalsByPathGroupWithSlash() {
+ public function testGetPrincipalsByPathGroupWithSlash(): void {
$group1 = $this->mockGroup('foo/bar');
$this->groupManager
->expects($this->once())
$this->assertSame($expectedResponse, $response);
}
- public function testGetPrincipalsByPathGroupWithHash() {
+ public function testGetPrincipalsByPathGroupWithHash(): void {
$group1 = $this->mockGroup('foo#bar');
$this->groupManager
->expects($this->once())
$this->assertSame($expectedResponse, $response);
}
- public function testGetGroupMemberSet() {
+ public function testGetGroupMemberSet(): void {
$response = $this->connector->getGroupMemberSet('principals/groups/foo');
$this->assertSame([], $response);
}
- public function testGetGroupMembership() {
+ public function testGetGroupMembership(): void {
$response = $this->connector->getGroupMembership('principals/groups/foo');
$this->assertSame([], $response);
}
- public function testSetGroupMembership() {
+ public function testSetGroupMembership(): void {
$this->expectException(\Sabre\DAV\Exception::class);
$this->expectExceptionMessage('Setting members of the group is not supported yet');
$this->connector->setGroupMemberSet('principals/groups/foo', ['foo']);
}
- public function testUpdatePrincipal() {
+ public function testUpdatePrincipal(): void {
$this->assertSame(0, $this->connector->updatePrincipal('foo', new PropPatch([])));
}
- public function testSearchPrincipalsWithEmptySearchProperties() {
+ public function testSearchPrincipalsWithEmptySearchProperties(): void {
$this->assertSame([], $this->connector->searchPrincipals('principals/groups', []));
}
- public function testSearchPrincipalsWithWrongPrefixPath() {
+ public function testSearchPrincipalsWithWrongPrefixPath(): void {
$this->assertSame([], $this->connector->searchPrincipals('principals/users',
['{DAV:}displayname' => 'Foo']));
}
});
}
- public function test() {
+ public function test(): void {
$user = $this->getMockBuilder(IUser::class)
->disableOriginalConstructor()
->getMock();
$hm->firstLogin($user);
}
- public function testWithExisting() {
+ public function testWithExisting(): void {
$user = $this->getMockBuilder(IUser::class)
->disableOriginalConstructor()
->getMock();
$hm->firstLogin($user);
}
- public function testWithBirthdayCalendar() {
+ public function testWithBirthdayCalendar(): void {
$user = $this->getMockBuilder(IUser::class)
->disableOriginalConstructor()
->getMock();
$hm->firstLogin($user);
}
- public function testDeleteCalendar() {
+ public function testDeleteCalendar(): void {
$user = $this->getMockBuilder(IUser::class)
->disableOriginalConstructor()
->getMock();
$this->plugin->initialize($this->server);
}
- public function testSharing() {
+ public function testSharing(): void {
$this->book->expects($this->once())->method('updateShares')->with([[
'href' => 'principal:principals/admin',
'commonName' => null,
* @param $expected
* @param $prefix
*/
- public function testGetPrincipalsByPrefix($expected, $prefix) {
+ public function testGetPrincipalsByPrefix($expected, $prefix): void {
$backend = new SystemPrincipalBackend();
$result = $backend->getPrincipalsByPrefix($prefix);
$this->assertEquals($expected, $result);
* @param $expected
* @param $path
*/
- public function testGetPrincipalByPath($expected, $path) {
+ public function testGetPrincipalByPath($expected, $path): void {
$backend = new SystemPrincipalBackend();
$result = $backend->getPrincipalByPath($path);
$this->assertEquals($expected, $result);
* @param string $principal
* @throws \Sabre\DAV\Exception
*/
- public function testGetGroupMemberSetExceptional($principal) {
+ public function testGetGroupMemberSetExceptional($principal): void {
$this->expectException(\Sabre\DAV\Exception::class);
$this->expectExceptionMessage('Principal not found');
/**
* @throws \Sabre\DAV\Exception
*/
- public function testGetGroupMemberSet() {
+ public function testGetGroupMemberSet(): void {
$backend = new SystemPrincipalBackend();
$result = $backend->getGroupMemberSet('principals/system/system');
$this->assertEquals(['principals/system/system'], $result);
* @param string $principal
* @throws \Sabre\DAV\Exception
*/
- public function testGetGroupMembershipExceptional($principal) {
+ public function testGetGroupMembershipExceptional($principal): void {
$this->expectException(\Sabre\DAV\Exception::class);
$this->expectExceptionMessage('Principal not found');
/**
* @throws \Sabre\DAV\Exception
*/
- public function testGetGroupMembership() {
+ public function testGetGroupMembership(): void {
$backend = new SystemPrincipalBackend();
$result = $backend->getGroupMembership('principals/system/system');
$this->assertEquals([], $result);
$this->directFile = new DirectFile($this->direct, $this->rootFolder, $this->eventDispatcher);
}
- public function testPut() {
+ public function testPut(): void {
$this->expectException(Forbidden::class);
$this->directFile->put('foo');
}
- public function testGet() {
+ public function testGet(): void {
$this->file->expects($this->once())
->method('fopen')
->with('rb');
$this->directFile->get();
}
- public function testGetContentType() {
+ public function testGetContentType(): void {
$this->file->method('getMimeType')
->willReturn('direct/type');
$this->assertSame('direct/type', $this->directFile->getContentType());
}
- public function testGetETag() {
+ public function testGetETag(): void {
$this->file->method('getEtag')
->willReturn('directEtag');
$this->assertSame('directEtag', $this->directFile->getETag());
}
- public function testGetSize() {
+ public function testGetSize(): void {
$this->file->method('getSize')
->willReturn(42);
$this->assertSame(42, $this->directFile->getSize());
}
- public function testDelete() {
+ public function testDelete(): void {
$this->expectException(Forbidden::class);
$this->directFile->delete();
}
- public function testGetName() {
+ public function testGetName(): void {
$this->assertSame('directToken', $this->directFile->getName());
}
- public function testSetName() {
+ public function testSetName(): void {
$this->expectException(Forbidden::class);
$this->directFile->setName('foobar');
}
- public function testGetLastModified() {
+ public function testGetLastModified(): void {
$this->file->method('getMTime')
->willReturn(42);
);
}
- public function testCreateFile() {
+ public function testCreateFile(): void {
$this->expectException(Forbidden::class);
$this->directHome->createFile('foo', 'bar');
}
- public function testCreateDirectory() {
+ public function testCreateDirectory(): void {
$this->expectException(Forbidden::class);
$this->directHome->createDirectory('foo');
}
- public function testGetChildren() {
+ public function testGetChildren(): void {
$this->expectException(MethodNotAllowed::class);
$this->directHome->getChildren();
}
- public function testChildExists() {
+ public function testChildExists(): void {
$this->assertFalse($this->directHome->childExists('foo'));
}
- public function testDelete() {
+ public function testDelete(): void {
$this->expectException(Forbidden::class);
$this->directHome->delete();
}
- public function testGetName() {
+ public function testGetName(): void {
$this->assertSame('direct', $this->directHome->getName());
}
- public function testSetName() {
+ public function testSetName(): void {
$this->expectException(Forbidden::class);
$this->directHome->setName('foo');
}
- public function testGetLastModified() {
+ public function testGetLastModified(): void {
$this->assertSame(0, $this->directHome->getLastModified());
}
- public function testGetChildValid() {
+ public function testGetChildValid(): void {
$direct = Direct::fromParams([
'expiration' => 100,
]);
$this->assertInstanceOf(DirectFile::class, $result);
}
- public function testGetChildExpired() {
+ public function testGetChildExpired(): void {
$direct = Direct::fromParams([
'expiration' => 41,
]);
$this->directHome->getChild('longtoken');
}
- public function testGetChildInvalid() {
+ public function testGetChildInvalid(): void {
$this->directMapper->method('getByToken')
->with('longtoken')
->willThrowException(new DoesNotExistException('not found'));
$this->search = new FileSearchBackend($this->tree, $this->user, $this->rootFolder, $this->shareManager, $this->view);
}
- public function testSearchFilename() {
+ public function testSearchFilename(): void {
$this->tree->expects($this->any())
->method('getNodeForPath')
->willReturn($this->davFolder);
$this->assertEquals('/files/test/test/path', $result[0]->href);
}
- public function testSearchMimetype() {
+ public function testSearchMimetype(): void {
$this->tree->expects($this->any())
->method('getNodeForPath')
->willReturn($this->davFolder);
$this->assertEquals('/files/test/test/path', $result[0]->href);
}
- public function testSearchSize() {
+ public function testSearchSize(): void {
$this->tree->expects($this->any())
->method('getNodeForPath')
->willReturn($this->davFolder);
$this->assertEquals('/files/test/test/path', $result[0]->href);
}
- public function testSearchMtime() {
+ public function testSearchMtime(): void {
$this->tree->expects($this->any())
->method('getNodeForPath')
->willReturn($this->davFolder);
$this->assertEquals('/files/test/test/path', $result[0]->href);
}
- public function testSearchIsCollection() {
+ public function testSearchIsCollection(): void {
$this->tree->expects($this->any())
->method('getNodeForPath')
->willReturn($this->davFolder);
}
- public function testSearchInvalidProp() {
+ public function testSearchInvalidProp(): void {
$this->expectException(\InvalidArgumentException::class);
$this->tree->expects($this->any())
}
- public function testSearchNonFolder() {
+ public function testSearchNonFolder(): void {
$this->expectException(\InvalidArgumentException::class);
$davNode = $this->createMock(File::class);
$this->search->search($query);
}
- public function testSearchLimitOwnerBasic() {
+ public function testSearchLimitOwnerBasic(): void {
$this->tree->expects($this->any())
->method('getNodeForPath')
->willReturn($this->davFolder);
$this->assertEmpty($operator->getArguments());
}
- public function testSearchLimitOwnerNested() {
+ public function testSearchLimitOwnerNested(): void {
$this->tree->expects($this->any())
->method('getNodeForPath')
->willReturn($this->davFolder);
$this->assertEmpty($operator->getArguments());
}
- public function testSearchOperatorLimit() {
+ public function testSearchOperatorLimit(): void {
$this->tree->expects($this->any())
->method('getNodeForPath')
->willReturn($this->davFolder);
/**
* Test validation of the request's body type
*/
- public function testBodyTypeValidation() {
+ public function testBodyTypeValidation(): void {
$bodyStream = "I am not a stream, but pretend to be";
$request = $this->getMockBuilder('Sabre\HTTP\RequestInterface')
->disableOriginalConstructor()
* - valid file content
* - valid file path
*/
- public function testValidRequest() {
+ public function testValidRequest(): void {
$multipartParser = $this->getMultipartParser(
$this->getValidBodyObject()
);
/**
* Test with invalid md5 hash.
*/
- public function testInvalidMd5Hash() {
+ public function testInvalidMd5Hash(): void {
$bodyObject = $this->getValidBodyObject();
$bodyObject["0"]["headers"]["X-File-MD5"] = "f2377b4d911f7ec46325fe603c3af03";
$multipartParser = $this->getMultipartParser(
/**
* Test with a null md5 hash.
*/
- public function testNullMd5Hash() {
+ public function testNullMd5Hash(): void {
$bodyObject = $this->getValidBodyObject();
unset($bodyObject["0"]["headers"]["X-File-MD5"]);
$multipartParser = $this->getMultipartParser(
/**
* Test with a null Content-Length.
*/
- public function testNullContentLength() {
+ public function testNullContentLength(): void {
$bodyObject = $this->getValidBodyObject();
unset($bodyObject["0"]["headers"]["Content-Length"]);
$multipartParser = $this->getMultipartParser(
/**
* Test with a lower Content-Length.
*/
- public function testLowerContentLength() {
+ public function testLowerContentLength(): void {
$bodyObject = $this->getValidBodyObject();
$bodyObject["0"]["headers"]["Content-Length"] = 6;
$multipartParser = $this->getMultipartParser(
/**
* Test with a higher Content-Length.
*/
- public function testHigherContentLength() {
+ public function testHigherContentLength(): void {
$bodyObject = $this->getValidBodyObject();
$bodyObject["0"]["headers"]["Content-Length"] = 8;
$multipartParser = $this->getMultipartParser(
/**
* Test with wrong boundary in body.
*/
- public function testWrongBoundary() {
+ public function testWrongBoundary(): void {
$bodyObject = $this->getValidBodyObject();
$multipartParser = $this->getMultipartParser(
$bodyObject,
/**
* Test with no boundary in request headers.
*/
- public function testNoBoundaryInHeader() {
+ public function testNoBoundaryInHeader(): void {
$bodyObject = $this->getValidBodyObject();
$this->expectExceptionMessage('Error while parsing boundary in Content-Type header.');
$this->getMultipartParser(
/**
* Test with no boundary in the request's headers.
*/
- public function testNoBoundaryInBody() {
+ public function testNoBoundaryInBody(): void {
$bodyObject = $this->getValidBodyObject();
$multipartParser = $this->getMultipartParser(
$bodyObject,
/**
* Test with a boundary with quotes in the request's headers.
*/
- public function testBoundaryWithQuotes() {
+ public function testBoundaryWithQuotes(): void {
$bodyObject = $this->getValidBodyObject();
$multipartParser = $this->getMultipartParser(
$bodyObject,
/**
* Test with a wrong Content-Type in the request's headers.
*/
- public function testWrongContentType() {
+ public function testWrongContentType(): void {
$bodyObject = $this->getValidBodyObject();
$this->expectExceptionMessage('Content-Type must be multipart/related');
$this->getMultipartParser(
/**
* Test with a wrong key after the content type in the request's headers.
*/
- public function testWrongKeyInContentType() {
+ public function testWrongKeyInContentType(): void {
$bodyObject = $this->getValidBodyObject();
$this->expectExceptionMessage('Boundary is invalid');
$this->getMultipartParser(
/**
* Test with a null Content-Type in the request's headers.
*/
- public function testNullContentType() {
+ public function testNullContentType(): void {
$bodyObject = $this->getValidBodyObject();
$this->expectExceptionMessage('Content-Type can not be null');
$this->getMultipartParser(
->method($this->anything());
}
- public function testInitialize() {
+ public function testInitialize(): void {
$this->server->expects($this->once())
->method('on')
->with(
$this->plugin->initialize($this->server);
}
- public function testNotEnabled() {
+ public function testNotEnabled(): void {
$this->view->expects($this->never())
->method($this->anything());
$this->plugin->beforeMethod($this->request, $this->response);
}
- public function testValid() {
+ public function testValid(): void {
$this->plugin->enable();
$this->plugin->setView($this->view);
$this->plugin->beforeMethod($this->request, $this->response);
}
- public function testFileAlreadyExistsValid() {
+ public function testFileAlreadyExistsValid(): void {
$this->plugin->enable();
$this->plugin->setView($this->view);
$this->plugin->beforeMethod($this->request, $this->response);
}
- public function testNoMKCOL() {
+ public function testNoMKCOL(): void {
$this->plugin->enable();
$this->plugin->setView($this->view);
$this->plugin->beforeMethod($this->request, $this->response);
}
- public function testNoSubdirPut() {
+ public function testNoSubdirPut(): void {
$this->plugin->enable();
$this->plugin->setView($this->view);
$this->output = $this->createMock(IOutput::class);
}
- public function testRunAllValid() {
+ public function testRunAllValid(): void {
/** @var CalDAVRemoveEmptyValue|\PHPUnit\Framework\MockObject\MockObject $step */
$step = $this->getMockBuilder(CalDAVRemoveEmptyValue::class)
->setConstructorArgs([
$step->run($this->output);
}
- public function testRunInvalid() {
+ public function testRunInvalid(): void {
/** @var CalDAVRemoveEmptyValue|\PHPUnit\Framework\MockObject\MockObject $step */
$step = $this->getMockBuilder(CalDAVRemoveEmptyValue::class)
->setConstructorArgs([
$step->run($this->output);
}
- public function testRunValid() {
+ public function testRunValid(): void {
/** @var CalDAVRemoveEmptyValue|\PHPUnit\Framework\MockObject\MockObject $step */
$step = $this->getMockBuilder(CalDAVRemoveEmptyValue::class)
->setConstructorArgs([
$step->run($this->output);
}
- public function testRunStillInvalid() {
+ public function testRunStillInvalid(): void {
/** @var CalDAVRemoveEmptyValue|\PHPUnit\Framework\MockObject\MockObject $step */
$step = $this->getMockBuilder(CalDAVRemoveEmptyValue::class)
->setConstructorArgs([
$this->migration = new RefreshWebcalJobRegistrar($this->db, $this->jobList);
}
- public function testGetName() {
+ public function testGetName(): void {
$this->assertEquals($this->migration->getName(), 'Registering background jobs to update cache for webcal calendars');
}
- public function testRun() {
+ public function testRun(): void {
$output = $this->createMock(IOutput::class);
$queryBuilder = $this->createMock(IQueryBuilder::class);
$this->config);
}
- public function testGetName() {
+ public function testGetName(): void {
$this->assertEquals(
'Regenerating birthday calendars to use new icons and fix old birthday events without year',
$this->migration->getName()
);
}
- public function testRun() {
+ public function testRun(): void {
$this->config->expects($this->once())
->method('getAppValue')
->with('dav', 'regeneratedBirthdayCalendarsForYearFix')
$this->migration->run($output);
}
- public function testRunSecondTime() {
+ public function testRunSecondTime(): void {
$this->config->expects($this->once())
->method('getAppValue')
->with('dav', 'regeneratedBirthdayCalendarsForYearFix')
$this->node = new AppleProvisioningNode($this->timeFactory);
}
- public function testGetName() {
+ public function testGetName(): void {
$this->assertEquals('apple-provisioning.mobileconfig', $this->node->getName());
}
- public function testSetName() {
+ public function testSetName(): void {
$this->expectException(\Sabre\DAV\Exception\Forbidden::class);
$this->expectExceptionMessage('Renaming apple-provisioning.mobileconfig is forbidden');
$this->node->setName('foo');
}
- public function testGetLastModified() {
+ public function testGetLastModified(): void {
$this->assertEquals(null, $this->node->getLastModified());
}
- public function testDelete() {
+ public function testDelete(): void {
$this->expectException(\Sabre\DAV\Exception\Forbidden::class);
$this->expectExceptionMessage('apple-provisioning.mobileconfig may not be deleted');
$this->node->delete();
}
- public function testGetProperties() {
+ public function testGetProperties(): void {
$this->timeFactory->expects($this->once())
->method('getDateTime')
->willReturn(new \DateTime('2000-01-01'));
}
- public function testGetPropPatch() {
+ public function testGetPropPatch(): void {
$this->expectException(\Sabre\DAV\Exception\Forbidden::class);
$this->expectExceptionMessage('apple-provisioning.mobileconfig\'s properties may not be altered.');
$this->sabreResponse = $this->createMock(\Sabre\HTTP\ResponseInterface::class);
}
- public function testInitialize() {
+ public function testInitialize(): void {
$server = $this->createMock(\Sabre\DAV\Server::class);
$plugin = new AppleProvisioningPlugin($this->userSession,
$this->urlGenerator, $this->themingDefaults, $this->request, $this->l10n,
- function () {
+ function (): void {
});
$server->expects($this->once())
$plugin->initialize($server);
}
- public function testHttpGetOnHttp() {
+ public function testHttpGetOnHttp(): void {
$this->sabreRequest->expects($this->once())
->method('getPath')
->with()
$this->assertFalse($returnValue);
}
- public function testHttpGetOnHttps() {
+ public function testHttpGetOnHttps(): void {
$this->sabreRequest->expects($this->once())
->method('getPath')
->with()
/**
* @dataProvider providesUris
*/
- public function test($uri, array $plugins) {
+ public function test($uri, array $plugins): void {
/** @var IRequest | \PHPUnit\Framework\MockObject\MockObject $r */
$r = $this->createMock(IRequest::class);
$r->expects($this->any())->method('getRequestUri')->willReturn($uri);
$this->settings = new CalDAVSettings($this->config, $this->initialState, $this->urlGenerator);
}
- public function testGetForm() {
+ public function testGetForm(): void {
$this->config->method('getAppValue')
->withConsecutive(
['dav', 'sendInvitations', 'yes'],
$this->assertInstanceOf(TemplateResponse::class, $result);
}
- public function testGetSection() {
+ public function testGetSection(): void {
$this->assertEquals('groupware', $this->settings->getSection());
}
- public function testGetPriority() {
+ public function testGetPriority(): void {
$this->assertEquals(10, $this->settings->getPriority());
}
}
);
}
- public function testGetters() {
+ public function testGetters(): void {
$tag = new SystemTag(1, 'Test', true, false);
$node = $this->getMappingNode($tag);
$this->assertEquals('1', $node->getName());
$this->assertEquals('files', $node->getObjectType());
}
- public function testDeleteTag() {
+ public function testDeleteTag(): void {
$node = $this->getMappingNode();
$this->tagManager->expects($this->once())
->method('canUserSeeTag')
/**
* @dataProvider tagNodeDeleteProviderPermissionException
*/
- public function testDeleteTagExpectedException(ISystemTag $tag, $expectedException) {
+ public function testDeleteTagExpectedException(ISystemTag $tag, $expectedException): void {
$this->tagManager->expects($this->any())
->method('canUserSeeTag')
->with($tag)
}
- public function testDeleteTagNotFound() {
+ public function testDeleteTagNotFound(): void {
$this->expectException(\Sabre\DAV\Exception\NotFound::class);
// assuming the tag existed at the time the node was created,
/**
* @dataProvider adminFlagProvider
*/
- public function testGetters($isAdmin) {
+ public function testGetters($isAdmin): void {
$tag = new SystemTag('1', 'Test', true, true);
$node = $this->getTagNode($isAdmin, $tag);
$this->assertEquals('1', $node->getName());
}
- public function testSetName() {
+ public function testSetName(): void {
$this->expectException(\Sabre\DAV\Exception\MethodNotAllowed::class);
$this->getTagNode()->setName('2');
/**
* @dataProvider tagNodeProvider
*/
- public function testUpdateTag($isAdmin, ISystemTag $originalTag, $changedArgs) {
+ public function testUpdateTag($isAdmin, ISystemTag $originalTag, $changedArgs): void {
$this->tagManager->expects($this->once())
->method('canUserSeeTag')
->with($originalTag)
/**
* @dataProvider tagNodeProviderPermissionException
*/
- public function testUpdateTagPermissionException(ISystemTag $originalTag, $changedArgs, $expectedException = null) {
+ public function testUpdateTagPermissionException(ISystemTag $originalTag, $changedArgs, $expectedException = null): void {
$this->tagManager->expects($this->any())
->method('canUserSeeTag')
->with($originalTag)
}
- public function testUpdateTagAlreadyExists() {
+ public function testUpdateTagAlreadyExists(): void {
$this->expectException(\Sabre\DAV\Exception\Conflict::class);
$tag = new SystemTag(1, 'tag1', true, true);
}
- public function testUpdateTagNotFound() {
+ public function testUpdateTagNotFound(): void {
$this->expectException(\Sabre\DAV\Exception\NotFound::class);
$tag = new SystemTag(1, 'tag1', true, true);
/**
* @dataProvider adminFlagProvider
*/
- public function testDeleteTag($isAdmin) {
+ public function testDeleteTag($isAdmin): void {
$tag = new SystemTag(1, 'tag1', true, true);
$this->tagManager->expects($isAdmin ? $this->once() : $this->never())
->method('canUserSeeTag')
/**
* @dataProvider tagNodeDeleteProviderPermissionException
*/
- public function testDeleteTagPermissionException(ISystemTag $tag, $expectedException) {
+ public function testDeleteTagPermissionException(ISystemTag $tag, $expectedException): void {
$this->tagManager->expects($this->any())
->method('canUserSeeTag')
->with($tag)
}
- public function testDeleteTagNotFound() {
+ public function testDeleteTagNotFound(): void {
$this->expectException(\Sabre\DAV\Exception\NotFound::class);
$tag = new SystemTag(1, 'tag1', true, true);
/**
* @dataProvider getPropertiesDataProvider
*/
- public function testGetProperties(ISystemTag $systemTag, $groups, $requestedProperties, $expectedProperties) {
+ public function testGetProperties(ISystemTag $systemTag, $groups, $requestedProperties, $expectedProperties): void {
$this->user->expects($this->any())
->method('getUID')
->willReturn('admin');
}
- public function testGetPropertiesForbidden() {
+ public function testGetPropertiesForbidden(): void {
$this->expectException(\Sabre\DAV\Exception\Forbidden::class);
$systemTag = new SystemTag(1, 'Test', true, false);
);
}
- public function testUpdatePropertiesAdmin() {
+ public function testUpdatePropertiesAdmin(): void {
$systemTag = new SystemTag(1, 'Test', true, false);
$this->user->expects($this->any())
->method('getUID')
}
- public function testUpdatePropertiesForbidden() {
+ public function testUpdatePropertiesForbidden(): void {
$this->expectException(\Sabre\DAV\Exception\Forbidden::class);
$systemTag = new SystemTag(1, 'Test', true, false);
/**
* @dataProvider createTagInsufficientPermissionsProvider
*/
- public function testCreateNotAssignableTagAsRegularUser($userVisible, $userAssignable, $groups) {
+ public function testCreateNotAssignableTagAsRegularUser($userVisible, $userAssignable, $groups): void {
$this->expectException(\Sabre\DAV\Exception\BadRequest::class);
$this->expectExceptionMessage('Not sufficient permissions');
$this->plugin->httpPost($request, $response);
}
- public function testCreateTagInByIdCollectionAsRegularUser() {
+ public function testCreateTagInByIdCollectionAsRegularUser(): void {
$systemTag = new SystemTag(1, 'Test', true, false);
$requestData = json_encode([
/**
* @dataProvider createTagProvider
*/
- public function testCreateTagInByIdCollection($userVisible, $userAssignable, $groups) {
+ public function testCreateTagInByIdCollection($userVisible, $userAssignable, $groups): void {
$this->user->expects($this->once())
->method('getUID')
->willReturn('admin');
];
}
- public function testCreateTagInMappingCollection() {
+ public function testCreateTagInMappingCollection(): void {
$this->user->expects($this->once())
->method('getUID')
->willReturn('admin');
}
- public function testCreateTagToUnknownNode() {
+ public function testCreateTagToUnknownNode(): void {
$this->expectException(\Sabre\DAV\Exception\NotFound::class);
$node = $this->getMockBuilder(SystemTagsObjectMappingCollection::class)
/**
* @dataProvider nodeClassProvider
*/
- public function testCreateTagConflict($nodeClass) {
+ public function testCreateTagConflict($nodeClass): void {
$this->expectException(\Sabre\DAV\Exception\Conflict::class);
$this->user->expects($this->once())
}
- public function testForbiddenCreateFile() {
+ public function testForbiddenCreateFile(): void {
$this->expectException(\Sabre\DAV\Exception\Forbidden::class);
$this->getNode()->createFile('555');
}
- public function testForbiddenCreateDirectory() {
+ public function testForbiddenCreateDirectory(): void {
$this->expectException(\Sabre\DAV\Exception\Forbidden::class);
$this->getNode()->createDirectory('789');
}
- public function testGetChild() {
+ public function testGetChild(): void {
$tag = new SystemTag(123, 'Test', true, false);
$this->tagManager->expects($this->once())
->method('canUserSeeTag')
}
- public function testGetChildInvalidName() {
+ public function testGetChildInvalidName(): void {
$this->expectException(\Sabre\DAV\Exception\BadRequest::class);
$this->tagManager->expects($this->once())
}
- public function testGetChildNotFound() {
+ public function testGetChildNotFound(): void {
$this->expectException(\Sabre\DAV\Exception\NotFound::class);
$this->tagManager->expects($this->once())
}
- public function testGetChildUserNotVisible() {
+ public function testGetChildUserNotVisible(): void {
$this->expectException(\Sabre\DAV\Exception\NotFound::class);
$tag = new SystemTag(123, 'Test', false, false);
$this->getNode(false)->getChild('123');
}
- public function testGetChildrenAdmin() {
+ public function testGetChildrenAdmin(): void {
$tag1 = new SystemTag(123, 'One', true, false);
$tag2 = new SystemTag(456, 'Two', true, true);
$this->assertEquals($tag2, $children[1]->getSystemTag());
}
- public function testGetChildrenNonAdmin() {
+ public function testGetChildrenNonAdmin(): void {
$tag1 = new SystemTag(123, 'One', true, false);
$tag2 = new SystemTag(456, 'Two', true, true);
$this->assertEquals($tag2, $children[1]->getSystemTag());
}
- public function testGetChildrenEmpty() {
+ public function testGetChildrenEmpty(): void {
$this->tagManager->expects($this->once())
->method('getAllTags')
->with(null)
/**
* @dataProvider childExistsProvider
*/
- public function testChildExists($userVisible, $expectedResult) {
+ public function testChildExists($userVisible, $expectedResult): void {
$tag = new SystemTag(123, 'One', $userVisible, false);
$this->tagManager->expects($this->once())
->method('canUserSeeTag')
$this->assertEquals($expectedResult, $this->getNode()->childExists('123'));
}
- public function testChildExistsNotFound() {
+ public function testChildExistsNotFound(): void {
$this->tagManager->expects($this->once())
->method('getTagsByIds')
->with(['123'])
}
- public function testChildExistsBadRequest() {
+ public function testChildExistsBadRequest(): void {
$this->expectException(\Sabre\DAV\Exception\BadRequest::class);
$this->tagManager->expects($this->once())
);
}
- public function testAssignTag() {
+ public function testAssignTag(): void {
$tag = new SystemTag('1', 'Test', true, true);
$this->tagManager->expects($this->once())
->method('canUserSeeTag')
/**
* @dataProvider permissionsProvider
*/
- public function testAssignTagNoPermission($userVisible, $userAssignable, $expectedException) {
+ public function testAssignTagNoPermission($userVisible, $userAssignable, $expectedException): void {
$tag = new SystemTag('1', 'Test', $userVisible, $userAssignable);
$this->tagManager->expects($this->once())
->method('canUserSeeTag')
}
- public function testAssignTagNotFound() {
+ public function testAssignTagNotFound(): void {
$this->expectException(\Sabre\DAV\Exception\PreconditionFailed::class);
$this->tagManager->expects($this->once())
}
- public function testForbiddenCreateDirectory() {
+ public function testForbiddenCreateDirectory(): void {
$this->expectException(\Sabre\DAV\Exception\Forbidden::class);
$this->getNode()->createDirectory('789');
}
- public function testGetChild() {
+ public function testGetChild(): void {
$tag = new SystemTag(555, 'TheTag', true, false);
$this->tagManager->expects($this->once())
->method('canUserSeeTag')
}
- public function testGetChildNonVisible() {
+ public function testGetChildNonVisible(): void {
$this->expectException(\Sabre\DAV\Exception\NotFound::class);
$tag = new SystemTag(555, 'TheTag', false, false);
}
- public function testGetChildRelationNotFound() {
+ public function testGetChildRelationNotFound(): void {
$this->expectException(\Sabre\DAV\Exception\NotFound::class);
$this->tagMapper->expects($this->once())
}
- public function testGetChildInvalidId() {
+ public function testGetChildInvalidId(): void {
$this->expectException(\Sabre\DAV\Exception\BadRequest::class);
$this->tagMapper->expects($this->once())
}
- public function testGetChildTagDoesNotExist() {
+ public function testGetChildTagDoesNotExist(): void {
$this->expectException(\Sabre\DAV\Exception\NotFound::class);
$this->tagMapper->expects($this->once())
$this->getNode()->getChild('777');
}
- public function testGetChildren() {
+ public function testGetChildren(): void {
$tag1 = new SystemTag(555, 'TagOne', true, false);
$tag2 = new SystemTag(556, 'TagTwo', true, true);
$tag3 = new SystemTag(557, 'InvisibleTag', false, true);
$this->assertEquals($tag2, $children[1]->getSystemTag());
}
- public function testChildExistsWithVisibleTag() {
+ public function testChildExistsWithVisibleTag(): void {
$tag = new SystemTag(555, 'TagOne', true, false);
$this->tagMapper->expects($this->once())
$this->assertTrue($this->getNode()->childExists('555'));
}
- public function testChildExistsWithInvisibleTag() {
+ public function testChildExistsWithInvisibleTag(): void {
$tag = new SystemTag(555, 'TagOne', false, false);
$this->tagMapper->expects($this->once())
$this->assertFalse($this->getNode()->childExists('555'));
}
- public function testChildExistsNotFound() {
+ public function testChildExistsNotFound(): void {
$this->tagMapper->expects($this->once())
->method('haveTag')
->with([111], 'files', '555')
$this->assertFalse($this->getNode()->childExists('555'));
}
- public function testChildExistsTagNotFound() {
+ public function testChildExistsTagNotFound(): void {
$this->tagMapper->expects($this->once())
->method('haveTag')
->with([111], 'files', '555')
}
- public function testChildExistsInvalidId() {
+ public function testChildExistsInvalidId(): void {
$this->expectException(\Sabre\DAV\Exception\BadRequest::class);
$this->tagMapper->expects($this->once())
}
- public function testDelete() {
+ public function testDelete(): void {
$this->expectException(\Sabre\DAV\Exception\Forbidden::class);
$this->getNode()->delete();
}
- public function testSetName() {
+ public function testSetName(): void {
$this->expectException(\Sabre\DAV\Exception\Forbidden::class);
$this->getNode()->setName('somethingelse');
}
- public function testGetName() {
+ public function testGetName(): void {
$this->assertEquals('111', $this->getNode()->getName());
}
}
}
- public function testForbiddenCreateFile() {
+ public function testForbiddenCreateFile(): void {
$this->expectException(\Sabre\DAV\Exception\Forbidden::class);
$this->node->createFile('555');
}
- public function testForbiddenCreateDirectory() {
+ public function testForbiddenCreateDirectory(): void {
$this->expectException(\Sabre\DAV\Exception\Forbidden::class);
$this->node->createDirectory('789');
}
- public function testGetChild() {
+ public function testGetChild(): void {
$this->userFolder->expects($this->once())
->method('getById')
->with('555')
}
- public function testGetChildWithoutAccess() {
+ public function testGetChildWithoutAccess(): void {
$this->expectException(\Sabre\DAV\Exception\NotFound::class);
$this->userFolder->expects($this->once())
}
- public function testGetChildren() {
+ public function testGetChildren(): void {
$this->expectException(\Sabre\DAV\Exception\MethodNotAllowed::class);
$this->node->getChildren();
}
- public function testChildExists() {
+ public function testChildExists(): void {
$this->userFolder->expects($this->once())
->method('getById')
->with('123')
$this->assertTrue($this->node->childExists('123'));
}
- public function testChildExistsWithoutAccess() {
+ public function testChildExistsWithoutAccess(): void {
$this->userFolder->expects($this->once())
->method('getById')
->with('555')
}
- public function testDelete() {
+ public function testDelete(): void {
$this->expectException(\Sabre\DAV\Exception\Forbidden::class);
$this->node->delete();
}
- public function testSetName() {
+ public function testSetName(): void {
$this->expectException(\Sabre\DAV\Exception\Forbidden::class);
$this->node->setName('somethingelse');
}
- public function testGetName() {
+ public function testGetName(): void {
$this->assertEquals('files', $this->node->getName());
}
}
/**
* @dataProvider providesNodes()
*/
- public function testGetContents($expected, $nodes) {
+ public function testGetContents($expected, $nodes): void {
$stream = \OCA\DAV\Upload\AssemblyStream::wrap($nodes);
$content = stream_get_contents($stream);
/**
* @dataProvider providesNodes()
*/
- public function testGetContentsFread($expected, $nodes) {
+ public function testGetContentsFread($expected, $nodes): void {
$stream = \OCA\DAV\Upload\AssemblyStream::wrap($nodes);
$content = '';
/**
* @dataProvider providesNodes()
*/
- public function testSeek($expected, $nodes) {
+ public function testSeek($expected, $nodes): void {
$stream = \OCA\DAV\Upload\AssemblyStream::wrap($nodes);
$offset = floor(strlen($expected) * 0.6);
$this->plugin->initialize($this->server);
}
- public function testBeforeMoveFutureFileSkip() {
+ public function testBeforeMoveFutureFileSkip(): void {
$node = $this->createMock(Directory::class);
$this->tree->expects($this->any())
$this->assertNull($this->plugin->beforeMove('source', 'target'));
}
- public function testBeforeMoveDestinationIsDirectory() {
+ public function testBeforeMoveDestinationIsDirectory(): void {
$this->expectException(\Sabre\DAV\Exception\BadRequest::class);
$this->expectExceptionMessage('The given destination target is a directory.');
$this->assertNull($this->plugin->beforeMove('source', 'target'));
}
- public function testBeforeMoveFutureFileSkipNonExisting() {
+ public function testBeforeMoveFutureFileSkipNonExisting(): void {
$sourceNode = $this->createMock(FutureFile::class);
$sourceNode->expects($this->once())
->method('getSize')
$this->assertFalse($this->plugin->beforeMove('source', 'target'));
}
- public function testBeforeMoveFutureFileMoveIt() {
+ public function testBeforeMoveFutureFileMoveIt(): void {
$sourceNode = $this->createMock(FutureFile::class);
$sourceNode->expects($this->once())
->method('getSize')
}
- public function testBeforeMoveSizeIsWrong() {
+ public function testBeforeMoveSizeIsWrong(): void {
$this->expectException(\Sabre\DAV\Exception\BadRequest::class);
$this->expectExceptionMessage('Chunks on server do not sum up to 4 but to 3 bytes');
use OCA\DAV\Connector\Sabre\Directory;
class FutureFileTest extends \Test\TestCase {
- public function testGetContentType() {
+ public function testGetContentType(): void {
$f = $this->mockFutureFile();
$this->assertEquals('application/octet-stream', $f->getContentType());
}
- public function testGetETag() {
+ public function testGetETag(): void {
$f = $this->mockFutureFile();
$this->assertEquals('1234567890', $f->getETag());
}
- public function testGetName() {
+ public function testGetName(): void {
$f = $this->mockFutureFile();
$this->assertEquals('foo.txt', $f->getName());
}
- public function testGetLastModified() {
+ public function testGetLastModified(): void {
$f = $this->mockFutureFile();
$this->assertEquals(12121212, $f->getLastModified());
}
- public function testGetSize() {
+ public function testGetSize(): void {
$f = $this->mockFutureFile();
$this->assertEquals(0, $f->getSize());
}
- public function testGet() {
+ public function testGet(): void {
$f = $this->mockFutureFile();
$stream = $f->get();
$this->assertTrue(is_resource($stream));
}
- public function testDelete() {
+ public function testDelete(): void {
$d = $this->getMockBuilder(Directory::class)
->disableOriginalConstructor()
->setMethods(['delete'])
}
- public function testPut() {
+ public function testPut(): void {
$this->expectException(\Sabre\DAV\Exception\Forbidden::class);
$f = $this->mockFutureFile();
}
- public function testSetName() {
+ public function testSetName(): void {
$this->expectException(\Sabre\DAV\Exception\Forbidden::class);
$f = $this->mockFutureFile();