From f57c12b14e360f1694a699fce5a7e8ae4c50b91c Mon Sep 17 00:00:00 2001 From: =?utf8?q?C=C3=B4me=20Chilliet?= Date: Mon, 14 Aug 2023 17:03:56 +0200 Subject: [PATCH] Fix various deprecation warnings in tests on PHP 8.3 MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Côme Chilliet --- apps/files/tests/Controller/ViewControllerTest.php | 1 + tests/lib/App/AppManagerTest.php | 5 +++++ .../Authentication/Token/PublicKeyTokenProviderTest.php | 3 +++ .../ContactsMenu/Providers/LocalTimeProviderTest.php | 2 ++ tests/lib/Http/Client/ClientTest.php | 1 + tests/lib/TextProcessing/TextProcessingTest.php | 9 +++++++++ 6 files changed, 21 insertions(+) diff --git a/apps/files/tests/Controller/ViewControllerTest.php b/apps/files/tests/Controller/ViewControllerTest.php index 783c9c8bbbb..d9ccaf47eed 100644 --- a/apps/files/tests/Controller/ViewControllerTest.php +++ b/apps/files/tests/Controller/ViewControllerTest.php @@ -158,6 +158,7 @@ class ViewControllerTest extends TestCase { ->willReturnMap([ [$this->user->getUID(), 'files', 'file_sorting', 'name', 'name'], [$this->user->getUID(), 'files', 'file_sorting_direction', 'asc', 'asc'], + [$this->user->getUID(), 'files', 'files_sorting_configs', '{}', '{}'], [$this->user->getUID(), 'files', 'show_hidden', false, false], [$this->user->getUID(), 'files', 'crop_image_previews', true, true], [$this->user->getUID(), 'files', 'show_grid', true], diff --git a/tests/lib/App/AppManagerTest.php b/tests/lib/App/AppManagerTest.php index 4717da008a4..3bf2195499f 100644 --- a/tests/lib/App/AppManagerTest.php +++ b/tests/lib/App/AppManagerTest.php @@ -642,6 +642,11 @@ class AppManagerTest extends TestCase { ->with('defaultapp', $this->anything()) ->willReturn($defaultApps); + $this->config->expects($this->once()) + ->method('getUserValue') + ->with('user1', 'core', 'defaultapp') + ->willReturn(''); + $this->assertEquals($expectedApp, $this->manager->getDefaultAppForUser()); } } diff --git a/tests/lib/Authentication/Token/PublicKeyTokenProviderTest.php b/tests/lib/Authentication/Token/PublicKeyTokenProviderTest.php index a614780a908..e37ef68852d 100644 --- a/tests/lib/Authentication/Token/PublicKeyTokenProviderTest.php +++ b/tests/lib/Authentication/Token/PublicKeyTokenProviderTest.php @@ -38,6 +38,7 @@ use OCP\AppFramework\Utility\ITimeFactory; use OCP\IConfig; use OCP\IDBConnection; use OCP\Security\ICrypto; +use OCP\Security\IHasher; use PHPUnit\Framework\MockObject\MockObject; use Psr\Log\LoggerInterface; use Test\TestCase; @@ -47,6 +48,8 @@ class PublicKeyTokenProviderTest extends TestCase { private $tokenProvider; /** @var PublicKeyTokenMapper|\PHPUnit\Framework\MockObject\MockObject */ private $mapper; + /** @var IHasher|\PHPUnit\Framework\MockObject\MockObject */ + private $hasher; /** @var ICrypto */ private $crypto; /** @var IConfig|\PHPUnit\Framework\MockObject\MockObject */ diff --git a/tests/lib/Contacts/ContactsMenu/Providers/LocalTimeProviderTest.php b/tests/lib/Contacts/ContactsMenu/Providers/LocalTimeProviderTest.php index 96fb7909d6b..5b4589de317 100644 --- a/tests/lib/Contacts/ContactsMenu/Providers/LocalTimeProviderTest.php +++ b/tests/lib/Contacts/ContactsMenu/Providers/LocalTimeProviderTest.php @@ -46,6 +46,8 @@ class LocalTimeProviderTest extends TestCase { private $actionFactory; /** @var IL10N|MockObject */ private $l; + /** @var IL10NFactory|MockObject */ + private $l10nFactory; /** @var IURLGenerator|MockObject */ private $urlGenerator; /** @var IUserManager|MockObject */ diff --git a/tests/lib/Http/Client/ClientTest.php b/tests/lib/Http/Client/ClientTest.php index e48e237e0cc..3cef9d75986 100644 --- a/tests/lib/Http/Client/ClientTest.php +++ b/tests/lib/Http/Client/ClientTest.php @@ -36,6 +36,7 @@ class ClientTest extends \Test\TestCase { private $config; /** @var IRemoteHostValidator|MockObject */ private IRemoteHostValidator $remoteHostValidator; + private LoggerInterface $logger; /** @var array */ private $defaultRequestOptions; diff --git a/tests/lib/TextProcessing/TextProcessingTest.php b/tests/lib/TextProcessing/TextProcessingTest.php index 3bda73e995b..15f36cb2452 100644 --- a/tests/lib/TextProcessing/TextProcessingTest.php +++ b/tests/lib/TextProcessing/TextProcessingTest.php @@ -19,6 +19,7 @@ use OC\TextProcessing\RemoveOldTasksBackgroundJob; use OC\TextProcessing\TaskBackgroundJob; use OCP\AppFramework\Db\DoesNotExistException; use OCP\AppFramework\Utility\ITimeFactory; +use OCP\BackgroundJob\IJobList; use OCP\Common\Exception\NotFoundException; use OCP\EventDispatcher\IEventDispatcher; use OCP\IConfig; @@ -90,6 +91,14 @@ class FreePromptProvider implements IProvider { class TextProcessingTest extends \Test\TestCase { private IManager $manager; private Coordinator $coordinator; + private array $providers; + private IServerContainer $serverContainer; + private IEventDispatcher $eventDispatcher; + private RegistrationContext $registrationContext; + private \DateTimeImmutable $currentTime; + private TaskMapper $taskMapper; + private array $tasksDb; + private IJobList $jobList; protected function setUp(): void { parent::setUp(); -- 2.39.5