88
99use Generator ;
1010use ParagonIE \HiddenString \HiddenString ;
11+ use PhpImap \Exceptions \ConnectionException ;
1112use PHPUnit \Framework \TestCase as Base ;
1213use const SORTARRIVAL ;
1314use Throwable ;
14- use UnexpectedValueException ;
1515
1616/**
1717 * @psalm-type MAILBOX_ARGS = array{
@@ -35,13 +35,13 @@ class ImapTest extends Base
3535 use LiveMailboxTestingTrait;
3636
3737 /**
38- * @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<empty, empty>}, 3?: true}, mixed, void>
38+ * @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<empty, empty>}, 3?: true}, mixed, void>
3939 */
4040 public function OpenFailure (): Generator
4141 {
4242 yield 'empty mailbox/username/password ' => [
43- UnexpectedValueException ::class,
44- 'IMAP error: Can \'t open mailbox : no such mailbox ' ,
43+ ConnectionException ::class,
44+ 'Can \'t open mailbox : no such mailbox ' ,
4545 [
4646 new HiddenString ('' ),
4747 new HiddenString ('' ),
@@ -58,8 +58,8 @@ public function OpenFailure(): Generator
5858
5959 if (\is_string ($ imapPath ) && \is_string ($ login ) && \is_string ($ password )) {
6060 yield 'CI ENV with invalid password ' => [
61- UnexpectedValueException ::class,
62- '/^IMAP error:.* \[AUTHENTICATIONFAILED\].*/ ' ,
61+ ConnectionException ::class,
62+ '/^\[AUTHENTICATIONFAILED\].*/ ' ,
6363 [
6464 new HiddenString ($ imapPath , true , true ),
6565 new HiddenString ($ login , true , true ),
0 commit comments