From 647a8d840981056db91bce63e8cd318bd1a8b82e Mon Sep 17 00:00:00 2001 From: Christoph Wurst Date: Thu, 5 Jun 2025 13:54:57 +0200 Subject: [PATCH] refactor: remove unused properties Signed-off-by: Christoph Wurst --- lib/Folder.php | 6 +----- lib/Http/Middleware/ProvisioningMiddleware.php | 8 +------- lib/IMAP/FolderMapper.php | 3 --- lib/Listener/NewMessagesSummarizeListener.php | 4 ---- lib/Migration/MigrateImportantFromImapAndDb.php | 4 +--- lib/PhishingDetectionList.php | 2 -- lib/Service/AvatarService.php | 7 ------- lib/Service/MailManager.php | 4 ++-- lib/Service/OutboxService.php | 6 +----- lib/Service/Search/MailSearch.php | 6 ------ lib/Service/Search/SearchQuery.php | 3 --- lib/Service/SmimeService.php | 7 ++----- lib/Service/Sync/SyncService.php | 12 +++--------- lib/SetupChecks/MailConnectionPerformance.php | 2 -- .../Service/OutboxServiceIntegrationTest.php | 7 +------ .../Http/Middleware/ProvisioningMiddlewareTest.php | 6 ------ tests/Unit/IMAP/FolderMapperTest.php | 12 ++++++------ .../Listener/NewMessagesSummarizeListenerTest.php | 9 --------- tests/Unit/Service/AvatarServiceTest.php | 10 ---------- tests/Unit/Service/MailManagerTest.php | 6 +++--- tests/Unit/Service/OutboxServiceTest.php | 6 ------ tests/Unit/Service/Search/MailSearchTest.php | 6 ------ tests/Unit/Service/SmimeServiceTest.php | 6 ------ tests/Unit/Service/Sync/SyncServiceTest.php | 6 ------ .../SetupChecks/MailConnectionPerformanceTest.php | 4 ---- 25 files changed, 21 insertions(+), 131 deletions(-) diff --git a/lib/Folder.php b/lib/Folder.php index f53c9d25e1..35a1581ebe 100644 --- a/lib/Folder.php +++ b/lib/Folder.php @@ -12,8 +12,6 @@ use Horde_Imap_Client_Mailbox; class Folder { - /** @var int */ - private $accountId; /** @var Horde_Imap_Client_Mailbox */ private $mailbox; @@ -32,12 +30,10 @@ class Folder { private ?string $myAcls; - public function __construct(int $accountId, - Horde_Imap_Client_Mailbox $mailbox, + public function __construct(Horde_Imap_Client_Mailbox $mailbox, array $attributes, ?string $delimiter, ?array $status) { - $this->accountId = $accountId; $this->mailbox = $mailbox; $this->attributes = $attributes; $this->delimiter = $delimiter; diff --git a/lib/Http/Middleware/ProvisioningMiddleware.php b/lib/Http/Middleware/ProvisioningMiddleware.php index 441f423de5..2b7bff8cb4 100644 --- a/lib/Http/Middleware/ProvisioningMiddleware.php +++ b/lib/Http/Middleware/ProvisioningMiddleware.php @@ -15,7 +15,6 @@ use OCP\Authentication\Exceptions\PasswordUnavailableException; use OCP\Authentication\LoginCredentials\IStore as ICredentialStore; use OCP\IUserSession; -use Psr\Log\LoggerInterface; class ProvisioningMiddleware extends Middleware { /** @var IUserSession */ @@ -27,17 +26,12 @@ class ProvisioningMiddleware extends Middleware { /** @var ProvisioningManager */ private $provisioningManager; - /** @var LoggerInterface */ - private $logger; - public function __construct(IUserSession $userSession, ICredentialStore $credentialStore, - ProvisioningManager $provisioningManager, - LoggerInterface $logger) { + ProvisioningManager $provisioningManager) { $this->userSession = $userSession; $this->credentialStore = $credentialStore; $this->provisioningManager = $provisioningManager; - $this->logger = $logger; } #[\Override] diff --git a/lib/IMAP/FolderMapper.php b/lib/IMAP/FolderMapper.php index f8892e3cf2..bcfc2e93a4 100644 --- a/lib/IMAP/FolderMapper.php +++ b/lib/IMAP/FolderMapper.php @@ -65,7 +65,6 @@ public function getFolders(Account $account, Horde_Imap_Client_Socket $client, }); return array_map(static function (array $mailbox) use ($account) { return new Folder( - $account->getId(), $mailbox['mailbox'], $mailbox['attributes'], $mailbox['delimiter'], @@ -75,7 +74,6 @@ public function getFolders(Account $account, Horde_Imap_Client_Socket $client, } public function createFolder(Horde_Imap_Client_Socket $client, - Account $account, string $name): Folder { $client->createMailbox($name); @@ -92,7 +90,6 @@ public function createFolder(Horde_Imap_Client_Socket $client, } return new Folder( - $account->getId(), $mb['mailbox'], $mb['attributes'], $mb['delimiter'], diff --git a/lib/Listener/NewMessagesSummarizeListener.php b/lib/Listener/NewMessagesSummarizeListener.php index 833db6bb4b..45e53bad63 100644 --- a/lib/Listener/NewMessagesSummarizeListener.php +++ b/lib/Listener/NewMessagesSummarizeListener.php @@ -9,10 +9,8 @@ namespace OCA\Mail\Listener; -use OCA\Mail\Contracts\IMailManager; use OCA\Mail\Events\NewMessagesSynchronized; use OCA\Mail\Exception\ServiceException; -use OCA\Mail\IMAP\IMAPClientFactory; use OCA\Mail\Service\AiIntegrations\AiIntegrationsService; use OCP\AppFramework\Services\IAppConfig; use OCP\EventDispatcher\Event; @@ -26,9 +24,7 @@ class NewMessagesSummarizeListener implements IEventListener { public function __construct( private LoggerInterface $logger, - private IMAPClientFactory $imapFactory, private AiIntegrationsService $aiService, - private IMailManager $mailManager, private IAppConfig $appConfig, ) { } diff --git a/lib/Migration/MigrateImportantFromImapAndDb.php b/lib/Migration/MigrateImportantFromImapAndDb.php index f8da7cd798..6412519fbf 100644 --- a/lib/Migration/MigrateImportantFromImapAndDb.php +++ b/lib/Migration/MigrateImportantFromImapAndDb.php @@ -16,13 +16,11 @@ use OCA\Mail\Db\MailboxMapper; use OCA\Mail\Db\Tag; use OCA\Mail\Exception\ServiceException; -use OCA\Mail\IMAP\IMAPClientFactory; use OCA\Mail\IMAP\MessageMapper; use Psr\Log\LoggerInterface; class MigrateImportantFromImapAndDb { - /** @var IMAPClientFactory */ - private $clientFactory; + /** @var MessageMapper */ private $messageMapper; diff --git a/lib/PhishingDetectionList.php b/lib/PhishingDetectionList.php index bfebff6dd2..2beb82d90e 100644 --- a/lib/PhishingDetectionList.php +++ b/lib/PhishingDetectionList.php @@ -17,8 +17,6 @@ class PhishingDetectionList implements JsonSerializable { /** @var PhishingDetectionResult[] */ private array $checks; - private bool $warning = false; - /** * @param PhishingDetectionResult[] $checks */ diff --git a/lib/Service/AvatarService.php b/lib/Service/AvatarService.php index 50c2430d46..214287150d 100644 --- a/lib/Service/AvatarService.php +++ b/lib/Service/AvatarService.php @@ -16,7 +16,6 @@ use OCA\Mail\Service\Avatar\Cache as AvatarCache; use OCA\Mail\Service\Avatar\CompositeAvatarSource; use OCA\Mail\Service\Avatar\Downloader; -use OCP\IURLGenerator; class AvatarService implements IAvatarService { /** @var AvatarCache */ @@ -28,9 +27,6 @@ class AvatarService implements IAvatarService { /** @var CompositeAvatarSource */ private $source; - /** @var IURLGenerator */ - private $urlGenerator; - /** @var AvatarFactory */ private $avatarFactory; @@ -41,19 +37,16 @@ class AvatarService implements IAvatarService { * @param CompositeAvatarSource $source * @param Downloader $downloader * @param AvatarCache $cache - * @param IURLGenerator $urlGenerator * @param AvatarFactory $avatarFactory * @param IUserPreferences $preferences */ public function __construct(CompositeAvatarSource $source, Downloader $downloader, AvatarCache $cache, - IURLGenerator $urlGenerator, AvatarFactory $avatarFactory, IUserPreferences $preferences) { $this->source = $source; $this->cache = $cache; - $this->urlGenerator = $urlGenerator; $this->downloader = $downloader; $this->avatarFactory = $avatarFactory; $this->preferences = $preferences; diff --git a/lib/Service/MailManager.php b/lib/Service/MailManager.php index 6603c64c32..1055b50f8e 100644 --- a/lib/Service/MailManager.php +++ b/lib/Service/MailManager.php @@ -152,7 +152,7 @@ public function getMailboxes(Account $account): array { public function createMailbox(Account $account, string $name): Mailbox { $client = $this->imapClientFactory->getClient($account); try { - $folder = $this->folderMapper->createFolder($client, $account, $name); + $folder = $this->folderMapper->createFolder($client, $name); $this->folderMapper->fetchFolderAcls([$folder], $client); } catch (Horde_Imap_Client_Exception $e) { throw new ServiceException( @@ -809,7 +809,7 @@ public function filterFlags(Horde_Imap_Client_Socket $client, Account $account, if (in_array("\*", $capabilities['permflags']) || in_array($flag, $capabilities['permflags'])) { return [$flag]; } - + return []; } diff --git a/lib/Service/OutboxService.php b/lib/Service/OutboxService.php index d8f3247c0e..06bb53ef10 100644 --- a/lib/Service/OutboxService.php +++ b/lib/Service/OutboxService.php @@ -11,7 +11,6 @@ use OCA\Mail\Account; use OCA\Mail\Contracts\IMailManager; -use OCA\Mail\Contracts\IMailTransmission; use OCA\Mail\Db\LocalMessage; use OCA\Mail\Db\LocalMessageMapper; use OCA\Mail\Db\Recipient; @@ -29,8 +28,7 @@ use Throwable; class OutboxService { - /** @var IMailTransmission */ - private $transmission; + /** @var LocalMessageMapper */ private $mapper; @@ -57,7 +55,6 @@ class OutboxService { private $logger; public function __construct( - IMailTransmission $transmission, LocalMessageMapper $mapper, AttachmentService $attachmentService, IEventDispatcher $eventDispatcher, @@ -68,7 +65,6 @@ public function __construct( LoggerInterface $logger, private Chain $sendChain, ) { - $this->transmission = $transmission; $this->mapper = $mapper; $this->attachmentService = $attachmentService; $this->eventDispatcher = $eventDispatcher; diff --git a/lib/Service/Search/MailSearch.php b/lib/Service/Search/MailSearch.php index 611fcf858b..16f8ada442 100644 --- a/lib/Service/Search/MailSearch.php +++ b/lib/Service/Search/MailSearch.php @@ -13,7 +13,6 @@ use OCA\Mail\Account; use OCA\Mail\Contracts\IMailSearch; use OCA\Mail\Db\Mailbox; -use OCA\Mail\Db\MailboxMapper; use OCA\Mail\Db\Message; use OCA\Mail\Db\MessageMapper; use OCA\Mail\Exception\ClientException; @@ -30,9 +29,6 @@ class MailSearch implements IMailSearch { /** @var FilterStringParser */ private $filterStringParser; - /** @var MailboxMapper */ - private $mailboxMapper; - /** @var ImapSearchProvider */ private $imapSearchProvider; @@ -46,13 +42,11 @@ class MailSearch implements IMailSearch { private $timeFactory; public function __construct(FilterStringParser $filterStringParser, - MailboxMapper $mailboxMapper, ImapSearchProvider $imapSearchProvider, MessageMapper $messageMapper, PreviewEnhancer $previewEnhancer, ITimeFactory $timeFactory) { $this->filterStringParser = $filterStringParser; - $this->mailboxMapper = $mailboxMapper; $this->imapSearchProvider = $imapSearchProvider; $this->messageMapper = $messageMapper; $this->previewEnhancer = $previewEnhancer; diff --git a/lib/Service/Search/SearchQuery.php b/lib/Service/Search/SearchQuery.php index 9e18d6ade9..575a4e45d5 100644 --- a/lib/Service/Search/SearchQuery.php +++ b/lib/Service/Search/SearchQuery.php @@ -39,9 +39,6 @@ class SearchQuery { /** @var string[] */ private $bodies = []; - /** @var string[] */ - private $textTokens = []; - /** @var array[] */ private $tags = []; diff --git a/lib/Service/SmimeService.php b/lib/Service/SmimeService.php index 2885b359cf..4203f67387 100644 --- a/lib/Service/SmimeService.php +++ b/lib/Service/SmimeService.php @@ -31,7 +31,6 @@ use OCA\Mail\Model\SmimeCertificatePurposes; use OCA\Mail\Model\SmimeDecryptionResult; use OCP\AppFramework\Db\DoesNotExistException; -use OCP\AppFramework\Utility\ITimeFactory; use OCP\ICertificateManager; use OCP\ITempManager; use OCP\Security\ICrypto; @@ -41,18 +40,16 @@ class SmimeService { private ICertificateManager $certificateManager; private ICrypto $crypto; private SmimeCertificateMapper $certificateMapper; - private ITimeFactory $timeFactory; + public function __construct(ITempManager $tempManager, ICertificateManager $certificateManager, ICrypto $crypto, - SmimeCertificateMapper $certificateMapper, - ITimeFactory $timeFactory) { + SmimeCertificateMapper $certificateMapper) { $this->tempManager = $tempManager; $this->certificateManager = $certificateManager; $this->crypto = $crypto; $this->certificateMapper = $certificateMapper; - $this->timeFactory = $timeFactory; } /** diff --git a/lib/Service/Sync/SyncService.php b/lib/Service/Sync/SyncService.php index f7cbf740db..2d1d1181d9 100644 --- a/lib/Service/Sync/SyncService.php +++ b/lib/Service/Sync/SyncService.php @@ -12,7 +12,6 @@ use OCA\Mail\Account; use OCA\Mail\Contracts\IMailSearch; use OCA\Mail\Db\Mailbox; -use OCA\Mail\Db\MailboxMapper; use OCA\Mail\Db\Message; use OCA\Mail\Db\MessageMapper; use OCA\Mail\Exception\ClientException; @@ -30,7 +29,7 @@ use function array_map; class SyncService { - + private IMAPClientFactory $clientFactory; /** @var ImapToDbSynchronizer */ @@ -39,9 +38,6 @@ class SyncService { /** @var FilterStringParser */ private $filterStringParser; - /** @var MailboxMapper */ - private $mailboxMapper; - /** @var MessageMapper */ private $messageMapper; @@ -58,7 +54,6 @@ public function __construct( IMAPClientFactory $clientFactory, ImapToDbSynchronizer $synchronizer, FilterStringParser $filterStringParser, - MailboxMapper $mailboxMapper, MessageMapper $messageMapper, PreviewEnhancer $previewEnhancer, LoggerInterface $logger, @@ -66,7 +61,6 @@ public function __construct( $this->clientFactory = $clientFactory; $this->synchronizer = $synchronizer; $this->filterStringParser = $filterStringParser; - $this->mailboxMapper = $mailboxMapper; $this->messageMapper = $messageMapper; $this->previewEnhancer = $previewEnhancer; $this->logger = $logger; @@ -120,9 +114,9 @@ public function syncMailbox(Account $account, if ($partialOnly && !$mailbox->isCached()) { throw MailboxNotCachedException::from($mailbox); } - + $client = $this->clientFactory->getClient($account); - + $this->synchronizer->sync( $account, $client, diff --git a/lib/SetupChecks/MailConnectionPerformance.php b/lib/SetupChecks/MailConnectionPerformance.php index d7ac2ade77..b531c14235 100644 --- a/lib/SetupChecks/MailConnectionPerformance.php +++ b/lib/SetupChecks/MailConnectionPerformance.php @@ -13,7 +13,6 @@ use OCA\Mail\Db\MailAccountMapper; use OCA\Mail\Db\ProvisioningMapper; use OCA\Mail\Exception\ServiceException; -use OCA\Mail\IMAP\FolderMapper; use OCA\Mail\IMAP\IMAPClientFactory; use OCP\IL10N; use OCP\SetupCheck\ISetupCheck; @@ -28,7 +27,6 @@ public function __construct( private ProvisioningMapper $provisioningMapper, private MailAccountMapper $accountMapper, private IMAPClientFactory $clientFactory, - private FolderMapper $folderMapper, private MicroTime $microtime, ) { } diff --git a/tests/Integration/Service/OutboxServiceIntegrationTest.php b/tests/Integration/Service/OutboxServiceIntegrationTest.php index 1a6cc27a92..6908f7911b 100644 --- a/tests/Integration/Service/OutboxServiceIntegrationTest.php +++ b/tests/Integration/Service/OutboxServiceIntegrationTest.php @@ -15,7 +15,6 @@ use OCA\Mail\Account; use OCA\Mail\Contracts\IAttachmentService; use OCA\Mail\Contracts\IMailManager; -use OCA\Mail\Contracts\IMailTransmission; use OCA\Mail\Db\LocalAttachmentMapper; use OCA\Mail\Db\LocalMessage; use OCA\Mail\Db\LocalMessageMapper; @@ -57,9 +56,6 @@ class OutboxServiceIntegrationTest extends TestCase { /** @var IAttachmentService */ private $attachmentService; - /** @var IMailTransmission */ - private $transmission; - /** @var OutboxService */ private $outbox; @@ -105,7 +101,6 @@ protected function setUp(): void { ); $this->client = $this->getClient($this->account); $this->mapper = Server::get(LocalMessageMapper::class); - $this->transmission = Server::get(IMailTransmission::class); $this->eventDispatcher = Server::get(IEventDispatcher::class); $this->clientFactory = Server::get(IMAPClientFactory::class); $this->accountService = Server::get(AccountService::class); @@ -117,7 +112,7 @@ protected function setUp(): void { $delete = $qb->delete($this->mapper->getTableName()); $delete->execute(); - $this->outbox = new OutboxService($this->transmission, + $this->outbox = new OutboxService( $this->mapper, $this->attachmentService, $this->eventDispatcher, diff --git a/tests/Unit/Http/Middleware/ProvisioningMiddlewareTest.php b/tests/Unit/Http/Middleware/ProvisioningMiddlewareTest.php index a65f262f6e..689b832539 100644 --- a/tests/Unit/Http/Middleware/ProvisioningMiddlewareTest.php +++ b/tests/Unit/Http/Middleware/ProvisioningMiddlewareTest.php @@ -21,7 +21,6 @@ use OCP\IUser; use OCP\IUserSession; use PHPUnit\Framework\MockObject\MockObject; -use Psr\Log\LoggerInterface; class ProvisioningMiddlewareTest extends TestCase { /** @var IUserSession|MockObject */ @@ -33,9 +32,6 @@ class ProvisioningMiddlewareTest extends TestCase { /** @var Manager|MockObject */ private $provisioningManager; - /** @var LoggerInterface|MockObject */ - private $logger; - /** @var ProvisioningMiddleware */ private $middleware; @@ -45,13 +41,11 @@ protected function setUp(): void { $this->userSession = $this->createMock(IUserSession::class); $this->credentialStore = $this->createMock(IStore::class); $this->provisioningManager = $this->createMock(Manager::class); - $this->logger = $this->createMock(LoggerInterface::class); $this->middleware = new ProvisioningMiddleware( $this->userSession, $this->credentialStore, $this->provisioningManager, - $this->logger ); } diff --git a/tests/Unit/IMAP/FolderMapperTest.php b/tests/Unit/IMAP/FolderMapperTest.php index 38644c2d9b..c938fd280c 100644 --- a/tests/Unit/IMAP/FolderMapperTest.php +++ b/tests/Unit/IMAP/FolderMapperTest.php @@ -80,7 +80,7 @@ public function testGetFoldersNonExistent(): void { ], ]); $expected = [ - new Folder(27, new Horde_Imap_Client_Mailbox('INBOX'), [], '.', null), + new Folder(new Horde_Imap_Client_Mailbox('INBOX'), [], '.', null), ]; $folders = $this->mapper->getFolders($account, $client); @@ -115,8 +115,8 @@ public function testGetFolders(): void { ], ]); $expected = [ - new Folder(27, new Horde_Imap_Client_Mailbox('INBOX'), [], '.', null), - new Folder(27, new Horde_Imap_Client_Mailbox('Sent'), ['\sent'], '.', null), + new Folder(new Horde_Imap_Client_Mailbox('INBOX'), [], '.', null), + new Folder(new Horde_Imap_Client_Mailbox('Sent'), ['\sent'], '.', null), ]; $folders = $this->mapper->getFolders($account, $client); @@ -151,9 +151,9 @@ public function testCreateFolder(): void { ], ]); - $created = $this->mapper->createFolder($client, $account, 'new'); + $created = $this->mapper->createFolder($client, 'new'); - $expected = new Folder(42, new Horde_Imap_Client_Mailbox('new'), [], '.', ['unseen' => 0]); + $expected = new Folder(new Horde_Imap_Client_Mailbox('new'), [], '.', ['unseen' => 0]); $this->assertEquals($expected, $created); } @@ -239,7 +239,7 @@ public function testGetFoldersStatusAsObjectNullStats(): void { 'unseen' => 2, ], ]); - + $stats = $this->mapper->getFoldersStatusAsObject($client, ['INBOX']); self::assertArrayNotHasKey('INBOX', $stats); diff --git a/tests/Unit/Listener/NewMessagesSummarizeListenerTest.php b/tests/Unit/Listener/NewMessagesSummarizeListenerTest.php index df5e306729..9bc8c479e4 100644 --- a/tests/Unit/Listener/NewMessagesSummarizeListenerTest.php +++ b/tests/Unit/Listener/NewMessagesSummarizeListenerTest.php @@ -10,10 +10,8 @@ use ChristophWurst\Nextcloud\Testing\TestCase; use OCA\Mail\Account; -use OCA\Mail\Contracts\IMailManager; use OCA\Mail\Db\MailAccount; use OCA\Mail\Events\NewMessagesSynchronized; -use OCA\Mail\IMAP\IMAPClientFactory; use OCA\Mail\Listener\NewMessagesSummarizeListener; use OCA\Mail\Service\AiIntegrations\AiIntegrationsService; use OCP\AppFramework\Services\IAppConfig; @@ -24,25 +22,19 @@ class NewMessagesSummarizeListenerTest extends TestCase { private LoggerInterface $logger; private NewMessagesSummarizeListener $listener; - private IMAPClientFactory|MockObject $imapFactory; private AiIntegrationsService|MockObject $aiService; - private IMailManager|MockObject $mailManager; private IAppConfig|MockObject $appConfig; protected function setUp(): void { parent::setUp(); $this->logger = new TestLogger(); - $this->imapFactory = $this->createMock(IMAPClientFactory::class); $this->aiService = $this->createMock(AiIntegrationsService::class); - $this->mailManager = $this->createMock(IMailManager::class); $this->appConfig = $this->createMock(IAppConfig::class); $this->listener = new NewMessagesSummarizeListener( $this->logger, - $this->imapFactory, $this->aiService, - $this->mailManager, $this->appConfig ); } @@ -77,5 +69,4 @@ public function testLlmDisabled(): void { $this->listener->handle($event); } - } diff --git a/tests/Unit/Service/AvatarServiceTest.php b/tests/Unit/Service/AvatarServiceTest.php index 3e7da89dbc..8d2f96f31a 100644 --- a/tests/Unit/Service/AvatarServiceTest.php +++ b/tests/Unit/Service/AvatarServiceTest.php @@ -18,7 +18,6 @@ use OCA\Mail\Service\Avatar\Downloader; use OCA\Mail\Service\Avatar\IAvatarSource; use OCA\Mail\Service\AvatarService; -use OCP\IURLGenerator; use OCP\IUser; use PHPUnit\Framework\MockObject\MockObject; @@ -34,9 +33,6 @@ class AvatarServiceTest extends TestCase { /** @var Cache|MockObject */ private $cache; - /** @var IURLGenerator|MockObject */ - private $urlGenerator; - /** @var AvatarFactory|MockObject */ private $avatarFactory; @@ -55,21 +51,15 @@ protected function setUp(): void { $this->source = $this->createMock(CompositeAvatarSource::class); $this->downloader = $this->createMock(Downloader::class); $this->cache = $this->createMock(Cache::class); - $this->urlGenerator = $this->createMock(IURLGenerator::class); $this->avatarFactory = $this->createMock(AvatarFactory::class); $this->preferences = $this->createMock(IUserPreferences::class); - $this->user = $this->createConfiguredMock(IUser::class, [ - 'getUID' => 'test' - ]); $this->avatarService = new AvatarService( $this->source, $this->downloader, $this->cache, - $this->urlGenerator, $this->avatarFactory, $this->preferences, - $this->user ); } diff --git a/tests/Unit/Service/MailManagerTest.php b/tests/Unit/Service/MailManagerTest.php index e027ab04c5..5b3086811a 100644 --- a/tests/Unit/Service/MailManagerTest.php +++ b/tests/Unit/Service/MailManagerTest.php @@ -135,7 +135,7 @@ public function testCreateFolder() { $folder = $this->createMock(Folder::class); $this->folderMapper->expects($this->once()) ->method('createFolder') - ->with($this->equalTo($client), $this->equalTo($account), $this->equalTo('new')) + ->with($this->equalTo($client), $this->equalTo('new')) ->willReturn($folder); $this->folderMapper->expects($this->once()) ->method('fetchFolderAcls') @@ -351,7 +351,7 @@ public function testFilterFlagsWithDefinedKeyword() { $client->expects($this->exactly(2)) ->method('status') ->willReturn(['permflags' => ['\seen', '$junk', '$notjunk']]); - + // test keyword supported $this->assertEquals(['$junk'], $this->manager->filterFlags($client, $account, '$junk', 'INBOX')); // test keyword unsupported @@ -368,7 +368,7 @@ public function testFilterFlagsWithCustomKeyword() { ['permflags' => ['\seen', '$junk', '$notjunk', '\*']], ['permflags' => ['\seen', '$junk', '$notjunk']], ); - + // test custom keyword supported $this->assertEquals([Tag::LABEL_IMPORTANT], $this->manager->filterFlags($client, $account, Tag::LABEL_IMPORTANT, 'INBOX')); // test custom keyword unsupported diff --git a/tests/Unit/Service/OutboxServiceTest.php b/tests/Unit/Service/OutboxServiceTest.php index d5d1f1a130..8b9a00a705 100644 --- a/tests/Unit/Service/OutboxServiceTest.php +++ b/tests/Unit/Service/OutboxServiceTest.php @@ -22,7 +22,6 @@ use OCA\Mail\Send\Chain; use OCA\Mail\Service\AccountService; use OCA\Mail\Service\Attachment\AttachmentService; -use OCA\Mail\Service\MailTransmission; use OCA\Mail\Service\OutboxService; use OCP\AppFramework\Db\DoesNotExistException; use OCP\AppFramework\Utility\ITimeFactory; @@ -31,9 +30,6 @@ use Psr\Log\LoggerInterface; class OutboxServiceTest extends TestCase { - /** @var MailTransmission|MockObject */ - private $transmission; - /** @var LocalMessageMapper|MockObject */ private $mapper; @@ -68,7 +64,6 @@ class OutboxServiceTest extends TestCase { protected function setUp(): void { parent::setUp(); - $this->transmission = $this->createMock(MailTransmission::class); $this->mapper = $this->createMock(LocalMessageMapper::class); $this->attachmentService = $this->createMock(AttachmentService::class); $this->clientFactory = $this->createMock(IMAPClientFactory::class); @@ -78,7 +73,6 @@ protected function setUp(): void { $this->logger = $this->createMock(LoggerInterface::class); $this->chain = $this->createMock(Chain::class); $this->outboxService = new OutboxService( - $this->transmission, $this->mapper, $this->attachmentService, $this->createMock(EventDispatcher::class), diff --git a/tests/Unit/Service/Search/MailSearchTest.php b/tests/Unit/Service/Search/MailSearchTest.php index 0bace906db..8b5a66f6ba 100644 --- a/tests/Unit/Service/Search/MailSearchTest.php +++ b/tests/Unit/Service/Search/MailSearchTest.php @@ -12,7 +12,6 @@ use ChristophWurst\Nextcloud\Testing\TestCase; use OCA\Mail\Account; use OCA\Mail\Db\Mailbox; -use OCA\Mail\Db\MailboxMapper; use OCA\Mail\Db\Message; use OCA\Mail\Db\MessageMapper; use OCA\Mail\Exception\MailboxLockedException; @@ -30,9 +29,6 @@ class MailSearchTest extends TestCase { /** @var FilterStringParser|MockObject */ private $filterStringParser; - /** @var MockObject|MailboxMapper */ - private $mailboxMapper; - /** @var MailSearch */ private $search; @@ -52,7 +48,6 @@ protected function setUp(): void { parent::setUp(); $this->filterStringParser = $this->createMock(FilterStringParser::class); - $this->mailboxMapper = $this->createMock(MailboxMapper::class); $this->imapSearchProvider = $this->createMock(Provider::class); $this->messageMapper = $this->createMock(MessageMapper::class); $this->previewEnhancer = $this->createMock(PreviewEnhancer::class); @@ -60,7 +55,6 @@ protected function setUp(): void { $this->search = new MailSearch( $this->filterStringParser, - $this->mailboxMapper, $this->imapSearchProvider, $this->messageMapper, $this->previewEnhancer, diff --git a/tests/Unit/Service/SmimeServiceTest.php b/tests/Unit/Service/SmimeServiceTest.php index d44d4f0952..2940dc5da6 100644 --- a/tests/Unit/Service/SmimeServiceTest.php +++ b/tests/Unit/Service/SmimeServiceTest.php @@ -22,7 +22,6 @@ use OCA\Mail\Model\SmimeCertificateInfo; use OCA\Mail\Model\SmimeCertificatePurposes; use OCA\Mail\Service\SmimeService; -use OCP\AppFramework\Utility\ITimeFactory; use OCP\ICertificateManager; use OCP\ITempManager; use OCP\Security\ICrypto; @@ -43,9 +42,6 @@ class SmimeServiceTest extends TestCase { /** @var SmimeCertificateMapper|MockObject */ private $certificateMapper; - /** @var ITimeFactory|MockObject */ - private $timeFactory; - /** @var SmimeService&MockObject */ private $smimeService; @@ -56,14 +52,12 @@ protected function setUp(): void { $this->certificateManager = $this->createMock(ICertificateManager::class); $this->crypto = $this->createMock(ICrypto::class); $this->certificateMapper = $this->createMock(SmimeCertificateMapper::class); - $this->timeFactory = $this->createMock(ITimeFactory::class); $this->smimeService = new SmimeService( $this->tempManager, $this->certificateManager, $this->crypto, $this->certificateMapper, - $this->timeFactory ); } diff --git a/tests/Unit/Service/Sync/SyncServiceTest.php b/tests/Unit/Service/Sync/SyncServiceTest.php index 448c8cffda..9549596186 100644 --- a/tests/Unit/Service/Sync/SyncServiceTest.php +++ b/tests/Unit/Service/Sync/SyncServiceTest.php @@ -12,7 +12,6 @@ use Horde_Imap_Client_Socket; use OCA\Mail\Account; use OCA\Mail\Db\Mailbox; -use OCA\Mail\Db\MailboxMapper; use OCA\Mail\Db\MessageMapper; use OCA\Mail\Exception\MailboxNotCachedException; use OCA\Mail\IMAP\IMAPClientFactory; @@ -38,9 +37,6 @@ class SyncServiceTest extends TestCase { /** @var FilterStringParser */ private $filterStringParser; - /** @var MailboxMapper */ - private $mailboxMapper; - /** @var MessageMapper */ private $messageMapper; @@ -63,7 +59,6 @@ protected function setUp(): void { $this->client = $this->createMock(Horde_Imap_Client_Socket::class); $this->synchronizer = $this->createMock(ImapToDbSynchronizer::class); $this->filterStringParser = $this->createMock(FilterStringParser::class); - $this->mailboxMapper = $this->createMock(MailboxMapper::class); $this->messageMapper = $this->createMock(MessageMapper::class); $this->previewEnhancer = $this->createMock(PreviewEnhancer::class); $this->loggerInterface = $this->createMock(LoggerInterface::class); @@ -73,7 +68,6 @@ protected function setUp(): void { $this->clientFactory, $this->synchronizer, $this->filterStringParser, - $this->mailboxMapper, $this->messageMapper, $this->previewEnhancer, $this->loggerInterface, diff --git a/tests/Unit/SetupChecks/MailConnectionPerformanceTest.php b/tests/Unit/SetupChecks/MailConnectionPerformanceTest.php index 9f407c2f0a..f8354dd1c9 100644 --- a/tests/Unit/SetupChecks/MailConnectionPerformanceTest.php +++ b/tests/Unit/SetupChecks/MailConnectionPerformanceTest.php @@ -16,7 +16,6 @@ use OCA\Mail\Db\MailAccountMapper; use OCA\Mail\Db\ProvisioningMapper; use OCA\Mail\Exception\ServiceException; -use OCA\Mail\IMAP\FolderMapper; use OCA\Mail\IMAP\IMAPClientFactory; use OCA\Mail\SetupChecks\MailConnectionPerformance; use OCA\Mail\SetupChecks\MicroTime; @@ -32,7 +31,6 @@ class MailConnectionPerformanceTest extends TestCase { private ProvisioningMapper&MockObject $provisioningMapper; private MailAccountMapper&MockObject $accountMapper; private IMAPClientFactory&MockObject $clientFactory; - private FolderMapper&MockObject $folderMapper; private MicroTime&MockObject $microtime; private MailConnectionPerformance $check; @@ -44,7 +42,6 @@ protected function setUp(): void { $this->provisioningMapper = $this->createMock(ProvisioningMapper::class); $this->accountMapper = $this->createMock(MailAccountMapper::class); $this->clientFactory = $this->createMock(IMAPClientFactory::class); - $this->folderMapper = $this->createMock(FolderMapper::class); $this->microtime = $this->createMock(MicroTime::class); $this->check = new MailConnectionPerformance( @@ -53,7 +50,6 @@ protected function setUp(): void { $this->provisioningMapper, $this->accountMapper, $this->clientFactory, - $this->folderMapper, $this->microtime ); }