diff options
author | Christoph Wurst <christoph@winzerhof-wurst.at> | 2022-04-04 12:30:02 +0300 |
---|---|---|
committer | Christoph Wurst <christoph@winzerhof-wurst.at> | 2022-04-04 12:30:02 +0300 |
commit | 27a4485ecd28618b93cafcebfd7859a51f476f04 (patch) | |
tree | 6548301b9f1e17269fb30b59a0856aec3ecdeb0c /tests | |
parent | 0b365745a9c478cdabef5a4836cb7a7cf3e10778 (diff) | |
parent | b39111631fff252b6fe2050cdb27de62e647d2c2 (diff) |
Merge remote-tracking branch 'origin/main' into chore/update-feature-outbox-III
Diffstat (limited to 'tests')
-rw-r--r-- | tests/Integration/Framework/ImapTest.php | 49 | ||||
-rw-r--r-- | tests/Integration/IMAP/AbstractTest.php | 17 | ||||
-rw-r--r-- | tests/Integration/IMAP/MessageMapperTest.php | 69 | ||||
-rw-r--r-- | tests/Unit/Controller/AccountsControllerTest.php | 165 | ||||
-rw-r--r-- | tests/Unit/Controller/SieveControllerTest.php | 3 |
5 files changed, 148 insertions, 155 deletions
diff --git a/tests/Integration/Framework/ImapTest.php b/tests/Integration/Framework/ImapTest.php index 1a68ad415..da18d3d1d 100644 --- a/tests/Integration/Framework/ImapTest.php +++ b/tests/Integration/Framework/ImapTest.php @@ -52,7 +52,7 @@ trait ImapTest { /** * @return Horde_Imap_Client_Socket */ - private function getTestClient() { + private function getTestClient(): Horde_Imap_Client_Socket { if ($this->client === null) { $this->client = new Horde_Imap_Client_Socket([ 'username' => 'user@domain.tld', @@ -134,8 +134,6 @@ trait ImapTest { * @return int id of the new message */ public function saveMessage(string $mailbox, SimpleMessage $message, MailAccount $account = null) { - $client = $this->getClient($account); - $headers = [ 'From' => new Horde_Mail_Rfc822_Address($message->getFrom()), 'To' => new Horde_Mail_Rfc822_Address($message->getTo()), @@ -155,32 +153,43 @@ trait ImapTest { $raw = $mail->getRaw(); $data = stream_get_contents($raw); - return $client->append($mailbox, [ - [ - 'data' => $data, - ] - ])->ids[0]; + $client = $this->getClient($account); + try { + return $client->append($mailbox, [ + [ + 'data' => $data, + ] + ])->ids[0]; + } finally { + $client->logout(); + } } public function flagMessage($mailbox, $id, MailAccount $account = null) { $client = $this->getClient($account); - - $client->store($mailbox, [ - 'ids' => new Horde_Imap_Client_Ids([$id]), - 'add' => [ - Horde_Imap_Client::FLAG_FLAGGED, - ], - ]); + try { + $client->store($mailbox, [ + 'ids' => new Horde_Imap_Client_Ids([$id]), + 'add' => [ + Horde_Imap_Client::FLAG_FLAGGED, + ], + ]); + } finally { + $client->logout(); + } } public function deleteMessage($mailbox, $id, MailAccount $account = null) { $client = $this->getClient($account); - $ids = new Horde_Imap_Client_Ids([$id]); - $client->expunge($mailbox, [ - 'ids' => $ids, - 'delete' => true, - ]); + try { + $client->expunge($mailbox, [ + 'ids' => $ids, + 'delete' => true, + ]); + } finally { + $client->logout(); + } } /** diff --git a/tests/Integration/IMAP/AbstractTest.php b/tests/Integration/IMAP/AbstractTest.php index bbaaddf46..a5119efc5 100644 --- a/tests/Integration/IMAP/AbstractTest.php +++ b/tests/Integration/IMAP/AbstractTest.php @@ -78,23 +78,6 @@ abstract class AbstractTest extends TestCase { } /** - * @param string $name - * @return Mailbox - */ - public function createMailBox($name) { - try { - $this->getTestAccount()->getMailbox($name); - $this->deleteMailbox($name); - } catch (Exception $e) { - // Ignore mailbox not found - } - - $mailbox = $this->getTestAccount()->createMailbox($name); - self::$createdMailboxes[$name] = $mailbox; - return $mailbox; - } - - /** * @return Account */ protected function getTestAccount() { diff --git a/tests/Integration/IMAP/MessageMapperTest.php b/tests/Integration/IMAP/MessageMapperTest.php index 20e93e688..d537bcaa1 100644 --- a/tests/Integration/IMAP/MessageMapperTest.php +++ b/tests/Integration/IMAP/MessageMapperTest.php @@ -77,10 +77,13 @@ class MessageMapperTest extends TestCase { $newUid = $this->saveMessage($inbox->getName(), $message, $account); // now we tag this message! + $client = $this->getClient($account); try { - $imapMessageMapper->addFlag($this->getClient($account), $mailBox, [$newUid], '$label1'); + $imapMessageMapper->addFlag($client, $mailBox, [$newUid], '$label1'); } catch (Horde_Imap_Client_Exception $e) { self::fail('Could not tag message'); + } finally { + $client->logout(); } // sync @@ -103,10 +106,13 @@ class MessageMapperTest extends TestCase { // now we untag this message! + $client = $this->getClient($account); try { - $imapMessageMapper->removeFlag($this->getClient($account), $mailBox, [$newUid], '$label1'); + $imapMessageMapper->removeFlag($client, $mailBox, [$newUid], '$label1'); } catch (Horde_Imap_Client_Exception $e) { self::fail('Could not untag message'); + } finally { + $client->logout(); } // sync again @@ -151,7 +157,6 @@ class MessageMapperTest extends TestCase { ->finish(); $newUid = $this->saveMessage($inbox->getName(), $message, $account); - // Put another new message into the mailbox $message = $this->getMessageBuilder() ->from('fluffington@domain.tld') @@ -166,38 +171,34 @@ class MessageMapperTest extends TestCase { ->finish(); $this->saveMessage($inbox->getName(), $message, $account); - // now we tag this message with $label1 + $client = $this->getClient($account); try { - $imapMessageMapper->addFlag($this->getClient($account), $mailBox, [$newUid], '$label1'); - } catch (Horde_Imap_Client_Exception $e) { - self::fail('Could not tag message'); + // now we tag this message with $label1 + $imapMessageMapper->addFlag($client, $mailBox, [$newUid], '$label1'); + // now we tag this and the previous message with $label2 + $imapMessageMapper->addFlag($client, $mailBox, [$newUid, $newUid2], '$label2'); + + // test for labels + $tagged = $imapMessageMapper->getFlagged($client, $mailBox, '$label1'); + self::assertNotEmpty($tagged); + // are the counts correct? + self::assertCount(1, $tagged); + + $tagged = $imapMessageMapper->getFlagged($client, $mailBox, '$label2'); + self::assertNotEmpty($tagged); + self::assertCount(2, $tagged); + + // test for labels that wasn't set + $tagged = $imapMessageMapper->getFlagged($client, $mailBox, '$notAvailable'); + self::assertEmpty($tagged); + + // test for regular flag - recent + $tagged = $imapMessageMapper->getFlagged($client, $mailBox, Horde_Imap_Client::FLAG_RECENT); + self::assertNotEmpty($tagged); + // should return all messages + self::assertCount(3, $tagged); + } finally { + $client->logout(); } - - // now we tag this and the previous message with $label2 - try { - $imapMessageMapper->addFlag($this->getClient($account), $mailBox, [$newUid, $newUid2], '$label2'); - } catch (Horde_Imap_Client_Exception $e) { - self::fail('Could not tag message'); - } - - // test for labels - $tagged = $imapMessageMapper->getFlagged($this->getClient($account), $mailBox, '$label1'); - self::assertNotEmpty($tagged); - // are the counts correct? - self::assertCount(1, $tagged); - - $tagged = $imapMessageMapper->getFlagged($this->getClient($account), $mailBox, '$label2'); - self::assertNotEmpty($tagged); - self::assertCount(2, $tagged); - - // test for labels that wasn't set - $tagged = $imapMessageMapper->getFlagged($this->getClient($account), $mailBox, '$notAvailable'); - self::assertEmpty($tagged); - - // test for regular flag - recent - $tagged = $imapMessageMapper->getFlagged($this->getClient($account), $mailBox, Horde_Imap_Client::FLAG_RECENT); - self::assertNotEmpty($tagged); - // should return all messages - self::assertCount(3, $tagged); } } diff --git a/tests/Unit/Controller/AccountsControllerTest.php b/tests/Unit/Controller/AccountsControllerTest.php index 5f8e8fe36..18e2a4f2b 100644 --- a/tests/Unit/Controller/AccountsControllerTest.php +++ b/tests/Unit/Controller/AccountsControllerTest.php @@ -25,7 +25,6 @@ declare(strict_types=1); namespace OCA\Mail\Tests\Unit\Controller; use ChristophWurst\Nextcloud\Testing\TestCase; -use Exception; use Horde_Exception; use OCA\Mail\Account; use OCA\Mail\Contracts\IMailManager; @@ -112,7 +111,7 @@ class AccountsControllerTest extends TestCase { $this->request = $this->createMock(IRequest::class); $this->accountService = $this->createMock(AccountService::class); $this->groupsIntegration = $this->createMock(GroupsIntegration::class); - $this->groupsIntegration->expects($this->any()) + $this->groupsIntegration->expects(self::any()) ->method('expand') ->will($this->returnArgument(0)); $this->userId = 'manfred'; @@ -144,20 +143,20 @@ class AccountsControllerTest extends TestCase { $this->accountId = 123; } - public function testIndex() { - $this->account->expects($this->once()) + public function testIndex(): void { + $this->account->expects(self::once()) ->method('jsonSerialize') - ->will($this->returnValue([ + ->will(self::returnValue([ 'accountId' => 123, ])); - $this->accountService->expects($this->once()) + $this->accountService->expects(self::once()) ->method('findByUserId') - ->with($this->equalTo($this->userId)) - ->will($this->returnValue([$this->account])); - $this->aliasesService->expects($this->any()) + ->with(self::equalTo($this->userId)) + ->will(self::returnValue([$this->account])); + $this->aliasesService->expects(self::any()) ->method('findAll') - ->with($this->equalTo($this->accountId), $this->equalTo($this->userId)) - ->will($this->returnValue(['a1', 'a2'])); + ->with(self::equalTo($this->accountId), self::equalTo($this->userId)) + ->will(self::returnValue(['a1', 'a2'])); $response = $this->controller->index(); @@ -170,80 +169,80 @@ class AccountsControllerTest extends TestCase { ], ] ]); - $this->assertEquals($expectedResponse, $response); + self::assertEquals($expectedResponse, $response); } - public function testShow() { - $this->accountService->expects($this->once()) + public function testShow(): void { + $this->accountService->expects(self::once()) ->method('find') - ->with($this->equalTo($this->userId), $this->equalTo($this->accountId)) - ->will($this->returnValue($this->account)); + ->with(self::equalTo($this->userId), self::equalTo($this->accountId)) + ->will(self::returnValue($this->account)); $response = $this->controller->show($this->accountId); $expectedResponse = new JSONResponse($this->account); - $this->assertEquals($expectedResponse, $response); + self::assertEquals($expectedResponse, $response); } - public function testShowDoesNotExist() { - $this->accountService->expects($this->once()) + public function testShowDoesNotExist(): void { + $this->accountService->expects(self::once()) ->method('find') - ->with($this->equalTo($this->userId), $this->equalTo($this->accountId)) - ->will($this->throwException(new DoesNotExistException('test123'))); + ->with(self::equalTo($this->userId), self::equalTo($this->accountId)) + ->will(self::throwException(new DoesNotExistException('test123'))); $this->expectException(DoesNotExistException::class); $this->controller->show($this->accountId); } - public function testUpdateSignature() { - $this->accountService->expects($this->once()) + public function testUpdateSignature(): void { + $this->accountService->expects(self::once()) ->method('updateSignature') - ->with($this->equalTo($this->accountId), $this->equalTo($this->userId), 'sig'); + ->with(self::equalTo($this->accountId), self::equalTo($this->userId), 'sig'); $response = $this->controller->updateSignature($this->accountId, 'sig'); $expectedResponse = new JSONResponse(); - $this->assertEquals($expectedResponse, $response); + self::assertEquals($expectedResponse, $response); } - public function testDeleteSignature() { - $this->accountService->expects($this->once()) + public function testDeleteSignature(): void { + $this->accountService->expects(self::once()) ->method('updateSignature') - ->with($this->equalTo($this->accountId), $this->equalTo($this->userId), null); + ->with(self::equalTo($this->accountId), self::equalTo($this->userId), null); $response = $this->controller->updateSignature($this->accountId, null); $expectedResponse = new JSONResponse(); - $this->assertEquals($expectedResponse, $response); + self::assertEquals($expectedResponse, $response); } - public function testDestroy() { - $this->accountService->expects($this->once()) + public function testDestroy(): void { + $this->accountService->expects(self::once()) ->method('delete') - ->with($this->equalTo($this->userId), $this->equalTo($this->accountId)); + ->with(self::equalTo($this->userId), self::equalTo($this->accountId)); $response = $this->controller->destroy($this->accountId); $expectedResponse = new JSONResponse(); - $this->assertEquals($expectedResponse, $response); + self::assertEquals($expectedResponse, $response); } - public function testDestroyDoesNotExist() { - $this->accountService->expects($this->once()) + public function testDestroyDoesNotExist(): void { + $this->accountService->expects(self::once()) ->method('delete') - ->with($this->equalTo($this->userId), $this->equalTo($this->accountId)) - ->will($this->throwException(new DoesNotExistException('test'))); + ->with(self::equalTo($this->userId), self::equalTo($this->accountId)) + ->will(self::throwException(new DoesNotExistException('test'))); $this->expectException(DoesNotExistException::class); $this->controller->destroy($this->accountId); } - public function testCreateAutoDetectSuccess() { + public function testCreateAutoDetectSuccess(): void { $email = 'john@example.com'; $password = '123456'; $accountName = 'John Doe'; $account = $this->createMock(Account::class); - $this->setupService->expects($this->once()) + $this->setupService->expects(self::once()) ->method('createNewAutoconfiguredAccount') ->with($accountName, $email, $password) ->willReturn($account); @@ -251,31 +250,31 @@ class AccountsControllerTest extends TestCase { $response = $this->controller->create($accountName, $email, $password, null, null, null, null, null, null, null, null, null, null, true); - $expectedResponse = new JSONResponse($account, Http::STATUS_CREATED); + $expectedResponse = \OCA\Mail\Http\JsonResponse::success($account, Http::STATUS_CREATED); - $this->assertEquals($expectedResponse, $response); + self::assertEquals($expectedResponse, $response); } - public function testCreateAutoDetectFailure() { + public function testCreateAutoDetectFailure(): void { $email = 'john@example.com'; $password = '123456'; $accountName = 'John Doe'; - $this->setupService->expects($this->once()) + $this->setupService->expects(self::once()) ->method('createNewAutoconfiguredAccount') ->with($accountName, $email, $password) - ->willThrowException(new \Exception()); + ->willThrowException(new ClientException()); $this->expectException(ClientException::class); $this->controller->create($accountName, $email, $password, null, null, null, null, null, null, null, null, null, null, true); } - public function testUpdateAutoDetectSuccess() { + public function testUpdateAutoDetectSuccess(): void { $email = 'john@example.com'; $password = '123456'; $accountName = 'John Doe'; $account = $this->createMock(Account::class); - $this->setupService->expects($this->once()) + $this->setupService->expects(self::once()) ->method('createNewAutoconfiguredAccount') ->with($accountName, $email, $password) ->willReturn($account); @@ -283,26 +282,26 @@ class AccountsControllerTest extends TestCase { $response = $this->controller->create($accountName, $email, $password, null, null, null, null, null, null, null, null, null, null, true); - $expectedResponse = new JSONResponse($account, Http::STATUS_CREATED); + $expectedResponse = \OCA\Mail\Http\JsonResponse::success($account, Http::STATUS_CREATED); - $this->assertEquals($expectedResponse, $response); + self::assertEquals($expectedResponse, $response); } - public function testUpdateAutoDetectFailure() { + public function testUpdateAutoDetectFailure(): void { $email = 'john@example.com'; $password = '123456'; $accountName = 'John Doe'; - $this->setupService->expects($this->once()) + $this->setupService->expects(self::once()) ->method('createNewAutoconfiguredAccount') ->with($accountName, $email, $password) - ->willThrowException(new Exception()); + ->willThrowException(new ClientException()); $this->expectException(ClientException::class); $this->controller->create($accountName, $email, $password, null, null, null, null, null, null, null, null, null, null, true); } - public function testCreateManualSuccess() { + public function testCreateManualSuccess(): void { $autoDetect = false; $email = 'user@domain.tld'; $password = 'mypassword'; @@ -318,19 +317,19 @@ class AccountsControllerTest extends TestCase { $smtpUser = 'user@domain.tld'; $smtpPassword = 'mypassword'; $account = $this->createMock(Account::class); - $this->setupService->expects($this->once()) + $this->setupService->expects(self::once()) ->method('createNewAccount') ->with($accountName, $email, $imapHost, $imapPort, $imapSslMode, $imapUser, $imapPassword, $smtpHost, $smtpPort, $smtpSslMode, $smtpUser, $smtpPassword, $this->userId) ->willReturn($account); $response = $this->controller->create($accountName, $email, $password, $imapHost, $imapPort, $imapSslMode, $imapUser, $imapPassword, $smtpHost, $smtpPort, $smtpSslMode, $smtpUser, $smtpPassword, $autoDetect); - $expectedResponse = new JSONResponse($account, Http::STATUS_CREATED); + $expectedResponse = \OCA\Mail\Http\JsonResponse::success($account, Http::STATUS_CREATED); - $this->assertEquals($expectedResponse, $response); + self::assertEquals($expectedResponse, $response); } - public function testCreateManualFailure() { + public function testCreateManualFailure(): void { $autoDetect = false; $email = 'user@domain.tld'; $password = 'mypassword'; @@ -345,16 +344,16 @@ class AccountsControllerTest extends TestCase { $smtpSslMode = 'none'; $smtpUser = 'user@domain.tld'; $smtpPassword = 'mypassword'; - $this->setupService->expects($this->once()) + $this->setupService->expects(self::once()) ->method('createNewAccount') ->with($accountName, $email, $imapHost, $imapPort, $imapSslMode, $imapUser, $imapPassword, $smtpHost, $smtpPort, $smtpSslMode, $smtpUser, $smtpPassword, $this->userId) - ->willThrowException(new Exception()); + ->willThrowException(new ClientException()); $this->expectException(ClientException::class); $this->controller->create($accountName, $email, $password, $imapHost, $imapPort, $imapSslMode, $imapUser, $imapPassword, $smtpHost, $smtpPort, $smtpSslMode, $smtpUser, $smtpPassword, $autoDetect); } - public function testUpdateManualSuccess() { + public function testUpdateManualSuccess(): void { $autoDetect = false; $id = 135; $email = 'user@domain.tld'; @@ -371,7 +370,7 @@ class AccountsControllerTest extends TestCase { $smtpUser = 'user@domain.tld'; $smtpPassword = 'mypassword'; $account = $this->createMock(Account::class); - $this->setupService->expects($this->once()) + $this->setupService->expects(self::once()) ->method('createNewAccount') ->with($accountName, $email, $imapHost, $imapPort, $imapSslMode, $imapUser, $imapPassword, $smtpHost, $smtpPort, $smtpSslMode, $smtpUser, $smtpPassword, $this->userId, $id) ->willReturn($account); @@ -380,10 +379,10 @@ class AccountsControllerTest extends TestCase { $expectedResponse = new JSONResponse($account); - $this->assertEquals($expectedResponse, $response); + self::assertEquals($expectedResponse, $response); } - public function testUpdateManualFailure() { + public function testUpdateManualFailure(): void { $autoDetect = false; $id = 135; $email = 'user@domain.tld'; @@ -399,38 +398,38 @@ class AccountsControllerTest extends TestCase { $smtpSslMode = 'none'; $smtpUser = 'user@domain.tld'; $smtpPassword = 'mypassword'; - $this->setupService->expects($this->once()) + $this->setupService->expects(self::once()) ->method('createNewAccount') ->with($accountName, $email, $imapHost, $imapPort, $imapSslMode, $imapUser, $imapPassword, $smtpHost, $smtpPort, $smtpSslMode, $smtpUser, $smtpPassword, $this->userId, $id) - ->willThrowException(new Exception()); + ->willThrowException(new ClientException()); $this->expectException(ClientException::class); $this->controller->update($id, $autoDetect, $accountName, $email, $password, $imapHost, $imapPort, $imapSslMode, $imapUser, $imapPassword, $smtpHost, $smtpPort, $smtpSslMode, $smtpUser, $smtpPassword); } - public function testSendNewMessage() { + public function testSendNewMessage(): void { $account = $this->createMock(Account::class); - $this->accountService->expects($this->once()) + $this->accountService->expects(self::once()) ->method('find') ->willReturn($account); $messageData = NewMessageData::fromRequest($account, 'to@d.com', '', '', 'sub', 'bod', []); - $this->transmission->expects($this->once()) + $this->transmission->expects(self::once()) ->method('sendMessage') ->with($messageData, null, null, null); $expected = new JSONResponse(); $resp = $this->controller->send(13, 'sub', 'bod', 'to@d.com', '', ''); - $this->assertEquals($expected, $resp); + self::assertEquals($expected, $resp); } - public function testSendingError() { + public function testSendingError(): void { $account = $this->createMock(Account::class); - $this->accountService->expects($this->once()) + $this->accountService->expects(self::once()) ->method('find') ->willReturn($account); $messageData = NewMessageData::fromRequest($account, 'to@d.com', '', '', 'sub', 'bod', []); - $this->transmission->expects($this->once()) + $this->transmission->expects(self::once()) ->method('sendMessage') ->with($messageData, null, null, null) ->willThrowException(new Horde_Exception('error')); @@ -439,7 +438,7 @@ class AccountsControllerTest extends TestCase { $this->controller->send(13, 'sub', 'bod', 'to@d.com', '', ''); } - public function testSendingManyRecipientsError() { + public function testSendingManyRecipientsError(): void { $this->expectException(ManyRecipientsException::class); $recipients = []; @@ -451,7 +450,7 @@ class AccountsControllerTest extends TestCase { $this->controller->send(13, 'sub', 'bod', $recipients, '', ''); } - public function testSendingManyRecipientsCcError() { + public function testSendingManyRecipientsCcError(): void { $this->expectException(ManyRecipientsException::class); $recipients = []; @@ -463,20 +462,20 @@ class AccountsControllerTest extends TestCase { $this->controller->send(13, 'sub', 'bod', '', $recipients, ''); } - public function testSendReply() { + public function testSendReply(): void { $account = $this->createMock(Account::class); $replyMessage = new Message(); $messageId = 1234; - $this->accountService->expects($this->once()) + $this->accountService->expects(self::once()) ->method('find') ->willReturn($account); - $this->mailManager->expects($this->once()) + $this->mailManager->expects(self::once()) ->method('getMessage') ->with($this->userId, $messageId) ->willReturn($replyMessage); $messageData = NewMessageData::fromRequest($account, 'to@d.com', '', '', 'sub', 'bod', []); $replyData = new RepliedMessageData($account, $replyMessage); - $this->transmission->expects($this->once()) + $this->transmission->expects(self::once()) ->method('sendMessage') ->with($messageData, $replyData, null, null); $expected = new JSONResponse(); @@ -495,7 +494,7 @@ class AccountsControllerTest extends TestCase { [], null); - $this->assertEquals($expected, $resp); + self::assertEquals($expected, $resp); } public function draftDataProvider(): array { @@ -518,14 +517,14 @@ class AccountsControllerTest extends TestCase { $newUid = 124; $account = $this->createMock(Account::class); $mailbox = new Mailbox(); - $this->accountService->expects($this->once()) + $this->accountService->expects(self::once()) ->method('find') ->with($this->userId, $this->accountId) - ->will($this->returnValue($this->account)); - $this->transmission->expects($this->once()) + ->will(self::returnValue($this->account)); + $this->transmission->expects(self::once()) ->method('saveDraft') ->willReturn([$account, $mailbox, $newUid]); - $this->mailManager->expects($this->once()) + $this->mailManager->expects(self::once()) ->method('getMessageIdForUid') ->willReturn($newId); @@ -534,6 +533,6 @@ class AccountsControllerTest extends TestCase { $expected = new JSONResponse([ 'id' => $newId, ]); - $this->assertEquals($expected, $actual); + self::assertEquals($expected, $actual); } } diff --git a/tests/Unit/Controller/SieveControllerTest.php b/tests/Unit/Controller/SieveControllerTest.php index 2d80afcbb..bad9ff61d 100644 --- a/tests/Unit/Controller/SieveControllerTest.php +++ b/tests/Unit/Controller/SieveControllerTest.php @@ -28,6 +28,7 @@ use Horde\ManageSieve\Exception; use OCA\Mail\Account; use OCA\Mail\Controller\SieveController; use OCA\Mail\Db\MailAccount; +use OCA\Mail\Exception\ClientException; use OCA\Mail\Exception\CouldNotConnectException; use OCA\Mail\Tests\Integration\TestCase; @@ -130,7 +131,7 @@ class SieveControllerTest extends TestCase { } public function testGetActiveScriptNoSieve(): void { - $this->expectException(CouldNotConnectException::class); + $this->expectException(ClientException::class); $this->expectExceptionMessage('ManageSieve is disabled'); $mailAccount = new MailAccount(); |