diff options
author | Lorry Tar Creator <lorry-tar-importer@baserock.org> | 2013-03-14 05:42:27 +0000 |
---|---|---|
committer | <> | 2013-04-03 16:25:08 +0000 |
commit | c4dd7a1a684490673e25aaf4fabec5df138854c4 (patch) | |
tree | 4d57c44caae4480efff02b90b9be86f44bf25409 /ext/imap/tests/imap_fetch_overview_variation6.phpt | |
download | php2-master.tar.gz |
Imported from /home/lorry/working-area/delta_php2/php-5.4.13.tar.bz2.HEADphp-5.4.13master
Diffstat (limited to 'ext/imap/tests/imap_fetch_overview_variation6.phpt')
-rw-r--r-- | ext/imap/tests/imap_fetch_overview_variation6.phpt | 109 |
1 files changed, 109 insertions, 0 deletions
diff --git a/ext/imap/tests/imap_fetch_overview_variation6.phpt b/ext/imap/tests/imap_fetch_overview_variation6.phpt new file mode 100644 index 0000000..bdf0557 --- /dev/null +++ b/ext/imap/tests/imap_fetch_overview_variation6.phpt @@ -0,0 +1,109 @@ +--TEST-- +Test imap_fetch_overview() function : usage variations - multipart message +--SKIPIF-- +<?php +require_once(dirname(__FILE__).'/skipif.inc'); +?> +--FILE-- +<?php +/* Prototype : array imap_fetch_overview(resource $stream_id, int $msg_no [, int $options]) + * Description: Read an overview of the information in the headers of the given message sequence + * Source code: ext/imap/php_imap.c + */ + +/* + * Pass a multipart message to imap_fetch_overview() to test the contents of returned array + */ + +echo "*** Testing imap_fetch_overview() : usage variations ***\n"; + +require_once(dirname(__FILE__).'/imap_include.inc'); + +$stream_id = setup_test_mailbox('', 0, $mailbox); // setup temp mailbox +create_multipart_message($stream_id, $mailbox); + +// refresh msg numbers +imap_check($stream_id); +$msg_no = 1; + +$a = imap_fetch_overview($stream_id, $msg_no); +echo "\n--> Object #1\n"; +displayOverviewFields($a[0]); + + + + +/** + * Create a multipart message with subparts + * + * @param resource $imap_stream + * @param string $mailbox + */ +function create_multipart_message($imap_stream, $mailbox) { + global $users, $domain; + $envelope["from"]= "foo@anywhere.com"; + $envelope["to"] = "$users[0]@$domain"; + $envelope["subject"] = "Test msg 1"; + + $part1["type"] = TYPEMULTIPART; + $part1["subtype"] = "mixed"; + + $part2["type"] = TYPETEXT; + $part2["subtype"] = "plain"; + $part2["description"] = "imap_mail_compose() function"; + $part2["contents.data"] = "message 1:xxxxxxxxxxxxxxxxxxxxxxxxxx"; + + $part3["type"] = TYPETEXT; + $part3["subtype"] = "plain"; + $part3["description"] = "Example"; + $part3["contents.data"] = "message 2:yyyyyyyyyyyyyyyyyyyyyyyyyy"; + + $file_handle = fopen(__FILE__, 'r+'); + $file_size = 1; + + $part4["type"] = TYPEAPPLICATION; + $part4["encoding"] = ENCBASE64; + $part4["subtype"] = "octet-stream"; + $part4["description"] = 'Test'; + $part4['disposition.type'] = 'attachment'; + $part4['disposition'] = array ('filename' => 'Test'); + $part4['type.parameters'] = array('name' => 'Test'); + $part4["contents.data"] = base64_encode(fread($file_handle, 1)); + + $body[1] = $part1; + $body[2] = $part2; + $body[3] = $part3; + $body[4] = $part4; + + $msg = imap_mail_compose($envelope, $body); + + if (imap_append($imap_stream, $mailbox, $msg) === false) { + echo imap_last_error() . "\n"; + echo "TEST FAILED : could not append new message to mailbox '$mailbox'\n"; + exit; + } +} + +?> +===DONE=== +--CLEAN-- +<?php +require_once(dirname(__FILE__).'/clean.inc'); +?> +--EXPECTF-- +*** Testing imap_fetch_overview() : usage variations *** +Create a temporary mailbox and add 0 msgs +.. mailbox '{%s}%s' created + +--> Object #1 +size is %d +uid is %d +msgno is 1 +recent is %d +flagged is 0 +answered is 0 +deleted is 0 +seen is 0 +draft is 0 +udate is OK +===DONE=== |