forked from php/php-src
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
19 changed files
with
1,018 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
Oops, something went wrong.