Skip to content

Commit 7606994

Browse files
committed
Make imap_errors() test no hang
Instead of attempting to connect with an invalid password, connect as an anonymous user. As this is disabled in our Dovecot configuration, this generates an error, and fails fast.
1 parent a80a029 commit 7606994

File tree

1 file changed

+7
-12
lines changed

1 file changed

+7
-12
lines changed

ext/imap/tests/imap_errors_basic.phpt

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,24 @@
11
--TEST--
2-
Test imap_errors() function : invalid password
2+
Test imap_errors() function : anonymous user not supported
33
--SKIPIF--
44
<?php
55
require_once __DIR__.'/setup/skipif.inc';
66
?>
77
--FILE--
88
<?php
9-
echo "*** Testing imap_errors() : invalid password ***\n";
9+
echo "*** Testing imap_errors() : anonymous user not supported ***\n";
1010
require_once __DIR__.'/setup/imap_include.inc';
11-
$password = "bogus"; // invalid password to use in this test
1211

13-
echo "Issue opening with invalid password, 1 retry\n";
14-
$mbox = imap_open(IMAP_DEFAULT_MAILBOX, IMAP_MAILBOX_USERNAME, $password, OP_READONLY, 1);
12+
$mbox = @imap_open(IMAP_DEFAULT_MAILBOX, IMAP_MAILBOX_USERNAME, IMAP_MAILBOX_PASSWORD, OP_ANONYMOUS);
1513

1614
echo "List any errors\n";
1715
var_dump(imap_errors());
1816

1917
?>
20-
--EXPECTF--
21-
*** Testing imap_errors() : invalid password ***
22-
Issue opening with invalid password, 1 retry
23-
24-
Warning: imap_open(): Couldn't open stream %s in %s on line %d
18+
--EXPECT--
19+
*** Testing imap_errors() : anonymous user not supported ***
2520
List any errors
26-
array(%d) {
21+
array(1) {
2722
[0]=>
28-
string(%d) "%s"
23+
string(45) "[ALERT] Unsupported authentication mechanism."
2924
}

0 commit comments

Comments
 (0)