19 changed files with 1018 additions and 0 deletions
-
21ext/imap/tests/imap_body.phpt
-
70ext/imap/tests/imap_fetchstructure_basic.phpt
-
7ext/imap/tests/imap_gc_error.phpt
-
68ext/imap/tests/imap_getsubscribed_basic.phpt
-
129ext/imap/tests/imap_headerinfo_basic.phpt
-
36ext/imap/tests/imap_headerinfo_error.phpt
-
47ext/imap/tests/imap_list_basic.phpt
-
61ext/imap/tests/imap_lsub_basic.phpt
-
54ext/imap/tests/imap_mail_copy.phpt
-
46ext/imap/tests/imap_mail_copy_basic.phpt
-
54ext/imap/tests/imap_mail_move.phpt
-
46ext/imap/tests/imap_mail_move_basic.phpt
-
5ext/imap/tests/imap_open_error.phpt
-
66ext/imap/tests/imap_renamemailbox_basic.phpt
-
122ext/imap/tests/imap_rfc822_parse_headers_basic.phpt
-
61ext/imap/tests/imap_savebody_basic.phpt
-
60ext/imap/tests/imap_timeout_basic.phpt
-
29ext/imap/tests/imap_undelete_basic.phpt
-
36ext/imap/tests/imap_undelete_error.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) |
|||
@ -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" |
|||
} |
|||
@ -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) |
|||
@ -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 |
|||
@ -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" |
|||
@ -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" |
|||
@ -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=== |
|||
@ -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=== |
|||
@ -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=== |
|||
@ -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=== |
|||
@ -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) |
|||
@ -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) |
|||
@ -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 |
|||
|
|||
@ -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) |
|||
@ -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) |
|||
@ -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 |
|||
Write
Preview
Loading…
Cancel
Save
Reference in new issue