diff options
Diffstat (limited to 'apps')
64 files changed, 669 insertions, 887 deletions
diff --git a/apps/dav/appinfo/info.xml b/apps/dav/appinfo/info.xml index e0f4608e8c2..2b3a9fcede8 100644 --- a/apps/dav/appinfo/info.xml +++ b/apps/dav/appinfo/info.xml @@ -41,6 +41,7 @@ <step>OCA\DAV\Migration\BuildSocialSearchIndex</step> <step>OCA\DAV\Migration\RefreshWebcalJobRegistrar</step> <step>OCA\DAV\Migration\RegisterBuildReminderIndexBackgroundJob</step> + <step>OCA\DAV\Migration\RegisterUpdateCalendarResourcesRoomBackgroundJob</step> <step>OCA\DAV\Migration\RemoveOrphanEventsAndContacts</step> <step>OCA\DAV\Migration\RemoveClassifiedEventActivity</step> <step>OCA\DAV\Migration\RemoveDeletedUsersCalendarSubscriptions</step> diff --git a/apps/dav/appinfo/v1/publicwebdav.php b/apps/dav/appinfo/v1/publicwebdav.php index aa16d6c584a..af49ca5462c 100644 --- a/apps/dav/appinfo/v1/publicwebdav.php +++ b/apps/dav/appinfo/v1/publicwebdav.php @@ -104,11 +104,9 @@ $server = $serverFactory->createServer(false, $baseuri, $requestUri, $authPlugin if (!$isReadable) { $filesDropPlugin->enable(); } - - $view = new View($node->getPath()); - $filesDropPlugin->setView($view); $filesDropPlugin->setShare($share); + $view = new View($node->getPath()); return $view; }); diff --git a/apps/dav/appinfo/v2/publicremote.php b/apps/dav/appinfo/v2/publicremote.php index 62336a9b80f..fbb3ddd2cb3 100644 --- a/apps/dav/appinfo/v2/publicremote.php +++ b/apps/dav/appinfo/v2/publicremote.php @@ -131,11 +131,9 @@ $server = $serverFactory->createServer(true, $baseuri, $requestUri, $authPlugin, if (!$isReadable) { $filesDropPlugin->enable(); } - - $view = new View($node->getPath()); - $filesDropPlugin->setView($view); $filesDropPlugin->setShare($share); + $view = new View($node->getPath()); return $view; }); diff --git a/apps/dav/composer/composer/autoload_classmap.php b/apps/dav/composer/composer/autoload_classmap.php index 913f5b46d98..fc753e79908 100644 --- a/apps/dav/composer/composer/autoload_classmap.php +++ b/apps/dav/composer/composer/autoload_classmap.php @@ -316,6 +316,7 @@ return array( 'OCA\\DAV\\Migration\\RefreshWebcalJobRegistrar' => $baseDir . '/../lib/Migration/RefreshWebcalJobRegistrar.php', 'OCA\\DAV\\Migration\\RegenerateBirthdayCalendars' => $baseDir . '/../lib/Migration/RegenerateBirthdayCalendars.php', 'OCA\\DAV\\Migration\\RegisterBuildReminderIndexBackgroundJob' => $baseDir . '/../lib/Migration/RegisterBuildReminderIndexBackgroundJob.php', + 'OCA\\DAV\\Migration\\RegisterUpdateCalendarResourcesRoomBackgroundJob' => $baseDir . '/../lib/Migration/RegisterUpdateCalendarResourcesRoomBackgroundJob.php', 'OCA\\DAV\\Migration\\RemoveClassifiedEventActivity' => $baseDir . '/../lib/Migration/RemoveClassifiedEventActivity.php', 'OCA\\DAV\\Migration\\RemoveDeletedUsersCalendarSubscriptions' => $baseDir . '/../lib/Migration/RemoveDeletedUsersCalendarSubscriptions.php', 'OCA\\DAV\\Migration\\RemoveObjectProperties' => $baseDir . '/../lib/Migration/RemoveObjectProperties.php', diff --git a/apps/dav/composer/composer/autoload_static.php b/apps/dav/composer/composer/autoload_static.php index 6369511343e..cd46530ecd4 100644 --- a/apps/dav/composer/composer/autoload_static.php +++ b/apps/dav/composer/composer/autoload_static.php @@ -331,6 +331,7 @@ class ComposerStaticInitDAV 'OCA\\DAV\\Migration\\RefreshWebcalJobRegistrar' => __DIR__ . '/..' . '/../lib/Migration/RefreshWebcalJobRegistrar.php', 'OCA\\DAV\\Migration\\RegenerateBirthdayCalendars' => __DIR__ . '/..' . '/../lib/Migration/RegenerateBirthdayCalendars.php', 'OCA\\DAV\\Migration\\RegisterBuildReminderIndexBackgroundJob' => __DIR__ . '/..' . '/../lib/Migration/RegisterBuildReminderIndexBackgroundJob.php', + 'OCA\\DAV\\Migration\\RegisterUpdateCalendarResourcesRoomBackgroundJob' => __DIR__ . '/..' . '/../lib/Migration/RegisterUpdateCalendarResourcesRoomBackgroundJob.php', 'OCA\\DAV\\Migration\\RemoveClassifiedEventActivity' => __DIR__ . '/..' . '/../lib/Migration/RemoveClassifiedEventActivity.php', 'OCA\\DAV\\Migration\\RemoveDeletedUsersCalendarSubscriptions' => __DIR__ . '/..' . '/../lib/Migration/RemoveDeletedUsersCalendarSubscriptions.php', 'OCA\\DAV\\Migration\\RemoveObjectProperties' => __DIR__ . '/..' . '/../lib/Migration/RemoveObjectProperties.php', diff --git a/apps/dav/lib/Files/Sharing/FilesDropPlugin.php b/apps/dav/lib/Files/Sharing/FilesDropPlugin.php index ad7648795da..9aee5283ea9 100644 --- a/apps/dav/lib/Files/Sharing/FilesDropPlugin.php +++ b/apps/dav/lib/Files/Sharing/FilesDropPlugin.php @@ -5,7 +5,8 @@ */ namespace OCA\DAV\Files\Sharing; -use OC\Files\View; +use OCP\Files\Folder; +use OCP\Files\NotFoundException; use OCP\Share\IShare; use Sabre\DAV\Exception\MethodNotAllowed; use Sabre\DAV\ServerPlugin; @@ -17,14 +18,9 @@ use Sabre\HTTP\ResponseInterface; */ class FilesDropPlugin extends ServerPlugin { - private ?View $view = null; private ?IShare $share = null; private bool $enabled = false; - public function setView(View $view): void { - $this->view = $view; - } - public function setShare(IShare $share): void { $this->share = $share; } @@ -33,7 +29,6 @@ class FilesDropPlugin extends ServerPlugin { $this->enabled = true; } - /** * This initializes the plugin. * It is ONLY initialized by the server on a file drop request. @@ -45,7 +40,12 @@ class FilesDropPlugin extends ServerPlugin { } public function onMkcol(RequestInterface $request, ResponseInterface $response) { - if (!$this->enabled || $this->share === null || $this->view === null) { + if (!$this->enabled || $this->share === null) { + return; + } + + $node = $this->share->getNode(); + if (!($node instanceof Folder)) { return; } @@ -57,7 +57,12 @@ class FilesDropPlugin extends ServerPlugin { } public function beforeMethod(RequestInterface $request, ResponseInterface $response) { - if (!$this->enabled || $this->share === null || $this->view === null) { + if (!$this->enabled || $this->share === null) { + return; + } + + $node = $this->share->getNode(); + if (!($node instanceof Folder)) { return; } @@ -127,45 +132,55 @@ class FilesDropPlugin extends ServerPlugin { } // Create the folders along the way - $folders = $this->getPathSegments(dirname($relativePath)); - foreach ($folders as $folder) { - if ($folder === '') { + $folder = $node; + $pathSegments = $this->getPathSegments(dirname($relativePath)); + foreach ($pathSegments as $pathSegment) { + if ($pathSegment === '') { continue; - } // skip empty parts - if (!$this->view->file_exists($folder)) { - $this->view->mkdir($folder); + } + + try { + // get the current folder + $currentFolder = $folder->get($pathSegment); + // check target is a folder + if ($currentFolder instanceof Folder) { + $folder = $currentFolder; + } else { + // otherwise look in the parent folder if we already create an unique folder name + foreach ($folder->getDirectoryListing() as $child) { + // we look for folders which match "NAME (SUFFIX)" + if ($child instanceof Folder && str_starts_with($child->getName(), $pathSegment)) { + $suffix = substr($child->getName(), strlen($pathSegment)); + if (preg_match('/^ \(\d+\)$/', $suffix)) { + // we found the unique folder name and can use it + $folder = $child; + break; + } + } + } + // no folder found so we need to create a new unique folder name + if (!isset($child) || $child !== $folder) { + $folder = $folder->newFolder($folder->getNonExistingName($pathSegment)); + } + } + } catch (NotFoundException) { + // the folder does simply not exist so we create it + $folder = $folder->newFolder($pathSegment); } } // Finally handle conflicts on the end files - $noConflictPath = \OC_Helper::buildNotExistingFileNameForView(dirname($relativePath), basename($relativePath), $this->view); - $path = '/files/' . $token . '/' . $noConflictPath; - $url = $request->getBaseUrl() . str_replace('//', '/', $path); + $uniqueName = $folder->getNonExistingName(basename($relativePath)); + $relativePath = substr($folder->getPath(), strlen($node->getPath())); + $path = '/files/' . $token . '/' . $relativePath . '/' . $uniqueName; + $url = rtrim($request->getBaseUrl(), '/') . str_replace('//', '/', $path); $request->setUrl($url); } private function getPathSegments(string $path): array { // Normalize slashes and remove trailing slash - $path = rtrim(str_replace('\\', '/', $path), '/'); - - // Handle absolute paths starting with / - $isAbsolute = str_starts_with($path, '/'); - - $segments = explode('/', $path); - - // Add back the leading slash for the first segment if needed - $result = []; - $current = $isAbsolute ? '/' : ''; - - foreach ($segments as $segment) { - if ($segment === '') { - // skip empty parts - continue; - } - $current = rtrim($current, '/') . '/' . $segment; - $result[] = $current; - } + $path = trim(str_replace('\\', '/', $path), '/'); - return $result; + return explode('/', $path); } } diff --git a/apps/dav/lib/Migration/RegisterUpdateCalendarResourcesRoomBackgroundJob.php b/apps/dav/lib/Migration/RegisterUpdateCalendarResourcesRoomBackgroundJob.php new file mode 100644 index 00000000000..9d77aefafd2 --- /dev/null +++ b/apps/dav/lib/Migration/RegisterUpdateCalendarResourcesRoomBackgroundJob.php @@ -0,0 +1,30 @@ +<?php + +declare(strict_types=1); + +/** + * SPDX-FileCopyrightText: 2025 Nextcloud GmbH and Nextcloud contributors + * SPDX-License-Identifier: AGPL-3.0-or-later + */ + +namespace OCA\DAV\Migration; + +use OCA\DAV\BackgroundJob\UpdateCalendarResourcesRoomsBackgroundJob; +use OCP\BackgroundJob\IJobList; +use OCP\Migration\IOutput; +use OCP\Migration\IRepairStep; + +class RegisterUpdateCalendarResourcesRoomBackgroundJob implements IRepairStep { + public function __construct( + private readonly IJobList $jobList, + ) { + } + + public function getName() { + return 'Register a background job to update rooms and resources'; + } + + public function run(IOutput $output) { + $this->jobList->add(UpdateCalendarResourcesRoomsBackgroundJob::class); + } +} diff --git a/apps/dav/tests/unit/Files/Sharing/FilesDropPluginTest.php b/apps/dav/tests/unit/Files/Sharing/FilesDropPluginTest.php index dc1e067dafd..16891ced3d0 100644 --- a/apps/dav/tests/unit/Files/Sharing/FilesDropPluginTest.php +++ b/apps/dav/tests/unit/Files/Sharing/FilesDropPluginTest.php @@ -5,10 +5,12 @@ */ namespace OCA\DAV\Tests\Files\Sharing; -use OC\Files\View; use OCA\DAV\Files\Sharing\FilesDropPlugin; +use OCP\Files\Folder; +use OCP\Files\NotFoundException; use OCP\Share\IAttributes; use OCP\Share\IShare; +use PHPUnit\Framework\MockObject\MockObject; use Sabre\DAV\Exception\MethodNotAllowed; use Sabre\DAV\Server; use Sabre\HTTP\RequestInterface; @@ -17,29 +19,25 @@ use Test\TestCase; class FilesDropPluginTest extends TestCase { - /** @var View|\PHPUnit\Framework\MockObject\MockObject */ - private $view; + private FilesDropPlugin $plugin; - /** @var IShare|\PHPUnit\Framework\MockObject\MockObject */ - private $share; - - /** @var Server|\PHPUnit\Framework\MockObject\MockObject */ - private $server; - - /** @var FilesDropPlugin */ - private $plugin; - - /** @var RequestInterface|\PHPUnit\Framework\MockObject\MockObject */ - private $request; - - /** @var ResponseInterface|\PHPUnit\Framework\MockObject\MockObject */ - private $response; + private Folder&MockObject $node; + private IShare&MockObject $share; + private Server&MockObject $server; + private RequestInterface&MockObject $request; + private ResponseInterface&MockObject $response; protected function setUp(): void { parent::setUp(); - $this->view = $this->createMock(View::class); + $this->node = $this->createMock(Folder::class); + $this->node->method('getPath') + ->willReturn('/files/token'); + $this->share = $this->createMock(IShare::class); + $this->share->expects(self::any()) + ->method('getNode') + ->willReturn($this->node); $this->server = $this->createMock(Server::class); $this->plugin = new FilesDropPlugin(); @@ -56,28 +54,7 @@ class FilesDropPluginTest extends TestCase { ->willReturn('token'); } - public function testInitialize(): void { - $this->server->expects($this->at(0)) - ->method('on') - ->with( - $this->equalTo('beforeMethod:*'), - $this->equalTo([$this->plugin, 'beforeMethod']), - $this->equalTo(999) - ); - $this->server->expects($this->at(1)) - ->method('on') - ->with( - $this->equalTo('method:MKCOL'), - $this->equalTo([$this->plugin, 'onMkcol']), - ); - - $this->plugin->initialize($this->server); - } - public function testNotEnabled(): void { - $this->view->expects($this->never()) - ->method($this->anything()); - $this->request->expects($this->never()) ->method($this->anything()); @@ -86,7 +63,6 @@ class FilesDropPluginTest extends TestCase { public function testValid(): void { $this->plugin->enable(); - $this->plugin->setView($this->view); $this->plugin->setShare($this->share); $this->request->method('getMethod') @@ -98,9 +74,10 @@ class FilesDropPluginTest extends TestCase { $this->request->method('getBaseUrl') ->willReturn('https://example.com'); - $this->view->method('file_exists') - ->with('/file.txt') - ->willReturn(false); + $this->node->expects(self::once()) + ->method('getNonExistingName') + ->with('file.txt') + ->willReturn('file.txt'); $this->request->expects($this->once()) ->method('setUrl') @@ -111,7 +88,6 @@ class FilesDropPluginTest extends TestCase { public function testFileAlreadyExistsValid(): void { $this->plugin->enable(); - $this->plugin->setView($this->view); $this->plugin->setShare($this->share); $this->request->method('getMethod') @@ -123,14 +99,9 @@ class FilesDropPluginTest extends TestCase { $this->request->method('getBaseUrl') ->willReturn('https://example.com'); - $this->view->method('file_exists') - ->willReturnCallback(function ($path) { - if ($path === 'file.txt' || $path === '/file.txt') { - return true; - } else { - return false; - } - }); + $this->node->method('getNonExistingName') + ->with('file.txt') + ->willReturn('file (2).txt'); $this->request->expects($this->once()) ->method('setUrl') @@ -141,7 +112,6 @@ class FilesDropPluginTest extends TestCase { public function testNoMKCOLWithoutNickname(): void { $this->plugin->enable(); - $this->plugin->setView($this->view); $this->plugin->setShare($this->share); $this->request->method('getMethod') @@ -154,7 +124,6 @@ class FilesDropPluginTest extends TestCase { public function testMKCOLWithNickname(): void { $this->plugin->enable(); - $this->plugin->setView($this->view); $this->plugin->setShare($this->share); $this->request->method('getMethod') @@ -174,7 +143,6 @@ class FilesDropPluginTest extends TestCase { public function testSubdirPut(): void { $this->plugin->enable(); - $this->plugin->setView($this->view); $this->plugin->setShare($this->share); $this->request->method('getMethod') @@ -193,14 +161,30 @@ class FilesDropPluginTest extends TestCase { $this->request->method('getBaseUrl') ->willReturn('https://example.com'); - $this->view->method('file_exists') - ->willReturnCallback(function ($path) { - if ($path === 'file.txt' || $path === '/folder/file.txt') { - return true; - } else { - return false; - } - }); + $nodeName = $this->createMock(Folder::class); + $nodeFolder = $this->createMock(Folder::class); + $nodeFolder->expects(self::once()) + ->method('getPath') + ->willReturn('/files/token/nickname/folder'); + $nodeFolder->method('getNonExistingName') + ->with('file.txt') + ->willReturn('file.txt'); + $nodeName->expects(self::once()) + ->method('get') + ->with('folder') + ->willThrowException(new NotFoundException()); + $nodeName->expects(self::once()) + ->method('newFolder') + ->with('folder') + ->willReturn($nodeFolder); + + $this->node->expects(self::once()) + ->method('get') + ->willThrowException(new NotFoundException()); + $this->node->expects(self::once()) + ->method('newFolder') + ->with('nickname') + ->willReturn($nodeName); $this->request->expects($this->once()) ->method('setUrl') @@ -211,7 +195,6 @@ class FilesDropPluginTest extends TestCase { public function testRecursiveFolderCreation(): void { $this->plugin->enable(); - $this->plugin->setView($this->view); $this->plugin->setShare($this->share); $this->request->method('getMethod') @@ -227,40 +210,40 @@ class FilesDropPluginTest extends TestCase { ->willReturn('/files/token/folder/subfolder/file.txt'); $this->request->method('getBaseUrl') ->willReturn('https://example.com'); - $this->view->method('file_exists') - ->willReturn(false); - - $this->view->expects($this->exactly(4)) - ->method('file_exists') - ->withConsecutive( - ['/nickname'], - ['/nickname/folder'], - ['/nickname/folder/subfolder'], - ['/nickname/folder/subfolder/file.txt'] - ) - ->willReturnOnConsecutiveCalls( - false, - false, - false, - false, - ); - $this->view->expects($this->exactly(3)) - ->method('mkdir') - ->withConsecutive( - ['/nickname'], - ['/nickname/folder'], - ['/nickname/folder/subfolder'], - ); $this->request->expects($this->once()) ->method('setUrl') ->with($this->equalTo('https://example.com/files/token/nickname/folder/subfolder/file.txt')); + + $subfolder = $this->createMock(Folder::class); + $subfolder->expects(self::once()) + ->method('getNonExistingName') + ->with('file.txt') + ->willReturn('file.txt'); + $subfolder->expects(self::once()) + ->method('getPath') + ->willReturn('/files/token/nickname/folder/subfolder'); + + $folder = $this->createMock(Folder::class); + $folder->expects(self::once()) + ->method('get') + ->with('subfolder') + ->willReturn($subfolder); + + $nickname = $this->createMock(Folder::class); + $nickname->expects(self::once()) + ->method('get') + ->with('folder') + ->willReturn($folder); + + $this->node->method('get') + ->with('nickname') + ->willReturn($nickname); $this->plugin->beforeMethod($this->request, $this->response); } public function testOnMkcol(): void { $this->plugin->enable(); - $this->plugin->setView($this->view); $this->plugin->setShare($this->share); $this->response->expects($this->once()) diff --git a/apps/files/l10n/de.js b/apps/files/l10n/de.js index a4a71d0087f..f4b11b60bfe 100644 --- a/apps/files/l10n/de.js +++ b/apps/files/l10n/de.js @@ -98,6 +98,7 @@ OC.L10N.register( "Renamed \"{oldName}\" to \"{newName}\"" : "\"{oldName}\" in \"{newName}\" umbenannt", "Rename file" : "Datei umbenennen", "Folder" : "Ordner", + "Unknown file type" : "Unbekannter Dateityp", "Pending" : "Ausstehend", "Unknown date" : "Unbekanntes Datum", "Clear filter" : "Filter zurücksetzen", @@ -108,6 +109,7 @@ OC.L10N.register( "Total rows summary" : "Zusammenfassung aller Zeilen", "Toggle selection for all files and folders" : "Auswahl für alle Dateien und Ordner umschalten", "Name" : "Name", + "File type" : "Dateityp", "Size" : "Größe", "\"{displayName}\" failed on some elements" : "\"{displayName}\" ist bei einigen Elementen fehlgeschlagen", "\"{displayName}\" batch action executed successfully" : "Stapelaktion \"{displayName}\" ausgeführt", @@ -186,6 +188,7 @@ OC.L10N.register( "Sort favorites first" : "Favoriten zuerst sortieren", "Sort folders before files" : "Ordner vor Dateien sortieren", "Show hidden files" : "Versteckte Dateien anzeigen", + "Show file type column" : "Dateityp-Spalte anzeigen", "Crop image previews" : "Bildvorschauen zuschneiden", "Enable the grid view" : "Kachelansicht aktivieren", "Enable folder tree" : "Ordnerstruktur aktivieren", diff --git a/apps/files/l10n/de.json b/apps/files/l10n/de.json index 8c460f60c44..f34d8585898 100644 --- a/apps/files/l10n/de.json +++ b/apps/files/l10n/de.json @@ -96,6 +96,7 @@ "Renamed \"{oldName}\" to \"{newName}\"" : "\"{oldName}\" in \"{newName}\" umbenannt", "Rename file" : "Datei umbenennen", "Folder" : "Ordner", + "Unknown file type" : "Unbekannter Dateityp", "Pending" : "Ausstehend", "Unknown date" : "Unbekanntes Datum", "Clear filter" : "Filter zurücksetzen", @@ -106,6 +107,7 @@ "Total rows summary" : "Zusammenfassung aller Zeilen", "Toggle selection for all files and folders" : "Auswahl für alle Dateien und Ordner umschalten", "Name" : "Name", + "File type" : "Dateityp", "Size" : "Größe", "\"{displayName}\" failed on some elements" : "\"{displayName}\" ist bei einigen Elementen fehlgeschlagen", "\"{displayName}\" batch action executed successfully" : "Stapelaktion \"{displayName}\" ausgeführt", @@ -184,6 +186,7 @@ "Sort favorites first" : "Favoriten zuerst sortieren", "Sort folders before files" : "Ordner vor Dateien sortieren", "Show hidden files" : "Versteckte Dateien anzeigen", + "Show file type column" : "Dateityp-Spalte anzeigen", "Crop image previews" : "Bildvorschauen zuschneiden", "Enable the grid view" : "Kachelansicht aktivieren", "Enable folder tree" : "Ordnerstruktur aktivieren", diff --git a/apps/files/l10n/de_DE.js b/apps/files/l10n/de_DE.js index b65015e0f68..cbb4d16f40a 100644 --- a/apps/files/l10n/de_DE.js +++ b/apps/files/l10n/de_DE.js @@ -98,6 +98,7 @@ OC.L10N.register( "Renamed \"{oldName}\" to \"{newName}\"" : "\"{oldName}\" in \"{newName}\" umbenannt", "Rename file" : "Datei umbenennen", "Folder" : "Ordner", + "Unknown file type" : "Unbekannter Dateityp", "Pending" : "Ausstehend", "Unknown date" : "Unbekanntes Datum", "Clear filter" : "Filter zurücksetzen", @@ -108,6 +109,7 @@ OC.L10N.register( "Total rows summary" : "Zusammenfassung aller Zeilen", "Toggle selection for all files and folders" : "Auswahl für alle Dateien und Ordner umschalten", "Name" : "Name", + "File type" : "Dateityp", "Size" : "Größe", "\"{displayName}\" failed on some elements" : "\"{displayName}\" ist bei einigen Elementen fehlgeschlagen", "\"{displayName}\" batch action executed successfully" : "Stapelaktion \"{displayName}\" ausgeführt", @@ -186,6 +188,7 @@ OC.L10N.register( "Sort favorites first" : "Favoriten zuerst sortieren", "Sort folders before files" : "Ordner vor Dateien sortieren", "Show hidden files" : "Versteckte Dateien anzeigen", + "Show file type column" : "Dateityp-Spalte anzeigen", "Crop image previews" : "Bildvorschauen zuschneiden", "Enable the grid view" : "Kachelansicht aktivieren", "Enable folder tree" : "Ordnerstruktur aktivieren", diff --git a/apps/files/l10n/de_DE.json b/apps/files/l10n/de_DE.json index 3818398effb..8e1f611f317 100644 --- a/apps/files/l10n/de_DE.json +++ b/apps/files/l10n/de_DE.json @@ -96,6 +96,7 @@ "Renamed \"{oldName}\" to \"{newName}\"" : "\"{oldName}\" in \"{newName}\" umbenannt", "Rename file" : "Datei umbenennen", "Folder" : "Ordner", + "Unknown file type" : "Unbekannter Dateityp", "Pending" : "Ausstehend", "Unknown date" : "Unbekanntes Datum", "Clear filter" : "Filter zurücksetzen", @@ -106,6 +107,7 @@ "Total rows summary" : "Zusammenfassung aller Zeilen", "Toggle selection for all files and folders" : "Auswahl für alle Dateien und Ordner umschalten", "Name" : "Name", + "File type" : "Dateityp", "Size" : "Größe", "\"{displayName}\" failed on some elements" : "\"{displayName}\" ist bei einigen Elementen fehlgeschlagen", "\"{displayName}\" batch action executed successfully" : "Stapelaktion \"{displayName}\" ausgeführt", @@ -184,6 +186,7 @@ "Sort favorites first" : "Favoriten zuerst sortieren", "Sort folders before files" : "Ordner vor Dateien sortieren", "Show hidden files" : "Versteckte Dateien anzeigen", + "Show file type column" : "Dateityp-Spalte anzeigen", "Crop image previews" : "Bildvorschauen zuschneiden", "Enable the grid view" : "Kachelansicht aktivieren", "Enable folder tree" : "Ordnerstruktur aktivieren", diff --git a/apps/files/l10n/et_EE.js b/apps/files/l10n/et_EE.js index 78db65694c1..17330fbf036 100644 --- a/apps/files/l10n/et_EE.js +++ b/apps/files/l10n/et_EE.js @@ -98,6 +98,7 @@ OC.L10N.register( "Renamed \"{oldName}\" to \"{newName}\"" : "Failinimi on muutunud „{oldName}“ ⇨ „{newName}“", "Rename file" : "Muuda failinime", "Folder" : "Kaust", + "Unknown file type" : "Tundmatu failitüüp", "Pending" : "Ootel", "Unknown date" : "Tundmatu kuupäev", "Clear filter" : "Tühjenda filter", @@ -108,6 +109,7 @@ OC.L10N.register( "Total rows summary" : "Ridade koondkokkuvõte", "Toggle selection for all files and folders" : "Lülita kõikide failide ja kaustade valik sisse/välja", "Name" : "Nimi", + "File type" : "Failitüüp", "Size" : "Suurus", "\"{displayName}\" failed on some elements" : "„{displayName}“ ei toiminud mõne objekti puhul", "\"{displayName}\" batch action executed successfully" : "Pakktöötlus õnnestus: „{displayName}“", @@ -186,6 +188,7 @@ OC.L10N.register( "Sort favorites first" : "Järjesta lemmikud esimesena", "Sort folders before files" : "Järjesta kaustad enne faile", "Show hidden files" : "Näita peidetud faile", + "Show file type column" : "Näita failitüübi veergu", "Crop image previews" : "Kadreeri piltide eelvaated", "Enable the grid view" : "Võta kasutusele ruudustikuvaade", "Enable folder tree" : "Võta kasutusele kaustapuu", diff --git a/apps/files/l10n/et_EE.json b/apps/files/l10n/et_EE.json index 428758f0287..cb2182202e8 100644 --- a/apps/files/l10n/et_EE.json +++ b/apps/files/l10n/et_EE.json @@ -96,6 +96,7 @@ "Renamed \"{oldName}\" to \"{newName}\"" : "Failinimi on muutunud „{oldName}“ ⇨ „{newName}“", "Rename file" : "Muuda failinime", "Folder" : "Kaust", + "Unknown file type" : "Tundmatu failitüüp", "Pending" : "Ootel", "Unknown date" : "Tundmatu kuupäev", "Clear filter" : "Tühjenda filter", @@ -106,6 +107,7 @@ "Total rows summary" : "Ridade koondkokkuvõte", "Toggle selection for all files and folders" : "Lülita kõikide failide ja kaustade valik sisse/välja", "Name" : "Nimi", + "File type" : "Failitüüp", "Size" : "Suurus", "\"{displayName}\" failed on some elements" : "„{displayName}“ ei toiminud mõne objekti puhul", "\"{displayName}\" batch action executed successfully" : "Pakktöötlus õnnestus: „{displayName}“", @@ -184,6 +186,7 @@ "Sort favorites first" : "Järjesta lemmikud esimesena", "Sort folders before files" : "Järjesta kaustad enne faile", "Show hidden files" : "Näita peidetud faile", + "Show file type column" : "Näita failitüübi veergu", "Crop image previews" : "Kadreeri piltide eelvaated", "Enable the grid view" : "Võta kasutusele ruudustikuvaade", "Enable folder tree" : "Võta kasutusele kaustapuu", diff --git a/apps/files/l10n/it.js b/apps/files/l10n/it.js index a98cb8fe96d..03a1cda9804 100644 --- a/apps/files/l10n/it.js +++ b/apps/files/l10n/it.js @@ -98,6 +98,7 @@ OC.L10N.register( "Renamed \"{oldName}\" to \"{newName}\"" : "Rinominato \"{oldName}\" in \"{newName}\"", "Rename file" : "Rinomina file", "Folder" : "Cartella", + "Unknown file type" : "Tipo di file sconosciuto", "Pending" : "In corso", "Unknown date" : "Data sconosciuta", "Clear filter" : "Pulisci il filtro", @@ -108,6 +109,7 @@ OC.L10N.register( "Total rows summary" : "Riepilogo totale delle righe", "Toggle selection for all files and folders" : "Attiva/disattiva la selezione per tutti i file e le cartelle", "Name" : "Nome", + "File type" : "Tipo di file", "Size" : "Dimensione", "\"{displayName}\" failed on some elements" : "\"{displayName}\" non riuscito su alcuni elementi", "\"{displayName}\" batch action executed successfully" : "L'azione batch \"{displayName}\" è stata eseguita correttamente", @@ -186,6 +188,7 @@ OC.L10N.register( "Sort favorites first" : "Ordina prima i preferiti", "Sort folders before files" : "Ordina cartelle prima dei files", "Show hidden files" : "Mostra i file nascosti", + "Show file type column" : "Mostra colonna tipo di file", "Crop image previews" : "Ritaglia le anteprime delle immagini", "Enable the grid view" : "Attiva visuale a griglia", "Enable folder tree" : "Abilita l'albero delle cartelle", diff --git a/apps/files/l10n/it.json b/apps/files/l10n/it.json index f645e6940bc..e83848ed70a 100644 --- a/apps/files/l10n/it.json +++ b/apps/files/l10n/it.json @@ -96,6 +96,7 @@ "Renamed \"{oldName}\" to \"{newName}\"" : "Rinominato \"{oldName}\" in \"{newName}\"", "Rename file" : "Rinomina file", "Folder" : "Cartella", + "Unknown file type" : "Tipo di file sconosciuto", "Pending" : "In corso", "Unknown date" : "Data sconosciuta", "Clear filter" : "Pulisci il filtro", @@ -106,6 +107,7 @@ "Total rows summary" : "Riepilogo totale delle righe", "Toggle selection for all files and folders" : "Attiva/disattiva la selezione per tutti i file e le cartelle", "Name" : "Nome", + "File type" : "Tipo di file", "Size" : "Dimensione", "\"{displayName}\" failed on some elements" : "\"{displayName}\" non riuscito su alcuni elementi", "\"{displayName}\" batch action executed successfully" : "L'azione batch \"{displayName}\" è stata eseguita correttamente", @@ -184,6 +186,7 @@ "Sort favorites first" : "Ordina prima i preferiti", "Sort folders before files" : "Ordina cartelle prima dei files", "Show hidden files" : "Mostra i file nascosti", + "Show file type column" : "Mostra colonna tipo di file", "Crop image previews" : "Ritaglia le anteprime delle immagini", "Enable the grid view" : "Attiva visuale a griglia", "Enable folder tree" : "Abilita l'albero delle cartelle", diff --git a/apps/files/l10n/pt_BR.js b/apps/files/l10n/pt_BR.js index 3308568155b..65358d419aa 100644 --- a/apps/files/l10n/pt_BR.js +++ b/apps/files/l10n/pt_BR.js @@ -98,6 +98,7 @@ OC.L10N.register( "Renamed \"{oldName}\" to \"{newName}\"" : "\"{oldName}\" foi renomeado para \"{newName}\"", "Rename file" : "Renomear arquivo", "Folder" : "Pasta", + "Unknown file type" : "Tipo de arquivo desconhecido", "Pending" : "Pendente", "Unknown date" : "Data desconhecida", "Clear filter" : "Limpar filtro", @@ -108,6 +109,7 @@ OC.L10N.register( "Total rows summary" : "Resumo do total de linhas", "Toggle selection for all files and folders" : "Alternar seleção para todos os arquivos e pastas", "Name" : "Nome", + "File type" : "Tipo de arquivo", "Size" : "Tamanho", "\"{displayName}\" failed on some elements" : "\"{displayName}\" falhou em alguns elementos", "\"{displayName}\" batch action executed successfully" : "Ação em lote \"{displayName}\" executada com êxito", @@ -186,6 +188,7 @@ OC.L10N.register( "Sort favorites first" : "Ordenar favoritos primeiro", "Sort folders before files" : "Ordenar pastas antes de arquivos", "Show hidden files" : "Mostrar arquivos ocultos", + "Show file type column" : "Mostrar coluna de tipo de arquivo", "Crop image previews" : "Cortar visualizações de imagem", "Enable the grid view" : "Ativar a visualização em grade", "Enable folder tree" : "Ativar árvore de pastas", diff --git a/apps/files/l10n/pt_BR.json b/apps/files/l10n/pt_BR.json index ceec9ac85f4..7b39fa76f77 100644 --- a/apps/files/l10n/pt_BR.json +++ b/apps/files/l10n/pt_BR.json @@ -96,6 +96,7 @@ "Renamed \"{oldName}\" to \"{newName}\"" : "\"{oldName}\" foi renomeado para \"{newName}\"", "Rename file" : "Renomear arquivo", "Folder" : "Pasta", + "Unknown file type" : "Tipo de arquivo desconhecido", "Pending" : "Pendente", "Unknown date" : "Data desconhecida", "Clear filter" : "Limpar filtro", @@ -106,6 +107,7 @@ "Total rows summary" : "Resumo do total de linhas", "Toggle selection for all files and folders" : "Alternar seleção para todos os arquivos e pastas", "Name" : "Nome", + "File type" : "Tipo de arquivo", "Size" : "Tamanho", "\"{displayName}\" failed on some elements" : "\"{displayName}\" falhou em alguns elementos", "\"{displayName}\" batch action executed successfully" : "Ação em lote \"{displayName}\" executada com êxito", @@ -184,6 +186,7 @@ "Sort favorites first" : "Ordenar favoritos primeiro", "Sort folders before files" : "Ordenar pastas antes de arquivos", "Show hidden files" : "Mostrar arquivos ocultos", + "Show file type column" : "Mostrar coluna de tipo de arquivo", "Crop image previews" : "Cortar visualizações de imagem", "Enable the grid view" : "Ativar a visualização em grade", "Enable folder tree" : "Ativar árvore de pastas", diff --git a/apps/files/l10n/zh_TW.js b/apps/files/l10n/zh_TW.js index af800f5614f..51c97322725 100644 --- a/apps/files/l10n/zh_TW.js +++ b/apps/files/l10n/zh_TW.js @@ -98,6 +98,7 @@ OC.L10N.register( "Renamed \"{oldName}\" to \"{newName}\"" : "已將「{oldName}」重新命名為「{newName}」", "Rename file" : "重新命名檔案", "Folder" : "資料夾", + "Unknown file type" : "未知檔案類型", "Pending" : "待處理", "Unknown date" : "未知日期", "Clear filter" : "清除過濾條件", @@ -108,6 +109,7 @@ OC.L10N.register( "Total rows summary" : "總列摘要", "Toggle selection for all files and folders" : "切換所有檔案和資料夾的選取", "Name" : "名稱", + "File type" : "檔案類型", "Size" : "大小", "\"{displayName}\" failed on some elements" : "「{displayName}」在某些元素上失敗", "\"{displayName}\" batch action executed successfully" : "「{displayName}」批次動作執行成功", @@ -186,6 +188,7 @@ OC.L10N.register( "Sort favorites first" : "先排序喜愛", "Sort folders before files" : "將資料夾排序在檔案前", "Show hidden files" : "顯示隱藏檔", + "Show file type column" : "顯示檔案類型欄位", "Crop image previews" : "圖片裁剪預覽", "Enable the grid view" : "啟用格狀檢視", "Enable folder tree" : "啟用資料夾樹", diff --git a/apps/files/l10n/zh_TW.json b/apps/files/l10n/zh_TW.json index 3c1c8d347fa..ead55fc3891 100644 --- a/apps/files/l10n/zh_TW.json +++ b/apps/files/l10n/zh_TW.json @@ -96,6 +96,7 @@ "Renamed \"{oldName}\" to \"{newName}\"" : "已將「{oldName}」重新命名為「{newName}」", "Rename file" : "重新命名檔案", "Folder" : "資料夾", + "Unknown file type" : "未知檔案類型", "Pending" : "待處理", "Unknown date" : "未知日期", "Clear filter" : "清除過濾條件", @@ -106,6 +107,7 @@ "Total rows summary" : "總列摘要", "Toggle selection for all files and folders" : "切換所有檔案和資料夾的選取", "Name" : "名稱", + "File type" : "檔案類型", "Size" : "大小", "\"{displayName}\" failed on some elements" : "「{displayName}」在某些元素上失敗", "\"{displayName}\" batch action executed successfully" : "「{displayName}」批次動作執行成功", @@ -184,6 +186,7 @@ "Sort favorites first" : "先排序喜愛", "Sort folders before files" : "將資料夾排序在檔案前", "Show hidden files" : "顯示隱藏檔", + "Show file type column" : "顯示檔案類型欄位", "Crop image previews" : "圖片裁剪預覽", "Enable the grid view" : "啟用格狀檢視", "Enable folder tree" : "啟用資料夾樹", diff --git a/apps/files/lib/AppInfo/Application.php b/apps/files/lib/AppInfo/Application.php index 4b3948d43b5..32c072ef0f4 100644 --- a/apps/files/lib/AppInfo/Application.php +++ b/apps/files/lib/AppInfo/Application.php @@ -132,7 +132,6 @@ class Application extends App implements IBootstrap { public function boot(IBootContext $context): void { $context->injectFn(Closure::fromCallable([$this, 'registerCollaboration'])); $context->injectFn([Listener::class, 'register']); - $this->registerTemplates(); $this->registerHooks(); } @@ -140,13 +139,6 @@ class Application extends App implements IBootstrap { $providerManager->registerResourceProvider(ResourceProvider::class); } - private function registerTemplates(): void { - $templateManager = \OC_Helper::getFileTemplateManager(); - $templateManager->registerTemplate('application/vnd.oasis.opendocument.presentation', 'core/templates/filetemplates/template.odp'); - $templateManager->registerTemplate('application/vnd.oasis.opendocument.text', 'core/templates/filetemplates/template.odt'); - $templateManager->registerTemplate('application/vnd.oasis.opendocument.spreadsheet', 'core/templates/filetemplates/template.ods'); - } - private function registerHooks(): void { Util::connectHook('\OCP\Config', 'js', '\OCA\Files\App', 'extendJsConfig'); } diff --git a/apps/files_sharing/l10n/ko.js b/apps/files_sharing/l10n/ko.js index 6c6967c59a8..d946d802981 100644 --- a/apps/files_sharing/l10n/ko.js +++ b/apps/files_sharing/l10n/ko.js @@ -311,7 +311,7 @@ OC.L10N.register( "Link shares" : "링크 공유", "Shares" : "공유", "Use this method to share files with individuals or teams within your organization. If the recipient already has access to the share but cannot locate it, you can send them the internal share link for easy access." : "이 방법을 사용하여 조직 내 개인 또는 팀과 파일을 공유하세요. 수신자가 이미 공유 폴더에 접근할 수 있지만 위치를 찾을 수 없는 경우, 쉽게 접근할 수 있도록 내부 공유 링크를 보낼 수 있습니다.", - "Use this method to share files with individuals or organizations outside your organization. Files and folders can be shared via public share links and email addresses. You can also share to other Nextcloud accounts hosted on different instances using their federated cloud ID." : "이 방법을 사용하면 조직 외부의 조직이나 개인과 파일을 공유할 수 있습니다. 파일과 폴더는 공개 공유 링크와 이메일 주소를 통해 공유할 수 있습니다. 또한, 다른 인스턴스에 소속된 다른 Nextcloud 계정과도 연합 클라우드 ID를 사용하여 공유할 수 있습니다.", + "Use this method to share files with individuals or organizations outside your organization. Files and folders can be shared via public share links and email addresses. You can also share to other Nextcloud accounts hosted on different instances using their federated cloud ID." : "이 방법을 사용하여 이 조직 외부의 개인이나 조직과 파일을 공유하세요. 파일과 폴더는 공개 공유 링크와 이메일 주소를 통해 공유할 수 있습니다. 다른 인스턴스에 소속된 다른 Nextcloud 계정과도 연합 클라우드 ID를 사용하여 공유할 수 있습니다.", "Shares that are not part of the internal or external shares. This can be shares from apps or other sources." : "내부 또는 외부 공유에 포함되지 않은 공유입니다. 앱이나 다른 소스에서 공유된 내용이 여기에 해당할 수 있습니다.", "Share with accounts, teams, federated cloud IDs" : "계정, 팀 및 연합 클라우드 ID와 공유", "Share with accounts and teams" : "계정 및 팀과 공유", diff --git a/apps/files_sharing/l10n/ko.json b/apps/files_sharing/l10n/ko.json index d08e914da29..4d9e598e1b5 100644 --- a/apps/files_sharing/l10n/ko.json +++ b/apps/files_sharing/l10n/ko.json @@ -309,7 +309,7 @@ "Link shares" : "링크 공유", "Shares" : "공유", "Use this method to share files with individuals or teams within your organization. If the recipient already has access to the share but cannot locate it, you can send them the internal share link for easy access." : "이 방법을 사용하여 조직 내 개인 또는 팀과 파일을 공유하세요. 수신자가 이미 공유 폴더에 접근할 수 있지만 위치를 찾을 수 없는 경우, 쉽게 접근할 수 있도록 내부 공유 링크를 보낼 수 있습니다.", - "Use this method to share files with individuals or organizations outside your organization. Files and folders can be shared via public share links and email addresses. You can also share to other Nextcloud accounts hosted on different instances using their federated cloud ID." : "이 방법을 사용하면 조직 외부의 조직이나 개인과 파일을 공유할 수 있습니다. 파일과 폴더는 공개 공유 링크와 이메일 주소를 통해 공유할 수 있습니다. 또한, 다른 인스턴스에 소속된 다른 Nextcloud 계정과도 연합 클라우드 ID를 사용하여 공유할 수 있습니다.", + "Use this method to share files with individuals or organizations outside your organization. Files and folders can be shared via public share links and email addresses. You can also share to other Nextcloud accounts hosted on different instances using their federated cloud ID." : "이 방법을 사용하여 이 조직 외부의 개인이나 조직과 파일을 공유하세요. 파일과 폴더는 공개 공유 링크와 이메일 주소를 통해 공유할 수 있습니다. 다른 인스턴스에 소속된 다른 Nextcloud 계정과도 연합 클라우드 ID를 사용하여 공유할 수 있습니다.", "Shares that are not part of the internal or external shares. This can be shares from apps or other sources." : "내부 또는 외부 공유에 포함되지 않은 공유입니다. 앱이나 다른 소스에서 공유된 내용이 여기에 해당할 수 있습니다.", "Share with accounts, teams, federated cloud IDs" : "계정, 팀 및 연합 클라우드 ID와 공유", "Share with accounts and teams" : "계정 및 팀과 공유", diff --git a/apps/provisioning_api/tests/CapabilitiesTest.php b/apps/provisioning_api/tests/CapabilitiesTest.php index e3c14f37ed7..67a0335829c 100644 --- a/apps/provisioning_api/tests/CapabilitiesTest.php +++ b/apps/provisioning_api/tests/CapabilitiesTest.php @@ -1,9 +1,11 @@ <?php + +declare(strict_types=1); /** * SPDX-FileCopyrightText: 2021 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later */ -namespace OCA\Provisioning_API\Tests\unit; +namespace OCA\Provisioning_API\Tests; use OCA\FederatedFileSharing\FederatedShareProvider; use OCA\Provisioning_API\Capabilities; @@ -21,11 +23,8 @@ use Test\TestCase; */ class CapabilitiesTest extends TestCase { - /** @var Capabilities */ - protected $capabilities; - - /** @var IAppManager|MockObject */ - protected $appManager; + protected IAppManager&MockObject $appManager; + protected Capabilities $capabilities; public function setUp(): void { parent::setUp(); @@ -38,7 +37,7 @@ class CapabilitiesTest extends TestCase { ->willReturn('1.12'); } - public function getCapabilitiesProvider() { + public static function getCapabilitiesProvider(): array { return [ [true, false, false, true, false], [true, true, false, true, false], @@ -52,7 +51,7 @@ class CapabilitiesTest extends TestCase { /** * @dataProvider getCapabilitiesProvider */ - public function testGetCapabilities($federationAppEnabled, $federatedFileSharingAppEnabled, $lookupServerEnabled, $expectedFederatedScopeEnabled, $expectedPublishedScopeEnabled): void { + public function testGetCapabilities(bool $federationAppEnabled, bool $federatedFileSharingAppEnabled, bool $lookupServerEnabled, bool $expectedFederatedScopeEnabled, bool $expectedPublishedScopeEnabled): void { $this->appManager->expects($this->any()) ->method('isEnabledForUser') ->will($this->returnValueMap([ diff --git a/apps/provisioning_api/tests/Controller/AppConfigControllerTest.php b/apps/provisioning_api/tests/Controller/AppConfigControllerTest.php index 41739b6283f..3d2c1645d25 100644 --- a/apps/provisioning_api/tests/Controller/AppConfigControllerTest.php +++ b/apps/provisioning_api/tests/Controller/AppConfigControllerTest.php @@ -1,4 +1,6 @@ <?php + +declare(strict_types=1); /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later @@ -30,7 +32,6 @@ use function json_encode; * @package OCA\Provisioning_API\Tests */ class AppConfigControllerTest extends TestCase { - private IAppConfig&MockObject $appConfig; private IUserSession&MockObject $userSession; private IL10N&MockObject $l10n; @@ -51,7 +52,7 @@ class AppConfigControllerTest extends TestCase { /** * @param string[] $methods - * @return AppConfigController|\PHPUnit\Framework\MockObject\MockObject + * @return AppConfigController|MockObject */ protected function getInstance(array $methods = []) { $request = $this->createMock(IRequest::class); @@ -79,7 +80,7 @@ class AppConfigControllerTest extends TestCase { $this->settingManager, $this->appManager, ]) - ->setMethods($methods) + ->onlyMethods($methods) ->getMock(); } } @@ -95,7 +96,7 @@ class AppConfigControllerTest extends TestCase { $this->assertEquals(['data' => ['apps']], $result->getData()); } - public function dataGetKeys() { + public static function dataGetKeys(): array { return [ ['app1 ', null, new \InvalidArgumentException('error'), Http::STATUS_FORBIDDEN], ['app2', ['keys'], null, Http::STATUS_OK], @@ -104,12 +105,8 @@ class AppConfigControllerTest extends TestCase { /** * @dataProvider dataGetKeys - * @param string $app - * @param array|null $keys - * @param \Exception|null $throws - * @param int $status */ - public function testGetKeys($app, $keys, $throws, $status): void { + public function testGetKeys(string $app, ?array $keys, ?\Throwable $throws, int $status): void { $api = $this->getInstance(['verifyAppId']); if ($throws instanceof \Exception) { $api->expects($this->once()) @@ -140,7 +137,7 @@ class AppConfigControllerTest extends TestCase { } } - public function dataGetValue() { + public static function dataGetValue(): array { return [ ['app1', 'key', 'default', null, new \InvalidArgumentException('error'), Http::STATUS_FORBIDDEN], ['app2', 'key', 'default', 'return', null, Http::STATUS_OK], @@ -149,14 +146,8 @@ class AppConfigControllerTest extends TestCase { /** * @dataProvider dataGetValue - * @param string $app - * @param string|null $key - * @param string|null $default - * @param string|null $return - * @param \Exception|null $throws - * @param int $status */ - public function testGetValue($app, $key, $default, $return, $throws, $status): void { + public function testGetValue(string $app, string $key, string $default, ?string $return, ?\Throwable $throws, int $status): void { $api = $this->getInstance(['verifyAppId']); if ($throws instanceof \Exception) { $api->expects($this->once()) @@ -184,7 +175,7 @@ class AppConfigControllerTest extends TestCase { } } - public function dataSetValue() { + public static function dataSetValue(): array { return [ ['app1', 'key', 'default', new \InvalidArgumentException('error1'), null, Http::STATUS_FORBIDDEN], ['app2', 'key', 'default', null, new \InvalidArgumentException('error2'), Http::STATUS_FORBIDDEN], @@ -201,14 +192,8 @@ class AppConfigControllerTest extends TestCase { /** * @dataProvider dataSetValue - * @param string $app - * @param string|null $key - * @param string|null $value - * @param \Exception|null $appThrows - * @param \Exception|null $keyThrows - * @param int|\Throwable $status */ - public function testSetValue($app, $key, $value, $appThrows, $keyThrows, $status, int|\Throwable $type = IAppConfig::VALUE_MIXED): void { + public function testSetValue(string $app, string $key, string $value, ?\Throwable $appThrows, ?\Throwable $keyThrows, int $status, int|\Throwable $type = IAppConfig::VALUE_MIXED): void { $adminUser = $this->createMock(IUser::class); $adminUser->expects($this->once()) ->method('getUid') @@ -297,7 +282,7 @@ class AppConfigControllerTest extends TestCase { } } - public function dataDeleteValue() { + public static function dataDeleteValue(): array { return [ ['app1', 'key', new \InvalidArgumentException('error1'), null, Http::STATUS_FORBIDDEN], ['app2', 'key', null, new \InvalidArgumentException('error2'), Http::STATUS_FORBIDDEN], @@ -307,13 +292,8 @@ class AppConfigControllerTest extends TestCase { /** * @dataProvider dataDeleteValue - * @param string $app - * @param string|null $key - * @param \Exception|null $appThrows - * @param \Exception|null $keyThrows - * @param int $status */ - public function testDeleteValue($app, $key, $appThrows, $keyThrows, $status): void { + public function testDeleteValue(string $app, string $key, ?\Throwable $appThrows, ?\Throwable $keyThrows, int $status): void { $api = $this->getInstance(['verifyAppId', 'verifyConfigKey']); if ($appThrows instanceof \Exception) { $api->expects($this->once()) @@ -367,7 +347,7 @@ class AppConfigControllerTest extends TestCase { $this->addToAssertionCount(1); } - public function dataVerifyAppIdThrows() { + public static function dataVerifyAppIdThrows(): array { return [ ['activity..'], ['activity/'], @@ -378,16 +358,15 @@ class AppConfigControllerTest extends TestCase { /** * @dataProvider dataVerifyAppIdThrows - * @param string $app */ - public function testVerifyAppIdThrows($app): void { + public function testVerifyAppIdThrows(string $app): void { $this->expectException(\InvalidArgumentException::class); $api = $this->getInstance(); $this->invokePrivate($api, 'verifyAppId', [$app]); } - public function dataVerifyConfigKey() { + public static function dataVerifyConfigKey(): array { return [ ['activity', 'abc', ''], ['dav', 'public_route', ''], @@ -398,17 +377,14 @@ class AppConfigControllerTest extends TestCase { /** * @dataProvider dataVerifyConfigKey - * @param string $app - * @param string $key - * @param string $value */ - public function testVerifyConfigKey($app, $key, $value): void { + public function testVerifyConfigKey(string $app, string $key, string $value): void { $api = $this->getInstance(); $this->invokePrivate($api, 'verifyConfigKey', [$app, $key, $value]); $this->addToAssertionCount(1); } - public function dataVerifyConfigKeyThrows() { + public static function dataVerifyConfigKeyThrows(): array { return [ ['activity', 'installed_version', ''], ['calendar', 'enabled', ''], @@ -424,11 +400,8 @@ class AppConfigControllerTest extends TestCase { /** * @dataProvider dataVerifyConfigKeyThrows - * @param string $app - * @param string $key - * @param string $value */ - public function testVerifyConfigKeyThrows($app, $key, $value): void { + public function testVerifyConfigKeyThrows(string $app, string $key, string $value): void { $this->expectException(\InvalidArgumentException::class); $api = $this->getInstance(); diff --git a/apps/provisioning_api/tests/Controller/AppsControllerTest.php b/apps/provisioning_api/tests/Controller/AppsControllerTest.php index bbcabfddd8b..f56be7c4c36 100644 --- a/apps/provisioning_api/tests/Controller/AppsControllerTest.php +++ b/apps/provisioning_api/tests/Controller/AppsControllerTest.php @@ -24,12 +24,9 @@ use OCP\Server; * @package OCA\Provisioning_API\Tests */ class AppsControllerTest extends TestCase { - /** @var IAppManager */ - private $appManager; - /** @var AppsController */ - private $api; - /** @var IUserSession */ - private $userSession; + private IAppManager $appManager; + private AppsController $api; + private IUserSession $userSession; protected function setUp(): void { parent::setUp(); @@ -38,9 +35,7 @@ class AppsControllerTest extends TestCase { $this->groupManager = Server::get(IGroupManager::class); $this->userSession = Server::get(IUserSession::class); - $request = $this->getMockBuilder(IRequest::class) - ->disableOriginalConstructor() - ->getMock(); + $request = $this->createMock(IRequest::class); $this->api = new AppsController( 'provisioning_api', @@ -96,7 +91,7 @@ class AppsControllerTest extends TestCase { $this->assertEquals(count($disabled), count($data['apps'])); } - + public function testGetAppsInvalidFilter(): void { $this->expectException(OCSException::class); $this->expectExceptionCode(101); diff --git a/apps/provisioning_api/tests/Controller/GroupsControllerTest.php b/apps/provisioning_api/tests/Controller/GroupsControllerTest.php index 29b098429e8..e4f8b3af183 100644 --- a/apps/provisioning_api/tests/Controller/GroupsControllerTest.php +++ b/apps/provisioning_api/tests/Controller/GroupsControllerTest.php @@ -22,30 +22,20 @@ use OCP\IUserManager; use OCP\IUserSession; use OCP\L10N\IFactory; use OCP\UserInterface; +use PHPUnit\Framework\MockObject\MockObject; use Psr\Log\LoggerInterface; class GroupsControllerTest extends \Test\TestCase { - /** @var IRequest|\PHPUnit\Framework\MockObject\MockObject */ - protected $request; - /** @var IUserManager|\PHPUnit\Framework\MockObject\MockObject */ - protected $userManager; - /** @var IConfig|\PHPUnit\Framework\MockObject\MockObject */ - protected $config; - /** @var Manager|\PHPUnit\Framework\MockObject\MockObject */ - protected $groupManager; - /** @var IUserSession|\PHPUnit\Framework\MockObject\MockObject */ - protected $userSession; - /** @var IAccountManager|\PHPUnit\Framework\MockObject\MockObject */ - protected $accountManager; - /** @var ISubAdmin|\PHPUnit\Framework\MockObject\MockObject */ - protected $subAdminManager; - /** @var IFactory|\PHPUnit\Framework\MockObject\MockObject */ - protected $l10nFactory; - /** @var LoggerInterface|\PHPUnit\Framework\MockObject\MockObject */ - protected $logger; - - /** @var GroupsController|\PHPUnit\Framework\MockObject\MockObject */ - protected $api; + protected IRequest&MockObject $request; + protected IUserManager&MockObject $userManager; + protected IConfig&MockObject $config; + protected Manager&MockObject $groupManager; + protected IUserSession&MockObject $userSession; + protected IAccountManager&MockObject $accountManager; + protected ISubAdmin&MockObject $subAdminManager; + protected IFactory&MockObject $l10nFactory; + protected LoggerInterface&MockObject $logger; + protected GroupsController&MockObject $api; private IRootFolder $rootFolder; @@ -82,16 +72,12 @@ class GroupsControllerTest extends \Test\TestCase { $this->rootFolder, $this->logger ]) - ->setMethods(['fillStorageInfo']) + ->onlyMethods(['fillStorageInfo']) ->getMock(); } - /** - * @param string $gid - * @return IGroup|\PHPUnit\Framework\MockObject\MockObject - */ - private function createGroup($gid) { - $group = $this->getMockBuilder('\OCP\IGroup')->disableOriginalConstructor()->getMock(); + private function createGroup(string $gid): IGroup&MockObject { + $group = $this->createMock(\OCP\IGroup::class); $group ->method('getGID') ->willReturn($gid); @@ -116,7 +102,7 @@ class GroupsControllerTest extends \Test\TestCase { /** * @param string $uid - * @return IUser|\PHPUnit\Framework\MockObject\MockObject + * @return IUser&MockObject */ private function createUser($uid) { $user = $this->getMockBuilder(IUser::class)->disableOriginalConstructor()->getMock(); @@ -165,7 +151,7 @@ class GroupsControllerTest extends \Test\TestCase { }); } - public function dataGetGroups() { + public static function dataGetGroups(): array { return [ [null, 0, 0], ['foo', 0, 0], @@ -177,12 +163,8 @@ class GroupsControllerTest extends \Test\TestCase { /** * @dataProvider dataGetGroups - * - * @param string|null $search - * @param int|null $limit - * @param int|null $offset */ - public function testGetGroups($search, $limit, $offset): void { + public function testGetGroups(?string $search, int $limit, int $offset): void { $groups = [$this->createGroup('group1'), $this->createGroup('group2')]; $search = $search === null ? '' : $search; @@ -509,7 +491,7 @@ class GroupsControllerTest extends \Test\TestCase { ->method('getUserGroups') ->willReturn([$group]); - /** @var \PHPUnit\Framework\MockObject\MockObject */ + /** @var MockObject */ $this->subAdminManager->expects($this->any()) ->method('isSubAdminOfGroup') ->willReturn(false); @@ -554,7 +536,7 @@ class GroupsControllerTest extends \Test\TestCase { ->method('getUserGroups') ->willReturn([$group]); - /** @var \PHPUnit\Framework\MockObject\MockObject */ + /** @var MockObject */ $this->subAdminManager->expects($this->any()) ->method('isSubAdminOfGroup') ->willReturn(false); diff --git a/apps/provisioning_api/tests/Controller/UsersControllerTest.php b/apps/provisioning_api/tests/Controller/UsersControllerTest.php index 7d4f99356b3..80d6d0f6152 100644 --- a/apps/provisioning_api/tests/Controller/UsersControllerTest.php +++ b/apps/provisioning_api/tests/Controller/UsersControllerTest.php @@ -46,41 +46,24 @@ use RuntimeException; use Test\TestCase; class UsersControllerTest extends TestCase { - /** @var IUserManager|MockObject */ - protected $userManager; - /** @var IConfig|MockObject */ - protected $config; - /** @var Manager|MockObject */ - protected $groupManager; - /** @var IUserSession|MockObject */ - protected $userSession; - /** @var LoggerInterface|MockObject */ - protected $logger; - /** @var UsersController|MockObject */ - protected $api; - /** @var IAccountManager|MockObject */ - protected $accountManager; - /** @var ISubAdmin|MockObject */ - protected $subAdminManager; - /** @var IURLGenerator|MockObject */ - protected $urlGenerator; - /** @var IRequest|MockObject */ - protected $request; - /** @var IFactory|MockObject */ - private $l10nFactory; - /** @var NewUserMailHelper|MockObject */ - private $newUserMailHelper; - /** @var ISecureRandom|MockObject */ - private $secureRandom; - /** @var RemoteWipe|MockObject */ - private $remoteWipe; - /** @var KnownUserService|MockObject */ - private $knownUserService; - /** @var IEventDispatcher|MockObject */ - private $eventDispatcher; + protected IUserManager&MockObject $userManager; + protected IConfig&MockObject $config; + protected Manager&MockObject $groupManager; + protected IUserSession&MockObject $userSession; + protected LoggerInterface&MockObject $logger; + protected UsersController&MockObject $api; + protected IAccountManager&MockObject $accountManager; + protected ISubAdmin&MockObject $subAdminManager; + protected IURLGenerator&MockObject $urlGenerator; + protected IRequest&MockObject $request; + private IFactory&MockObject $l10nFactory; + private NewUserMailHelper&MockObject $newUserMailHelper; + private ISecureRandom&MockObject $secureRandom; + private RemoteWipe&MockObject $remoteWipe; + private KnownUserService&MockObject $knownUserService; + private IEventDispatcher&MockObject $eventDispatcher; private IRootFolder $rootFolder; - /** @var IPhoneNumberUtil */ - private $phoneNumberUtil; + private IPhoneNumberUtil $phoneNumberUtil; protected function setUp(): void { parent::setUp(); @@ -449,10 +432,6 @@ class UsersControllerTest extends TestCase { $this->groupManager ->expects($this->exactly(2)) ->method('groupExists') - ->withConsecutive( - ['ExistingGroup'], - ['NonExistingGroup'] - ) ->willReturnMap([ ['ExistingGroup', true], ['NonExistingGroup', false] @@ -798,18 +777,20 @@ class UsersControllerTest extends TestCase { ->method('get') ->with('ExistingGroup') ->willReturn($group); + + $calls = [ + ['Successful addUser call with userid: NewUser', ['app' => 'ocs_api']], + ['Added userid NewUser to group ExistingGroup', ['app' => 'ocs_api']], + ]; $this->logger ->expects($this->exactly(2)) ->method('info') - ->withConsecutive( - ['Successful addUser call with userid: NewUser', ['app' => 'ocs_api']], - ['Added userid NewUser to group ExistingGroup', ['app' => 'ocs_api']] - ); + ->willReturnCallback(function () use (&$calls) { + $expected = array_shift($calls); + $this->assertEquals($expected, func_get_args()); + }); - $this->assertTrue(key_exists( - 'id', - $this->api->addUser('NewUser', 'PasswordOfTheNewUser', '', '', ['ExistingGroup'])->getData() - )); + $this->assertArrayHasKey('id', $this->api->addUser('NewUser', 'PasswordOfTheNewUser', '', '', ['ExistingGroup'])->getData()); } @@ -966,11 +947,10 @@ class UsersControllerTest extends TestCase { $this->groupManager ->expects($this->exactly(2)) ->method('groupExists') - ->withConsecutive( - ['ExistingGroup1'], - ['ExistingGroup2'] - ) - ->willReturn(true); + ->willReturnMap([ + ['ExistingGroup1', true], + ['ExistingGroup2', true] + ]); $user = $this->getMockBuilder(IUser::class) ->disableOriginalConstructor() ->getMock(); @@ -996,24 +976,23 @@ class UsersControllerTest extends TestCase { $this->groupManager ->expects($this->exactly(4)) ->method('get') - ->withConsecutive( - ['ExistingGroup1'], - ['ExistingGroup2'], - ['ExistingGroup1'], - ['ExistingGroup2'] - ) ->willReturnMap([ ['ExistingGroup1', $existingGroup1], ['ExistingGroup2', $existingGroup2] ]); + + $calls = [ + ['Successful addUser call with userid: NewUser', ['app' => 'ocs_api']], + ['Added userid NewUser to group ExistingGroup1', ['app' => 'ocs_api']], + ['Added userid NewUser to group ExistingGroup2', ['app' => 'ocs_api']], + ]; $this->logger ->expects($this->exactly(3)) ->method('info') - ->withConsecutive( - ['Successful addUser call with userid: NewUser', ['app' => 'ocs_api']], - ['Added userid NewUser to group ExistingGroup1', ['app' => 'ocs_api']], - ['Added userid NewUser to group ExistingGroup2', ['app' => 'ocs_api']] - ); + ->willReturnCallback(function () use (&$calls) { + $expected = array_shift($calls); + $this->assertEquals($expected, func_get_args()); + }); $subAdminManager = $this->getMockBuilder('OC\SubAdmin') ->disableOriginalConstructor()->getMock(); $this->groupManager @@ -1023,16 +1002,12 @@ class UsersControllerTest extends TestCase { $subAdminManager ->expects($this->exactly(2)) ->method('isSubAdminOfGroup') - ->withConsecutive( - [$loggedInUser, $existingGroup1], - [$loggedInUser, $existingGroup2] - ) - ->willReturn(true); + ->willReturnMap([ + [$loggedInUser, $existingGroup1, true], + [$loggedInUser, $existingGroup2, true], + ]); - $this->assertTrue(key_exists( - 'id', - $this->api->addUser('NewUser', 'PasswordOfTheNewUser', '', '', ['ExistingGroup1', 'ExistingGroup2'])->getData() - )); + $this->assertArrayHasKey('id', $this->api->addUser('NewUser', 'PasswordOfTheNewUser', '', '', ['ExistingGroup1', 'ExistingGroup2'])->getData()); } @@ -1541,7 +1516,7 @@ class UsersControllerTest extends TestCase { $this->assertEquals($expected, $this->invokePrivate($this->api, 'getUserData', ['UID'])); } - public function dataSearchByPhoneNumbers(): array { + public static function dataSearchByPhoneNumbers(): array { return [ 'Invalid country' => ['Not a country code', ['12345' => ['NaN']], 400, null, null, []], 'No number to search' => ['DE', ['12345' => ['NaN']], 200, null, null, []], @@ -1556,10 +1531,6 @@ class UsersControllerTest extends TestCase { /** * @dataProvider dataSearchByPhoneNumbers - * @param string $location - * @param array $search - * @param int $status - * @param array $expected */ public function testSearchByPhoneNumbers(string $location, array $search, int $status, ?array $searchUsers, ?array $userMatches, array $expected): void { $knownTo = 'knownTo'; @@ -1870,7 +1841,7 @@ class UsersControllerTest extends TestCase { $this->api->editUser('UserToEdit', 'email', 'demo.org'); } - public function selfEditChangePropertyProvider() { + public static function selfEditChangePropertyProvider(): array { return [ [IAccountManager::PROPERTY_TWITTER, '@oldtwitter', '@newtwitter'], [IAccountManager::PROPERTY_FEDIVERSE, '@oldFediverse@floss.social', '@newFediverse@floss.social'], @@ -2294,7 +2265,7 @@ class UsersControllerTest extends TestCase { $this->assertEquals([], $this->api->editUser('UserToEdit', 'language', 'de')->getData()); } - public function dataEditUserSelfEditChangeLanguageButForced() { + public static function dataEditUserSelfEditChangeLanguageButForced(): array { return [ ['de'], [true], @@ -3942,11 +3913,10 @@ class UsersControllerTest extends TestCase { $api->expects($this->exactly(2)) ->method('getUserData') - ->withConsecutive( - ['uid', false], - ['currentuser', true], - ) - ->willReturn($expected); + ->willReturnMap([ + ['uid', false, $expected], + ['currentuser', true, $expected], + ]); $this->assertSame($expected, $api->getUser('uid')->getData()); @@ -4263,7 +4233,7 @@ class UsersControllerTest extends TestCase { } - public function dataGetEditableFields() { + public static function dataGetEditableFields(): array { return [ [false, true, ISetDisplayNameBackend::class, [ IAccountManager::PROPERTY_EMAIL, @@ -4388,10 +4358,6 @@ class UsersControllerTest extends TestCase { /** * @dataProvider dataGetEditableFields - * - * @param bool $allowedToChangeDisplayName - * @param string $userBackend - * @param array $expected */ public function testGetEditableFields(bool $allowedToChangeDisplayName, bool $allowedToChangeEmail, string $userBackend, array $expected): void { $this->config->method('getSystemValue')->willReturnCallback(fn (string $key, mixed $default) => match ($key) { diff --git a/apps/provisioning_api/tests/Middleware/ProvisioningApiMiddlewareTest.php b/apps/provisioning_api/tests/Middleware/ProvisioningApiMiddlewareTest.php index d097febb04f..d40aab90d66 100644 --- a/apps/provisioning_api/tests/Middleware/ProvisioningApiMiddlewareTest.php +++ b/apps/provisioning_api/tests/Middleware/ProvisioningApiMiddlewareTest.php @@ -24,34 +24,29 @@ class ProvisioningApiMiddlewareTest extends TestCase { $this->reflector = $this->createMock(IControllerMethodReflector::class); } - public function dataAnnotation() { + public static function dataAnnotation(): array { return [ [false, false, false, false, false], - [false, false, true, false, false], - [false, true, true, false, false], - [ true, false, false, false, true], - [ true, false, true, false, false], - [ true, true, false, false, false], - [ true, true, true, false, false], + [false, false, true, false, false], + [false, true, true, false, false], + [true, false, false, false, true], + [true, false, true, false, false], + [true, true, false, false, false], + [true, true, true, false, false], [false, false, false, true, false], - [false, false, true, true, false], - [false, true, true, true, false], - [ true, false, false, true, false], - [ true, false, true, true, false], - [ true, true, false, true, false], - [ true, true, true, true, false], + [false, false, true, true, false], + [false, true, true, true, false], + [true, false, false, true, false], + [true, false, true, true, false], + [true, true, false, true, false], + [true, true, true, true, false], ]; } /** * @dataProvider dataAnnotation - * - * @param bool $subadminRequired - * @param bool $isAdmin - * @param bool $isSubAdmin - * @param bool $shouldThrowException */ - public function testBeforeController($subadminRequired, $isAdmin, $isSubAdmin, $hasSettingAuthorizationAnnotation, $shouldThrowException): void { + public function testBeforeController(bool $subadminRequired, bool $isAdmin, bool $isSubAdmin, bool $hasSettingAuthorizationAnnotation, bool $shouldThrowException): void { $middleware = new ProvisioningApiMiddleware( $this->reflector, $isAdmin, @@ -80,7 +75,7 @@ class ProvisioningApiMiddlewareTest extends TestCase { } } - public function dataAfterException() { + public static function dataAfterException(): array { return [ [new NotSubAdminException(), false], [new \Exception('test', 42), true], @@ -89,11 +84,8 @@ class ProvisioningApiMiddlewareTest extends TestCase { /** * @dataProvider dataAfterException - * - * @param \Exception $e - * @param bool $forwared */ - public function testAfterException(\Exception $exception, $forwared): void { + public function testAfterException(\Exception $exception, bool $forwared): void { $middleware = new ProvisioningApiMiddleware( $this->reflector, false, diff --git a/apps/settings/l10n/et_EE.js b/apps/settings/l10n/et_EE.js index 35fc7a5d4e3..b04802d8704 100644 --- a/apps/settings/l10n/et_EE.js +++ b/apps/settings/l10n/et_EE.js @@ -485,6 +485,7 @@ OC.L10N.register( "Visibility" : "Nähtavus", "Show language" : "Näita keelt", "Show last login" : "Näita viimast sisselogimist", + "Sorting" : "Järjestus", "Sorting only applies to the currently loaded groups for performance reasons. Groups will be loaded as you navigate or search through the list." : "Jõudluse mõttes kehtib järjestus vaid hetkel laaditud gruppidele. Uued grupid lisanduvad sedamööda, kuidas sa loendis edasi liigud.", "Send email" : "Saada kiri", "Defaults" : "Vaikeväärtused", diff --git a/apps/settings/l10n/et_EE.json b/apps/settings/l10n/et_EE.json index a29cfa38243..c820494e24b 100644 --- a/apps/settings/l10n/et_EE.json +++ b/apps/settings/l10n/et_EE.json @@ -483,6 +483,7 @@ "Visibility" : "Nähtavus", "Show language" : "Näita keelt", "Show last login" : "Näita viimast sisselogimist", + "Sorting" : "Järjestus", "Sorting only applies to the currently loaded groups for performance reasons. Groups will be loaded as you navigate or search through the list." : "Jõudluse mõttes kehtib järjestus vaid hetkel laaditud gruppidele. Uued grupid lisanduvad sedamööda, kuidas sa loendis edasi liigud.", "Send email" : "Saada kiri", "Defaults" : "Vaikeväärtused", diff --git a/apps/settings/tests/Activity/SecurityFilterTest.php b/apps/settings/tests/Activity/SecurityFilterTest.php index f3f94df3d21..22ef03816d3 100644 --- a/apps/settings/tests/Activity/SecurityFilterTest.php +++ b/apps/settings/tests/Activity/SecurityFilterTest.php @@ -12,15 +12,9 @@ use PHPUnit\Framework\MockObject\MockObject; use Test\TestCase; class SecurityFilterTest extends TestCase { - - /** @var IURLGenerator|MockObject */ - private $urlGenerator; - - /** @var IL10N|MockObject */ - private $l10n; - - /** @var SecurityFilter */ - private $filter; + private IURLGenerator&MockObject $urlGenerator; + private IL10N&MockObject $l10n; + private SecurityFilter $filter; protected function setUp(): void { parent::setUp(); diff --git a/apps/settings/tests/Activity/SecurityProviderTest.php b/apps/settings/tests/Activity/SecurityProviderTest.php index 35526995a67..1687f116871 100644 --- a/apps/settings/tests/Activity/SecurityProviderTest.php +++ b/apps/settings/tests/Activity/SecurityProviderTest.php @@ -16,27 +16,19 @@ use PHPUnit\Framework\MockObject\MockObject; use Test\TestCase; class SecurityProviderTest extends TestCase { - - /** @var IFactory|MockObject */ - private $l10n; - - /** @var IURLGenerator|MockObject */ - private $urlGenerator; - - /** @var IManager|MockObject */ - private $activityManager; - - /** @var SecurityProvider */ - private $provider; + private IFactory&MockObject $l10nFactory; + private IURLGenerator&MockObject $urlGenerator; + private IManager&MockObject $activityManager; + private SecurityProvider $provider; protected function setUp(): void { parent::setUp(); - $this->l10n = $this->createMock(IFactory::class); + $this->l10nFactory = $this->createMock(IFactory::class); $this->urlGenerator = $this->createMock(IURLGenerator::class); $this->activityManager = $this->createMock(IManager::class); - $this->provider = new SecurityProvider($this->l10n, $this->urlGenerator, $this->activityManager); + $this->provider = new SecurityProvider($this->l10nFactory, $this->urlGenerator, $this->activityManager); } public function testParseUnrelated(): void { @@ -50,7 +42,7 @@ class SecurityProviderTest extends TestCase { $this->provider->parse($lang, $event); } - public function subjectData() { + public static function subjectData(): array { return [ ['twofactor_success'], ['twofactor_failed'], @@ -60,7 +52,7 @@ class SecurityProviderTest extends TestCase { /** * @dataProvider subjectData */ - public function testParse($subject): void { + public function testParse(string $subject): void { $lang = 'ru'; $event = $this->createMock(IEvent::class); $l = $this->createMock(IL10N::class); @@ -68,7 +60,7 @@ class SecurityProviderTest extends TestCase { $event->expects($this->once()) ->method('getType') ->willReturn('security'); - $this->l10n->expects($this->once()) + $this->l10nFactory->expects($this->once()) ->method('get') ->with('settings', $lang) ->willReturn($l); @@ -104,7 +96,7 @@ class SecurityProviderTest extends TestCase { $event->expects($this->once()) ->method('getType') ->willReturn('security'); - $this->l10n->expects($this->once()) + $this->l10nFactory->expects($this->once()) ->method('get') ->with('settings', $lang) ->willReturn($l); diff --git a/apps/settings/tests/Activity/SecuritySettingTest.php b/apps/settings/tests/Activity/SecuritySettingTest.php index 1b2b0e3361c..c109a9f7fdf 100644 --- a/apps/settings/tests/Activity/SecuritySettingTest.php +++ b/apps/settings/tests/Activity/SecuritySettingTest.php @@ -12,8 +12,8 @@ use Test\TestCase; class SecuritySettingTest extends TestCase { private $l10n; - /** @var SecuritySetting */ - private $setting; + /** @var */ + private SecuritySetting $setting; protected function setUp(): void { parent::setUp(); diff --git a/apps/settings/tests/AppInfo/ApplicationTest.php b/apps/settings/tests/AppInfo/ApplicationTest.php index 677efdc64bf..85be8c56178 100644 --- a/apps/settings/tests/AppInfo/ApplicationTest.php +++ b/apps/settings/tests/AppInfo/ApplicationTest.php @@ -1,4 +1,6 @@ <?php + +declare(strict_types=1); /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later @@ -26,11 +28,8 @@ use Test\TestCase; * @group DB */ class ApplicationTest extends TestCase { - /** @var Application */ - protected $app; - - /** @var IAppContainer */ - protected $container; + protected Application $app; + protected IAppContainer $container; protected function setUp(): void { parent::setUp(); @@ -43,7 +42,7 @@ class ApplicationTest extends TestCase { $this->assertEquals('settings', $this->container->getAppName()); } - public function dataContainerQuery() { + public static function dataContainerQuery(): array { return [ [AdminSettingsController::class, Controller::class], [AppSettingsController::class, Controller::class], @@ -59,10 +58,8 @@ class ApplicationTest extends TestCase { /** * @dataProvider dataContainerQuery - * @param string $service - * @param string $expected */ - public function testContainerQuery($service, $expected): void { + public function testContainerQuery(string $service, string $expected): void { $this->assertTrue($this->container->query($service) instanceof $expected); } } diff --git a/apps/settings/tests/Controller/AppSettingsControllerTest.php b/apps/settings/tests/Controller/AppSettingsControllerTest.php index f72bd45a3d2..5194ca2cc33 100644 --- a/apps/settings/tests/Controller/AppSettingsControllerTest.php +++ b/apps/settings/tests/Controller/AppSettingsControllerTest.php @@ -37,39 +37,23 @@ use Test\TestCase; * @group DB */ class AppSettingsControllerTest extends TestCase { - /** @var AppSettingsController */ - private $appSettingsController; - /** @var IRequest|MockObject */ - private $request; - /** @var IL10N|MockObject */ - private $l10n; - /** @var IConfig|MockObject */ - private $config; - /** @var INavigationManager|MockObject */ - private $navigationManager; + private IRequest&MockObject $request; + private IL10N&MockObject $l10n; + private IConfig&MockObject $config; + private INavigationManager&MockObject $navigationManager; private AppManager&MockObject $appManager; - /** @var CategoryFetcher|MockObject */ - private $categoryFetcher; - /** @var AppFetcher|MockObject */ - private $appFetcher; - /** @var IFactory|MockObject */ - private $l10nFactory; - /** @var BundleFetcher|MockObject */ - private $bundleFetcher; - /** @var Installer|MockObject */ - private $installer; - /** @var IURLGenerator|MockObject */ - private $urlGenerator; - /** @var LoggerInterface|MockObject */ - private $logger; - /** @var IInitialState|MockObject */ - private $initialState; - /** @var IAppDataFactory|MockObject */ - private $appDataFactory; - /** @var AppDiscoverFetcher|MockObject */ - private $discoverFetcher; - /** @var IClientService|MockObject */ - private $clientService; + private CategoryFetcher&MockObject $categoryFetcher; + private AppFetcher&MockObject $appFetcher; + private IFactory&MockObject $l10nFactory; + private BundleFetcher&MockObject $bundleFetcher; + private Installer&MockObject $installer; + private IURLGenerator&MockObject $urlGenerator; + private LoggerInterface&MockObject $logger; + private IInitialState&MockObject $initialState; + private IAppDataFactory&MockObject $appDataFactory; + private AppDiscoverFetcher&MockObject $discoverFetcher; + private IClientService&MockObject $clientService; + private AppSettingsController $appSettingsController; protected function setUp(): void { parent::setUp(); diff --git a/apps/settings/tests/Controller/AuthSettingsControllerTest.php b/apps/settings/tests/Controller/AuthSettingsControllerTest.php index 13213992d94..bb6068ffe94 100644 --- a/apps/settings/tests/Controller/AuthSettingsControllerTest.php +++ b/apps/settings/tests/Controller/AuthSettingsControllerTest.php @@ -28,24 +28,15 @@ use Psr\Log\LoggerInterface; use Test\TestCase; class AuthSettingsControllerTest extends TestCase { - - /** @var AuthSettingsController */ - private $controller; - /** @var IRequest|MockObject */ - private $request; - /** @var IProvider|MockObject */ - private $tokenProvider; - /** @var ISession|MockObject */ - private $session; - /** @var IUserSession|MockObject */ - private $userSession; - /** @var ISecureRandom|MockObject */ - private $secureRandom; - /** @var IManager|MockObject */ - private $activityManager; - /** @var RemoteWipe|MockObject */ - private $remoteWipe; - private $uid = 'jane'; + private IRequest&MockObject $request; + private IProvider&MockObject $tokenProvider; + private ISession&MockObject $session; + private IUserSession&MockObject $userSession; + private ISecureRandom&MockObject $secureRandom; + private IManager&MockObject $activityManager; + private RemoteWipe&MockObject $remoteWipe; + private string $uid = 'jane'; + private AuthSettingsController $controller; protected function setUp(): void { parent::setUp(); @@ -57,7 +48,7 @@ class AuthSettingsControllerTest extends TestCase { $this->secureRandom = $this->createMock(ISecureRandom::class); $this->activityManager = $this->createMock(IManager::class); $this->remoteWipe = $this->createMock(RemoteWipe::class); - /** @var LoggerInterface|MockObject $logger */ + /** @var LoggerInterface&MockObject $logger */ $logger = $this->createMock(LoggerInterface::class); $this->controller = new AuthSettingsController( @@ -214,7 +205,7 @@ class AuthSettingsControllerTest extends TestCase { $this->assertSame(\OCP\AppFramework\Http::STATUS_NOT_FOUND, $response->getStatus()); } - public function dataRenameToken(): array { + public static function dataRenameToken(): array { return [ 'App password => Other token name' => ['App password', 'Other token name'], 'Other token name => App password' => ['Other token name', 'App password'], @@ -223,9 +214,6 @@ class AuthSettingsControllerTest extends TestCase { /** * @dataProvider dataRenameToken - * - * @param string $name - * @param string $newName */ public function testUpdateRename(string $name, string $newName): void { $tokenId = 42; @@ -257,7 +245,7 @@ class AuthSettingsControllerTest extends TestCase { $this->assertSame([], $this->controller->update($tokenId, [IToken::SCOPE_FILESYSTEM => true], $newName)); } - public function dataUpdateFilesystemScope(): array { + public static function dataUpdateFilesystemScope(): array { return [ 'Grant filesystem access' => [false, true], 'Revoke filesystem access' => [true, false], @@ -266,9 +254,6 @@ class AuthSettingsControllerTest extends TestCase { /** * @dataProvider dataUpdateFilesystemScope - * - * @param bool $filesystem - * @param bool $newFilesystem */ public function testUpdateFilesystemScope(bool $filesystem, bool $newFilesystem): void { $tokenId = 42; diff --git a/apps/settings/tests/Controller/CheckSetupControllerTest.php b/apps/settings/tests/Controller/CheckSetupControllerTest.php index 27f7aa1b696..a8e89260573 100644 --- a/apps/settings/tests/Controller/CheckSetupControllerTest.php +++ b/apps/settings/tests/Controller/CheckSetupControllerTest.php @@ -29,59 +29,40 @@ use Test\TestCase; * @package Tests\Settings\Controller */ class CheckSetupControllerTest extends TestCase { - /** @var CheckSetupController | \PHPUnit\Framework\MockObject\MockObject */ - private $checkSetupController; - /** @var IRequest | \PHPUnit\Framework\MockObject\MockObject */ - private $request; - /** @var IConfig | \PHPUnit\Framework\MockObject\MockObject */ - private $config; - /** @var IURLGenerator | \PHPUnit\Framework\MockObject\MockObject */ - private $urlGenerator; - /** @var IL10N | \PHPUnit\Framework\MockObject\MockObject */ - private $l10n; - /** @var LoggerInterface */ - private $logger; - /** @var Checker|\PHPUnit\Framework\MockObject\MockObject */ - private $checker; - /** @var ISetupCheckManager|MockObject */ - private $setupCheckManager; + private IRequest&MockObject $request; + private IConfig&MockObject $config; + private IURLGenerator&MockObject $urlGenerator; + private IL10N&MockObject $l10n; + private LoggerInterface&MockObject $logger; + private Checker&MockObject $checker; + private ISetupCheckManager&MockObject $setupCheckManager; + private CheckSetupController $checkSetupController; protected function setUp(): void { parent::setUp(); - $this->request = $this->getMockBuilder(IRequest::class) - ->disableOriginalConstructor()->getMock(); - $this->config = $this->getMockBuilder(IConfig::class) - ->disableOriginalConstructor()->getMock(); - $this->urlGenerator = $this->getMockBuilder(IURLGenerator::class) - ->disableOriginalConstructor()->getMock(); - $this->l10n = $this->getMockBuilder(IL10N::class) - ->disableOriginalConstructor()->getMock(); + $this->request = $this->createMock(IRequest::class); + $this->config = $this->createMock(IConfig::class); + $this->urlGenerator = $this->createMock(IURLGenerator::class); + $this->l10n = $this->createMock(IL10N::class); $this->l10n->expects($this->any()) ->method('t') ->willReturnCallback(function ($message, array $replace) { return vsprintf($message, $replace); }); - $this->checker = $this->getMockBuilder('\OC\IntegrityCheck\Checker') - ->disableOriginalConstructor()->getMock(); - $this->logger = $this->getMockBuilder(LoggerInterface::class)->getMock(); + $this->checker = $this->createMock(Checker::class); + $this->logger = $this->createMock(LoggerInterface::class); $this->setupCheckManager = $this->createMock(ISetupCheckManager::class); - $this->checkSetupController = $this->getMockBuilder(CheckSetupController::class) - ->setConstructorArgs([ - 'settings', - $this->request, - $this->config, - $this->urlGenerator, - $this->l10n, - $this->checker, - $this->logger, - $this->setupCheckManager, - ]) - ->setMethods([ - 'getCurlVersion', - 'isPhpOutdated', - 'isPHPMailerUsed', - ])->getMock(); + $this->checkSetupController = new CheckSetupController( + 'settings', + $this->request, + $this->config, + $this->urlGenerator, + $this->l10n, + $this->checker, + $this->logger, + $this->setupCheckManager, + ); } public function testCheck(): void { diff --git a/apps/settings/tests/Controller/DelegationControllerTest.php b/apps/settings/tests/Controller/DelegationControllerTest.php index 5994ddf298d..c4cbe67466b 100644 --- a/apps/settings/tests/Controller/DelegationControllerTest.php +++ b/apps/settings/tests/Controller/DelegationControllerTest.php @@ -10,23 +10,18 @@ use OC\Settings\AuthorizedGroup; use OCA\Settings\Controller\AuthorizedGroupController; use OCA\Settings\Service\AuthorizedGroupService; use OCP\IRequest; +use PHPUnit\Framework\MockObject\MockObject; use Test\TestCase; class DelegationControllerTest extends TestCase { - - /** @var AuthorizedGroupService */ - private $service; - - /** @var IRequest */ - private $request; - - /** @var AuthorizedGroupController */ - private $controller; + private AuthorizedGroupService&MockObject $service; + private IRequest&MockObject $request; + private AuthorizedGroupController $controller; protected function setUp(): void { parent::setUp(); - $this->request = $this->getMockBuilder(IRequest::class)->getMock(); - $this->service = $this->getMockBuilder(AuthorizedGroupService::class)->disableOriginalConstructor()->getMock(); + $this->request = $this->createMock(IRequest::class); + $this->service = $this->createMock(AuthorizedGroupService::class); $this->controller = new AuthorizedGroupController( 'settings', $this->request, $this->service ); @@ -41,7 +36,7 @@ class DelegationControllerTest extends TestCase { $this->service->expects($this->once()) ->method('findExistingGroupsForClass') ->with('MySecretSetting') - ->will($this->returnValue($oldGroups)); + ->willReturn($oldGroups); $this->service->expects($this->once()) ->method('delete') @@ -50,7 +45,7 @@ class DelegationControllerTest extends TestCase { $this->service->expects($this->once()) ->method('create') ->with('world', 'MySecretSetting') - ->will($this->returnValue(AuthorizedGroup::fromParams(['groupId' => 'world', 'class' => $setting]))); + ->willReturn(AuthorizedGroup::fromParams(['groupId' => 'world', 'class' => $setting])); $result = $this->controller->saveSettings([['gid' => 'hello'], ['gid' => 'world']], 'MySecretSetting'); diff --git a/apps/settings/tests/Controller/MailSettingsControllerTest.php b/apps/settings/tests/Controller/MailSettingsControllerTest.php index 2a0028738dd..dcb1e3efef4 100644 --- a/apps/settings/tests/Controller/MailSettingsControllerTest.php +++ b/apps/settings/tests/Controller/MailSettingsControllerTest.php @@ -1,4 +1,6 @@ <?php + +declare(strict_types=1); /** * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later @@ -16,25 +18,18 @@ use OCP\IURLGenerator; use OCP\IUserSession; use OCP\Mail\IEMailTemplate; use OCP\Mail\IMailer; +use PHPUnit\Framework\MockObject\MockObject; /** * @package Tests\Settings\Controller */ class MailSettingsControllerTest extends \Test\TestCase { - - /** @var IConfig|\PHPUnit\Framework\MockObject\MockObject */ - private $config; - /** @var IUserSession|\PHPUnit\Framework\MockObject\MockObject */ - private $userSession; - /** @var IMailer|\PHPUnit\Framework\MockObject\MockObject */ - private $mailer; - /** @var IL10N|\PHPUnit\Framework\MockObject\MockObject */ - private $l; - /** @var IURLGenerator */ - private $urlGenerator; - - /** @var MailSettingsController */ - private $mailController; + private IConfig&MockObject $config; + private IUserSession&MockObject $userSession; + private IMailer&MockObject $mailer; + private IL10N&MockObject $l; + private IURLGenerator&MockObject $urlGenerator; + private MailSettingsController $mailController; protected function setUp(): void { parent::setUp(); @@ -44,7 +39,7 @@ class MailSettingsControllerTest extends \Test\TestCase { $this->userSession = $this->createMock(IUserSession::class); $this->mailer = $this->createMock(IMailer::class); $this->urlGenerator = $this->createMock(IURLGenerator::class); - /** @var IRequest|\PHPUnit\Framework\MockObject\MockObject $request */ + /** @var IRequest&MockObject $request */ $request = $this->createMock(IRequest::class); $this->mailController = new MailSettingsController( 'settings', @@ -54,37 +49,40 @@ class MailSettingsControllerTest extends \Test\TestCase { $this->userSession, $this->urlGenerator, $this->mailer, - 'no-reply@nextcloud.com' ); } public function testSetMailSettings(): void { + $calls = [ + [[ + 'mail_domain' => 'nextcloud.com', + 'mail_from_address' => 'demo@nextcloud.com', + 'mail_smtpmode' => 'smtp', + 'mail_smtpsecure' => 'ssl', + 'mail_smtphost' => 'mx.nextcloud.org', + 'mail_smtpauth' => 1, + 'mail_smtpport' => '25', + 'mail_sendmailmode' => 'smtp', + ]], + [[ + 'mail_domain' => 'nextcloud.com', + 'mail_from_address' => 'demo@nextcloud.com', + 'mail_smtpmode' => 'smtp', + 'mail_smtpsecure' => 'ssl', + 'mail_smtphost' => 'mx.nextcloud.org', + 'mail_smtpauth' => null, + 'mail_smtpport' => '25', + 'mail_smtpname' => null, + 'mail_smtppassword' => null, + 'mail_sendmailmode' => 'smtp', + ]], + ]; $this->config->expects($this->exactly(2)) ->method('setSystemValues') - ->withConsecutive( - [[ - 'mail_domain' => 'nextcloud.com', - 'mail_from_address' => 'demo@nextcloud.com', - 'mail_smtpmode' => 'smtp', - 'mail_smtpsecure' => 'ssl', - 'mail_smtphost' => 'mx.nextcloud.org', - 'mail_smtpauth' => 1, - 'mail_smtpport' => '25', - 'mail_sendmailmode' => 'smtp', - ]], - [[ - 'mail_domain' => 'nextcloud.com', - 'mail_from_address' => 'demo@nextcloud.com', - 'mail_smtpmode' => 'smtp', - 'mail_smtpsecure' => 'ssl', - 'mail_smtphost' => 'mx.nextcloud.org', - 'mail_smtpauth' => null, - 'mail_smtpport' => '25', - 'mail_smtpname' => null, - 'mail_smtppassword' => null, - 'mail_sendmailmode' => 'smtp', - ]] - ); + ->willReturnCallback(function () use (&$calls) { + $expected = array_shift($calls); + $this->assertEquals($expected, func_get_args()); + }); // With authentication $response = $this->mailController->setMailSettings( @@ -93,7 +91,7 @@ class MailSettingsControllerTest extends \Test\TestCase { 'smtp', 'ssl', 'mx.nextcloud.org', - 1, + '1', '25', 'smtp' ); @@ -106,7 +104,7 @@ class MailSettingsControllerTest extends \Test\TestCase { 'smtp', 'ssl', 'mx.nextcloud.org', - 0, + '0', '25', 'smtp' ); diff --git a/apps/settings/tests/Controller/TwoFactorSettingsControllerTest.php b/apps/settings/tests/Controller/TwoFactorSettingsControllerTest.php index c34b2907dfd..9f8d53d4f9f 100644 --- a/apps/settings/tests/Controller/TwoFactorSettingsControllerTest.php +++ b/apps/settings/tests/Controller/TwoFactorSettingsControllerTest.php @@ -1,4 +1,6 @@ <?php + +declare(strict_types=1); /** * SPDX-FileCopyrightText: 2018 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later @@ -14,15 +16,9 @@ use PHPUnit\Framework\MockObject\MockObject; use Test\TestCase; class TwoFactorSettingsControllerTest extends TestCase { - - /** @var IRequest|MockObject */ - private $request; - - /** @var MandatoryTwoFactor|MockObject */ - private $mandatoryTwoFactor; - - /** @var TwoFactorSettingsController */ - private $controller; + private IRequest&MockObject $request; + private MandatoryTwoFactor&MockObject $mandatoryTwoFactor; + private TwoFactorSettingsController $controller; protected function setUp(): void { parent::setUp(); diff --git a/apps/settings/tests/Controller/UsersControllerTest.php b/apps/settings/tests/Controller/UsersControllerTest.php index 96823e5ceed..d5fe38ad458 100644 --- a/apps/settings/tests/Controller/UsersControllerTest.php +++ b/apps/settings/tests/Controller/UsersControllerTest.php @@ -1,4 +1,6 @@ <?php + +declare(strict_types=1); /** * SPDX-FileCopyrightText: 2019-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2014-2015 ownCloud, Inc. @@ -40,38 +42,22 @@ use PHPUnit\Framework\MockObject\MockObject; * @package Tests\Settings\Controller */ class UsersControllerTest extends \Test\TestCase { - /** @var IGroupManager|\PHPUnit\Framework\MockObject\MockObject */ - private $groupManager; - /** @var UserManager|\PHPUnit\Framework\MockObject\MockObject */ - private $userManager; - /** @var IUserSession|\PHPUnit\Framework\MockObject\MockObject */ - private $userSession; - /** @var IConfig|\PHPUnit\Framework\MockObject\MockObject */ - private $config; - /** @var IMailer|\PHPUnit\Framework\MockObject\MockObject */ - private $mailer; - /** @var IFactory|\PHPUnit\Framework\MockObject\MockObject */ - private $l10nFactory; - /** @var IAppManager|\PHPUnit\Framework\MockObject\MockObject */ - private $appManager; - /** @var IL10N|\PHPUnit\Framework\MockObject\MockObject */ - private $l; - /** @var AccountManager|\PHPUnit\Framework\MockObject\MockObject */ - private $accountManager; - /** @var IJobList | \PHPUnit\Framework\MockObject\MockObject */ - private $jobList; - /** @var \OC\Security\IdentityProof\Manager|\PHPUnit\Framework\MockObject\MockObject */ - private $securityManager; - /** @var IManager|\PHPUnit\Framework\MockObject\MockObject */ - private $encryptionManager; - /** @var KnownUserService|\PHPUnit\Framework\MockObject\MockObject */ - private $knownUserService; - /** @var IEncryptionModule|\PHPUnit\Framework\MockObject\MockObject */ - private $encryptionModule; - /** @var IEventDispatcher|\PHPUnit\Framework\MockObject\MockObject */ - private $dispatcher; - /** @var IInitialState|\PHPUnit\Framework\MockObject\MockObject */ - private $initialState; + private IGroupManager&MockObject $groupManager; + private UserManager&MockObject $userManager; + private IUserSession&MockObject $userSession; + private IConfig&MockObject $config; + private IMailer&MockObject $mailer; + private IFactory&MockObject $l10nFactory; + private IAppManager&MockObject $appManager; + private IL10N&MockObject $l; + private AccountManager&MockObject $accountManager; + private IJobList&MockObject $jobList; + private \OC\Security\IdentityProof\Manager&MockObject $securityManager; + private IManager&MockObject $encryptionManager; + private KnownUserService&MockObject $knownUserService; + private IEncryptionModule&MockObject $encryptionModule; + private IEventDispatcher&MockObject $dispatcher; + private IInitialState&MockObject $initialState; protected function setUp(): void { parent::setUp(); @@ -85,7 +71,7 @@ class UsersControllerTest extends \Test\TestCase { $this->l10nFactory = $this->createMock(IFactory::class); $this->appManager = $this->createMock(IAppManager::class); $this->accountManager = $this->createMock(AccountManager::class); - $this->securityManager = $this->getMockBuilder(\OC\Security\IdentityProof\Manager::class)->disableOriginalConstructor()->getMock(); + $this->securityManager = $this->createMock(\OC\Security\IdentityProof\Manager::class); $this->jobList = $this->createMock(IJobList::class); $this->encryptionManager = $this->createMock(IManager::class); $this->knownUserService = $this->createMock(KnownUserService::class); @@ -106,9 +92,9 @@ class UsersControllerTest extends \Test\TestCase { /** * @param bool $isAdmin - * @return UsersController | \PHPUnit\Framework\MockObject\MockObject + * @return UsersController|MockObject */ - protected function getController($isAdmin = false, $mockedMethods = []) { + protected function getController(bool $isAdmin = false, array $mockedMethods = []) { $this->groupManager->expects($this->any()) ->method('isAdmin') ->willReturn($isAdmin); @@ -155,7 +141,9 @@ class UsersControllerTest extends \Test\TestCase { $this->dispatcher, $this->initialState, ] - )->onlyMethods($mockedMethods)->getMock(); + ) + ->onlyMethods($mockedMethods) + ->getMock(); } } @@ -177,7 +165,7 @@ class UsersControllerTest extends \Test\TestCase { return $property; } - protected function getDefaultAccountMock(bool $useDefaultValues = true): MockObject { + protected function getDefaultAccountMock(): MockObject { $propertyMocks = [ IAccountManager::PROPERTY_DISPLAYNAME => $this->buildPropertyMock( IAccountManager::PROPERTY_DISPLAYNAME, @@ -249,12 +237,8 @@ class UsersControllerTest extends \Test\TestCase { /** * @dataProvider dataTestSetUserSettings - * - * @param string $email - * @param bool $validEmail - * @param $expectedStatus */ - public function testSetUserSettings($email, $validEmail, $expectedStatus): void { + public function testSetUserSettings(string $email, bool $validEmail, int $expectedStatus): void { $controller = $this->getController(false, ['saveUserSettings']); $user = $this->createMock(IUser::class); $user->method('getUID')->willReturn('johndoe'); @@ -305,7 +289,7 @@ class UsersControllerTest extends \Test\TestCase { $this->assertSame($expectedStatus, $result->getStatus()); } - public function dataTestSetUserSettings() { + public static function dataTestSetUserSettings(): array { return [ ['', true, Http::STATUS_OK], ['', false, Http::STATUS_OK], @@ -515,18 +499,15 @@ class UsersControllerTest extends \Test\TestCase { /** * @dataProvider dataTestSetUserSettingsSubset - * - * @param string $property - * @param string $propertyValue */ - public function testSetUserSettingsSubset($property, $propertyValue): void { + public function testSetUserSettingsSubset(string $property, string $propertyValue): void { $controller = $this->getController(false, ['saveUserSettings']); $user = $this->createMock(IUser::class); $user->method('getUID')->willReturn('johndoe'); $this->userSession->method('getUser')->willReturn($user); - /** @var IAccount|MockObject $userAccount */ + /** @var IAccount&MockObject $userAccount */ $userAccount = $this->getDefaultAccountMock(); $this->accountManager->expects($this->once()) @@ -554,9 +535,9 @@ class UsersControllerTest extends \Test\TestCase { $pronouns = ($property === 'pronouns') ? $propertyValue : null; $pronounsScope = ($property === 'pronounsScope') ? $propertyValue : null; - /** @var IAccountProperty[]|MockObject[] $expectedProperties */ + /** @var IAccountProperty[]&MockObject[] $expectedProperties */ $expectedProperties = $userAccount->getProperties(); - $isScope = strrpos($property, 'Scope') === strlen($property) - strlen(5); + $isScope = strrpos($property, 'Scope') === strlen($property) - strlen('5'); switch ($property) { case 'avatarScope': $propertyId = IAccountManager::PROPERTY_AVATAR; @@ -636,7 +617,7 @@ class UsersControllerTest extends \Test\TestCase { ); } - public function dataTestSetUserSettingsSubset() { + public static function dataTestSetUserSettingsSubset(): array { return [ ['avatarScope', IAccountManager::SCOPE_PUBLISHED], ['displayName', 'Display name'], @@ -662,15 +643,8 @@ class UsersControllerTest extends \Test\TestCase { /** * @dataProvider dataTestSaveUserSettings - * - * @param array $data - * @param ?string $oldEmailAddress - * @param ?string $oldDisplayName */ - public function testSaveUserSettings($data, - $oldEmailAddress, - $oldDisplayName, - ): void { + public function testSaveUserSettings(array $data, ?string $oldEmailAddress, ?string $oldDisplayName): void { $controller = $this->getController(); $user = $this->createMock(IUser::class); @@ -722,7 +696,7 @@ class UsersControllerTest extends \Test\TestCase { $this->invokePrivate($controller, 'saveUserSettings', [$account]); } - public function dataTestSaveUserSettings() { + public static function dataTestSaveUserSettings(): array { return [ [ [ @@ -833,7 +807,7 @@ class UsersControllerTest extends \Test\TestCase { } - public function dataTestSaveUserSettingsException() { + public static function dataTestSaveUserSettingsException(): array { return [ [ [ @@ -870,14 +844,9 @@ class UsersControllerTest extends \Test\TestCase { } /** - * @param string $account - * @param string $type - * @param array $dataBefore - * @param array $expectedData - * * @dataProvider dataTestGetVerificationCode */ - public function testGetVerificationCode($account, $type, $dataBefore, $expectedData, $onlyVerificationCode): void { + public function testGetVerificationCode(string $account, string $type, array $dataBefore, array $expectedData, bool $onlyVerificationCode): void { $message = 'Use my Federated Cloud ID to share with me: user@nextcloud.com'; $signature = 'theSignature'; @@ -936,7 +905,7 @@ class UsersControllerTest extends \Test\TestCase { $this->assertSame($code, $data['code']); } - public function dataTestGetVerificationCode() { + public static function dataTestGetVerificationCode(): array { $accountDataBefore = [ IAccountManager::PROPERTY_WEBSITE => ['value' => 'https://nextcloud.com', 'verified' => IAccountManager::NOT_VERIFIED], IAccountManager::PROPERTY_TWITTER => ['value' => '@nextclouders', 'verified' => IAccountManager::NOT_VERIFIED, 'signature' => 'theSignature'], @@ -973,16 +942,13 @@ class UsersControllerTest extends \Test\TestCase { /** * @dataProvider dataTestCanAdminChangeUserPasswords - * - * @param bool $encryptionEnabled - * @param bool $encryptionModuleLoaded - * @param bool $masterKeyEnabled - * @param bool $expected */ - public function testCanAdminChangeUserPasswords($encryptionEnabled, - $encryptionModuleLoaded, - $masterKeyEnabled, - $expected): void { + public function testCanAdminChangeUserPasswords( + bool $encryptionEnabled, + bool $encryptionModuleLoaded, + bool $masterKeyEnabled, + bool $expected, + ): void { $controller = $this->getController(); $this->encryptionManager->expects($this->any()) @@ -1005,7 +971,7 @@ class UsersControllerTest extends \Test\TestCase { $this->assertSame($expected, $result); } - public function dataTestCanAdminChangeUserPasswords() { + public static function dataTestCanAdminChangeUserPasswords(): array { return [ // encryptionEnabled, encryptionModuleLoaded, masterKeyEnabled, expectedResult [true, true, true, true], diff --git a/apps/settings/tests/Mailer/NewUserMailHelperTest.php b/apps/settings/tests/Mailer/NewUserMailHelperTest.php index 1a1fc20354b..26a2bf5a6b6 100644 --- a/apps/settings/tests/Mailer/NewUserMailHelperTest.php +++ b/apps/settings/tests/Mailer/NewUserMailHelperTest.php @@ -20,29 +20,20 @@ use OCP\Mail\IEMailTemplate; use OCP\Mail\IMailer; use OCP\Security\ICrypto; use OCP\Security\ISecureRandom; +use PHPUnit\Framework\MockObject\MockObject; use Test\TestCase; class NewUserMailHelperTest extends TestCase { - /** @var Defaults|\PHPUnit\Framework\MockObject\MockObject */ - private $defaults; - /** @var IURLGenerator|\PHPUnit\Framework\MockObject\MockObject */ - private $urlGenerator; - /** @var IL10N|\PHPUnit\Framework\MockObject\MockObject */ - private $l10n; - /** @var IFactory|\PHPUnit\Framework\MockObject\MockObject */ - private $l10nFactory; - /** @var IMailer|\PHPUnit\Framework\MockObject\MockObject */ - private $mailer; - /** @var ISecureRandom|\PHPUnit\Framework\MockObject\MockObject */ - private $secureRandom; - /** @var ITimeFactory|\PHPUnit\Framework\MockObject\MockObject */ - private $timeFactory; - /** @var IConfig|\PHPUnit\Framework\MockObject\MockObject */ - private $config; - /** @var ICrypto|\PHPUnit\Framework\MockObject\MockObject */ - private $crypto; - /** @var NewUserMailHelper */ - private $newUserMailHelper; + private Defaults&MockObject $defaults; + private IURLGenerator&MockObject $urlGenerator; + private IL10N&MockObject $l10n; + private IFactory&MockObject $l10nFactory; + private IMailer&MockObject $mailer; + private ISecureRandom&MockObject $secureRandom; + private ITimeFactory&MockObject $timeFactory; + private IConfig&MockObject $config; + private ICrypto&MockObject $crypto; + private NewUserMailHelper $newUserMailHelper; protected function setUp(): void { parent::setUp(); @@ -113,7 +104,7 @@ class NewUserMailHelperTest extends TestCase { ->expects($this->once()) ->method('getTime') ->willReturn(12345); - /** @var IUser|\PHPUnit\Framework\MockObject\MockObject $user */ + /** @var IUser&MockObject $user */ $user = $this->createMock(IUser::class); $user ->expects($this->any()) @@ -371,7 +362,7 @@ EOF; ['myLogo',''], ]); - /** @var IUser|\PHPUnit\Framework\MockObject\MockObject $user */ + /** @var IUser&MockObject $user */ $user = $this->createMock(IUser::class); $user ->expects($this->any()) @@ -611,7 +602,7 @@ EOF; ['myLogo', ''], ]); - /** @var IUser|\PHPUnit\Framework\MockObject\MockObject $user */ + /** @var IUser&MockObject $user */ $user = $this->createMock(IUser::class); $user ->expects($this->any()) @@ -830,7 +821,7 @@ EOF; } public function testSendMail(): void { - /** @var IUser|\PHPUnit\Framework\MockObject\MockObject $user */ + /** @var IUser&MockObject $user */ $user = $this->createMock(IUser::class); $user ->expects($this->once()) @@ -840,7 +831,7 @@ EOF; ->expects($this->once()) ->method('getDisplayName') ->willReturn('John Doe'); - /** @var IEMailTemplate|\PHPUnit\Framework\MockObject\MockObject $emailTemplate */ + /** @var IEMailTemplate&MockObject $emailTemplate */ $emailTemplate = $this->createMock(IEMailTemplate::class); $message = $this->createMock(Message::class); $message diff --git a/apps/settings/tests/Middleware/SubadminMiddlewareTest.php b/apps/settings/tests/Middleware/SubadminMiddlewareTest.php index 2992810af6c..37cfb5ccc59 100644 --- a/apps/settings/tests/Middleware/SubadminMiddlewareTest.php +++ b/apps/settings/tests/Middleware/SubadminMiddlewareTest.php @@ -29,7 +29,6 @@ use PHPUnit\Framework\MockObject\MockObject; */ class SubadminMiddlewareTest extends \Test\TestCase { private SubadminMiddleware $subadminMiddleware; - private IUserSession&MockObject $userSession; private ISubAdmin&MockObject $subAdminManager; private ControllerMethodReflector&MockObject $reflector; @@ -38,8 +37,7 @@ class SubadminMiddlewareTest extends \Test\TestCase { protected function setUp(): void { parent::setUp(); - $this->reflector = $this->getMockBuilder(ControllerMethodReflector::class) - ->disableOriginalConstructor()->getMock(); + $this->reflector = $this->createMock(ControllerMethodReflector::class); $this->userSession = $this->createMock(IUserSession::class); $this->subAdminManager = $this->createMock(ISubAdmin::class); $this->l10n = $this->createMock(IL10N::class); @@ -51,8 +49,7 @@ class SubadminMiddlewareTest extends \Test\TestCase { $this->l10n, ); - $this->controller = $this->getMockBuilder(Controller::class) - ->disableOriginalConstructor()->getMock(); + $this->controller = $this->createMock(Controller::class); $this->userSession ->expects(self::any()) @@ -67,10 +64,10 @@ class SubadminMiddlewareTest extends \Test\TestCase { $this->reflector ->expects($this->exactly(2)) ->method('hasAnnotation') - ->withConsecutive( - ['NoSubAdminRequired'], - ['AuthorizedAdminSetting'], - )->willReturn(false); + ->willReturnMap([ + ['NoSubAdminRequired', false], + ['AuthorizedAdminSetting', false], + ]); $this->subAdminManager ->expects(self::once()) @@ -99,10 +96,10 @@ class SubadminMiddlewareTest extends \Test\TestCase { $this->reflector ->expects($this->exactly(2)) ->method('hasAnnotation') - ->withConsecutive( - ['NoSubAdminRequired'], - ['AuthorizedAdminSetting'], - )->willReturn(false); + ->willReturnMap([ + ['NoSubAdminRequired', false], + ['AuthorizedAdminSetting', false], + ]); $this->subAdminManager ->expects(self::once()) diff --git a/apps/settings/tests/Settings/Admin/MailTest.php b/apps/settings/tests/Settings/Admin/MailTest.php index 560e4f8e997..37d7cb7d56d 100644 --- a/apps/settings/tests/Settings/Admin/MailTest.php +++ b/apps/settings/tests/Settings/Admin/MailTest.php @@ -21,8 +21,8 @@ class MailTest extends TestCase { protected function setUp(): void { parent::setUp(); - $this->config = $this->getMockBuilder(IConfig::class)->getMock(); - $this->l10n = $this->getMockBuilder(IL10N::class)->getMock(); + $this->config = $this->createMock(IConfig::class); + $this->l10n = $this->createMock(IL10N::class); $this->admin = new Mail( $this->config, diff --git a/apps/settings/tests/Settings/Admin/SecurityTest.php b/apps/settings/tests/Settings/Admin/SecurityTest.php index 95b5e988397..63b52dd8616 100644 --- a/apps/settings/tests/Settings/Admin/SecurityTest.php +++ b/apps/settings/tests/Settings/Admin/SecurityTest.php @@ -16,21 +16,16 @@ use PHPUnit\Framework\MockObject\MockObject; use Test\TestCase; class SecurityTest extends TestCase { - /** @var Security */ - private $admin; - /** @var Manager */ - private $manager; - /** @var IUserManager */ - private $userManager; - /** @var MandatoryTwoFactor|MockObject */ - private $mandatoryTwoFactor; - /** @var IInitialState|MockObject */ - private $initialState; + private Manager $manager; + private IUserManager $userManager; + private MandatoryTwoFactor&MockObject $mandatoryTwoFactor; + private IInitialState&MockObject $initialState; + private Security $admin; protected function setUp(): void { parent::setUp(); - $this->manager = $this->getMockBuilder(Manager::class)->disableOriginalConstructor()->getMock(); - $this->userManager = $this->getMockBuilder(IUserManager::class)->getMock(); + $this->manager = $this->createMock(Manager::class); + $this->userManager = $this->createMock(IUserManager::class); $this->mandatoryTwoFactor = $this->createMock(MandatoryTwoFactor::class); $this->initialState = $this->createMock(IInitialState::class); @@ -43,10 +38,7 @@ class SecurityTest extends TestCase { ); } - /** - * @return array - */ - public function encryptionSettingsProvider() { + public static function encryptionSettingsProvider(): array { return [ [true], [false], @@ -55,9 +47,8 @@ class SecurityTest extends TestCase { /** * @dataProvider encryptionSettingsProvider - * @param bool $enabled */ - public function testGetFormWithOnlyOneBackend($enabled): void { + public function testGetFormWithOnlyOneBackend(bool $enabled): void { $this->manager ->expects($this->once()) ->method('isEnabled') diff --git a/apps/settings/tests/Settings/Admin/ServerTest.php b/apps/settings/tests/Settings/Admin/ServerTest.php index 35a8a3ce7f7..e2ca4cff3c6 100644 --- a/apps/settings/tests/Settings/Admin/ServerTest.php +++ b/apps/settings/tests/Settings/Admin/ServerTest.php @@ -25,24 +25,15 @@ use Test\TestCase; * @group DB */ class ServerTest extends TestCase { - /** @var IDBConnection */ - private $connection; - /** @var Server&MockObject */ - private $admin; - /** @var IInitialState&MockObject */ - private $initialStateService; - /** @var ProfileManager&MockObject */ - private $profileManager; - /** @var ITimeFactory&MockObject */ - private $timeFactory; - /** @var IConfig&MockObject */ - private $config; - /** @var IAppConfig&MockObject */ - private $appConfig; - /** @var IL10N&MockObject */ - private $l10n; - /** @var IUrlGenerator&MockObject */ - private $urlGenerator; + private IDBConnection $connection; + private Server&MockObject $admin; + private IInitialState&MockObject $initialStateService; + private ProfileManager&MockObject $profileManager; + private ITimeFactory&MockObject $timeFactory; + private IConfig&MockObject $config; + private IAppConfig&MockObject $appConfig; + private IL10N&MockObject $l10n; + private IUrlGenerator&MockObject $urlGenerator; protected function setUp(): void { parent::setUp(); diff --git a/apps/settings/tests/Settings/Admin/SharingTest.php b/apps/settings/tests/Settings/Admin/SharingTest.php index 048634be1e0..bd1a7a1045b 100644 --- a/apps/settings/tests/Settings/Admin/SharingTest.php +++ b/apps/settings/tests/Settings/Admin/SharingTest.php @@ -18,34 +18,22 @@ use PHPUnit\Framework\MockObject\MockObject; use Test\TestCase; class SharingTest extends TestCase { - /** @var Sharing */ - private $admin; - /** @var IConfig&MockObject */ - private $config; - /** @var IL10N&MockObject */ - private $l10n; - /** @var IManager|MockObject */ - private $shareManager; - /** @var IAppManager|MockObject */ - private $appManager; - /** @var IURLGenerator|MockObject */ - private $urlGenerator; - /** @var IInitialState|MockObject */ - private $initialState; + private IConfig&MockObject $config; + private IL10N&MockObject $l10n; + private IManager&MockObject $shareManager; + private IAppManager&MockObject $appManager; + private IURLGenerator&MockObject $urlGenerator; + private IInitialState&MockObject $initialState; + private Sharing $admin; protected function setUp(): void { parent::setUp(); - $this->config = $this->getMockBuilder(IConfig::class)->getMock(); - $this->l10n = $this->getMockBuilder(IL10N::class)->getMock(); - - /** @var IManager|MockObject */ - $this->shareManager = $this->getMockBuilder(IManager::class)->getMock(); - /** @var IAppManager|MockObject */ - $this->appManager = $this->getMockBuilder(IAppManager::class)->getMock(); - /** @var IURLGenerator|MockObject */ - $this->urlGenerator = $this->getMockBuilder(IURLGenerator::class)->getMock(); - /** @var IInitialState|MockObject */ - $this->initialState = $this->getMockBuilder(IInitialState::class)->getMock(); + $this->config = $this->createMock(IConfig::class); + $this->l10n = $this->createMock(IL10N::class); + $this->shareManager = $this->createMock(IManager::class); + $this->appManager = $this->createMock(IAppManager::class); + $this->urlGenerator = $this->createMock(IURLGenerator::class); + $this->initialState = $this->createMock(IInitialState::class); $this->admin = new Sharing( $this->config, @@ -104,7 +92,7 @@ class SharingTest extends TestCase { ->willReturnCallback(function (string $key) use (&$initialStateCalls): void { $initialStateCalls[$key] = func_get_args(); }); - + $expectedInitialStateCalls = [ 'sharingAppEnabled' => false, 'sharingDocumentation' => '', diff --git a/apps/settings/tests/Settings/Personal/Security/AuthtokensTest.php b/apps/settings/tests/Settings/Personal/Security/AuthtokensTest.php index 44641ee98b3..f6f82ab311a 100644 --- a/apps/settings/tests/Settings/Personal/Security/AuthtokensTest.php +++ b/apps/settings/tests/Settings/Personal/Security/AuthtokensTest.php @@ -20,24 +20,12 @@ use PHPUnit\Framework\MockObject\MockObject; use Test\TestCase; class AuthtokensTest extends TestCase { - - /** @var IAuthTokenProvider|MockObject */ - private $authTokenProvider; - - /** @var ISession|MockObject */ - private $session; - - /** @var IUserSession|MockObject */ - private $userSession; - - /** @var IInitialState|MockObject */ - private $initialState; - - /** @var string */ - private $uid; - - /** @var Authtokens */ - private $section; + private IAuthTokenProvider&MockObject $authTokenProvider; + private ISession&MockObject $session; + private IUserSession&MockObject $userSession; + private IInitialState&MockObject $initialState; + private string $uid; + private Authtokens $section; protected function setUp(): void { parent::setUp(); @@ -80,34 +68,39 @@ class AuthtokensTest extends TestCase { ->method('getToken') ->with('session123') ->willReturn($sessionToken); + + $calls = [ + [ + 'app_tokens', [ + [ + 'id' => 100, + 'name' => null, + 'lastActivity' => 0, + 'type' => 0, + 'canDelete' => false, + 'current' => true, + 'scope' => [IToken::SCOPE_FILESYSTEM => true], + 'canRename' => false, + ], + [ + 'id' => 200, + 'name' => null, + 'lastActivity' => 0, + 'type' => 0, + 'canDelete' => true, + 'scope' => [IToken::SCOPE_FILESYSTEM => true], + 'canRename' => true, + ], + ] + ], + ['can_create_app_token', true], + ]; $this->initialState->expects($this->exactly(2)) ->method('provideInitialState') - ->withConsecutive( - [ - 'app_tokens', [ - [ - 'id' => 100, - 'name' => null, - 'lastActivity' => 0, - 'type' => 0, - 'canDelete' => false, - 'current' => true, - 'scope' => [IToken::SCOPE_FILESYSTEM => true], - 'canRename' => false, - ], - [ - 'id' => 200, - 'name' => null, - 'lastActivity' => 0, - 'type' => 0, - 'canDelete' => true, - 'scope' => [IToken::SCOPE_FILESYSTEM => true], - 'canRename' => true, - ], - ] - ], - ['can_create_app_token', true], - ); + ->willReturnCallback(function () use (&$calls) { + $expected = array_shift($calls); + $this->assertEquals($expected, func_get_args()); + }); $form = $this->section->getForm(); diff --git a/apps/settings/tests/Settings/Personal/Security/PasswordTest.php b/apps/settings/tests/Settings/Personal/Security/PasswordTest.php index 62f2c998943..34a4b8e296f 100644 --- a/apps/settings/tests/Settings/Personal/Security/PasswordTest.php +++ b/apps/settings/tests/Settings/Personal/Security/PasswordTest.php @@ -16,15 +16,9 @@ use PHPUnit\Framework\MockObject\MockObject; use Test\TestCase; class PasswordTest extends TestCase { - - /** @var IUserManager|MockObject */ - private $userManager; - - /** @var string */ - private $uid; - - /** @var Password */ - private $section; + private IUserManager&MockObject $userManager; + private string $uid; + private Password $section; protected function setUp(): void { parent::setUp(); diff --git a/apps/settings/tests/SetupChecks/AppDirsWithDifferentOwnerTest.php b/apps/settings/tests/SetupChecks/AppDirsWithDifferentOwnerTest.php index db3141e3a26..423f932dcf5 100644 --- a/apps/settings/tests/SetupChecks/AppDirsWithDifferentOwnerTest.php +++ b/apps/settings/tests/SetupChecks/AppDirsWithDifferentOwnerTest.php @@ -6,7 +6,7 @@ declare(strict_types=1); * SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later */ -namespace OCA\Settings\Tests; +namespace OCA\Settings\Tests\SetupChecks; use OCA\Settings\SetupChecks\AppDirsWithDifferentOwner; use OCP\IL10N; @@ -26,8 +26,7 @@ class AppDirsWithDifferentOwnerTest extends TestCase { protected function setUp(): void { parent::setUp(); - $this->l10n = $this->getMockBuilder(IL10N::class) - ->disableOriginalConstructor()->getMock(); + $this->l10n = $this->createMock(IL10N::class); $this->l10n->expects($this->any()) ->method('t') ->willReturnCallback(function ($message, array $replace) { diff --git a/apps/settings/tests/SetupChecks/CodeIntegrityTest.php b/apps/settings/tests/SetupChecks/CodeIntegrityTest.php index 52101aed901..4dd54a644f5 100644 --- a/apps/settings/tests/SetupChecks/CodeIntegrityTest.php +++ b/apps/settings/tests/SetupChecks/CodeIntegrityTest.php @@ -6,7 +6,7 @@ declare(strict_types=1); * SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later */ -namespace OCA\Settings\Tests; +namespace OCA\Settings\Tests\SetupChecks; use OC\IntegrityCheck\Checker; use OCA\Settings\SetupChecks\CodeIntegrity; @@ -17,7 +17,7 @@ use PHPUnit\Framework\MockObject\MockObject; use Test\TestCase; class CodeIntegrityTest extends TestCase { - + private IL10N&MockObject $l10n; private IURLGenerator&MockObject $urlGenerator; private Checker&MockObject $checker; @@ -25,8 +25,7 @@ class CodeIntegrityTest extends TestCase { protected function setUp(): void { parent::setUp(); - $this->l10n = $this->getMockBuilder(IL10N::class) - ->disableOriginalConstructor()->getMock(); + $this->l10n = $this->createMock(IL10N::class); $this->l10n->expects($this->any()) ->method('t') ->willReturnCallback(function ($message, array $replace) { diff --git a/apps/settings/tests/SetupChecks/DataDirectoryProtectedTest.php b/apps/settings/tests/SetupChecks/DataDirectoryProtectedTest.php index 51dffe58787..a48c6296aff 100644 --- a/apps/settings/tests/SetupChecks/DataDirectoryProtectedTest.php +++ b/apps/settings/tests/SetupChecks/DataDirectoryProtectedTest.php @@ -6,7 +6,7 @@ declare(strict_types=1); * SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later */ -namespace OCA\Settings\Tests; +namespace OCA\Settings\Tests\SetupChecks; use OCA\Settings\SetupChecks\DataDirectoryProtected; use OCP\Http\Client\IClientService; @@ -30,9 +30,7 @@ class DataDirectoryProtectedTest extends TestCase { protected function setUp(): void { parent::setUp(); - /** @var IL10N&MockObject */ - $this->l10n = $this->getMockBuilder(IL10N::class) - ->disableOriginalConstructor()->getMock(); + $this->l10n = $this->createMock(IL10N::class); $this->l10n->expects($this->any()) ->method('t') ->willReturnCallback(function ($message, array $replace) { diff --git a/apps/settings/tests/SetupChecks/ForwardedForHeadersTest.php b/apps/settings/tests/SetupChecks/ForwardedForHeadersTest.php index b8b25e74c63..b57eb852d80 100644 --- a/apps/settings/tests/SetupChecks/ForwardedForHeadersTest.php +++ b/apps/settings/tests/SetupChecks/ForwardedForHeadersTest.php @@ -6,7 +6,7 @@ declare(strict_types=1); * SPDX-FileCopyrightText: 2021 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later */ -namespace OCA\Settings\Tests; +namespace OCA\Settings\Tests\SetupChecks; use OCA\Settings\SetupChecks\ForwardedForHeaders; use OCP\IConfig; @@ -26,8 +26,7 @@ class ForwardedForHeadersTest extends TestCase { protected function setUp(): void { parent::setUp(); - $this->l10n = $this->getMockBuilder(IL10N::class) - ->disableOriginalConstructor()->getMock(); + $this->l10n = $this->createMock(IL10N::class); $this->l10n->expects($this->any()) ->method('t') ->willReturnCallback(function ($message, array $replace) { @@ -68,7 +67,7 @@ class ForwardedForHeadersTest extends TestCase { ); } - public function dataForwardedForHeadersWorking(): array { + public static function dataForwardedForHeadersWorking(): array { return [ // description => trusted proxies, getHeader('REMOTE_ADDR'), getRemoteAddr, expected result 'no trusted proxies' => [[], '2.2.2.2', '2.2.2.2', SetupResult::SUCCESS], diff --git a/apps/settings/tests/SetupChecks/LoggingLevelTest.php b/apps/settings/tests/SetupChecks/LoggingLevelTest.php index d87f66bb484..9d588a4e486 100644 --- a/apps/settings/tests/SetupChecks/LoggingLevelTest.php +++ b/apps/settings/tests/SetupChecks/LoggingLevelTest.php @@ -6,7 +6,7 @@ declare(strict_types=1); * SPDX-FileCopyrightText: 2025 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later */ -namespace OCA\Settings\Tests; +namespace OCA\Settings\Tests\SetupChecks; use OCA\Settings\SetupChecks\LoggingLevel; use OCP\IConfig; @@ -60,7 +60,7 @@ class LoggingLevelTest extends TestCase { } /** @dataProvider dataRun */ - public function testRun(mixed $value, string $expected): void { + public function testRun(string|int $value, string $expected): void { $this->urlGenerator->method('linkToDocs')->willReturn('admin-logging'); $this->config->expects(self::once()) diff --git a/apps/settings/tests/SetupChecks/OcxProvicersTest.php b/apps/settings/tests/SetupChecks/OcxProvicersTest.php index 4c2b36a8325..8e5a2c1b88b 100644 --- a/apps/settings/tests/SetupChecks/OcxProvicersTest.php +++ b/apps/settings/tests/SetupChecks/OcxProvicersTest.php @@ -6,7 +6,7 @@ declare(strict_types=1); * SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later */ -namespace OCA\Settings\Tests; +namespace OCA\Settings\Tests\SetupChecks; use OCA\Settings\SetupChecks\OcxProviders; use OCP\Http\Client\IClientService; @@ -30,9 +30,7 @@ class OcxProvicersTest extends TestCase { protected function setUp(): void { parent::setUp(); - /** @var IL10N|MockObject */ - $this->l10n = $this->getMockBuilder(IL10N::class) - ->disableOriginalConstructor()->getMock(); + $this->l10n = $this->createMock(IL10N::class); $this->l10n->expects($this->any()) ->method('t') ->willReturnCallback(function ($message, array $replace) { diff --git a/apps/settings/tests/SetupChecks/PhpDefaultCharsetTest.php b/apps/settings/tests/SetupChecks/PhpDefaultCharsetTest.php index 4fba60cf72f..3722346219a 100644 --- a/apps/settings/tests/SetupChecks/PhpDefaultCharsetTest.php +++ b/apps/settings/tests/SetupChecks/PhpDefaultCharsetTest.php @@ -6,7 +6,7 @@ declare(strict_types=1); * SPDX-FileCopyrightText: 2020 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later */ -namespace OCA\Settings\Tests; +namespace OCA\Settings\Tests\SetupChecks; use OCA\Settings\SetupChecks\PhpDefaultCharset; use OCP\IL10N; @@ -21,8 +21,7 @@ class PhpDefaultCharsetTest extends TestCase { protected function setUp(): void { parent::setUp(); - $this->l10n = $this->getMockBuilder(IL10N::class) - ->disableOriginalConstructor()->getMock(); + $this->l10n = $this->createMock(IL10N::class); $this->l10n->expects($this->any()) ->method('t') ->willReturnCallback(function ($message, array $replace) { diff --git a/apps/settings/tests/SetupChecks/PhpOutputBufferingTest.php b/apps/settings/tests/SetupChecks/PhpOutputBufferingTest.php index 69194df81c5..de509347044 100644 --- a/apps/settings/tests/SetupChecks/PhpOutputBufferingTest.php +++ b/apps/settings/tests/SetupChecks/PhpOutputBufferingTest.php @@ -6,7 +6,7 @@ declare(strict_types=1); * SPDX-FileCopyrightText: 2020 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later */ -namespace OCA\Settings\Tests; +namespace OCA\Settings\Tests\SetupChecks; use OCA\Settings\SetupChecks\PhpOutputBuffering; use OCP\IL10N; @@ -21,8 +21,7 @@ class PhpOutputBufferingTest extends TestCase { protected function setUp(): void { parent::setUp(); - $this->l10n = $this->getMockBuilder(IL10N::class) - ->disableOriginalConstructor()->getMock(); + $this->l10n = $this->createMock(IL10N::class); $this->l10n->expects($this->any()) ->method('t') ->willReturnCallback(function ($message, array $replace) { diff --git a/apps/settings/tests/SetupChecks/SecurityHeadersTest.php b/apps/settings/tests/SetupChecks/SecurityHeadersTest.php index d8bb51d47c6..e7d87775485 100644 --- a/apps/settings/tests/SetupChecks/SecurityHeadersTest.php +++ b/apps/settings/tests/SetupChecks/SecurityHeadersTest.php @@ -6,7 +6,7 @@ declare(strict_types=1); * SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later */ -namespace OCA\Settings\Tests; +namespace OCA\Settings\Tests\SetupChecks; use OCA\Settings\SetupChecks\SecurityHeaders; use OCP\Http\Client\IClientService; @@ -20,19 +20,17 @@ use Psr\Log\LoggerInterface; use Test\TestCase; class SecurityHeadersTest extends TestCase { - private IL10N|MockObject $l10n; - private IConfig|MockObject $config; - private IURLGenerator|MockObject $urlGenerator; - private IClientService|MockObject $clientService; - private LoggerInterface|MockObject $logger; - private SecurityHeaders|MockObject $setupcheck; + private IL10N&MockObject $l10n; + private IConfig&MockObject $config; + private IURLGenerator&MockObject $urlGenerator; + private IClientService&MockObject $clientService; + private LoggerInterface&MockObject $logger; + private SecurityHeaders&MockObject $setupcheck; protected function setUp(): void { parent::setUp(); - /** @var IL10N|MockObject */ - $this->l10n = $this->getMockBuilder(IL10N::class) - ->disableOriginalConstructor()->getMock(); + $this->l10n = $this->createMock(IL10N::class); $this->l10n->expects($this->any()) ->method('t') ->willReturnCallback(function ($message, array $replace) { @@ -92,7 +90,7 @@ class SecurityHeadersTest extends TestCase { $this->assertEquals(SetupResult::WARNING, $result->getSeverity()); } - public function dataSuccess(): array { + public static function dataSuccess(): array { return [ // description => modifiedHeaders 'basic' => [[]], @@ -112,7 +110,7 @@ class SecurityHeadersTest extends TestCase { /** * @dataProvider dataSuccess */ - public function testSuccess($headers): void { + public function testSuccess(array $headers): void { $headers = array_merge( [ 'X-XSS-Protection' => '1; mode=block', @@ -138,7 +136,7 @@ class SecurityHeadersTest extends TestCase { $this->assertEquals(SetupResult::SUCCESS, $result->getSeverity()); } - public function dataFailure(): array { + public static function dataFailure(): array { return [ // description => modifiedHeaders 'x-robots-none' => [['X-Robots-Tag' => 'none'], "- The `X-Robots-Tag` HTTP header is not set to `noindex,nofollow`. This is a potential security or privacy risk, as it is recommended to adjust this setting accordingly.\n"], diff --git a/apps/settings/tests/SetupChecks/SupportedDatabaseTest.php b/apps/settings/tests/SetupChecks/SupportedDatabaseTest.php index 4bf529da6bb..6c75df47aa0 100644 --- a/apps/settings/tests/SetupChecks/SupportedDatabaseTest.php +++ b/apps/settings/tests/SetupChecks/SupportedDatabaseTest.php @@ -6,12 +6,12 @@ declare(strict_types=1); * SPDX-FileCopyrightText: 2021 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later */ -namespace OCA\Settings\Tests; +namespace OCA\Settings\Tests\SetupChecks; use OCA\Settings\SetupChecks\SupportedDatabase; use OCP\IDBConnection; use OCP\IL10N; -use OCP\IUrlGenerator; +use OCP\IURLGenerator; use OCP\Server; use OCP\SetupCheck\SetupResult; use Test\TestCase; @@ -29,8 +29,8 @@ class SupportedDatabaseTest extends TestCase { protected function setUp(): void { parent::setUp(); - $this->l10n = $this->getMockBuilder(IL10N::class)->getMock(); - $this->urlGenerator = $this->getMockBuilder(IUrlGenerator::class)->getMock(); + $this->l10n = $this->createMock(IL10N::class); + $this->urlGenerator = $this->createMock(IURLGenerator::class); $this->connection = Server::get(IDBConnection::class); $this->check = new SupportedDatabase( diff --git a/apps/settings/tests/SetupChecks/WellKnownUrlsTest.php b/apps/settings/tests/SetupChecks/WellKnownUrlsTest.php index 983f2c427ad..14473a540ba 100644 --- a/apps/settings/tests/SetupChecks/WellKnownUrlsTest.php +++ b/apps/settings/tests/SetupChecks/WellKnownUrlsTest.php @@ -6,7 +6,7 @@ declare(strict_types=1); * SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later */ -namespace OCA\Settings\Tests; +namespace OCA\Settings\Tests\SetupChecks; use OCA\Settings\SetupChecks\WellKnownUrls; use OCP\Http\Client\IClientService; @@ -20,19 +20,18 @@ use Psr\Log\LoggerInterface; use Test\TestCase; class WellKnownUrlsTest extends TestCase { - private IL10N|MockObject $l10n; - private IConfig|MockObject $config; - private IURLGenerator|MockObject $urlGenerator; - private IClientService|MockObject $clientService; - private LoggerInterface|MockObject $logger; - private WellKnownUrls|MockObject $setupcheck; + private IL10N&MockObject $l10n; + private IConfig&MockObject $config; + private IURLGenerator&MockObject $urlGenerator; + private IClientService&MockObject $clientService; + private LoggerInterface&MockObject $logger; + private WellKnownUrls&MockObject $setupcheck; protected function setUp(): void { parent::setUp(); - /** @var IL10N|MockObject */ - $this->l10n = $this->getMockBuilder(IL10N::class) - ->disableOriginalConstructor()->getMock(); + /** @var IL10N&MockObject */ + $this->l10n = $this->createMock(IL10N::class); $this->l10n->expects($this->any()) ->method('t') ->willReturnCallback(function ($message, array $replace) { @@ -116,7 +115,7 @@ class WellKnownUrlsTest extends TestCase { } public function dataTestResponses(): array { - $createResponse = function (int $statuscode, array $header = []): IResponse|MockObject { + $createResponse = function (int $statuscode, array $header = []): IResponse&MockObject { $response = $this->createMock(IResponse::class); $response->expects($this->any()) ->method('getStatusCode') diff --git a/apps/settings/tests/UserMigration/AccountMigratorTest.php b/apps/settings/tests/UserMigration/AccountMigratorTest.php index cd3fd2f7aeb..ded905d226c 100644 --- a/apps/settings/tests/UserMigration/AccountMigratorTest.php +++ b/apps/settings/tests/UserMigration/AccountMigratorTest.php @@ -27,21 +27,12 @@ use Test\TestCase; * @group DB */ class AccountMigratorTest extends TestCase { - private IUserManager $userManager; - private IAvatarManager $avatarManager; - private AccountMigrator $migrator; - - /** @var IImportSource|MockObject */ - private $importSource; - - /** @var IExportDestination|MockObject */ - private $exportDestination; - - /** @var OutputInterface|MockObject */ - private $output; + private IImportSource&MockObject $importSource; + private IExportDestination&MockObject $exportDestination; + private OutputInterface&MockObject $output; private const ASSETS_DIR = __DIR__ . '/assets/'; @@ -72,9 +63,9 @@ class AccountMigratorTest extends TestCase { parent::tearDown(); } - public function dataImportExportAccount(): array { + public static function dataImportExportAccount(): array { return array_map( - function (string $filename) { + static function (string $filename): array { $dataPath = static::ASSETS_DIR . $filename; // For each account json file there is an avatar image and a config json file with the same basename $basename = pathinfo($filename, PATHINFO_FILENAME); @@ -111,17 +102,18 @@ class AccountMigratorTest extends TestCase { ->with($this->migrator->getId()) ->willReturn(1); + $calls = [ + [static::REGEX_ACCOUNT_FILE, json_encode($importData)], + [static::REGEX_CONFIG_FILE, json_encode($importConfig)], + ]; $this->importSource ->expects($this->exactly(2)) ->method('getFileContents') - ->withConsecutive( - [$this->matchesRegularExpression(static::REGEX_ACCOUNT_FILE)], - [$this->matchesRegularExpression(static::REGEX_CONFIG_FILE)], - ) - ->willReturnOnConsecutiveCalls( - json_encode($importData), - json_encode($importConfig), - ); + ->willReturnCallback(function ($path) use (&$calls) { + $expected = array_shift($calls); + $this->assertMatchesRegularExpression($expected[0], $path); + return $expected[1]; + }); $this->importSource ->expects($this->once()) @@ -152,13 +144,18 @@ class AccountMigratorTest extends TestCase { ); } + $calls = [ + [static::REGEX_ACCOUNT_FILE, new JsonMatches(json_encode($importData))], + [static::REGEX_CONFIG_FILE,new JsonMatches(json_encode($importConfig))], + ]; $this->exportDestination ->expects($this->exactly(2)) ->method('addFileContents') - ->withConsecutive( - [$this->matchesRegularExpression(static::REGEX_ACCOUNT_FILE), new JsonMatches(json_encode($exportData))], - [$this->matchesRegularExpression(static::REGEX_CONFIG_FILE), new JsonMatches(json_encode($exportConfig))], - ); + ->willReturnCallback(function ($path) use (&$calls) { + $expected = array_shift($calls); + $this->assertMatchesRegularExpression($expected[0], $path); + return $expected[1]; + }); $this->exportDestination ->expects($this->once()) diff --git a/apps/user_ldap/l10n/da.js b/apps/user_ldap/l10n/da.js index 1982f52351f..0c909bddbf0 100644 --- a/apps/user_ldap/l10n/da.js +++ b/apps/user_ldap/l10n/da.js @@ -20,10 +20,10 @@ OC.L10N.register( "Good password" : "God adgangskode", "Strong password" : "Stærk adgangskode", "The Base DN appears to be wrong" : "Base DN synes at være forkert", - "Testing configuration…" : "Test af konfiguration...", - "Configuration incorrect" : "Indstilling forkert", + "Testing configuration…" : "Tester konfiguration...", + "Configuration incorrect" : "Konfiguration forkert", "Configuration incomplete" : "Konfiguration ufuldstændig", - "Configuration OK" : "Indstilling OK", + "Configuration OK" : "Konfiguration OK", "Select groups" : "Vælg grupper", "Select object classes" : "Vælg objektklasser", "Please check the credentials, they seem to be wrong." : "Tjek venligst legitimationerne.", @@ -35,7 +35,7 @@ OC.L10N.register( "More than 1,000 directory entries available." : "Mere end 1.000 mappeindgange til rådighed.", "_{objectsFound} entry available within the provided Base DN_::_{objectsFound} entries available within the provided Base DN_" : ["{objectsFound} indgang tilgængelig i den givne Base DN","{objectsFound} poster tilgængelige inden for den givne Base DN"], "An error occurred. Please check the Base DN, as well as connection settings and credentials." : "Der opstod en fejl. Tjek venligst Base DN samt tilslutningsindstillinger og legitimationsoplysninger.", - "Do you really want to delete the current Server Configuration?" : "Vil du virkelig slette den aktuelle serverindstilling?", + "Do you really want to delete the current Server Configuration?" : "Vil du virkelig slette den aktuelle server konfiguration?", "Confirm Deletion" : "Bekræft sletning", "Mappings cleared successfully!" : "Mappings ryddet med succes!", "Error while clearing the mappings." : "Fejl under rydning af tilknytninger.", @@ -46,7 +46,7 @@ OC.L10N.register( "Mode switch" : "Tilstandsafbryder", "Select attributes" : "Vælg attributter", "User not found. Please check your login attributes and username. Effective filter (to copy-and-paste for command-line validation): <br/>" : "Brugeren ikke fundet. Tjek venligst dine login attributter og brugernavn. Effektiv filter (til copy- and - paste til kommandolinjevalidering): < br / >", - "User found and settings verified." : "Brugerfundet og indstillinger verificeret.", + "User found and settings verified." : "Bruger fundet og indstillinger verificeret.", "Consider narrowing your search, as it encompassed many users, only the first one of whom will be able to log in." : "Overvej at indsnævre din søgning, som det omfattede mange brugere, kun den første af dem vil være i stand til at logge ind.", "An unspecified error occurred. Please check log and settings." : "En uspecificeret fejl opstod. Tjek log og indstillinger.", "The search filter is invalid, probably due to syntax issues like uneven number of opened and closed brackets. Please revise." : "Søgefilteret er ugyldigt, sandsynligvis på grund af syntaksspørgsmål som ulige antal åbne og lukkede parenteser. Vær venlig at revidere.", @@ -101,7 +101,7 @@ OC.L10N.register( "When logging in, %s will find the user based on the following attributes:" : "Når du logger ind, vil %s finde brugeren baseret på følgende egenskaber:", "LDAP/AD Username:" : "LDAP / AD Brugernavn:", "Allows login against the LDAP/AD username, which is either \"uid\" or \"sAMAccountName\" and will be detected." : "Tillader login mod LDAP / AD brugernavn, som er enten \"uid\" eller \"SAMAccountName\" og vil blive opdaget.", - "LDAP/AD Email Address:" : "LDAP / AD Email adresse:", + "LDAP/AD Email Address:" : "LDAP / AD E-mail adresse:", "Allows login against an email attribute. \"mail\" and \"mailPrimaryAddress\" allowed." : "Tillader login mod en e- mail- attribut. \"mail\" og \"mailPrimaryAddress\" tilladt.", "Other Attributes:" : "Andre attributter:", "Defines the filter to apply, when login is attempted. \"%%uid\" replaces the username in the login action. Example: \"uid=%%uid\"" : "Definerer det filter der skal anvendes, når login er forsøgt. \"%% uid\" erstatter brugernavnet i login-handlingen. Eksempel: \"uid =%% uid\"", @@ -131,7 +131,7 @@ OC.L10N.register( "The most common object classes for users are organizationalPerson, person, user, and inetOrgPerson. If you are not sure which object class to select, please consult your directory admin." : "De mest almindelige objektklasser for brugere er organisationalPerson, person, bruger og inetOrgPerson. Hvis du ikke er sikker på hvilken objektklasse du skal vælge, bedes du konsultere din mappe- admin.", "The filter specifies which LDAP users shall have access to the %s instance." : "Filteret angiver, hvilke LDAP-brugere der skal have adgang til %s instansen.", "Verify settings and count users" : "Verificér indstillinger og tæller brugere", - "Saving" : "Gemning", + "Saving" : "Gemmer", "Back" : "Tilbage", "Continue" : "Fortsæt", "Please renew your password." : "Venligst forny din adgangskode.", diff --git a/apps/user_ldap/l10n/da.json b/apps/user_ldap/l10n/da.json index 22050580fcb..99ad292499e 100644 --- a/apps/user_ldap/l10n/da.json +++ b/apps/user_ldap/l10n/da.json @@ -18,10 +18,10 @@ "Good password" : "God adgangskode", "Strong password" : "Stærk adgangskode", "The Base DN appears to be wrong" : "Base DN synes at være forkert", - "Testing configuration…" : "Test af konfiguration...", - "Configuration incorrect" : "Indstilling forkert", + "Testing configuration…" : "Tester konfiguration...", + "Configuration incorrect" : "Konfiguration forkert", "Configuration incomplete" : "Konfiguration ufuldstændig", - "Configuration OK" : "Indstilling OK", + "Configuration OK" : "Konfiguration OK", "Select groups" : "Vælg grupper", "Select object classes" : "Vælg objektklasser", "Please check the credentials, they seem to be wrong." : "Tjek venligst legitimationerne.", @@ -33,7 +33,7 @@ "More than 1,000 directory entries available." : "Mere end 1.000 mappeindgange til rådighed.", "_{objectsFound} entry available within the provided Base DN_::_{objectsFound} entries available within the provided Base DN_" : ["{objectsFound} indgang tilgængelig i den givne Base DN","{objectsFound} poster tilgængelige inden for den givne Base DN"], "An error occurred. Please check the Base DN, as well as connection settings and credentials." : "Der opstod en fejl. Tjek venligst Base DN samt tilslutningsindstillinger og legitimationsoplysninger.", - "Do you really want to delete the current Server Configuration?" : "Vil du virkelig slette den aktuelle serverindstilling?", + "Do you really want to delete the current Server Configuration?" : "Vil du virkelig slette den aktuelle server konfiguration?", "Confirm Deletion" : "Bekræft sletning", "Mappings cleared successfully!" : "Mappings ryddet med succes!", "Error while clearing the mappings." : "Fejl under rydning af tilknytninger.", @@ -44,7 +44,7 @@ "Mode switch" : "Tilstandsafbryder", "Select attributes" : "Vælg attributter", "User not found. Please check your login attributes and username. Effective filter (to copy-and-paste for command-line validation): <br/>" : "Brugeren ikke fundet. Tjek venligst dine login attributter og brugernavn. Effektiv filter (til copy- and - paste til kommandolinjevalidering): < br / >", - "User found and settings verified." : "Brugerfundet og indstillinger verificeret.", + "User found and settings verified." : "Bruger fundet og indstillinger verificeret.", "Consider narrowing your search, as it encompassed many users, only the first one of whom will be able to log in." : "Overvej at indsnævre din søgning, som det omfattede mange brugere, kun den første af dem vil være i stand til at logge ind.", "An unspecified error occurred. Please check log and settings." : "En uspecificeret fejl opstod. Tjek log og indstillinger.", "The search filter is invalid, probably due to syntax issues like uneven number of opened and closed brackets. Please revise." : "Søgefilteret er ugyldigt, sandsynligvis på grund af syntaksspørgsmål som ulige antal åbne og lukkede parenteser. Vær venlig at revidere.", @@ -99,7 +99,7 @@ "When logging in, %s will find the user based on the following attributes:" : "Når du logger ind, vil %s finde brugeren baseret på følgende egenskaber:", "LDAP/AD Username:" : "LDAP / AD Brugernavn:", "Allows login against the LDAP/AD username, which is either \"uid\" or \"sAMAccountName\" and will be detected." : "Tillader login mod LDAP / AD brugernavn, som er enten \"uid\" eller \"SAMAccountName\" og vil blive opdaget.", - "LDAP/AD Email Address:" : "LDAP / AD Email adresse:", + "LDAP/AD Email Address:" : "LDAP / AD E-mail adresse:", "Allows login against an email attribute. \"mail\" and \"mailPrimaryAddress\" allowed." : "Tillader login mod en e- mail- attribut. \"mail\" og \"mailPrimaryAddress\" tilladt.", "Other Attributes:" : "Andre attributter:", "Defines the filter to apply, when login is attempted. \"%%uid\" replaces the username in the login action. Example: \"uid=%%uid\"" : "Definerer det filter der skal anvendes, når login er forsøgt. \"%% uid\" erstatter brugernavnet i login-handlingen. Eksempel: \"uid =%% uid\"", @@ -129,7 +129,7 @@ "The most common object classes for users are organizationalPerson, person, user, and inetOrgPerson. If you are not sure which object class to select, please consult your directory admin." : "De mest almindelige objektklasser for brugere er organisationalPerson, person, bruger og inetOrgPerson. Hvis du ikke er sikker på hvilken objektklasse du skal vælge, bedes du konsultere din mappe- admin.", "The filter specifies which LDAP users shall have access to the %s instance." : "Filteret angiver, hvilke LDAP-brugere der skal have adgang til %s instansen.", "Verify settings and count users" : "Verificér indstillinger og tæller brugere", - "Saving" : "Gemning", + "Saving" : "Gemmer", "Back" : "Tilbage", "Continue" : "Fortsæt", "Please renew your password." : "Venligst forny din adgangskode.", |