diff --git a/lib/Account.php b/lib/Account.php index 1bd89c997f..c2b965f236 100644 --- a/lib/Account.php +++ b/lib/Account.php @@ -7,6 +7,7 @@ * SPDX-FileCopyrightText: 2015-2016 owncloud, Inc. * SPDX-License-Identifier: AGPL-3.0-only */ + namespace OCA\Mail; use JsonSerializable; diff --git a/lib/BackgroundJob/ContextChat/SubmitContentJob.php b/lib/BackgroundJob/ContextChat/SubmitContentJob.php index 0f6ffabfe6..11619b92fe 100644 --- a/lib/BackgroundJob/ContextChat/SubmitContentJob.php +++ b/lib/BackgroundJob/ContextChat/SubmitContentJob.php @@ -108,7 +108,6 @@ protected function run($argument): void { return; } - $client = $this->clientFactory->getClient($account); $items = []; @@ -128,16 +127,13 @@ protected function run($argument): void { continue; } - // Skip encrypted messages if ($imapMessage->isEncrypted()) { continue; } - $fullMessage = $imapMessage->getFullMessage($imapMessage->getUid(), true); - $items[] = new ContentItem( "{$mailbox->getId()}:{$message->getId()}", $this->contextChatProvider->getId(), diff --git a/lib/BackgroundJob/MigrateImportantJob.php b/lib/BackgroundJob/MigrateImportantJob.php index 7cb27d06e7..c2cfaa2c71 100644 --- a/lib/BackgroundJob/MigrateImportantJob.php +++ b/lib/BackgroundJob/MigrateImportantJob.php @@ -12,7 +12,6 @@ use OCA\Mail\Account; use OCA\Mail\Db\MailAccountMapper; use OCA\Mail\Db\MailboxMapper; - use OCA\Mail\Exception\ServiceException; use OCA\Mail\IMAP\IMAPClientFactory; use OCA\Mail\Migration\MigrateImportantFromImapAndDb; diff --git a/lib/Command/UpdateAccount.php b/lib/Command/UpdateAccount.php index f21705d29c..b23605b010 100644 --- a/lib/Command/UpdateAccount.php +++ b/lib/Command/UpdateAccount.php @@ -32,7 +32,6 @@ final class UpdateAccount extends Command { public const ARGUMENT_SMTP_USER = 'smtp-user'; public const ARGUMENT_SMTP_PASSWORD = 'smtp-password'; - /** @var mapper */ private $mapper; diff --git a/lib/Controller/ContactIntegrationController.php b/lib/Controller/ContactIntegrationController.php index f34882342a..cb12aacd39 100644 --- a/lib/Controller/ContactIntegrationController.php +++ b/lib/Controller/ContactIntegrationController.php @@ -23,7 +23,6 @@ class ContactIntegrationController extends Controller { private ICache $cache; - public function __construct( string $appName, IRequest $request, diff --git a/lib/Controller/DraftsController.php b/lib/Controller/DraftsController.php index dae7f90fcb..89385b37e0 100644 --- a/lib/Controller/DraftsController.php +++ b/lib/Controller/DraftsController.php @@ -28,7 +28,6 @@ class DraftsController extends Controller { private ITimeFactory $timeFactory; - public function __construct( string $appName, private string $userId, diff --git a/lib/Controller/FilterController.php b/lib/Controller/FilterController.php index d7359db8e4..1429fd1a72 100644 --- a/lib/Controller/FilterController.php +++ b/lib/Controller/FilterController.php @@ -31,7 +31,6 @@ public function __construct( parent::__construct(Application::APP_ID, $request); } - /** * @psalm-return JSONResponse<200|404, array, array> */ diff --git a/lib/Controller/MailboxesApiController.php b/lib/Controller/MailboxesApiController.php index 9dcf555499..bf5d65de62 100644 --- a/lib/Controller/MailboxesApiController.php +++ b/lib/Controller/MailboxesApiController.php @@ -69,8 +69,6 @@ public function list(int $accountId): DataResponse { return new DataResponse($mailboxes, Http::STATUS_OK); } - - /** * List the newest messages in a mailbox of the user which is currently logged-in * diff --git a/lib/Controller/MessageApiController.php b/lib/Controller/MessageApiController.php index b78cf6747e..b628c8a9dc 100644 --- a/lib/Controller/MessageApiController.php +++ b/lib/Controller/MessageApiController.php @@ -5,6 +5,7 @@ * SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later */ + namespace OCA\Mail\Controller; use OCA\Mail\Contracts\IDkimService; @@ -140,7 +141,6 @@ public function send( return new DataResponse('Recipients cannot be empty.', Http::STATUS_BAD_REQUEST); } - try { $messageAttachments = $this->handleAttachments(); } catch (UploadException $e) { diff --git a/lib/Controller/MessagesController.php b/lib/Controller/MessagesController.php index eb076c9f24..e3b25e4148 100755 --- a/lib/Controller/MessagesController.php +++ b/lib/Controller/MessagesController.php @@ -642,7 +642,6 @@ public function getHtmlBody(int $id, bool $plain = false): Response { } } - $htmlResponse = $plain ? HtmlResponse::plain($html) : HtmlResponse::withResizer( @@ -1016,7 +1015,6 @@ public function smartReply(int $messageId):JSONResponse { return new JSONResponse([], Http::STATUS_NO_CONTENT); } return new JSONResponse($replies); - } /** diff --git a/lib/Controller/PreferencesController.php b/lib/Controller/PreferencesController.php index 6ab85f2817..620de4641a 100644 --- a/lib/Controller/PreferencesController.php +++ b/lib/Controller/PreferencesController.php @@ -59,7 +59,6 @@ public function update($key, $value): JSONResponse { throw new ClientException('key or value missing'); } - $newValue = $this->userPreference->setPreference($this->userId, $key, $value); return new JSONResponse([ diff --git a/lib/Controller/SettingsController.php b/lib/Controller/SettingsController.php index 4890f69227..82db5b05cd 100644 --- a/lib/Controller/SettingsController.php +++ b/lib/Controller/SettingsController.php @@ -21,7 +21,6 @@ use OCP\IConfig; use OCP\IRequest; use Psr\Container\ContainerInterface; - use function array_merge; #[OpenAPI(scope: OpenAPI::SCOPE_IGNORE)] diff --git a/lib/Db/Actions.php b/lib/Db/Actions.php index 5b4b64793e..da4afc7ee5 100644 --- a/lib/Db/Actions.php +++ b/lib/Db/Actions.php @@ -47,7 +47,6 @@ public function jsonSerialize() { 'accountId' => $this->getAccountId(), 'actionSteps' => $this->actionSteps, 'icon' => $this->icon, - ]; } } diff --git a/lib/Db/ActionsMapper.php b/lib/Db/ActionsMapper.php index f04319fbe1..6970a50c8e 100644 --- a/lib/Db/ActionsMapper.php +++ b/lib/Db/ActionsMapper.php @@ -53,5 +53,4 @@ public function findAll(string $owner) { return $this->findEntities($qb); } - } diff --git a/lib/Db/MailboxMapper.php b/lib/Db/MailboxMapper.php index ccae2d48ce..7ece9a8a1f 100644 --- a/lib/Db/MailboxMapper.php +++ b/lib/Db/MailboxMapper.php @@ -128,7 +128,6 @@ public function findByIds(array $ids): array { return $this->findEntities($select); } - /** * @param int $id * @param string $uid diff --git a/lib/Db/MessageMapper.php b/lib/Db/MessageMapper.php index 02399b0718..1d80e55049 100644 --- a/lib/Db/MessageMapper.php +++ b/lib/Db/MessageMapper.php @@ -468,7 +468,6 @@ public function updateBulk(Account $account, bool $permflagsEnabled, Message ... } } - try { // UPDATE messages SET flag true/false WHERE uid in (uids) -> for each flag // => total of 20 queries @@ -949,7 +948,6 @@ public function findIdsByQuery(Mailbox $mailbox, SearchQuery $query, string $sor ); } - if ($query->getHasAttachments()) { $select->andWhere( $qb->expr()->eq('m.flag_attachments', $qb->createNamedParameter($query->getHasAttachments(), IQueryBuilder::PARAM_INT)) diff --git a/lib/Db/MessageTagsMapper.php b/lib/Db/MessageTagsMapper.php index 9847bd78a9..3fdc8d7dad 100644 --- a/lib/Db/MessageTagsMapper.php +++ b/lib/Db/MessageTagsMapper.php @@ -28,7 +28,6 @@ public function getMessagesByTag(int $id): array { ->from($this->getTableName()) ->where( $qb->expr()->eq('tag_id', $qb->createNamedParameter($id, IQueryBuilder::PARAM_INT)), - ); return $this->findEntities($qb); } diff --git a/lib/Db/TextBlockShareMapper.php b/lib/Db/TextBlockShareMapper.php index 354e568cab..42567a4ef9 100644 --- a/lib/Db/TextBlockShareMapper.php +++ b/lib/Db/TextBlockShareMapper.php @@ -96,5 +96,4 @@ public function deleteByTextBlockId(int $textBlockId): void { ); } - } diff --git a/lib/HordeTranslationHandler.php b/lib/HordeTranslationHandler.php index 8eeaba8cdb..4022ddd4be 100644 --- a/lib/HordeTranslationHandler.php +++ b/lib/HordeTranslationHandler.php @@ -5,6 +5,7 @@ * SPDX-FileCopyrightText: 2014-2016 ownCloud, Inc. * SPDX-License-Identifier: AGPL-3.0-only */ + namespace OCA\Mail; use Horde_Translation_Handler; diff --git a/lib/IMAP/ImapMessageFetcher.php b/lib/IMAP/ImapMessageFetcher.php index 693465df79..71ff349e50 100644 --- a/lib/IMAP/ImapMessageFetcher.php +++ b/lib/IMAP/ImapMessageFetcher.php @@ -73,7 +73,6 @@ public function __construct( ) { } - /** * Configure the fetcher to fetch the body of the message. * @@ -170,7 +169,6 @@ public function fetchMessage(?Horde_Imap_Client_Data_Fetch $fetch = null): IMAPM throw new DoesNotExistException("This email ($this->uid) can't be found. Probably it was deleted from the server recently. Please reload."); } - $decryptionResult = $this->smimeService->decryptDataFetch($fullTextFetch, $this->userId); $isSigned = $decryptionResult->isSigned(); $signatureIsValid = $decryptionResult->isSignatureValid(); diff --git a/lib/IMAP/MessageMapper.php b/lib/IMAP/MessageMapper.php index bd6174c0f3..ac657cb2c5 100644 --- a/lib/IMAP/MessageMapper.php +++ b/lib/IMAP/MessageMapper.php @@ -977,7 +977,6 @@ public function getBodyStructureData(Horde_Imap_Client_Socket $client, return $this->converter->convert($structure); }; - $htmlBody = ($htmlBodyId !== null) ? $part->getBodyPart($htmlBodyId) : null; if (!empty($htmlBody)) { $htmlBody = $convertBody($htmlBodyId, $htmlBody); diff --git a/lib/IMAP/PreviewEnhancer.php b/lib/IMAP/PreviewEnhancer.php index 4203f5a436..3f67545379 100644 --- a/lib/IMAP/PreviewEnhancer.php +++ b/lib/IMAP/PreviewEnhancer.php @@ -77,7 +77,6 @@ public function process(Account $account, Mailbox $mailbox, array $messages, boo return $messages; } - try { $data = $this->imapMapper->getBodyStructureData( $client, diff --git a/lib/Listener/AccountSynchronizedThreadUpdaterListener.php b/lib/Listener/AccountSynchronizedThreadUpdaterListener.php index a74277a702..1e21cb4c87 100644 --- a/lib/Listener/AccountSynchronizedThreadUpdaterListener.php +++ b/lib/Listener/AccountSynchronizedThreadUpdaterListener.php @@ -18,7 +18,6 @@ use OCA\Mail\IMAP\Threading\ThreadBuilder; use OCP\EventDispatcher\Event; use OCP\EventDispatcher\IEventListener; - use function array_chunk; use function gc_collect_cycles; use function iterator_to_array; diff --git a/lib/Migration/MigrateImportantFromImapAndDb.php b/lib/Migration/MigrateImportantFromImapAndDb.php index 97f4b33664..46357fc198 100644 --- a/lib/Migration/MigrateImportantFromImapAndDb.php +++ b/lib/Migration/MigrateImportantFromImapAndDb.php @@ -24,7 +24,6 @@ */ class MigrateImportantFromImapAndDb { - public function __construct( private MessageMapper $messageMapper, private MailboxMapper $mailboxMapper, diff --git a/lib/Migration/Version4000Date20240716172702.php b/lib/Migration/Version4000Date20240716172702.php index a568cdd94c..aa63f04ff1 100644 --- a/lib/Migration/Version4000Date20240716172702.php +++ b/lib/Migration/Version4000Date20240716172702.php @@ -54,5 +54,4 @@ public function changeSchema(IOutput $output, Closure $schemaClosure, array $opt return $schema; } - } diff --git a/lib/Migration/Version4001Date20241009140707.php b/lib/Migration/Version4001Date20241009140707.php index bbc61840cc..b25e3ab693 100644 --- a/lib/Migration/Version4001Date20241009140707.php +++ b/lib/Migration/Version4001Date20241009140707.php @@ -20,7 +20,6 @@ */ class Version4001Date20241009140707 extends SimpleMigrationStep { - /** * @param IOutput $output * @param Closure(): ISchemaWrapper $schemaClosure diff --git a/lib/Migration/Version5200Date20250728000000.php b/lib/Migration/Version5200Date20250728000000.php index b7f3e18a75..6563e7eb9f 100644 --- a/lib/Migration/Version5200Date20250728000000.php +++ b/lib/Migration/Version5200Date20250728000000.php @@ -60,5 +60,4 @@ public function changeSchema(IOutput $output, Closure $schemaClosure, array $opt return $schema; } - } diff --git a/lib/Model/IMAPMessage.php b/lib/Model/IMAPMessage.php index a181f74426..ed9d95a144 100644 --- a/lib/Model/IMAPMessage.php +++ b/lib/Model/IMAPMessage.php @@ -239,7 +239,6 @@ public function getSentDate(): Horde_Imap_Client_DateTime { return $this->imapDate; } - /** * @param int $id * diff --git a/lib/Notification/Notifier.php b/lib/Notification/Notifier.php index a89684a382..ba00b2c690 100644 --- a/lib/Notification/Notifier.php +++ b/lib/Notification/Notifier.php @@ -40,7 +40,6 @@ public function getName(): string { return $this->factory->get(Application::APP_ID)->t('Mail'); } - #[\Override] public function prepare(INotification $notification, string $languageCode): INotification { if ($notification->getApp() !== Application::APP_ID) { diff --git a/lib/PhishingDetectionResult.php b/lib/PhishingDetectionResult.php index 83c4b130ec..3081f19c85 100644 --- a/lib/PhishingDetectionResult.php +++ b/lib/PhishingDetectionResult.php @@ -6,6 +6,7 @@ * SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later */ + namespace OCA\Mail; use JsonSerializable; diff --git a/lib/Provider/Command/MessageSend.php b/lib/Provider/Command/MessageSend.php index bad5ea7dd4..494e4791e2 100644 --- a/lib/Provider/Command/MessageSend.php +++ b/lib/Provider/Command/MessageSend.php @@ -6,6 +6,7 @@ * SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later */ + namespace OCA\Mail\Provider\Command; use OCA\Mail\Db\LocalAttachment; diff --git a/lib/Provider/MailProvider.php b/lib/Provider/MailProvider.php index e24497faa0..a806faa717 100644 --- a/lib/Provider/MailProvider.php +++ b/lib/Provider/MailProvider.php @@ -6,6 +6,7 @@ * SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later */ + namespace OCA\Mail\Provider; use OCA\Mail\Account; diff --git a/lib/Provider/MailService.php b/lib/Provider/MailService.php index c140adfc9a..c4830caceb 100644 --- a/lib/Provider/MailService.php +++ b/lib/Provider/MailService.php @@ -6,6 +6,7 @@ * SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later */ + namespace OCA\Mail\Provider; use OCA\Mail\Provider\Command\MessageSend; @@ -16,7 +17,6 @@ use OCP\Mail\Provider\IMessageSend; use OCP\Mail\Provider\IService; use OCP\Mail\Provider\Message; - use Psr\Container\ContainerInterface; class MailService implements IService, IMessageSend { diff --git a/lib/Send/AHandler.php b/lib/Send/AHandler.php index b1aa900cc7..85e283dce4 100644 --- a/lib/Send/AHandler.php +++ b/lib/Send/AHandler.php @@ -5,6 +5,7 @@ * SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later */ + namespace OCA\Mail\Send; use Horde_Imap_Client_Socket; diff --git a/lib/Send/AntiAbuseHandler.php b/lib/Send/AntiAbuseHandler.php index 17d84aaf8d..d6a19cf9f6 100644 --- a/lib/Send/AntiAbuseHandler.php +++ b/lib/Send/AntiAbuseHandler.php @@ -5,6 +5,7 @@ * SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later */ + namespace OCA\Mail\Send; use Horde_Imap_Client_Socket; diff --git a/lib/Send/Chain.php b/lib/Send/Chain.php index a55aeebbee..5e7d60c204 100644 --- a/lib/Send/Chain.php +++ b/lib/Send/Chain.php @@ -5,6 +5,7 @@ * SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later */ + namespace OCA\Mail\Send; use OCA\Mail\Account; diff --git a/lib/Send/CopySentMessageHandler.php b/lib/Send/CopySentMessageHandler.php index dffe3b08b9..068e6254ff 100644 --- a/lib/Send/CopySentMessageHandler.php +++ b/lib/Send/CopySentMessageHandler.php @@ -5,6 +5,7 @@ * SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later */ + namespace OCA\Mail\Send; use Horde_Imap_Client_Exception; diff --git a/lib/Send/FlagRepliedMessageHandler.php b/lib/Send/FlagRepliedMessageHandler.php index d0982579ce..7aa46ebe51 100644 --- a/lib/Send/FlagRepliedMessageHandler.php +++ b/lib/Send/FlagRepliedMessageHandler.php @@ -5,6 +5,7 @@ * SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later */ + namespace OCA\Mail\Send; use Horde_Imap_Client; diff --git a/lib/Send/SendHandler.php b/lib/Send/SendHandler.php index c3df8f6aa9..38e1d47690 100644 --- a/lib/Send/SendHandler.php +++ b/lib/Send/SendHandler.php @@ -5,6 +5,7 @@ * SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later */ + namespace OCA\Mail\Send; use Horde_Imap_Client_Socket; diff --git a/lib/Send/SentMailboxHandler.php b/lib/Send/SentMailboxHandler.php index c86b4fcb61..298fffd0b5 100644 --- a/lib/Send/SentMailboxHandler.php +++ b/lib/Send/SentMailboxHandler.php @@ -5,6 +5,7 @@ * SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later */ + namespace OCA\Mail\Send; use Horde_Imap_Client_Socket; diff --git a/lib/Service/AccountService.php b/lib/Service/AccountService.php index 10a7c56015..256b546e98 100644 --- a/lib/Service/AccountService.php +++ b/lib/Service/AccountService.php @@ -225,7 +225,6 @@ public function getAllAcounts(): array { return $this->mapper->getAllAccounts(); } - /** * @param string $currentUserId * @param int $accountId diff --git a/lib/Service/AiIntegrations/AiIntegrationsService.php b/lib/Service/AiIntegrations/AiIntegrationsService.php index 49243344cc..7b7dd449c0 100644 --- a/lib/Service/AiIntegrations/AiIntegrationsService.php +++ b/lib/Service/AiIntegrations/AiIntegrationsService.php @@ -31,7 +31,6 @@ use OCP\TextProcessing\SummaryTaskType; use OCP\TextProcessing\Task as TextProcessingTask; use Psr\Log\LoggerInterface; - use function array_map; use function implode; use function in_array; @@ -447,5 +446,4 @@ private function isPersonalEmail(IMAPMessage $imapMessage): bool { return true; } - } diff --git a/lib/Service/AiIntegrations/Cache.php b/lib/Service/AiIntegrations/Cache.php index 42e5312168..185fe8b50e 100644 --- a/lib/Service/AiIntegrations/Cache.php +++ b/lib/Service/AiIntegrations/Cache.php @@ -19,7 +19,6 @@ class Cache { /** @var ICache */ private $cache; - public function __construct(ICacheFactory $cacheFactory) { $this->cache = $cacheFactory->createLocal('mail.ai'); } @@ -32,7 +31,6 @@ public function buildUrlKey(array $ids): string { return base64_encode(json_encode($ids, JSON_THROW_ON_ERROR)); } - /** * @param array $ids * diff --git a/lib/Service/Attachment/AttachmentService.php b/lib/Service/Attachment/AttachmentService.php index 58ed117411..8f718d007c 100644 --- a/lib/Service/Attachment/AttachmentService.php +++ b/lib/Service/Attachment/AttachmentService.php @@ -95,7 +95,6 @@ public function addFileFromString( string $fileContents, ?string $contentId, ?string $disposition, - ): LocalAttachment { $attachment = new LocalAttachment(); $attachment->setUserId($userId); @@ -213,7 +212,6 @@ public function updateLocalMessageAttachments(string $userId, LocalMessage $mess return $this->mapper->findByLocalMessageId($userId, $message->getId()); } - /** * @param array $attachments * @return int[] @@ -388,7 +386,6 @@ private function hasDownloadPermissions(File $file, string $fileName): bool { if ($attributes->getAttribute('permissions', 'download') === false) { $this->logger->warning('Could not create attachment, no download permission for file: ' . $fileName); return false; - } } return true; diff --git a/lib/Service/Attachment/AttachmentStorage.php b/lib/Service/Attachment/AttachmentStorage.php index 94853dd1cf..1b3f87836b 100644 --- a/lib/Service/Attachment/AttachmentStorage.php +++ b/lib/Service/Attachment/AttachmentStorage.php @@ -91,9 +91,6 @@ public function saveContent(string $userId, int $attachmentId, string $fileConte $file->putContent($fileContent); } - - - /** * @param string $userId * @param int $attachmentId diff --git a/lib/Service/Classification/ImportanceClassifier.php b/lib/Service/Classification/ImportanceClassifier.php index eeb4d867a5..0d9bb1193e 100644 --- a/lib/Service/Classification/ImportanceClassifier.php +++ b/lib/Service/Classification/ImportanceClassifier.php @@ -327,7 +327,6 @@ private function trainWithCustomDataSet( return new ClassifierPipeline($persistedEstimator, $extractor); } - /** * @param Account $account * diff --git a/lib/Service/DelegationService.php b/lib/Service/DelegationService.php index a484ace858..f553940ae4 100644 --- a/lib/Service/DelegationService.php +++ b/lib/Service/DelegationService.php @@ -139,7 +139,6 @@ public function resolveLocalMessageUserId(int $localMessageId, string $currentUs return $this->resolveAccountUserId($accountId, $currentUserId); } - public function logDelegatedAction(string $currentUserId, string $effectiveUserId, string $logMessage): void { if ($currentUserId === $effectiveUserId) { return; @@ -166,7 +165,6 @@ private function notify(string $userId, string $currentUserId, Account $account, ->setSubject('account_delegation', [ 'id' => $account->getId(), 'account_email' => $account->getEmail(), - ]) ->setDateTime($time) ->setMessage('account_delegation_changed', [ diff --git a/lib/Service/DraftsService.php b/lib/Service/DraftsService.php index 712468926b..1224cb8499 100644 --- a/lib/Service/DraftsService.php +++ b/lib/Service/DraftsService.php @@ -126,7 +126,6 @@ public function updateMessage(Account $account, LocalMessage $message, array $to $ccRecipients = self::convertToRecipient($cc, Recipient::TYPE_CC); $bccRecipients = self::convertToRecipient($bcc, Recipient::TYPE_BCC); - $message = $this->mapper->updateWithRecipients($message, $toRecipients, $ccRecipients, $bccRecipients); if ($attachments === []) { diff --git a/lib/Service/IMipService.php b/lib/Service/IMipService.php index 7b784b2555..328ed0a0fb 100644 --- a/lib/Service/IMipService.php +++ b/lib/Service/IMipService.php @@ -21,7 +21,6 @@ use OCP\Calendar\IManager; use Psr\Log\LoggerInterface; use Throwable; - use function array_filter; class IMipService { diff --git a/lib/Service/MailFilter/FilterBuilder.php b/lib/Service/MailFilter/FilterBuilder.php index 870572c91c..a2bbc91f01 100644 --- a/lib/Service/MailFilter/FilterBuilder.php +++ b/lib/Service/MailFilter/FilterBuilder.php @@ -23,7 +23,6 @@ public function __construct( ) { } - public function buildSieveScript(array $filters, string $untouchedScript): string { $commands = []; $extensions = []; diff --git a/lib/Service/MimeMessage.php b/lib/Service/MimeMessage.php index 5a619379f8..ccc29d315a 100644 --- a/lib/Service/MimeMessage.php +++ b/lib/Service/MimeMessage.php @@ -236,7 +236,6 @@ private function buildPgpPart(string $content): Horde_Mime_Part { $basePart[] = $contentPart; return $basePart; - } /** diff --git a/lib/Service/OutboxService.php b/lib/Service/OutboxService.php index d9d1f59d6f..f4aee70355 100644 --- a/lib/Service/OutboxService.php +++ b/lib/Service/OutboxService.php @@ -29,7 +29,6 @@ class OutboxService { - /** @var IEventDispatcher */ private $eventDispatcher; diff --git a/lib/Service/PhishingDetection/LinkCheck.php b/lib/Service/PhishingDetection/LinkCheck.php index 8b77465317..882f618f3e 100644 --- a/lib/Service/PhishingDetection/LinkCheck.php +++ b/lib/Service/PhishingDetection/LinkCheck.php @@ -17,7 +17,6 @@ class LinkCheck { protected IL10N $l10n; - public function __construct(IL10N $l10n) { $this->l10n = $l10n; } diff --git a/lib/Service/PhishingDetection/ReplyToCheck.php b/lib/Service/PhishingDetection/ReplyToCheck.php index aadaa73180..fc3eac995e 100644 --- a/lib/Service/PhishingDetection/ReplyToCheck.php +++ b/lib/Service/PhishingDetection/ReplyToCheck.php @@ -28,7 +28,6 @@ public function run(string $fromEmail, ?string $replyToEmail) :PhishingDetection } return new PhishingDetectionResult(PhishingDetectionResult::REPLYTO_CHECK, true, $this->l10n->t('Reply-To email: %1$s is different from sender email: %2$s', [$replyToEmail, $fromEmail])); - } } diff --git a/lib/Service/PreprocessingService.php b/lib/Service/PreprocessingService.php index ebde7a729f..2c9390e09c 100644 --- a/lib/Service/PreprocessingService.php +++ b/lib/Service/PreprocessingService.php @@ -5,6 +5,7 @@ * SPDX-FileCopyrightText: 2022 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later */ + namespace OCA\Mail\Service; use OCA\Mail\Account; diff --git a/lib/Service/Search/FilterStringParser.php b/lib/Service/Search/FilterStringParser.php index 0713f0d33d..7cc8d192d4 100644 --- a/lib/Service/Search/FilterStringParser.php +++ b/lib/Service/Search/FilterStringParser.php @@ -127,7 +127,6 @@ private function parseFilterToken(SearchQuery $query, string $token): bool { } } - return true; } diff --git a/lib/Service/SmimeService.php b/lib/Service/SmimeService.php index bd261b7626..1e3c0cf3d8 100644 --- a/lib/Service/SmimeService.php +++ b/lib/Service/SmimeService.php @@ -40,7 +40,6 @@ class SmimeService { private ICertificateManager $certificateManager; private ICrypto $crypto; - public function __construct( ITempManager $tempManager, ICertificateManager $certificateManager, diff --git a/lib/Service/SnoozeService.php b/lib/Service/SnoozeService.php index ae45e8bcd8..56426923fa 100644 --- a/lib/Service/SnoozeService.php +++ b/lib/Service/SnoozeService.php @@ -231,7 +231,6 @@ public function unSnoozeThread( } } - /** * Adds a DB entry for the message with a wake timestamp * diff --git a/lib/Service/TextBlockService.php b/lib/Service/TextBlockService.php index 33c8b018c6..ec245edfe8 100644 --- a/lib/Service/TextBlockService.php +++ b/lib/Service/TextBlockService.php @@ -88,7 +88,6 @@ public function delete(int $textBlockId, string $userId): void { $this->textBlockShareMapper->deleteByTextBlockId($textBlockId); } - /** * @throws UserNotFoundException * @throws ShareeAlreadyExistsException diff --git a/lib/Service/TransmissionService.php b/lib/Service/TransmissionService.php index af3ac3c4a4..6832e920d3 100644 --- a/lib/Service/TransmissionService.php +++ b/lib/Service/TransmissionService.php @@ -5,6 +5,7 @@ * SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later */ + namespace OCA\Mail\Service; use Horde_Mime_Part; diff --git a/lib/Sieve/SieveClientFactory.php b/lib/Sieve/SieveClientFactory.php index fbe6d340d1..f39867271b 100644 --- a/lib/Sieve/SieveClientFactory.php +++ b/lib/Sieve/SieveClientFactory.php @@ -80,7 +80,6 @@ public function createClient(string $host, int $port, string $user, string $pass 'ssl' => [ 'verify_peer' => $this->config->getSystemValueBool('app.mail.verify-tls-peer', true), 'verify_peer_name' => $this->config->getSystemValueBool('app.mail.verify-tls-peer', true), - ] ], ]; diff --git a/tests/FolderTest.php b/tests/FolderTest.php index d4a4fade74..7492c24058 100644 --- a/tests/FolderTest.php +++ b/tests/FolderTest.php @@ -4,6 +4,7 @@ * SPDX-FileCopyrightText: 2017-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-only */ + namespace OCA\Mail\Tests; use ChristophWurst\Nextcloud\Testing\TestCase; diff --git a/tests/HordeTranslationHandlerTest.php b/tests/HordeTranslationHandlerTest.php index 4464731c00..be1516b7a8 100644 --- a/tests/HordeTranslationHandlerTest.php +++ b/tests/HordeTranslationHandlerTest.php @@ -4,6 +4,7 @@ * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-only */ + namespace OCA\Mail\Tests; use ChristophWurst\Nextcloud\Testing\TestCase; diff --git a/tests/Integration/Db/InternalAddressMapperTest.php b/tests/Integration/Db/InternalAddressMapperTest.php index 3cecc50999..f1be9f2b8d 100644 --- a/tests/Integration/Db/InternalAddressMapperTest.php +++ b/tests/Integration/Db/InternalAddressMapperTest.php @@ -55,7 +55,6 @@ public function testIndividualExists(): void { 'user_id' => $qb->createNamedParameter($uid), 'address' => $qb->createNamedParameter('hamza@next.cloud'), 'type' => $qb->createNamedParameter('individual') - ]) ->executeStatement(); @@ -72,7 +71,6 @@ public function testDomainExists(): void { 'user_id' => $qb->createNamedParameter($uid), 'address' => $qb->createNamedParameter('next.cloud'), 'type' => $qb->createNamedParameter('domain'), - ]) ->executeStatement(); diff --git a/tests/Integration/Db/RecipientTest.php b/tests/Integration/Db/RecipientTest.php index 623e977c8b..c3c4fa647b 100644 --- a/tests/Integration/Db/RecipientTest.php +++ b/tests/Integration/Db/RecipientTest.php @@ -24,7 +24,6 @@ public function testGettersSetters(): void { $recipient->setLabel('Penny'); $recipient->setEmail('penny@stardew-library.edu'); - $this->assertEquals(1, $recipient->getMessageId()); $this->assertEquals(100, $recipient->getLocalMessageId()); $this->assertEquals(Recipient::TYPE_TO, $recipient->getType()); diff --git a/tests/Integration/Db/TrustedSenderMapperTest.php b/tests/Integration/Db/TrustedSenderMapperTest.php index a066931ac7..f5cc85f5a1 100644 --- a/tests/Integration/Db/TrustedSenderMapperTest.php +++ b/tests/Integration/Db/TrustedSenderMapperTest.php @@ -70,7 +70,6 @@ public function testDomainExists(): void { 'user_id' => $qb->createNamedParameter($uid), 'email' => $qb->createNamedParameter('next.cloud'), 'type' => $qb->createNamedParameter('domain'), - ]) ->executeStatement(); diff --git a/tests/Integration/IMAP/ImapMessageFetcherIntegrationTest.php b/tests/Integration/IMAP/ImapMessageFetcherIntegrationTest.php index 7c5d2a73fd..4ebb47f160 100644 --- a/tests/Integration/IMAP/ImapMessageFetcherIntegrationTest.php +++ b/tests/Integration/IMAP/ImapMessageFetcherIntegrationTest.php @@ -35,7 +35,6 @@ class ImapMessageFetcherIntegrationTest extends TestCase { protected function setUp(): void { parent::setUp(); - $this->account = $this->createTestAccount(); $this->fetcherFactory = Server::get(ImapMessageFetcherFactory::class); $this->certificateMapper = Server::get(SmimeCertificateMapper::class); diff --git a/tests/Integration/IMAP/MessageMapperTest.php b/tests/Integration/IMAP/MessageMapperTest.php index fed6fa5bd4..d8e2fbd7e4 100644 --- a/tests/Integration/IMAP/MessageMapperTest.php +++ b/tests/Integration/IMAP/MessageMapperTest.php @@ -91,7 +91,6 @@ public function testTagging(): void { self::assertEquals('$label1', $tags[0]->getImapLabel()); } - // now we untag this message! $client = $this->getClient($account); try { diff --git a/tests/Integration/Service/AvatarServiceIntegrationTest.php b/tests/Integration/Service/AvatarServiceIntegrationTest.php index 8a2337c49b..5a84a77b0c 100644 --- a/tests/Integration/Service/AvatarServiceIntegrationTest.php +++ b/tests/Integration/Service/AvatarServiceIntegrationTest.php @@ -19,7 +19,6 @@ class AvatarServiceIntegrationTest extends TestCase { /** @var IAvatarService */ private $service; - private function clearCache() { /* @var $cacheFactory ICacheFactory */ $cacheFactory = Server::get(ICacheFactory::class); @@ -38,7 +37,6 @@ protected function setUp(): void { public function testJansGravatar() { $this->markTestSkipped('Unreliable test'); return; - $avatar = $this->service->getAvatar('hey@jancborchardt.net', 'john'); $this->assertNotNull($avatar); $this->assertEquals('https://secure.gravatar.com/avatar/2fd3f4d5d762955e5b603794a888fa97?size=128&d=404', $avatar->getUrl()); diff --git a/tests/Integration/Service/DraftServiceIntegrationTest.php b/tests/Integration/Service/DraftServiceIntegrationTest.php index 42931858ee..828fa89287 100644 --- a/tests/Integration/Service/DraftServiceIntegrationTest.php +++ b/tests/Integration/Service/DraftServiceIntegrationTest.php @@ -240,7 +240,6 @@ public function testSaveAndConvertToOutboxMessage(): void { $this->assertEquals(LocalMessage::TYPE_OUTGOING, $saved->getType()); } - public function testSaveAndSendMessage(): void { $message = new LocalMessage(); $message->setType(LocalMessage::TYPE_DRAFT); diff --git a/tests/Integration/Service/Phishing/PhishingDetectionServiceIntegrationTest.php b/tests/Integration/Service/Phishing/PhishingDetectionServiceIntegrationTest.php index 4590970d9d..72ef5606ce 100644 --- a/tests/Integration/Service/Phishing/PhishingDetectionServiceIntegrationTest.php +++ b/tests/Integration/Service/Phishing/PhishingDetectionServiceIntegrationTest.php @@ -5,13 +5,11 @@ * SPDX-License-Identifier: AGPL-3.0-or-later */ - namespace OCA\Mail\Tests\Integration\Service\Phishing; use ChristophWurst\Nextcloud\Testing\TestCase; use Horde_Mime_Headers; use OCA\Mail\Service\ContactsIntegration; - use OCA\Mail\Service\PhishingDetection\ContactCheck; use OCA\Mail\Service\PhishingDetection\CustomEmailCheck; use OCA\Mail\Service\PhishingDetection\DateCheck; @@ -21,7 +19,6 @@ use OCA\Mail\Service\PhishingDetection\ReplyToCheck; use OCP\AppFramework\Utility\ITimeFactory; use OCP\IL10N; - use PHPUnit\Framework\MockObject\MockObject; class PhishingDetectionServiceIntegrationTest extends TestCase { diff --git a/tests/Unit/AppInfo/ApplicationTest.php b/tests/Unit/AppInfo/ApplicationTest.php index 8f23796b37..b655268722 100644 --- a/tests/Unit/AppInfo/ApplicationTest.php +++ b/tests/Unit/AppInfo/ApplicationTest.php @@ -5,6 +5,7 @@ * SPDX-FileCopyrightText: 2015-2016 ownCloud, Inc. * SPDX-License-Identifier: AGPL-3.0-only */ + namespace OCA\Mail\Tests\Unit\AppInfo; use ChristophWurst\Nextcloud\Testing\TestCase; diff --git a/tests/Unit/BackgroundJob/ContextChat/SubmitContentJobTest.php b/tests/Unit/BackgroundJob/ContextChat/SubmitContentJobTest.php index 20ba81844e..1581c1aeb2 100644 --- a/tests/Unit/BackgroundJob/ContextChat/SubmitContentJobTest.php +++ b/tests/Unit/BackgroundJob/ContextChat/SubmitContentJobTest.php @@ -121,7 +121,6 @@ public function provideEvents(): array { ]; } - public function testRunWithoutContextChat(): void { $this->contentManager->expects($this->once()) ->method('isContextChatAvailable') diff --git a/tests/Unit/Controller/AccountApiControllerTest.php b/tests/Unit/Controller/AccountApiControllerTest.php index 010c08219c..fb051db2fd 100644 --- a/tests/Unit/Controller/AccountApiControllerTest.php +++ b/tests/Unit/Controller/AccountApiControllerTest.php @@ -162,7 +162,6 @@ public function testListWithDelegatedAccounts() { $ownMailAccount->setUserId(self::USER_ID); $ownAccount = new Account($ownMailAccount); - $delegatedMailAccount = new MailAccount(); $delegatedMailAccount->setId(99); $delegatedMailAccount->setEmail('shared@bar.com'); diff --git a/tests/Unit/Controller/AccountsControllerTest.php b/tests/Unit/Controller/AccountsControllerTest.php index d11ebe2603..3e76209b3f 100644 --- a/tests/Unit/Controller/AccountsControllerTest.php +++ b/tests/Unit/Controller/AccountsControllerTest.php @@ -299,7 +299,6 @@ public function testCreateManualNotAllowed(): void { self::assertEquals($expectedResponse, $response); } - public function testCreateManualFailure(): void { $email = 'user@domain.tld'; $accountName = 'Mail'; diff --git a/tests/Unit/Controller/DraftsControllerTest.php b/tests/Unit/Controller/DraftsControllerTest.php index fe34b71b81..cc77da35e4 100644 --- a/tests/Unit/Controller/DraftsControllerTest.php +++ b/tests/Unit/Controller/DraftsControllerTest.php @@ -552,7 +552,6 @@ public function testUpdateMoveToOutbox(): void { $this->assertEquals($expected, $actual); } - public function testUpdateMessageNotFound(): void { $message = new LocalMessage(); $message->setId(1); @@ -576,7 +575,6 @@ public function testUpdateMessageNotFound(): void { $this->service->expects(self::never()) ->method('updateMessage'); - $this->expectException(DoesNotExistException::class); $expected = JsonResponse::fail('', Http::STATUS_NOT_FOUND); $actual = $this->controller->update( diff --git a/tests/Unit/Controller/MailboxesApiControllerTest.php b/tests/Unit/Controller/MailboxesApiControllerTest.php index f00754af70..052d40c0ff 100644 --- a/tests/Unit/Controller/MailboxesApiControllerTest.php +++ b/tests/Unit/Controller/MailboxesApiControllerTest.php @@ -80,7 +80,6 @@ public function testListMailboxesWithoutUser() { $this->assertEquals(Http::STATUS_NOT_FOUND, $actual->getStatus()); } - public function testListMailboxes() { $account = $this->createStub(Account::class); $folder = $this->createStub(Folder::class); @@ -121,7 +120,6 @@ public function testListMessagesWithoutUser() { $this->assertEquals(Http::STATUS_NOT_FOUND, $actual->getStatus()); } - public function testListMessages(): void { $accountId = 100; $mailboxId = 101; @@ -173,7 +171,6 @@ public function testListMessagesInvalidMailbox(): void { $this->accountService->expects(self::never()) ->method('find'); - $actual = $this->controller->listMessages($mailboxId); $this->assertEquals(Http::STATUS_FORBIDDEN, $actual->getStatus()); @@ -219,5 +216,4 @@ public function testRestrictLimit(?int $limit, int $expectedLimit): void { $this->controller->listMessages($mailboxId, null, null, $limit); } - } diff --git a/tests/Unit/Controller/MessageApiControllerTest.php b/tests/Unit/Controller/MessageApiControllerTest.php index 62e9f4ece5..8384ff1f88 100644 --- a/tests/Unit/Controller/MessageApiControllerTest.php +++ b/tests/Unit/Controller/MessageApiControllerTest.php @@ -68,8 +68,6 @@ class MessageApiControllerTest extends TestCase { private int $messageId = 100; private int $mailboxId = 42; - - protected function setUp(): void { parent::setUp(); diff --git a/tests/Unit/Controller/MessagesControllerTest.php b/tests/Unit/Controller/MessagesControllerTest.php index d0a774702c..66a44b9b89 100644 --- a/tests/Unit/Controller/MessagesControllerTest.php +++ b/tests/Unit/Controller/MessagesControllerTest.php @@ -605,7 +605,6 @@ public function testDownloadAttachmentsNoAccountError() { ->method('find') ->willThrowException(new ClientException()); - // test our json error response $this->expectException(ClientException::class); $response = $this->controller->downloadAttachments( @@ -668,7 +667,6 @@ public function testDownloadAttachmentsNoMessageError() { $this->assertInstanceOf(JSONResponse::class, $response); } - public function testSetFlagsUnseen() { $accountId = 17; $mailboxId = 987; @@ -1208,7 +1206,6 @@ public function testGetDkim() { $message->setUid(123); $message->setSubject('core/master has new results'); - $this->mailManager->expects($this->exactly(1)) ->method('getMessage') ->with($this->userId, $message->getId()) diff --git a/tests/Unit/Controller/OutboxControllerTest.php b/tests/Unit/Controller/OutboxControllerTest.php index bf243ec2e8..227447ebe3 100644 --- a/tests/Unit/Controller/OutboxControllerTest.php +++ b/tests/Unit/Controller/OutboxControllerTest.php @@ -519,7 +519,6 @@ public function testUpdateMessageNotFound(): void { $this->service->expects(self::never()) ->method('updateMessage'); - $this->expectException(DoesNotExistException::class); $expected = JsonResponse::fail('', Http::STATUS_NOT_FOUND); $actual = $this->controller->update( @@ -611,7 +610,6 @@ public function testCreateValidateCertificateId(): void { $to = [['label' => 'Lewis', 'email' => 'tent@stardewvalley.com']]; $cc = [['label' => 'Pierre', 'email' => 'generalstore@stardewvalley.com']]; - $this->smimeService ->method('findCertificate') ->willThrowException(new DoesNotExistException('No such certificate')); @@ -660,7 +658,6 @@ public function testUpdateValidateCertificateId(): void { $to = [['label' => 'Lewis', 'email' => 'tent@stardewvalley.com']]; $cc = [['label' => 'Pierre', 'email' => 'generalstore@stardewvalley.com']]; - $this->smimeService ->method('findCertificate') ->willThrowException(new DoesNotExistException('No such certificate')); diff --git a/tests/Unit/Controller/ProxyControllerTest.php b/tests/Unit/Controller/ProxyControllerTest.php index ee6ed5cf0a..51b5c41dd1 100644 --- a/tests/Unit/Controller/ProxyControllerTest.php +++ b/tests/Unit/Controller/ProxyControllerTest.php @@ -71,7 +71,6 @@ protected function setUp(): void { $this->logger = new NullLogger(); } - public function testProxyWithoutCookies(): void { $src = 'http://example.com'; $this->request->expects($this->once()) diff --git a/tests/Unit/Controller/SieveControllerTest.php b/tests/Unit/Controller/SieveControllerTest.php index 6fa6bd6956..66d958d275 100644 --- a/tests/Unit/Controller/SieveControllerTest.php +++ b/tests/Unit/Controller/SieveControllerTest.php @@ -31,7 +31,6 @@ class SieveControllerTest extends TestCase { private string $userId = 'testUser'; - protected function setUp(): void { parent::setUp(); diff --git a/tests/Unit/Controller/TextBlockControllerTest.php b/tests/Unit/Controller/TextBlockControllerTest.php index c2746a6190..fb37254854 100644 --- a/tests/Unit/Controller/TextBlockControllerTest.php +++ b/tests/Unit/Controller/TextBlockControllerTest.php @@ -7,7 +7,6 @@ * SPDX-License-Identifier: AGPL-3.0-only */ - namespace OCA\Mail\Tests\Unit\Controller; use OCA\Mail\Controller\TextBlockController; @@ -27,7 +26,6 @@ final class TextBlockControllerTest extends TestCase { /** @var string */ private $userId; - protected function setUp(): void { $this->textBlockService = $this->createMock(TextBlockService::class); $this->userId = 'bob'; @@ -152,7 +150,6 @@ public function testDeleteTextBlock(): void { ->method('delete') ->with(1, $this->userId); - $controller = new TextBlockController($this->createStub(\OCP\IRequest::class), $this->userId, $this->textBlockService); $response = $controller->destroy(1); diff --git a/tests/Unit/Controller/TextBlockSharesControllerTest.php b/tests/Unit/Controller/TextBlockSharesControllerTest.php index f9f2cb23d0..ae416d591b 100644 --- a/tests/Unit/Controller/TextBlockSharesControllerTest.php +++ b/tests/Unit/Controller/TextBlockSharesControllerTest.php @@ -7,7 +7,6 @@ * SPDX-License-Identifier: AGPL-3.0-only */ - namespace OCA\Mail\Tests\Unit\Controller; use OCA\Mail\Controller\TextBlockSharesController; @@ -28,7 +27,6 @@ final class TextBlockSharesControllerTest extends TestCase { /** @var string */ private $userId; - protected function setUp(): void { $this->textBlockService = $this->createMock(TextBlockService::class); $this->userId = 'bob'; @@ -72,7 +70,6 @@ public function testGetSharedTextBlocks(): void { $this->assertEquals($expectedResponse, $response); } - public function testShareNoUser(): void { $controller = new TextBlockSharesController($this->createStub(\OCP\IRequest::class), null, $this->textBlockService); @@ -210,7 +207,6 @@ public function testGetShares(): void { $this->assertEquals($expectedResponse, $response); } - public function testGetSharesNoUser(): void { $controller = new TextBlockSharesController($this->createStub(\OCP\IRequest::class), null, $this->textBlockService); @@ -219,5 +215,4 @@ public function testGetSharesNoUser(): void { $this->assertEquals($expectedResponse, $response); } - } diff --git a/tests/Unit/Controller/ThreadControllerTest.php b/tests/Unit/Controller/ThreadControllerTest.php index 2df5353ee9..1a9b7f4c70 100644 --- a/tests/Unit/Controller/ThreadControllerTest.php +++ b/tests/Unit/Controller/ThreadControllerTest.php @@ -282,7 +282,6 @@ public function testSummarizeThread(): void { ->method('summarizeThread') ->willReturn('example summary'); - $response = $this->controller->summarize(300); $this->assertEquals(Http::STATUS_OK, $response->getStatus()); $this->assertEquals(['data' => 'example summary'], $response->getData()); diff --git a/tests/Unit/IMAP/PreviewEnhancerTest.php b/tests/Unit/IMAP/PreviewEnhancerTest.php index 90730058dc..6a08b3deb7 100644 --- a/tests/Unit/IMAP/PreviewEnhancerTest.php +++ b/tests/Unit/IMAP/PreviewEnhancerTest.php @@ -26,7 +26,6 @@ class PreviewEnhancerTest extends TestCase { - /** @var IMAPClientFactory|MockObject */ private $imapClientFactory; /** @var ImapMapper|MockObject */ @@ -112,5 +111,4 @@ public function testAvatars(): void { $this->assertSame($message2Avatar, $message2->getAvatar()); } - } diff --git a/tests/Unit/Job/PreviewEnhancementProcessingJobTest.php b/tests/Unit/Job/PreviewEnhancementProcessingJobTest.php index 96b7c3c65a..df384dbea9 100644 --- a/tests/Unit/Job/PreviewEnhancementProcessingJobTest.php +++ b/tests/Unit/Job/PreviewEnhancementProcessingJobTest.php @@ -4,6 +4,7 @@ * SPDX-FileCopyrightText: 2022 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later */ + namespace OCA\Mail\Tests\Unit\Job; use ChristophWurst\Nextcloud\Testing\TestCase; diff --git a/tests/Unit/Listener/MoveJunkListenerTest.php b/tests/Unit/Listener/MoveJunkListenerTest.php index 7efaf0f062..f3d09764d8 100644 --- a/tests/Unit/Listener/MoveJunkListenerTest.php +++ b/tests/Unit/Listener/MoveJunkListenerTest.php @@ -6,6 +6,7 @@ * SPDX-FileCopyrightText: 2023 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later */ + namespace Unit\Listener; use ChristophWurst\Nextcloud\Testing\TestCase; diff --git a/tests/Unit/Listener/NewMessagesSummarizeListenerTest.php b/tests/Unit/Listener/NewMessagesSummarizeListenerTest.php index 2f0fa34643..4cd0bec68e 100644 --- a/tests/Unit/Listener/NewMessagesSummarizeListenerTest.php +++ b/tests/Unit/Listener/NewMessagesSummarizeListenerTest.php @@ -6,6 +6,7 @@ * SPDX-FileCopyrightText: 2025 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later */ + namespace Unit\Listener; use ChristophWurst\Nextcloud\Testing\TestCase; diff --git a/tests/Unit/Listener/TaskProcessingListenerTest.php b/tests/Unit/Listener/TaskProcessingListenerTest.php index 7c97fb90fd..a7244977cd 100644 --- a/tests/Unit/Listener/TaskProcessingListenerTest.php +++ b/tests/Unit/Listener/TaskProcessingListenerTest.php @@ -33,7 +33,6 @@ protected function setUp(): void { $this->logger = $this->createMock(LoggerInterface::class); $this->messageMapper = $this->createMock(MessageMapper::class); - $this->listener = new TaskProcessingListener( $this->logger, $this->messageMapper, diff --git a/tests/Unit/Provider/Command/MessageSendTest.php b/tests/Unit/Provider/Command/MessageSendTest.php index 016ac357dd..db2481f13a 100644 --- a/tests/Unit/Provider/Command/MessageSendTest.php +++ b/tests/Unit/Provider/Command/MessageSendTest.php @@ -6,6 +6,7 @@ * SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later */ + namespace OCA\Mail\Tests\Unit\Provider\Command; use ChristophWurst\Nextcloud\Testing\TestCase; diff --git a/tests/Unit/Provider/MailProviderTest.php b/tests/Unit/Provider/MailProviderTest.php index 2f808ea5d1..8872ed2c4c 100644 --- a/tests/Unit/Provider/MailProviderTest.php +++ b/tests/Unit/Provider/MailProviderTest.php @@ -6,6 +6,7 @@ * SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later */ + namespace OCA\Mail\Tests\Unit\Provider; use ChristophWurst\Nextcloud\Testing\TestCase; diff --git a/tests/Unit/Provider/MailServiceTest.php b/tests/Unit/Provider/MailServiceTest.php index 09a809f233..94ee98b73b 100644 --- a/tests/Unit/Provider/MailServiceTest.php +++ b/tests/Unit/Provider/MailServiceTest.php @@ -6,6 +6,7 @@ * SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later */ + namespace OCA\Mail\Tests\Unit\Provider; use ChristophWurst\Nextcloud\Testing\TestCase; diff --git a/tests/Unit/Send/AntiAbuseHandlerTest.php b/tests/Unit/Send/AntiAbuseHandlerTest.php index 683055e5db..a590d40bb0 100644 --- a/tests/Unit/Send/AntiAbuseHandlerTest.php +++ b/tests/Unit/Send/AntiAbuseHandlerTest.php @@ -5,6 +5,7 @@ * SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later */ + namespace Unit\Send; use ChristophWurst\Nextcloud\Testing\TestCase; diff --git a/tests/Unit/Send/ChainTest.php b/tests/Unit/Send/ChainTest.php index 681f5e823b..c580ff4997 100644 --- a/tests/Unit/Send/ChainTest.php +++ b/tests/Unit/Send/ChainTest.php @@ -5,10 +5,10 @@ * SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later */ + namespace Unit\Send; use ChristophWurst\Nextcloud\Testing\TestCase; - use Horde_Imap_Client_Socket; use OCA\Mail\Account; use OCA\Mail\Db\LocalMessage; diff --git a/tests/Unit/Send/CopySendMessageHandlerTest.php b/tests/Unit/Send/CopySendMessageHandlerTest.php index 9e193bbf60..d947b49c70 100644 --- a/tests/Unit/Send/CopySendMessageHandlerTest.php +++ b/tests/Unit/Send/CopySendMessageHandlerTest.php @@ -5,6 +5,7 @@ * SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later */ + namespace Unit\Send; use ChristophWurst\Nextcloud\Testing\TestCase; @@ -76,7 +77,6 @@ public function testProcess(): void { ->method('process') ->with($account, $mock); - $this->handler->process($account, $mock, $client); } diff --git a/tests/Unit/Send/FlagRepliedMessageHandlerTest.php b/tests/Unit/Send/FlagRepliedMessageHandlerTest.php index 5c87048269..1f0ba61d0f 100644 --- a/tests/Unit/Send/FlagRepliedMessageHandlerTest.php +++ b/tests/Unit/Send/FlagRepliedMessageHandlerTest.php @@ -5,6 +5,7 @@ * SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later */ + namespace Unit\Send; use ChristophWurst\Nextcloud\Testing\TestCase; diff --git a/tests/Unit/Send/SendHandlerTest.php b/tests/Unit/Send/SendHandlerTest.php index 013c086745..ddaf96f335 100644 --- a/tests/Unit/Send/SendHandlerTest.php +++ b/tests/Unit/Send/SendHandlerTest.php @@ -5,6 +5,7 @@ * SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later */ + namespace Unit\Send; use ChristophWurst\Nextcloud\Testing\TestCase; diff --git a/tests/Unit/Send/SentMailboxHandlerTest.php b/tests/Unit/Send/SentMailboxHandlerTest.php index 8f52ac238e..12285a42b3 100644 --- a/tests/Unit/Send/SentMailboxHandlerTest.php +++ b/tests/Unit/Send/SentMailboxHandlerTest.php @@ -5,6 +5,7 @@ * SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later */ + namespace Unit\Send; use ChristophWurst\Nextcloud\Testing\TestCase; diff --git a/tests/Unit/Service/AccountServiceTest.php b/tests/Unit/Service/AccountServiceTest.php index d2b9e7f1e5..1461b14ac8 100644 --- a/tests/Unit/Service/AccountServiceTest.php +++ b/tests/Unit/Service/AccountServiceTest.php @@ -139,7 +139,6 @@ public function testFindById() { $this->assertEquals($expected, $actual); } - public function testDelete() { $accountId = 33; diff --git a/tests/Unit/Service/AiIntegrationsServiceTest.php b/tests/Unit/Service/AiIntegrationsServiceTest.php index 442e44e0a9..820536cb85 100644 --- a/tests/Unit/Service/AiIntegrationsServiceTest.php +++ b/tests/Unit/Service/AiIntegrationsServiceTest.php @@ -6,6 +6,7 @@ * SPDX-FileCopyrightText: 2023 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later */ + namespace OCA\Mail\Tests\Unit\Service; use ChristophWurst\Nextcloud\Testing\TestCase; @@ -90,7 +91,6 @@ public function testSummarizeThreadNoBackend(): void { $this->aiIntegrationsService->summarizeThread($account, '', [], ''); } - public function testSmartReplyNoBackend(): void { $account = new Account(new MailAccount()); $mailbox = new Mailbox(); diff --git a/tests/Unit/Service/Attachment/AttachmentServiceTest.php b/tests/Unit/Service/Attachment/AttachmentServiceTest.php index 28e629191d..5c5a5e5a8a 100644 --- a/tests/Unit/Service/Attachment/AttachmentServiceTest.php +++ b/tests/Unit/Service/Attachment/AttachmentServiceTest.php @@ -55,7 +55,6 @@ class AttachmentServiceTest extends TestCase { private ITimeFactory&MockObject $timeFactory; private AttachmentService $service; - protected function setUp(): void { parent::setUp(); @@ -336,7 +335,6 @@ public function testHandleAttachmentsForwardedMessageAttachment(): void { 'id' => 123, 'fileName' => 'cat.jpg', 'mimeType' => 'text/plain', - ]; $this->mailManager->expects(self::once()) @@ -563,7 +561,6 @@ public function testHandleAttachmentsCloudAttachment(): void { 'messageId' => 999, 'fileName' => 'cat.jpg', 'mimeType' => 'text/plain', - ]; $this->userFolder->expects(self::once()) diff --git a/tests/Unit/Service/Group/NextcloudGroupServiceTest.php b/tests/Unit/Service/Group/NextcloudGroupServiceTest.php index 4c93d88eea..05ff8d9a46 100644 --- a/tests/Unit/Service/Group/NextcloudGroupServiceTest.php +++ b/tests/Unit/Service/Group/NextcloudGroupServiceTest.php @@ -84,7 +84,6 @@ public function dataForTestSearch(): array { ]; } - /** * @dataProvider dataForTestSearch * @param string $allowGroupSharing @@ -109,7 +108,6 @@ public function testSearch(string $allowGroupSharing, string $restrictSharingToG ['core', 'shareapi_only_share_with_group_members', 'no', $restrictSharingToGroups], ]); - $actual = $this->groupService->search($term); self::assertEquals($expected, $actual); diff --git a/tests/Unit/Service/MailManagerTest.php b/tests/Unit/Service/MailManagerTest.php index 5bd24acc40..cfcd6dd28c 100644 --- a/tests/Unit/Service/MailManagerTest.php +++ b/tests/Unit/Service/MailManagerTest.php @@ -73,8 +73,6 @@ class MailManagerTest extends TestCase { /** @var ThreadMapper|MockObject */ private $threadMapper; - - protected function setUp(): void { parent::setUp(); diff --git a/tests/Unit/Service/MailTransmissionTest.php b/tests/Unit/Service/MailTransmissionTest.php index fd9a895904..fe2925fbf8 100644 --- a/tests/Unit/Service/MailTransmissionTest.php +++ b/tests/Unit/Service/MailTransmissionTest.php @@ -464,7 +464,6 @@ public function testSendMessageCc() { return new AddressList($addresses); }); - $this->transmission->sendMessage($account, $localMessage); $this->assertEquals(LocalMessage::STATUS_RAW, $localMessage->getStatus()); diff --git a/tests/Unit/Service/Phishing/ContactCheckTest.php b/tests/Unit/Service/Phishing/ContactCheckTest.php index f5bc3a3b04..f21e147dab 100644 --- a/tests/Unit/Service/Phishing/ContactCheckTest.php +++ b/tests/Unit/Service/Phishing/ContactCheckTest.php @@ -8,11 +8,9 @@ namespace OCA\Mail\Tests\Unit\Service\Phishing; use ChristophWurst\Nextcloud\Testing\TestCase; - use OCA\Mail\Service\ContactsIntegration; use OCA\Mail\Service\PhishingDetection\ContactCheck; use OCP\IL10N; - use PHPUnit\Framework\MockObject\MockObject; class ContactCheckTest extends TestCase { diff --git a/tests/Unit/Service/Phishing/CustomEmailCheckTest.php b/tests/Unit/Service/Phishing/CustomEmailCheckTest.php index 2d23e3b515..bc642f68f8 100644 --- a/tests/Unit/Service/Phishing/CustomEmailCheckTest.php +++ b/tests/Unit/Service/Phishing/CustomEmailCheckTest.php @@ -8,10 +8,8 @@ namespace OCA\Mail\Tests\Unit\Service\Phishing; use ChristophWurst\Nextcloud\Testing\TestCase; - use OCA\Mail\Service\PhishingDetection\CustomEmailCheck; use OCP\IL10N; - use PHPUnit\Framework\MockObject\MockObject; class CustomEmailCheckTest extends TestCase { diff --git a/tests/Unit/Service/Phishing/DateCheckTest.php b/tests/Unit/Service/Phishing/DateCheckTest.php index e94ed7df03..51fc570965 100644 --- a/tests/Unit/Service/Phishing/DateCheckTest.php +++ b/tests/Unit/Service/Phishing/DateCheckTest.php @@ -8,12 +8,10 @@ namespace OCA\Mail\Tests\Unit\Service\Phishing; use ChristophWurst\Nextcloud\Testing\TestCase; - use DateTime; use OCA\Mail\Service\PhishingDetection\DateCheck; use OCP\AppFramework\Utility\ITimeFactory; use OCP\IL10N; - use PHPUnit\Framework\MockObject\MockObject; class DateCheckTest extends TestCase { @@ -49,7 +47,6 @@ public function testInThePast(): void { public function testInTheFuture(): void { - $this->time->expects($this->exactly(2)) ->method('getDateTime') ->withConsecutive( diff --git a/tests/Unit/Service/Phishing/ImapFlagCheckTest.php b/tests/Unit/Service/Phishing/ImapFlagCheckTest.php index 7874ea13f3..8d92341e8c 100644 --- a/tests/Unit/Service/Phishing/ImapFlagCheckTest.php +++ b/tests/Unit/Service/Phishing/ImapFlagCheckTest.php @@ -8,11 +8,9 @@ namespace OCA\Mail\Tests\Integration\Service\Phishing; use ChristophWurst\Nextcloud\Testing\TestCase; - use Horde_Imap_Client; use OCA\Mail\Service\PhishingDetection\ImapFlagCheck; use OCP\IL10N; - use PHPUnit\Framework\MockObject\MockObject; class ImapFlagCheckTest extends TestCase { diff --git a/tests/Unit/Service/Phishing/LinkCheckTest.php b/tests/Unit/Service/Phishing/LinkCheckTest.php index 2cf39705b0..8edeabb354 100644 --- a/tests/Unit/Service/Phishing/LinkCheckTest.php +++ b/tests/Unit/Service/Phishing/LinkCheckTest.php @@ -9,10 +9,8 @@ namespace OCA\Mail\Tests\Unit\Service\Phishing; use ChristophWurst\Nextcloud\Testing\TestCase; - use OCA\Mail\Service\PhishingDetection\LinkCheck; use OCP\IL10N; - use PHPUnit\Framework\MockObject\MockObject; class LinkCheckTest extends TestCase { diff --git a/tests/Unit/Service/Phishing/PhishingDetectionServiceTest.php b/tests/Unit/Service/Phishing/PhishingDetectionServiceTest.php index ea965c04a8..bd81650cf1 100644 --- a/tests/Unit/Service/Phishing/PhishingDetectionServiceTest.php +++ b/tests/Unit/Service/Phishing/PhishingDetectionServiceTest.php @@ -10,7 +10,6 @@ use ChristophWurst\Nextcloud\Testing\TestCase; use Horde_Mime_Headers; use OCA\Mail\PhishingDetectionResult; - use OCA\Mail\Service\PhishingDetection\ContactCheck; use OCA\Mail\Service\PhishingDetection\CustomEmailCheck; use OCA\Mail\Service\PhishingDetection\DateCheck; @@ -18,7 +17,6 @@ use OCA\Mail\Service\PhishingDetection\LinkCheck; use OCA\Mail\Service\PhishingDetection\PhishingDetectionService; use OCA\Mail\Service\PhishingDetection\ReplyToCheck; - use PHPUnit\Framework\MockObject\MockObject; class PhishingDetectionServiceTest extends TestCase { diff --git a/tests/Unit/Service/Phishing/ReplyToCheckTest.php b/tests/Unit/Service/Phishing/ReplyToCheckTest.php index bb50436a1c..2c473b505a 100644 --- a/tests/Unit/Service/Phishing/ReplyToCheckTest.php +++ b/tests/Unit/Service/Phishing/ReplyToCheckTest.php @@ -8,10 +8,8 @@ namespace OCA\Mail\Tests\Integration\Service\Phishing; use ChristophWurst\Nextcloud\Testing\TestCase; - use OCA\Mail\Service\PhishingDetection\ReplyToCheck; use OCP\IL10N; - use PHPUnit\Framework\MockObject\MockObject; class ReplyToCheckTest extends TestCase { @@ -25,7 +23,6 @@ protected function setUp(): void { $this->service = new ReplyToCheck($this->l10n); } - public function testNoEmail(): void { $email = 'jhon@example.com'; $result = $this->service->run($email, null); diff --git a/tests/Unit/Service/QuickActionsServiceTest.php b/tests/Unit/Service/QuickActionsServiceTest.php index f4a142d913..6816c1e885 100644 --- a/tests/Unit/Service/QuickActionsServiceTest.php +++ b/tests/Unit/Service/QuickActionsServiceTest.php @@ -52,7 +52,6 @@ public function testFindAll(): void { $actionStep->setOrder(1); $actionStep->setActionId(1); - $this->actionsMapper->expects($this->once()) ->method('findAll') ->with($userId) @@ -72,7 +71,6 @@ public function testFindAll(): void { $this->assertCount(1, $result); } - public function testFind(): void { $actionId = 1; $userId = 'user123'; @@ -346,5 +344,4 @@ public function testCreateActionMoveThreadWithoutMailboxId(): void { $this->quickActionsService->createActionStep('moveThread', 1, 1); } - } diff --git a/tests/Unit/Service/TextBlockServiceTest.php b/tests/Unit/Service/TextBlockServiceTest.php index a2534bc02a..17fd3f7862 100644 --- a/tests/Unit/Service/TextBlockServiceTest.php +++ b/tests/Unit/Service/TextBlockServiceTest.php @@ -105,7 +105,6 @@ public function testUpdate(): void { $this->assertSame($textBlock, $result); } - public function testDelete(): void { $textBlockId = 1; $userId = 'bob'; diff --git a/tests/Unit/Service/TransmissionServiceTest.php b/tests/Unit/Service/TransmissionServiceTest.php index 2dcf1d079c..342a83d172 100644 --- a/tests/Unit/Service/TransmissionServiceTest.php +++ b/tests/Unit/Service/TransmissionServiceTest.php @@ -5,6 +5,7 @@ * SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later */ + namespace OCA\Mail\Tests\Unit\Service; use ChristophWurst\Nextcloud\Testing\TestCase; diff --git a/tests/Unit/SetupChecks/MailConnectionPerformanceTest.php b/tests/Unit/SetupChecks/MailConnectionPerformanceTest.php index f8354dd1c9..96a03a1049 100644 --- a/tests/Unit/SetupChecks/MailConnectionPerformanceTest.php +++ b/tests/Unit/SetupChecks/MailConnectionPerformanceTest.php @@ -6,6 +6,7 @@ * SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later */ + namespace Unit\SetupChecks; use ChristophWurst\Nextcloud\Testing\TestCase; diff --git a/tests/Unit/SetupChecks/MailTransportTest.php b/tests/Unit/SetupChecks/MailTransportTest.php index f743d2431e..f45708e8bb 100644 --- a/tests/Unit/SetupChecks/MailTransportTest.php +++ b/tests/Unit/SetupChecks/MailTransportTest.php @@ -6,6 +6,7 @@ * SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later */ + namespace Unit\SetupChecks; use ChristophWurst\Nextcloud\Testing\TestCase; diff --git a/tests/bootstrap.php b/tests/bootstrap.php index 22eaad39b1..39854a28fe 100644 --- a/tests/bootstrap.php +++ b/tests/bootstrap.php @@ -1,6 +1,5 @@