From c79a6b3f62948075f7ce67a0294b0410fd61af3d Mon Sep 17 00:00:00 2001 From: Côme Chilliet Date: Mon, 14 Nov 2022 17:06:28 +0100 Subject: Fix errors from PHP 8.2 testing MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Côme Chilliet --- .../tests/unit/BackgroundJob/CleanupInvitationTokenJobTest.php | 4 +--- .../tests/unit/BackgroundJob/PruneOutdatedSyncTokensJobTest.php | 3 ++- apps/dav/tests/unit/CalDAV/Reminder/ReminderServiceTest.php | 5 +++-- apps/dav/tests/unit/CardDAV/Activity/BackendTest.php | 4 +++- apps/dav/tests/unit/Connector/Sabre/PrincipalTest.php | 9 ++++----- .../tests/unit/Controller/InvitationResponseControllerTest.php | 4 +--- 6 files changed, 14 insertions(+), 15 deletions(-) (limited to 'apps/dav/tests') diff --git a/apps/dav/tests/unit/BackgroundJob/CleanupInvitationTokenJobTest.php b/apps/dav/tests/unit/BackgroundJob/CleanupInvitationTokenJobTest.php index fd27b4d2776..d3b7ca92581 100644 --- a/apps/dav/tests/unit/BackgroundJob/CleanupInvitationTokenJobTest.php +++ b/apps/dav/tests/unit/BackgroundJob/CleanupInvitationTokenJobTest.php @@ -32,12 +32,10 @@ namespace OCA\DAV\Tests\unit\BackgroundJob; use OCA\DAV\BackgroundJob\CleanupInvitationTokenJob; use OCP\AppFramework\Utility\ITimeFactory; use OCP\DB\QueryBuilder\IQueryBuilder; -use OCP\DB\QueryBuilder\IQueryFunction; use OCP\IDBConnection; use Test\TestCase; class CleanupInvitationTokenJobTest extends TestCase { - /** @var IDBConnection | \PHPUnit\Framework\MockObject\MockObject */ private $dbConnection; @@ -78,7 +76,7 @@ class CleanupInvitationTokenJobTest extends TestCase { [1337, \PDO::PARAM_STR, null, 'namedParameter1337'] ]); - $function = $this->createMock(IQueryFunction::class); + $function = 'function1337'; $expr->expects($this->once()) ->method('lt') ->with('expiration', 'namedParameter1337') diff --git a/apps/dav/tests/unit/BackgroundJob/PruneOutdatedSyncTokensJobTest.php b/apps/dav/tests/unit/BackgroundJob/PruneOutdatedSyncTokensJobTest.php index 991caafd597..1de56b37d80 100644 --- a/apps/dav/tests/unit/BackgroundJob/PruneOutdatedSyncTokensJobTest.php +++ b/apps/dav/tests/unit/BackgroundJob/PruneOutdatedSyncTokensJobTest.php @@ -34,13 +34,14 @@ use OCA\DAV\BackgroundJob\PruneOutdatedSyncTokensJob; use OCA\DAV\CalDAV\CalDavBackend; use OCA\DAV\CardDAV\CardDavBackend; use OCP\AppFramework\Utility\ITimeFactory; -use OCP\DB\Exception; use OCP\IConfig; use PHPUnit\Framework\MockObject\MockObject; use Psr\Log\LoggerInterface; use Test\TestCase; class PruneOutdatedSyncTokensJobTest extends TestCase { + /** @var ITimeFactory | MockObject */ + private $timeFactory; /** @var CalDavBackend | MockObject */ private $calDavBackend; diff --git a/apps/dav/tests/unit/CalDAV/Reminder/ReminderServiceTest.php b/apps/dav/tests/unit/CalDAV/Reminder/ReminderServiceTest.php index 79d9376650b..e2b5390f875 100644 --- a/apps/dav/tests/unit/CalDAV/Reminder/ReminderServiceTest.php +++ b/apps/dav/tests/unit/CalDAV/Reminder/ReminderServiceTest.php @@ -40,13 +40,11 @@ use OCP\IConfig; use OCP\IGroupManager; use OCP\IUser; use OCP\IUserManager; -use OCP\IUserSession; use PHPUnit\Framework\MockObject\MockObject; use Psr\Log\LoggerInterface; use Test\TestCase; class ReminderServiceTest extends TestCase { - /** @var Backend|MockObject */ private $backend; @@ -74,6 +72,9 @@ class ReminderServiceTest extends TestCase { /** @var MockObject|LoggerInterface */ private $logger; + /** @var MockObject|Principal */ + private $principalConnector; + public const CALENDAR_DATA = <<activityManager = $this->createMock(IManager::class); diff --git a/apps/dav/tests/unit/Connector/Sabre/PrincipalTest.php b/apps/dav/tests/unit/Connector/Sabre/PrincipalTest.php index 7cd31e3b8dd..2614f541613 100644 --- a/apps/dav/tests/unit/Connector/Sabre/PrincipalTest.php +++ b/apps/dav/tests/unit/Connector/Sabre/PrincipalTest.php @@ -54,7 +54,6 @@ use Sabre\DAV\PropPatch; use Test\TestCase; class PrincipalTest extends TestCase { - /** @var IUserManager | MockObject */ private $userManager; @@ -658,12 +657,12 @@ class PrincipalTest extends TestCase { $user2->method('getSystemEMailAddress')->willReturn('user2@foo.bar'); $user3 = $this->createMock(IUser::class); $user3->method('getUID')->willReturn('user3'); - $user2->method('getDisplayName')->willReturn('User 22'); - $user2->method('getSystemEMailAddress')->willReturn('user2@foo.bar123'); + $user3->method('getDisplayName')->willReturn('User 22'); + $user3->method('getSystemEMailAddress')->willReturn('user2@foo.bar123'); $user4 = $this->createMock(IUser::class); $user4->method('getUID')->willReturn('user4'); - $user2->method('getDisplayName')->willReturn('User 222'); - $user2->method('getSystemEMailAddress')->willReturn('user2@foo.bar456'); + $user4->method('getDisplayName')->willReturn('User 222'); + $user4->method('getSystemEMailAddress')->willReturn('user2@foo.bar456'); $this->userManager->expects($this->at(0)) ->method('searchDisplayName') diff --git a/apps/dav/tests/unit/Controller/InvitationResponseControllerTest.php b/apps/dav/tests/unit/Controller/InvitationResponseControllerTest.php index 576fde2d4af..efbad5e3008 100644 --- a/apps/dav/tests/unit/Controller/InvitationResponseControllerTest.php +++ b/apps/dav/tests/unit/Controller/InvitationResponseControllerTest.php @@ -37,14 +37,12 @@ use OCP\AppFramework\Utility\ITimeFactory; use OCP\DB\IResult; use OCP\DB\QueryBuilder\IExpressionBuilder; use OCP\DB\QueryBuilder\IQueryBuilder; -use OCP\DB\QueryBuilder\IQueryFunction; use OCP\IDBConnection; use OCP\IRequest; use Sabre\VObject\ITip\Message; use Test\TestCase; class InvitationResponseControllerTest extends TestCase { - /** @var InvitationResponseController */ private $controller; @@ -478,7 +476,7 @@ EOF; ->with(\PDO::FETCH_ASSOC) ->willReturn($return); - $function = $this->createMock(IQueryFunction::class); + $function = 'functionToken'; $expr->expects($this->once()) ->method('eq') ->with('token', 'namedParameterToken') -- cgit v1.2.3 From 13957032cfd2c4e1d306b3a1b3c6076ecf160f80 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Fri, 25 Nov 2022 11:46:56 +0100 Subject: More fixing Signed-off-by: Joas Schilling --- .../Sabre/BlockLegacyClientPluginTest.php | 4 ++-- config/config.sample.php | 24 +++++++++++----------- 2 files changed, 14 insertions(+), 14 deletions(-) (limited to 'apps/dav/tests') diff --git a/apps/dav/tests/unit/Connector/Sabre/BlockLegacyClientPluginTest.php b/apps/dav/tests/unit/Connector/Sabre/BlockLegacyClientPluginTest.php index 4d2771132cc..e9d43f77cca 100644 --- a/apps/dav/tests/unit/Connector/Sabre/BlockLegacyClientPluginTest.php +++ b/apps/dav/tests/unit/Connector/Sabre/BlockLegacyClientPluginTest.php @@ -82,7 +82,7 @@ class BlockLegacyClientPluginTest extends TestCase { $this->config ->expects($this->once()) ->method('getSystemValue') - ->with('minimum.supported.desktop.version', '2.0.0') + ->with('minimum.supported.desktop.version', '2.3.0') ->willReturn('1.7.0'); $this->blockLegacyClientVersionPlugin->beforeHandler($request); @@ -117,7 +117,7 @@ class BlockLegacyClientPluginTest extends TestCase { $this->config ->expects($this->once()) ->method('getSystemValue') - ->with('minimum.supported.desktop.version', '2.0.0') + ->with('minimum.supported.desktop.version', '2.3.0') ->willReturn('1.7.0'); $this->blockLegacyClientVersionPlugin->beforeHandler($request); diff --git a/config/config.sample.php b/config/config.sample.php index 40eaee3179d..80daf8909b9 100644 --- a/config/config.sample.php +++ b/config/config.sample.php @@ -140,7 +140,7 @@ $CONFIG = [ /** * Enable persistent connexions to the database. - * This setting uses the "persistent" option from doctrine dbal, wich in turns + * This setting uses the "persistent" option from doctrine dbal, wich in turns * uses the PDO::ATTR_PERSISTENT option from de pdo driver. */ 'dbpersistent' => '', @@ -675,16 +675,16 @@ $CONFIG = [ * and a maximum time for trash bin retention. * * Minimum time is the number of days a file will be kept, after which it - * _may be_ deleted. A file may be deleted after the minimum number of days - * is expired if space is needed. The file will not be deleted if space is - * not needed. + * _may be_ deleted. A file may be deleted after the minimum number of days + * is expired if space is needed. The file will not be deleted if space is + * not needed. * * Whether "space is needed" depends on whether a user quota is defined or not: * - * * If no user quota is defined, the available space on the Nextcloud data + * * If no user quota is defined, the available space on the Nextcloud data * partition sets the limit for the trashbin * (issues: see https://github.com/nextcloud/server/issues/28451). - * * If a user quota is defined, 50% of the user's remaining quota space sets + * * If a user quota is defined, 50% of the user's remaining quota space sets * the limit for the trashbin. * * Maximum time is the number of days at which it is _guaranteed @@ -1123,7 +1123,7 @@ $CONFIG = [ * Number of all preview requests being processed concurrently, * including previews that need to be newly generated, and those that have * been generated. - * + * * This should be greater than 'preview_concurrency_new'. * If unspecified, defaults to twice the value of 'preview_concurrency_new'. */ @@ -1131,10 +1131,10 @@ $CONFIG = [ /** * Number of new previews that are being concurrently generated. - * + * * Depending on the max preview size set by 'preview_max_x' and 'preview_max_y', * the generation process can consume considerable CPU and memory resources. - * It's recommended to limit this to be no greater than the number of CPU cores. + * It's recommended to limit this to be no greater than the number of CPU cores. * If unspecified, defaults to the number of CPU cores, or 4 if that cannot * be determined. */ @@ -1904,15 +1904,15 @@ $CONFIG = [ * The minimum Nextcloud desktop client version that will be allowed to sync with * this server instance. All connections made from earlier clients will be denied * by the server. Defaults to the minimum officially supported Nextcloud desktop - * clientversion at the time of release of this server version. + * client version at the time of release of this server version. * * When changing this, note that older unsupported versions of the Nextcloud desktop * client may not function as expected, and could lead to permanent data loss for * clients or other unexpected results. * - * Defaults to ``2.0.0`` + * Defaults to ``2.3.0`` */ -'minimum.supported.desktop.version' => '2.0.0', +'minimum.supported.desktop.version' => '2.3.0', /** * Option to allow local storage to contain symlinks. -- cgit v1.2.3