diff --git a/tests/unit/ImapTest.php b/tests/unit/ImapTest.php index 670eae0e..d5cd6fc3 100644 --- a/tests/unit/ImapTest.php +++ b/tests/unit/ImapTest.php @@ -8,10 +8,10 @@ use Generator; use ParagonIE\HiddenString\HiddenString; +use PhpImap\Exceptions\ConnectionException; use PHPUnit\Framework\TestCase as Base; use const SORTARRIVAL; use Throwable; -use UnexpectedValueException; /** * @psalm-type MAILBOX_ARGS = array{ @@ -35,13 +35,13 @@ class ImapTest extends Base use LiveMailboxTestingTrait; /** - * @psalm-return Generator<'CI ENV with invalid password'|'empty mailbox/username/password', array{0: UnexpectedValueException::class, 1: '/^IMAP error:.[AUTHENTICATIONFAILED]/'|'IMAP error:Can't open mailbox : no such mailbox', 2: array{0: HiddenString, 1: HiddenString, 2: HiddenString, 3: 0, 4: 0, 5: array}, 3?: true}, mixed, void> + * @psalm-return Generator<'CI ENV with invalid password'|'empty mailbox/username/password', array{0: ConnectionException::class, 1: '/^[AUTHENTICATIONFAILED]/'|'Can't open mailbox : no such mailbox', 2: array{0: HiddenString, 1: HiddenString, 2: HiddenString, 3: 0, 4: 0, 5: array}, 3?: true}, mixed, void> */ public function OpenFailure(): Generator { yield 'empty mailbox/username/password' => [ - UnexpectedValueException::class, - 'IMAP error:Can\'t open mailbox : no such mailbox', + ConnectionException::class, + 'Can\'t open mailbox : no such mailbox', [ new HiddenString(''), new HiddenString(''), @@ -58,8 +58,8 @@ public function OpenFailure(): Generator if (\is_string($imapPath) && \is_string($login) && \is_string($password)) { yield 'CI ENV with invalid password' => [ - UnexpectedValueException::class, - '/^IMAP error:.*\[AUTHENTICATIONFAILED\].*/', + ConnectionException::class, + '/^\[AUTHENTICATIONFAILED\].*/', [ new HiddenString($imapPath, true, true), new HiddenString($login, true, true),