diff options
Diffstat (limited to 'ext/imap/tests')
39 files changed, 1067 insertions, 25 deletions
diff --git a/ext/imap/tests/bug44098.phpt b/ext/imap/tests/bug44098.phpt new file mode 100644 index 000000000..f758c117b --- /dev/null +++ b/ext/imap/tests/bug44098.phpt @@ -0,0 +1,20 @@ +--TEST-- +Bug #44098 (imap_utf8() returns only capital letters) +--SKIPIF-- +<?php + if (!extension_loaded("imap")) { + die("skip imap extension not available"); + } +?> +--FILE-- +<?php +$exp = 'Luzon®14 dot CoM'; +$res = imap_utf8('=?iso-8859-1?b?THV6b26uMTQ=?= dot CoM'); +if ($res != $exp) { + echo "failed: got <$res>, expected <exp>\n"; +} else { + echo "ok"; +} +?> +--EXPECT-- +ok diff --git a/ext/imap/tests/imap_body.phpt b/ext/imap/tests/imap_body.phpt index 08f63db47..40f35f07a 100644 --- a/ext/imap/tests/imap_body.phpt +++ b/ext/imap/tests/imap_body.phpt @@ -15,6 +15,18 @@ imap_body(); echo "Checking with incorrect parameter type\n"; imap_body(''); imap_body(false); +require_once(dirname(__FILE__).'/imap_include.inc'); +$stream_id = imap_open($default_mailbox, $username, $password) or + die("Cannot connect to mailbox $default_mailbox: " . imap_last_error()); +imap_body($stream_id); +imap_body($stream_id,-1); +imap_body($stream_id,1,-1); + +//Access not existing +var_dump(imap_body($stream_id, 999, FT_UID)); + +imap_close($stream_id); + ?> --EXPECTF-- Checking with no parameters @@ -25,3 +37,12 @@ Checking with incorrect parameter type Warning: imap_body() expects at least 2 parameters, 1 given in %s on line %d Warning: imap_body() expects at least 2 parameters, 1 given in %s on line %d + +Warning: imap_body() expects at least 2 parameters, 1 given in %s on line %d + +Warning: imap_body(): Bad message number in %s on line %d + +Warning: imap_body(): invalid value for the options parameter in %s on line %d + +Warning: imap_body(): Bad message number in %s on line %d +bool(false)
\ No newline at end of file diff --git a/ext/imap/tests/imap_body_basic.phpt b/ext/imap/tests/imap_body_basic.phpt index 7cd518111..0eb4a2b83 100644 --- a/ext/imap/tests/imap_body_basic.phpt +++ b/ext/imap/tests/imap_body_basic.phpt @@ -27,6 +27,9 @@ echo "Msg Count in new mailbox: ". $check->Nmsgs . "\n"; // show body for msg 1 var_dump(imap_body($imap_stream, 1)); +//Access via FT_UID +var_dump(imap_body($imap_stream, 1, FT_UID)); + imap_close($imap_stream); ?> ===Done=== @@ -40,5 +43,6 @@ Create a new mailbox for test Create a temporary mailbox and add 1 msgs .. mailbox '%s' created Msg Count in new mailbox: 1 -string(%d) "1: this is a test message, please ignore%a" -===Done===
\ No newline at end of file +%unicode|string%(%d) "1: this is a test message, please ignore%a" +%unicode|string%(%d) "1: this is a test message, please ignore%a" +===Done=== diff --git a/ext/imap/tests/imap_bodystruct_basic.phpt b/ext/imap/tests/imap_bodystruct_basic.phpt index 4edc753b6..cc643a6b5 100644 --- a/ext/imap/tests/imap_bodystruct_basic.phpt +++ b/ext/imap/tests/imap_bodystruct_basic.phpt @@ -77,7 +77,7 @@ require_once('clean.inc'); *** Testing string imap_bodystruct : basic functionality *** Create a new mailbox for test and add a multipart msgs Create a temporary mailbox and add 1 msgs -.. mailbox '{localhost/norsh}INBOX.phpttest' created +.. mailbox '{%s}%s' created Get and validate structure of body part 1 ifsubtype is 0 or 1 diff --git a/ext/imap/tests/imap_clearflag_full_basic.phpt b/ext/imap/tests/imap_clearflag_full_basic.phpt index fb7465dc4..4269688e1 100644 --- a/ext/imap/tests/imap_clearflag_full_basic.phpt +++ b/ext/imap/tests/imap_clearflag_full_basic.phpt @@ -56,7 +56,7 @@ require_once('clean.inc'); *** Testing imap_clearflag_full() : basic functionality *** Create a new mailbox for test Create a temporary mailbox and add 10 msgs -.. mailbox '{localhost/norsh}INBOX.%s' created +.. mailbox '{%s}%s' created Initial msg count in new_mailbox : 10 Set some flags bool(true) diff --git a/ext/imap/tests/imap_close_variation2.phpt b/ext/imap/tests/imap_close_variation2.phpt index 6378e88ad..feadfed5f 100644 --- a/ext/imap/tests/imap_close_variation2.phpt +++ b/ext/imap/tests/imap_close_variation2.phpt @@ -118,7 +118,7 @@ require_once(dirname(__FILE__).'/clean.inc'); --EXPECTF-- *** Testing imap_close() : usage variations *** Create a temporary mailbox and add 3 msgs -.. mailbox '{localhost/norsh}INBOX.phpttest' created +.. mailbox '{%s}%s' created -- Iteration 1 -- bool(true) diff --git a/ext/imap/tests/imap_close_variation4.phpt b/ext/imap/tests/imap_close_variation4.phpt index 65b05786f..ca82619d4 100644 --- a/ext/imap/tests/imap_close_variation4.phpt +++ b/ext/imap/tests/imap_close_variation4.phpt @@ -66,7 +66,7 @@ require_once(dirname(__FILE__).'/clean.inc'); --EXPECTF-- *** Testing imap_close() : usage variations *** Create a temporary mailbox and add 3 msgs -.. mailbox '{localhost/norsh}INBOX.phpttest' created +.. mailbox '{%s}%s' created -- Iteration 1 -- bool(true) diff --git a/ext/imap/tests/imap_fetch_overview_basic.phpt b/ext/imap/tests/imap_fetch_overview_basic.phpt index 80d5c69f1..2b4623feb 100644 --- a/ext/imap/tests/imap_fetch_overview_basic.phpt +++ b/ext/imap/tests/imap_fetch_overview_basic.phpt @@ -77,7 +77,7 @@ require_once(dirname(__FILE__).'/clean.inc'); --EXPECTF-- *** Testing imap_fetch_overview() : basic functionality *** Create a temporary mailbox and add 2 msgs -.. mailbox '{localhost/norsh}INBOX.phpttest' created +.. mailbox '{%s}%s' created -- All possible arguments -- diff --git a/ext/imap/tests/imap_fetch_overview_error.phpt b/ext/imap/tests/imap_fetch_overview_error.phpt index 2fc0f343c..e300e6292 100644 --- a/ext/imap/tests/imap_fetch_overview_error.phpt +++ b/ext/imap/tests/imap_fetch_overview_error.phpt @@ -42,7 +42,7 @@ require_once(dirname(__FILE__).'/clean.inc'); -- Testing imap_fetch_overview() function with more than expected no. of arguments -- Create a temporary mailbox and add 2 msgs -.. mailbox '{localhost/norsh}INBOX.phpttest' created +.. mailbox '{%s}%s' created Warning: imap_fetch_overview() expects at most 3 parameters, 4 given in %s on line %d NULL diff --git a/ext/imap/tests/imap_fetch_overview_variation2.phpt b/ext/imap/tests/imap_fetch_overview_variation2.phpt index dfc3783d0..8634cefab 100644 --- a/ext/imap/tests/imap_fetch_overview_variation2.phpt +++ b/ext/imap/tests/imap_fetch_overview_variation2.phpt @@ -136,7 +136,7 @@ require_once(dirname(__FILE__).'/clean.inc'); --EXPECTF-- *** Testing imap_fetch_overview() : usage variations *** Create a temporary mailbox and add 1 msgs -.. mailbox '{localhost/norsh}INBOX.phpttest' created +.. mailbox '{%s}%s' created -- Testing with second argument value: int(0) Sequence out of range diff --git a/ext/imap/tests/imap_fetch_overview_variation3.phpt b/ext/imap/tests/imap_fetch_overview_variation3.phpt index 5fa56b5f7..7bd78d899 100644 --- a/ext/imap/tests/imap_fetch_overview_variation3.phpt +++ b/ext/imap/tests/imap_fetch_overview_variation3.phpt @@ -56,7 +56,7 @@ require_once(dirname(__FILE__).'/clean.inc'); --EXPECTF-- *** Testing imap_fetch_overview() : usage variations *** Create a temporary mailbox and add 1 msgs -.. mailbox '{localhost/norsh}INBOX.phpttest' created +.. mailbox '{%s}%s' created Testing with option value:%string|unicode%(1) "1" imap_fetch_overview() returns an object diff --git a/ext/imap/tests/imap_fetch_overview_variation5.phpt b/ext/imap/tests/imap_fetch_overview_variation5.phpt index 79861be7a..d5bc88858 100644 --- a/ext/imap/tests/imap_fetch_overview_variation5.phpt +++ b/ext/imap/tests/imap_fetch_overview_variation5.phpt @@ -67,7 +67,7 @@ require_once(dirname(__FILE__).'/clean.inc'); --EXPECTF-- *** Testing imap_fetch_overview() : usage variations *** Create a temporary mailbox and add 3 msgs -.. mailbox '{localhost/norsh}INBOX.phpttest' created +.. mailbox '{%s}%s' created -- $msg_no is 0 -- Sequence out of range diff --git a/ext/imap/tests/imap_fetch_overview_variation6.phpt b/ext/imap/tests/imap_fetch_overview_variation6.phpt index fda937e24..6ee65f68f 100644 --- a/ext/imap/tests/imap_fetch_overview_variation6.phpt +++ b/ext/imap/tests/imap_fetch_overview_variation6.phpt @@ -110,7 +110,7 @@ require_once(dirname(__FILE__).'/clean.inc'); --EXPECTF-- *** Testing imap_fetch_overview() : usage variations *** Create a temporary mailbox and add 0 msgs -.. mailbox '{localhost/norsh}INBOX.phpttest' created +.. mailbox '{%s}%s' created --> Object #1 size is %d diff --git a/ext/imap/tests/imap_fetchbody_basic.phpt b/ext/imap/tests/imap_fetchbody_basic.phpt index 469d498f1..66b84b165 100644 --- a/ext/imap/tests/imap_fetchbody_basic.phpt +++ b/ext/imap/tests/imap_fetchbody_basic.phpt @@ -64,7 +64,7 @@ require_once(dirname(__FILE__).'/clean.inc'); --EXPECTF-- *** Testing imap_fetchbody() : basic functionality *** Create a temporary mailbox and add 1 msgs -.. mailbox '{localhost/norsh}INBOX.phpttest' created +.. mailbox '{%s}%s' created -- All possible arguments -- -- Option is FT_UID -- diff --git a/ext/imap/tests/imap_fetchbody_error.phpt b/ext/imap/tests/imap_fetchbody_error.phpt index 77b71644f..f496fbd76 100644 --- a/ext/imap/tests/imap_fetchbody_error.phpt +++ b/ext/imap/tests/imap_fetchbody_error.phpt @@ -45,7 +45,7 @@ require_once(dirname(__FILE__).'/clean.inc'); -- Testing imap_fetchbody() function with more than expected no. of arguments -- Create a temporary mailbox and add 1 msgs -.. mailbox '{localhost/norsh}INBOX.phpttest' created +.. mailbox '{%s}%s' created Warning: imap_fetchbody() expects at most 4 parameters, 5 given in %s on line %d NULL diff --git a/ext/imap/tests/imap_fetchbody_variation2.phpt b/ext/imap/tests/imap_fetchbody_variation2.phpt index e80ac3915..64b7a3284 100644 --- a/ext/imap/tests/imap_fetchbody_variation2.phpt +++ b/ext/imap/tests/imap_fetchbody_variation2.phpt @@ -103,7 +103,7 @@ require_once(dirname(__FILE__).'/clean.inc'); --EXPECTF-- *** Testing imap_fetchbody() : usage variations *** Create a temporary mailbox and add 1 msgs -.. mailbox '{localhost/norsh}INBOX.phpttest' created +.. mailbox '{%s}%s' created -- Iteration 1 -- diff --git a/ext/imap/tests/imap_fetchbody_variation4.phpt b/ext/imap/tests/imap_fetchbody_variation4.phpt index 6b9579abd..d8126bce0 100644 --- a/ext/imap/tests/imap_fetchbody_variation4.phpt +++ b/ext/imap/tests/imap_fetchbody_variation4.phpt @@ -53,7 +53,7 @@ require_once(dirname(__FILE__).'/clean.inc'); --EXPECTF-- *** Testing imap_fetchbody() : usage variations *** Create a temporary mailbox and add 1 msgs -.. mailbox '{localhost/norsh}INBOX.phpttest' created +.. mailbox '{%s}%s' created -- Iteration 1 -- FT_UID valid diff --git a/ext/imap/tests/imap_fetchbody_variation6.phpt b/ext/imap/tests/imap_fetchbody_variation6.phpt index 608a0459d..52a50a77d 100644 --- a/ext/imap/tests/imap_fetchbody_variation6.phpt +++ b/ext/imap/tests/imap_fetchbody_variation6.phpt @@ -44,7 +44,7 @@ require_once(dirname(__FILE__).'/clean.inc'); --EXPECTF-- *** Testing imap_fetchbody() : usage variations *** Create a temporary mailbox and add 3 msgs -.. mailbox '{localhost/norsh}INBOX.phpttest' created +.. mailbox '{%s}%s' created -- $msg_no is 0 -- diff --git a/ext/imap/tests/imap_fetchheader_variation2.phpt b/ext/imap/tests/imap_fetchheader_variation2.phpt index d2269adf8..fe115779f 100644 --- a/ext/imap/tests/imap_fetchheader_variation2.phpt +++ b/ext/imap/tests/imap_fetchheader_variation2.phpt @@ -118,7 +118,7 @@ require_once(dirname(__FILE__).'/clean.inc'); --EXPECTF-- *** Testing imap_fetchheader() : usage variations *** Create a temporary mailbox and add 1 msgs -.. mailbox '{localhost/norsh}INBOX.phpttest' created +.. mailbox '{%s}%s' created -- Iteration 1 -- @@ -128,7 +128,7 @@ bool(false) -- Iteration 2 -- %unicode|string%(%d) "From: foo@anywhere.com Subject: Test msg 1 -To: webmaster@something.com +To: %s MIME-Version: 1.0 Content-Type: MULTIPART/mixed; BOUNDARY="%s" @@ -182,7 +182,7 @@ bool(false) -- Iteration 12 -- %unicode|string%(%d) "From: foo@anywhere.com Subject: Test msg 1 -To: webmaster@something.com +To: %s MIME-Version: 1.0 Content-Type: MULTIPART/mixed; BOUNDARY="%s" @@ -196,7 +196,7 @@ bool(false) -- Iteration 14 -- %unicode|string%(%d) "From: foo@anywhere.com Subject: Test msg 1 -To: webmaster@something.com +To: %s MIME-Version: 1.0 Content-Type: MULTIPART/mixed; BOUNDARY="%s" diff --git a/ext/imap/tests/imap_fetchheader_variation3.phpt b/ext/imap/tests/imap_fetchheader_variation3.phpt index e21c1a966..feba766e6 100644 --- a/ext/imap/tests/imap_fetchheader_variation3.phpt +++ b/ext/imap/tests/imap_fetchheader_variation3.phpt @@ -51,7 +51,7 @@ require_once(dirname(__FILE__).'/clean.inc'); --EXPECTF-- *** Testing imap_fetchheader() : usage variations *** Create a temporary mailbox and add 1 msgs -.. mailbox '{localhost/norsh}INBOX.phpttest' created +.. mailbox '{%s}%s' created -- Iteration 1 -- FT_UID valid diff --git a/ext/imap/tests/imap_fetchheader_variation5.phpt b/ext/imap/tests/imap_fetchheader_variation5.phpt index 6f5b426d3..ed2aa84dc 100644 --- a/ext/imap/tests/imap_fetchheader_variation5.phpt +++ b/ext/imap/tests/imap_fetchheader_variation5.phpt @@ -45,7 +45,7 @@ require_once(dirname(__FILE__).'/clean.inc'); --EXPECTF-- *** Testing imap_fetchheader() : usage variations *** Create a temporary mailbox and add 3 msgs -.. mailbox '{localhost/norsh}INBOX.phpttest' created +.. mailbox '{%s}%s' created -- $msg_no is 0 -- @@ -64,7 +64,7 @@ bool(false) Notice: A non well formed numeric value encountered in %s on line %d %unicode|string%(%d) "From: foo@anywhere.com Subject: Test msg 1 -To: webmaster@something.com +To: %s MIME-Version: 1.0 Content-Type: MULTIPART/mixed; BOUNDARY="%s" @@ -75,7 +75,7 @@ Content-Type: MULTIPART/mixed; BOUNDARY="%s" Notice: A non well formed numeric value encountered in %s on line %d %unicode|string%(%d) "From: foo@anywhere.com Subject: Test msg 1 -To: webmaster@something.com +To: %s MIME-Version: 1.0 Content-Type: MULTIPART/mixed; BOUNDARY="%s" diff --git a/ext/imap/tests/imap_fetchstructure_basic.phpt b/ext/imap/tests/imap_fetchstructure_basic.phpt new file mode 100644 index 000000000..7ad4fc562 --- /dev/null +++ b/ext/imap/tests/imap_fetchstructure_basic.phpt @@ -0,0 +1,70 @@ +--TEST-- +imap_fetchstructure() function : basic functionality +--CREDITS-- +Olivier Doucet +--SKIPIF-- +<?php +require_once(dirname(__FILE__).'/skipif.inc'); +?> +--FILE-- +<?php +echo "Checking with no parameters\n"; +imap_fetchstructure(); + +echo "Checking with incorrect parameter type\n"; +imap_fetchstructure(''); +imap_fetchstructure(false); + +require_once(dirname(__FILE__).'/imap_include.inc'); +$stream_id = setup_test_mailbox('', 1); + +imap_fetchstructure($stream_id); +imap_fetchstructure($stream_id,0); + +$z = imap_fetchstructure($stream_id,1); + + +$fields = array('type','encoding','ifsubtype','subtype', +'ifdescription','lines','bytes','parameters'); + +foreach ($fields as $key) { + var_dump(isset($z->$key)); +} +var_dump($z->type); +var_dump($z->encoding); +var_dump($z->bytes); +var_dump($z->lines); +var_dump(is_object($z->parameters)); + +imap_close($stream_id); +?> +--CLEAN-- +<?php +require_once('clean.inc'); +?> +--EXPECTF-- +Checking with no parameters + +Warning: imap_fetchstructure() expects at least 2 parameters, 0 given in %s on line %d +Checking with incorrect parameter type + +Warning: imap_fetchstructure() expects at least 2 parameters, 1 given in %s on line %d + +Warning: imap_fetchstructure() expects at least 2 parameters, 1 given in %s on line %d +Create a temporary mailbox and add 1 msgs +.. mailbox '{%s}%s' created + +Warning: imap_fetchstructure() expects at least 2 parameters, 1 given in %s on line %d +bool(true) +bool(true) +bool(true) +bool(true) +bool(true) +bool(true) +bool(true) +bool(true) +int(%d) +int(%d) +int(%d) +int(%d) +bool(true)
\ No newline at end of file diff --git a/ext/imap/tests/imap_gc_error.phpt b/ext/imap/tests/imap_gc_error.phpt index c0830c000..f8e6201eb 100644 --- a/ext/imap/tests/imap_gc_error.phpt +++ b/ext/imap/tests/imap_gc_error.phpt @@ -16,6 +16,11 @@ echo "Checking with incorrect parameter type\n"; imap_gc('', false); imap_gc(false, false); +require_once(dirname(__FILE__).'/imap_include.inc'); +$stream_id = imap_open($default_mailbox, $username, $password) or + die("Cannot connect to mailbox $default_mailbox: " . imap_last_error()); +imap_gc($stream_id, -1); + ?> --EXPECTF-- Checking with no parameters @@ -26,3 +31,5 @@ Checking with incorrect parameter type Warning: imap_gc() expects parameter 1 to be resource, %unicode_string_optional% given in %s on line %d Warning: imap_gc() expects parameter 1 to be resource, boolean given in %s on line %d + +Warning: imap_gc(): invalid value for the flags parameter in %s on line %d diff --git a/ext/imap/tests/imap_getsubscribed_basic.phpt b/ext/imap/tests/imap_getsubscribed_basic.phpt new file mode 100644 index 000000000..ba8a42daa --- /dev/null +++ b/ext/imap/tests/imap_getsubscribed_basic.phpt @@ -0,0 +1,68 @@ +--TEST-- +imap_getsubscribed() function : basic functionality +--CREDITS-- +Olivier Doucet +--SKIPIF-- +<?php +require_once(dirname(__FILE__).'/skipif.inc'); +?> +--FILE-- +<?php +echo "Checking with no parameters\n"; +imap_getsubscribed(); + +echo "Checking with incorrect parameter type\n"; +imap_getsubscribed(''); +imap_getsubscribed(false); + +require_once(dirname(__FILE__).'/imap_include.inc'); +$stream_id = imap_open($default_mailbox, $username, $password) or + die("Cannot connect to mailbox $default_mailbox: " . imap_last_error()); + +imap_getsubscribed($stream_id); +imap_getsubscribed($stream_id,$default_mailbox); +var_dump(imap_getsubscribed($stream_id,$default_mailbox,'ezDvfXvbvcxSerz')); + + +echo "Checking OK\n"; + +$newbox = $default_mailbox . "." . $mailbox_prefix; + +imap_createmailbox($stream_id, $newbox); +imap_subscribe($stream_id, $newbox); + +$z = imap_getsubscribed($stream_id,$default_mailbox,'*'); + +var_dump(is_array($z)); +var_dump($z[0]); + +imap_close($stream_id); +?> +--CLEAN-- +<?php +require_once('clean.inc'); +?> +--EXPECTF-- +Checking with no parameters + +Warning: imap_getsubscribed() expects exactly 3 parameters, 0 given in %s on line %d +Checking with incorrect parameter type + +Warning: imap_getsubscribed() expects exactly 3 parameters, 1 given in %s on line %d + +Warning: imap_getsubscribed() expects exactly 3 parameters, 1 given in %s on line %d + +Warning: imap_getsubscribed() expects exactly 3 parameters, 1 given in %s on line %d + +Warning: imap_getsubscribed() expects exactly 3 parameters, 2 given in %s on line %d +bool(false) +Checking OK +bool(true) +object(stdClass)#%d (%d) { + [%sname"]=> + string(%d) "{%s}%s" + [%sattributes"]=> + int(%d) + [%sdelimiter"]=> + string(%d) "%s" +}
\ No newline at end of file diff --git a/ext/imap/tests/imap_headerinfo_basic.phpt b/ext/imap/tests/imap_headerinfo_basic.phpt new file mode 100644 index 000000000..b772476af --- /dev/null +++ b/ext/imap/tests/imap_headerinfo_basic.phpt @@ -0,0 +1,129 @@ +--TEST-- +imap_headerinfo() function : basic functionality +--CREDITS-- +Olivier Doucet +--SKIPIF-- +<?php +require_once(dirname(__FILE__).'/skipif.inc'); +?> +--FILE-- +<?php + +require_once(dirname(__FILE__).'/imap_include.inc'); +$stream_id = setup_test_mailbox('', 1); + +$z = imap_headerinfo($stream_id, 1); + +$fields = array ('toaddress','to','fromaddress','from', +'reply_toaddress','reply_to', + 'senderaddress', 'sender', +'subject','Subject', + 'Recent','Unseen','Flagged','Answered','Deleted','Draft', + 'Msgno','MailDate','Size','udate'); + +echo "Check general fields\n"; +foreach ($fields as $key) { + var_dump(isset($z->$key)); +} + +echo "Check type\n"; +var_dump($z->toaddress); +var_dump($z->fromaddress); +var_dump($z->reply_toaddress); +var_dump($z->senderaddress); +var_dump($z->subject); +var_dump($z->Subject); + +if ($z->Recent == 'R' || $z->Recent == 'N' || $z->Recent == ' ') { + echo "Recent: OK"; +} else { + echo "Recent: error: ".$z->Recent; +} +echo "\n"; + +if ($z->Unseen == 'U' || $z->Unseen == ' ') { + echo "Unseen: OK"; +} else { + echo "Unseen: error: ".$z->Unseen; +} +echo "\n"; + +if ($z->Flagged == 'F' || $z->Flagged == ' ') { + echo "Flagged: OK"; +} else { + echo "Flagged: error: ".$z->Flagged; +} +echo "\n"; + +if ($z->Answered == 'A' || $z->Answered == ' ') { + echo "Answered: OK"; +} else { + echo "Answered: error"; +} +echo "\n"; + +if ($z->Deleted == 'D' || $z->Deleted == ' ') { + echo "Deleted: OK"; +} else { + echo "Deleted: error"; +} +echo "\n"; + +if ($z->Draft == 'X' || $z->Draft == ' ') { + echo "Draft: OK"; +} else { + echo "Draft: error"; +} +echo "\n"; + +var_dump($z->Msgno); +var_dump($z->Size); +var_dump($z->udate); + +imap_close($stream_id); + +?> +--CLEAN-- +<?php +require_once('clean.inc'); +?> +--EXPECTF-- +Create a temporary mailbox and add 1 msgs +.. mailbox '{%s}%s' created +Check general fields +bool(true) +bool(true) +bool(true) +bool(true) +bool(true) +bool(true) +bool(true) +bool(true) +bool(true) +bool(true) +bool(true) +bool(true) +bool(true) +bool(true) +bool(true) +bool(true) +bool(true) +bool(true) +bool(true) +bool(true) +Check type +string(%d) "%s" +string(%d) "%s" +string(%d) "%s" +string(%d) "%s" +string(%d) "%s" +string(%d) "%s" +Recent: OK +Unseen: OK +Flagged: OK +Answered: OK +Deleted: OK +Draft: OK +string(%d) "%s" +string(%d) "%d" +int(%d)
\ No newline at end of file diff --git a/ext/imap/tests/imap_headerinfo_error.phpt b/ext/imap/tests/imap_headerinfo_error.phpt new file mode 100644 index 000000000..b526096fe --- /dev/null +++ b/ext/imap/tests/imap_headerinfo_error.phpt @@ -0,0 +1,36 @@ +--TEST-- +imap_headerinfo() incorrect parameter count +--CREDITS-- +Olivier Doucet +--SKIPIF-- +<?php +require_once(dirname(__FILE__).'/skipif.inc'); +?> +--FILE-- +<?php +echo "Checking with no parameters\n"; +imap_headerinfo(); + +echo "Checking with incorrect parameter type\n"; +imap_headerinfo(''); +imap_headerinfo(false); + +require_once(dirname(__FILE__).'/imap_include.inc'); +$stream_id = imap_open($default_mailbox, $username, $password) or + die("Cannot connect to mailbox $default_mailbox: " . imap_last_error()); + +imap_headerinfo($stream_id); + +imap_close($stream_id); +?> +--EXPECTF-- +Checking with no parameters + +Warning: imap_headerinfo() expects at least 2 parameters, 0 given in %s on line %d +Checking with incorrect parameter type + +Warning: imap_headerinfo() expects at least 2 parameters, 1 given in %s on line %d + +Warning: imap_headerinfo() expects at least 2 parameters, 1 given in %s on line %d + +Warning: imap_headerinfo() expects at least 2 parameters, 1 given in %s on line %d diff --git a/ext/imap/tests/imap_list_basic.phpt b/ext/imap/tests/imap_list_basic.phpt new file mode 100644 index 000000000..36f07f755 --- /dev/null +++ b/ext/imap/tests/imap_list_basic.phpt @@ -0,0 +1,47 @@ +--TEST-- +imap_list() function : basic functionality +--CREDITS-- +Olivier Doucet +--SKIPIF-- +<?php +require_once(dirname(__FILE__).'/skipif.inc'); +?> +--FILE-- +<?php +echo "Checking with no parameters\n"; +imap_list(); + +echo "Checking with incorrect parameter type\n"; +imap_list(''); +imap_list(false); + +require_once(dirname(__FILE__).'/imap_include.inc'); +$stream_id = imap_open($default_mailbox, $username, $password) or + die("Cannot connect to mailbox $default_mailbox: " . imap_last_error()); + +imap_list($stream_id); +imap_list($stream_id,$default_mailbox); +imap_list($stream_id,$default_mailbox,'ezerz'); + + +$z = imap_list($stream_id,$default_mailbox,'*'); +var_dump(is_array($z)); +var_dump($z[0]); + +imap_close($stream_id); +?> +--EXPECTF-- +Checking with no parameters + +Warning: imap_list() expects exactly 3 parameters, 0 given in %s on line %d +Checking with incorrect parameter type + +Warning: imap_list() expects exactly 3 parameters, 1 given in %s on line %d + +Warning: imap_list() expects exactly 3 parameters, 1 given in %s on line %d + +Warning: imap_list() expects exactly 3 parameters, 1 given in %s on line %d + +Warning: imap_list() expects exactly 3 parameters, 2 given in %s on line %d +bool(true) +string(%s) "{%s}%s"
\ No newline at end of file diff --git a/ext/imap/tests/imap_lsub_basic.phpt b/ext/imap/tests/imap_lsub_basic.phpt new file mode 100644 index 000000000..153ca2a1b --- /dev/null +++ b/ext/imap/tests/imap_lsub_basic.phpt @@ -0,0 +1,61 @@ +--TEST-- +imap_lsub() function : basic functionality +--CREDITS-- +Olivier Doucet +--SKIPIF-- +<?php +require_once(dirname(__FILE__).'/skipif.inc'); +?> +--FILE-- +<?php +echo "Checking with no parameters\n"; +imap_lsub(); + +echo "Checking with incorrect parameter type\n"; +imap_lsub(''); +imap_lsub(false); + +require_once(dirname(__FILE__).'/imap_include.inc'); +$stream_id = imap_open($default_mailbox, $username, $password) or + die("Cannot connect to mailbox $default_mailbox: " . imap_last_error()); + +imap_lsub($stream_id); +imap_lsub($stream_id,$default_mailbox); +var_dump(imap_lsub($stream_id,$default_mailbox,'ezDvfXvbvcxSerz')); + + +echo "Checking OK\n"; + +$newbox = $default_mailbox . "." . $mailbox_prefix; + +imap_createmailbox($stream_id, $newbox); +imap_subscribe($stream_id, $newbox); + +$z = imap_lsub($stream_id,$default_mailbox,'*'); + +var_dump(is_array($z)); +var_dump($z[0]); + +imap_close($stream_id); +?> +--CLEAN-- +<?php +require_once('clean.inc'); +?> +--EXPECTF-- +Checking with no parameters + +Warning: imap_lsub() expects exactly 3 parameters, 0 given in %s on line %d +Checking with incorrect parameter type + +Warning: imap_lsub() expects exactly 3 parameters, 1 given in %s on line %d + +Warning: imap_lsub() expects exactly 3 parameters, 1 given in %s on line %d + +Warning: imap_lsub() expects exactly 3 parameters, 1 given in %s on line %d + +Warning: imap_lsub() expects exactly 3 parameters, 2 given in %s on line %d +bool(false) +Checking OK +bool(true) +string(%s) "{%s}%s"
\ No newline at end of file diff --git a/ext/imap/tests/imap_mail_copy.phpt b/ext/imap/tests/imap_mail_copy.phpt new file mode 100644 index 000000000..47c5e61bb --- /dev/null +++ b/ext/imap/tests/imap_mail_copy.phpt @@ -0,0 +1,54 @@ +--TEST-- +Test imap_mail_copy() incorrect parameters +--CREDITS-- +Olivier Doucet +--SKIPIF-- +<?php +require_once(dirname(__FILE__).'/skipif.inc'); +?> +--FILE-- +<?php +echo "Checking with no parameters\n"; +imap_mail_copy(); + + +echo "Checking with incorrect parameter type\n"; +imap_mail_copy(''); +imap_mail_copy(false); + + +// more tests +require_once(dirname(__FILE__).'/imap_include.inc'); + + +echo "Test with IMAP server\n"; +$stream_id = imap_open($default_mailbox, $username, $password) or + die("Cannot connect to mailbox $default_mailbox: " . imap_last_error()); + +var_dump(imap_mail_copy($stream_id)); +var_dump(imap_mail_copy($stream_id,-1)); +var_dump(imap_mail_copy($stream_id, '')); + +imap_close($stream_id); +?> +===Done=== +--EXPECTF-- +Checking with no parameters + +Warning: imap_mail_copy() expects at least 3 parameters, 0 given in %s on line %d +Checking with incorrect parameter type + +Warning: imap_mail_copy() expects at least 3 parameters, 1 given in %s on line %d + +Warning: imap_mail_copy() expects at least 3 parameters, 1 given in %s on line %d +Test with IMAP server + +Warning: imap_mail_copy() expects at least 3 parameters, 1 given in %s on line %d +NULL + +Warning: imap_mail_copy() expects at least 3 parameters, 2 given in %s on line %d +NULL + +Warning: imap_mail_copy() expects at least 3 parameters, 2 given in %s on line %d +NULL +===Done===
\ No newline at end of file diff --git a/ext/imap/tests/imap_mail_copy_basic.phpt b/ext/imap/tests/imap_mail_copy_basic.phpt new file mode 100644 index 000000000..a7b9421e3 --- /dev/null +++ b/ext/imap/tests/imap_mail_copy_basic.phpt @@ -0,0 +1,46 @@ +--TEST-- +Test imap_mail_copy() function : basic functionality +--CREDITS-- +Olivier Doucet +--SKIPIF-- +<?php +require_once(dirname(__FILE__).'/skipif.inc'); +?> +--FILE-- +<?php +/* Prototype : bool imap_mail_copy ( resource $imap_stream , string $msglist , string $mailbox [, int $options = 0 ] ) + * Description: Copies mail messages specified by msglist to specified mailbox. + * Source code: ext/imap/php_imap.c + */ + +echo "*** Testing imap_mail_copy() : basic functionality ***\n"; + +require_once(dirname(__FILE__).'/imap_include.inc'); + + +echo "Create a new mailbox for test\n"; +$imap_stream = setup_test_mailbox("", 1); +if (!is_resource($imap_stream)) { + exit("TEST FAILED: Unable to create test mailbox\n"); +} + +$check = imap_check($imap_stream); +echo "Msg Count in new mailbox: ". $check->Nmsgs . "\n"; + +var_dump(imap_mail_copy($imap_stream, '1', 'INBOX.'.$mailbox_prefix)); + +imap_close($imap_stream); +?> +===Done=== +--CLEAN-- +<?php +require_once('clean.inc'); +?> +--EXPECTF-- +*** Testing imap_mail_copy() : basic functionality *** +Create a new mailbox for test +Create a temporary mailbox and add 1 msgs +.. mailbox '%s' created +Msg Count in new mailbox: 1 +bool(true) +===Done===
\ No newline at end of file diff --git a/ext/imap/tests/imap_mail_move.phpt b/ext/imap/tests/imap_mail_move.phpt new file mode 100644 index 000000000..67ddea713 --- /dev/null +++ b/ext/imap/tests/imap_mail_move.phpt @@ -0,0 +1,54 @@ +--TEST-- +Test imap_mail_move() incorrect parameters +--CREDITS-- +Olivier Doucet +--SKIPIF-- +<?php +require_once(dirname(__FILE__).'/skipif.inc'); +?> +--FILE-- +<?php +echo "Checking with no parameters\n"; +imap_mail_move(); + + +echo "Checking with incorrect parameter type\n"; +imap_mail_move(''); +imap_mail_move(false); + + +// more tests +require_once(dirname(__FILE__).'/imap_include.inc'); + + +echo "Test with IMAP server\n"; +$stream_id = imap_open($default_mailbox, $username, $password) or + die("Cannot connect to mailbox $default_mailbox: " . imap_last_error()); + +var_dump(imap_mail_move($stream_id)); +var_dump(imap_mail_move($stream_id,-1)); +var_dump(imap_mail_move($stream_id, '')); + +imap_close($stream_id); +?> +===Done=== +--EXPECTF-- +Checking with no parameters + +Warning: imap_mail_move() expects at least 3 parameters, 0 given in %s on line %d +Checking with incorrect parameter type + +Warning: imap_mail_move() expects at least 3 parameters, 1 given in %s on line %d + +Warning: imap_mail_move() expects at least 3 parameters, 1 given in %s on line %d +Test with IMAP server + +Warning: imap_mail_move() expects at least 3 parameters, 1 given in %s on line %d +NULL + +Warning: imap_mail_move() expects at least 3 parameters, 2 given in %s on line %d +NULL + +Warning: imap_mail_move() expects at least 3 parameters, 2 given in %s on line %d +NULL +===Done===
\ No newline at end of file diff --git a/ext/imap/tests/imap_mail_move_basic.phpt b/ext/imap/tests/imap_mail_move_basic.phpt new file mode 100644 index 000000000..a54358256 --- /dev/null +++ b/ext/imap/tests/imap_mail_move_basic.phpt @@ -0,0 +1,46 @@ +--TEST-- +Test imap_mail_move() function : basic functionality +--CREDITS-- +Olivier Doucet +--SKIPIF-- +<?php +require_once(dirname(__FILE__).'/skipif.inc'); +?> +--FILE-- +<?php +/* Prototype : bool imap_mail_move ( resource $imap_stream , string $msglist , string $mailbox [, int $options = 0 ] ) + * Description: Copies mail messages specified by msglist to specified mailbox. + * Source code: ext/imap/php_imap.c + */ + +echo "*** Testing imap_mail_move() : basic functionality ***\n"; + +require_once(dirname(__FILE__).'/imap_include.inc'); + + +echo "Create a new mailbox for test\n"; +$imap_stream = setup_test_mailbox("", 1); +if (!is_resource($imap_stream)) { + exit("TEST FAILED: Unable to create test mailbox\n"); +} + +$check = imap_check($imap_stream); +echo "Msg Count in new mailbox: ". $check->Nmsgs . "\n"; + +var_dump(imap_mail_move($imap_stream, '1', 'INBOX.'.$mailbox_prefix)); + +imap_close($imap_stream); +?> +===Done=== +--CLEAN-- +<?php +require_once('clean.inc'); +?> +--EXPECTF-- +*** Testing imap_mail_move() : basic functionality *** +Create a new mailbox for test +Create a temporary mailbox and add 1 msgs +.. mailbox '%s' created +Msg Count in new mailbox: 1 +bool(true) +===Done===
\ No newline at end of file diff --git a/ext/imap/tests/imap_open_error.phpt b/ext/imap/tests/imap_open_error.phpt index 7934ee2ef..83b0eba80 100644 --- a/ext/imap/tests/imap_open_error.phpt +++ b/ext/imap/tests/imap_open_error.phpt @@ -20,6 +20,9 @@ echo "Checking with incorrect parameters\n" ; imap_open('', '', ''); imap_open('', '', '', -1); +require_once(dirname(__FILE__).'/imap_include.inc'); +imap_open($default_mailbox, $username, $password, NIL, -1); + ?> --EXPECTF-- Checking with no parameters @@ -39,4 +42,6 @@ Warning: imap_open(): Couldn't open stream in %s on line %d Warning: imap_open(): Couldn't open stream in %s on line %d +Warning: imap_open(): Retries must be greater or equal to 0 in %s on line %d + Notice: Unknown: Can't open mailbox : no such mailbox (errflg=2) in Unknown on line 0 diff --git a/ext/imap/tests/imap_renamemailbox_basic.phpt b/ext/imap/tests/imap_renamemailbox_basic.phpt new file mode 100644 index 000000000..b445f1d3e --- /dev/null +++ b/ext/imap/tests/imap_renamemailbox_basic.phpt @@ -0,0 +1,66 @@ +--TEST-- +imap_renamemailbox() function : basic functionality +--CREDITS-- +Olivier Doucet +--SKIPIF-- +<?php +require_once(dirname(__FILE__).'/skipif.inc'); +?> +--FILE-- +<?php +echo "Checking with no parameters\n"; +imap_renamemailbox(); + +echo "Checking with incorrect parameter type\n"; +imap_renamemailbox(''); +imap_renamemailbox(false); + + +require_once(dirname(__FILE__).'/imap_include.inc'); + +$stream_id = setup_test_mailbox('', 1); + +if (!is_resource($stream_id)) { + exit("TEST FAILED: Unable to create test mailbox\n"); +} + +$newbox = $default_mailbox . "." . $mailbox_prefix; + +imap_renamemailbox($stream_id, $newbox.'not'); +imap_renamemailbox($stream_id, $newbox); + +//commented because of bug #49901 +//$ancError = error_reporting(0); +//$z = imap_renamemailbox($stream_id, $newbox.'not2', $newbox.'2'); +//var_dump($z); +//error_reporting($ancError); +echo "Checking OK\n"; + + +var_dump(imap_createmailbox($stream_id, $newbox.'.test')); +var_dump(imap_renamemailbox($stream_id, $newbox.'.test', $newbox.'.testd')); + +imap_close($stream_id); +?> +--CLEAN-- +<?php +require_once('clean.inc'); +?> +--EXPECTF-- +Checking with no parameters + +Warning: imap_renamemailbox() expects exactly 3 parameters, 0 given in %s on line %d +Checking with incorrect parameter type + +Warning: imap_renamemailbox() expects exactly 3 parameters, 1 given in %s on line %d + +Warning: imap_renamemailbox() expects exactly 3 parameters, 1 given in %s on line %d +Create a temporary mailbox and add 1 msgs +.. mailbox '{%s}%s' created + +Warning: imap_renamemailbox() expects exactly 3 parameters, 2 given in %s on line %d + +Warning: imap_renamemailbox() expects exactly 3 parameters, 2 given in %s on line %d +Checking OK +bool(true) +bool(true) diff --git a/ext/imap/tests/imap_rfc822_parse_headers_basic.phpt b/ext/imap/tests/imap_rfc822_parse_headers_basic.phpt new file mode 100644 index 000000000..e4253925d --- /dev/null +++ b/ext/imap/tests/imap_rfc822_parse_headers_basic.phpt @@ -0,0 +1,122 @@ +--TEST-- +imap_rfc822_parse_headers() function : basic functionality +--CREDITS-- +Olivier Doucet +--SKIPIF-- +<?php +require_once(dirname(__FILE__).'/skipif.inc'); +?> +--FILE-- +<?php + +require_once(dirname(__FILE__).'/imap_include.inc'); +$stream_id = setup_test_mailbox('', 1); + +$z = imap_headerinfo($stream_id, 1); + +$fields = array ('toaddress','to','fromaddress','from', +'reply_toaddress','reply_to', + 'senderaddress', 'sender', +'subject','Subject', + 'MailDate','Size','udate'); + + +echo "Check general fields\n"; +foreach ($fields as $key) { + var_dump(isset($z->$key)); +} + +echo "Check type\n"; +var_dump($z->toaddress); +var_dump($z->fromaddress); +var_dump($z->reply_toaddress); +var_dump($z->senderaddress); +var_dump($z->subject); +var_dump($z->Subject); + +if ($z->Recent == 'R' || $z->Recent == 'N' || $z->Recent == ' ') { + echo "Recent: OK"; +} else { + echo "Recent: error"; +} +echo "\n"; + +if ($z->Unseen == 'U' || $z->Unseen == ' ') { + echo "Unseen: OK"; +} else { + echo "Unseen: error"; +} +echo "\n"; + +if ($z->Flagged == 'F' || $z->Flagged == ' ') { + echo "Flagged: OK"; +} else { + echo "Flagged: error"; +} +echo "\n"; + +if ($z->Answered == 'A' || $z->Answered == ' ') { + echo "Answered: OK"; +} else { + echo "Answered: error"; +} +echo "\n"; + +if ($z->Deleted == 'D' || $z->Deleted == ' ') { + echo "Deleted: OK"; +} else { + echo "Deleted: error"; +} +echo "\n"; + +if ($z->Draft == 'X' || $z->Draft == ' ') { + echo "Draft: OK"; +} else { + echo "Draft: error"; +} +echo "\n"; + +var_dump($z->Msgno); +var_dump($z->Size); +var_dump($z->udate); + +imap_close($stream_id); + +?> +--CLEAN-- +<?php +require_once('clean.inc'); +?> +--EXPECTF-- +Create a temporary mailbox and add 1 msgs +.. mailbox '{%s}%s' created +Check general fields +bool(true) +bool(true) +bool(true) +bool(true) +bool(true) +bool(true) +bool(true) +bool(true) +bool(true) +bool(true) +bool(true) +bool(true) +bool(true) +Check type +string(%d) "%s" +string(%d) "%s" +string(%d) "%s" +string(%d) "%s" +string(%d) "%s" +string(%d) "%s" +Recent: OK +Unseen: OK +Flagged: OK +Answered: OK +Deleted: OK +Draft: OK +string(%d) "%s" +string(%d) "%d" +int(%d)
\ No newline at end of file diff --git a/ext/imap/tests/imap_savebody_basic.phpt b/ext/imap/tests/imap_savebody_basic.phpt new file mode 100644 index 000000000..91e6ce03e --- /dev/null +++ b/ext/imap/tests/imap_savebody_basic.phpt @@ -0,0 +1,61 @@ +--TEST-- +imap_savebody() function : basic functionality +--CREDITS-- +Olivier Doucet +--SKIPIF-- +<?php +require_once(dirname(__FILE__).'/skipif.inc'); +?> +--FILE-- +<?php +echo "Checking with no parameters\n"; +imap_savebody(); + +echo "Checking with incorrect parameter type\n"; +imap_savebody(''); +imap_savebody(false); + +require_once(dirname(__FILE__).'/imap_include.inc'); +$stream_id = setup_test_mailbox('', 1); + +imap_savebody($stream_id); + +$file = dirname(__FILE__).'/tmpsavebody.txt'; + +//with URL +$z = imap_savebody($stream_id, $file, 1); +var_dump($z); +echo "Size: ".filesize($file)."\n"; + +//With FOPEN +$fp = fopen($file, 'w'); +$z = imap_savebody($stream_id, $fp, 1); +fclose($fp); +var_dump($z); +echo "Size: ".filesize($file)."\n"; + +imap_close($stream_id); +?> +--CLEAN-- +<?php +@unlink(dirname(__FILE__).'/tmpsavebody.txt'); +require_once('clean.inc'); +?> +--EXPECTF-- +Checking with no parameters + +Warning: imap_savebody() expects at least 3 parameters, 0 given in %s on line %d +Checking with incorrect parameter type + +Warning: imap_savebody() expects at least 3 parameters, 1 given in %s on line %d + +Warning: imap_savebody() expects at least 3 parameters, 1 given in %s on line %d +Create a temporary mailbox and add 1 msgs +.. mailbox '{%s}%s' created + +Warning: imap_savebody() expects at least 3 parameters, 1 given in %s on line %d +bool(true) +Size: %d +bool(true) +Size: %d + diff --git a/ext/imap/tests/imap_timeout_basic.phpt b/ext/imap/tests/imap_timeout_basic.phpt new file mode 100644 index 000000000..c2727e56b --- /dev/null +++ b/ext/imap/tests/imap_timeout_basic.phpt @@ -0,0 +1,60 @@ +--TEST-- +imap_timeout() function : basic functionality +--CREDITS-- +Olivier Doucet +--SKIPIF-- +<?php +require_once(dirname(__FILE__).'/skipif.inc'); +?> +--FILE-- +<?php +echo "Checking with no parameters\n"; +imap_timeout(); + +echo "Checking with incorrect parameter type\n"; +imap_timeout(''); +imap_timeout(false); + +echo "GET values:\n"; +var_dump(imap_timeout(IMAP_OPENTIMEOUT)); +var_dump(imap_timeout(IMAP_READTIMEOUT)); +var_dump(imap_timeout(IMAP_WRITETIMEOUT)); +var_dump(imap_timeout(IMAP_CLOSETIMEOUT)); + +echo "SET values:\n"; +var_dump(imap_timeout(IMAP_OPENTIMEOUT, 10)); +var_dump(imap_timeout(IMAP_READTIMEOUT, 10)); +var_dump(imap_timeout(IMAP_WRITETIMEOUT, 10)); + +//IMAP_CLOSETIMEOUT not implemented +//var_dump(imap_timeout(IMAP_CLOSETIMEOUT, 10)); + +echo "CHECK values:\n"; +var_dump(imap_timeout(IMAP_OPENTIMEOUT)); +var_dump(imap_timeout(IMAP_READTIMEOUT)); +var_dump(imap_timeout(IMAP_WRITETIMEOUT)); + +//IMAP_CLOSETIMEOUT not implemented +//var_dump(imap_timeout(IMAP_CLOSETIMEOUT)); + +?> +--EXPECTF-- +Checking with no parameters + +Warning: imap_timeout() expects at least 1 parameter, 0 given in %s on line %d +Checking with incorrect parameter type + +Warning: imap_timeout() expects parameter 1 to be long, %s given in %s on line %d +GET values: +int(%d) +int(%d) +int(%d) +int(%d) +SET values: +bool(true) +bool(true) +bool(true) +CHECK values: +int(10) +int(10) +int(10) diff --git a/ext/imap/tests/imap_undelete_basic.phpt b/ext/imap/tests/imap_undelete_basic.phpt new file mode 100644 index 000000000..4b48b1b09 --- /dev/null +++ b/ext/imap/tests/imap_undelete_basic.phpt @@ -0,0 +1,29 @@ +--TEST-- +imap_undelete() function : basic functionality +--CREDITS-- +Olivier Doucet +--SKIPIF-- +<?php +require_once(dirname(__FILE__).'/skipif.inc'); +?> +--FILE-- +<?php + +require_once(dirname(__FILE__).'/imap_include.inc'); +$stream_id = setup_test_mailbox('', 1); + +imap_delete($stream_id, 1); + +var_dump(imap_undelete($stream_id, 1)); + +imap_close($stream_id); + +?> +--CLEAN-- +<?php +require_once('clean.inc'); +?> +--EXPECTF-- +Create a temporary mailbox and add 1 msgs +.. mailbox '{%s}%s' created +bool(true)
\ No newline at end of file diff --git a/ext/imap/tests/imap_undelete_error.phpt b/ext/imap/tests/imap_undelete_error.phpt new file mode 100644 index 000000000..c82801e15 --- /dev/null +++ b/ext/imap/tests/imap_undelete_error.phpt @@ -0,0 +1,36 @@ +--TEST-- +imap_undelete() incorrect parameter count +--CREDITS-- +Olivier Doucet +--SKIPIF-- +<?php +require_once(dirname(__FILE__).'/skipif.inc'); +?> +--FILE-- +<?php +echo "Checking with no parameters\n"; +imap_undelete(); + +echo "Checking with incorrect parameter type\n"; +imap_undelete(''); +imap_undelete(false); + +require_once(dirname(__FILE__).'/imap_include.inc'); +$stream_id = imap_open($default_mailbox, $username, $password) or + die("Cannot connect to mailbox $default_mailbox: " . imap_last_error()); + +imap_undelete($stream_id); + +imap_close($stream_id); +?> +--EXPECTF-- +Checking with no parameters + +Warning: imap_undelete() expects at least 2 parameters, 0 given in %s on line %d +Checking with incorrect parameter type + +Warning: imap_undelete() expects at least 2 parameters, 1 given in %s on line %d + +Warning: imap_undelete() expects at least 2 parameters, 1 given in %s on line %d + +Warning: imap_undelete() expects at least 2 parameters, 1 given in %s on line %d |
