summaryrefslogtreecommitdiff
path: root/ext/imap/tests
diff options
context:
space:
mode:
Diffstat (limited to 'ext/imap/tests')
-rw-r--r--ext/imap/tests/bug75774.phpt5
-rw-r--r--ext/imap/tests/imap_constructor.phpt15
-rw-r--r--ext/imap/tests/imap_errors_basic.phpt17
-rw-r--r--ext/imap/tests/imap_final.phpt11
-rw-r--r--ext/imap/tests/setup/dovecot.conf24
5 files changed, 52 insertions, 20 deletions
diff --git a/ext/imap/tests/bug75774.phpt b/ext/imap/tests/bug75774.phpt
index 08883ad8f0..dc6b2910b6 100644
--- a/ext/imap/tests/bug75774.phpt
+++ b/ext/imap/tests/bug75774.phpt
@@ -20,6 +20,5 @@ fclose($var1);
unlink($fn);
?>
---EXPECTF--
-Warning: imap_append(): Internal date not correctly formatted in %s on line %d
-imap_append(): supplied resource is not a valid imap resource
+--EXPECT--
+imap_append(): Argument #1 ($imap) must be of type IMAPConnection, resource given
diff --git a/ext/imap/tests/imap_constructor.phpt b/ext/imap/tests/imap_constructor.phpt
new file mode 100644
index 0000000000..bc5da991d1
--- /dev/null
+++ b/ext/imap/tests/imap_constructor.phpt
@@ -0,0 +1,15 @@
+--TEST--
+Attempt to instantiate an IMAPConnection directly
+--SKIPIF--
+<?php
+extension_loaded('imap') or die('skip imap extension not available in this build');
+--FILE--
+<?php
+
+try {
+ new IMAPConnection();
+} catch (Error $ex) {
+ echo "Exception: ", $ex->getMessage(), "\n";
+}
+--EXPECT--
+Exception: Cannot directly construct IMAPConnection, use imap_open() instead
diff --git a/ext/imap/tests/imap_errors_basic.phpt b/ext/imap/tests/imap_errors_basic.phpt
index f691a5c705..9a92877007 100644
--- a/ext/imap/tests/imap_errors_basic.phpt
+++ b/ext/imap/tests/imap_errors_basic.phpt
@@ -1,31 +1,24 @@
--TEST--
-Test imap_errors() function : invalid password
+Test imap_errors() function : anonymous user not supported
--SKIPIF--
<?php
require_once __DIR__.'/setup/skipif.inc';
?>
--FILE--
<?php
-echo "*** Testing imap_errors() : invalid password ***\n";
+echo "*** Testing imap_errors() : anonymous user not supported ***\n";
require_once __DIR__.'/setup/imap_include.inc';
-$password = "bogus"; // invalid password to use in this test
-echo "Issue opening with invalid password, 1 retry\n";
-$mbox = imap_open(IMAP_DEFAULT_MAILBOX, IMAP_MAILBOX_USERNAME, $password, OP_READONLY, 1);
+$mbox = @imap_open(IMAP_DEFAULT_MAILBOX, IMAP_MAILBOX_USERNAME, IMAP_MAILBOX_PASSWORD, OP_ANONYMOUS);
echo "List any errors\n";
var_dump(imap_errors());
?>
--EXPECTF--
-*** Testing imap_errors() : invalid password ***
-Issue opening with invalid password, 1 retry
-
-Warning: imap_open(): Couldn't open stream %s in %s on line %d
+*** Testing imap_errors() : anonymous user not supported ***
List any errors
-array(%d) {
+array(1) {
[0]=>
string(%d) "%s"
- [1]=>
- string(%d) "%s"
}
diff --git a/ext/imap/tests/imap_final.phpt b/ext/imap/tests/imap_final.phpt
new file mode 100644
index 0000000000..a896b4e6c4
--- /dev/null
+++ b/ext/imap/tests/imap_final.phpt
@@ -0,0 +1,11 @@
+--TEST--
+Check that IMAPConnection is declared final
+--SKIPIF--
+<?php
+extension_loaded('imap') or die('skip imap extension not available in this build');
+--FILE--
+<?php
+
+class T extends IMAPConnection {}
+--EXPECTF--
+Fatal error: Class T may not inherit from final class (IMAPConnection) in %s on line %d
diff --git a/ext/imap/tests/setup/dovecot.conf b/ext/imap/tests/setup/dovecot.conf
index c465ba3ce9..21687a31e4 100644
--- a/ext/imap/tests/setup/dovecot.conf
+++ b/ext/imap/tests/setup/dovecot.conf
@@ -2,15 +2,29 @@
# Pigeonhole version 0.4.21 (92477967)
listen = *, ::
-# To make authentication work
+# For SSL need to setup a certificate
+# See https://wiki.dovecot.org/SSL/DovecotConfiguration
ssl = no
-disable_plaintext_auth = no
-auth_mechanisms = plain cram-md5
+# Disable plaintext to prevent a warning at each login
+disable_plaintext_auth = yes
+
+auth_mechanisms = cram-md5
auth_username_format = %u
-auth_debug = yes
auth_verbose = yes
-#log
+auth_debug = yes
+auth_failure_delay = 1secs
+
+# This need dovecot 2.3.12.
+# login_proxy_timeout = 500milliseconds
+# ^ This would allow to kill login processes early, but needs testing. So would use v instead
+# login_proxy_timeout = 5s
+# There is a 1 second delay between each reconnection attempt.
+# https://doc.dovecot.org/settings/core/#login-proxy-max-reconnects
+# This need dovecot 2.3.12.
+# login_proxy_max_reconnects = 3
+
+# Log config
log_path = /var/log/dovecot.log
# If not set, use the value from log_path
info_log_path = /var/log/dovecot-info.log