Annotation of embedaddon/php/ext/imap/tests/imap_append_basic.phpt, revision 1.1.1.1

1.1       misho       1: --TEST--
                      2: Test imap_append() function : basic functionality 
                      3: --SKIPIF--
                      4: <?php 
                      5: require_once(dirname(__FILE__).'/skipif.inc');
                      6: ?>
                      7: --FILE--
                      8: <?php
                      9: /* Prototype  : bool imap_append  ( resource $imap_stream  , string $mailbox  , string $message  [, string $options  ] )
                     10:  * Description: Append a string message to a specified mailbox.
                     11:  * Source code: ext/imap/php_imap.c
                     12:  */
                     13: 
                     14: echo "*** Testing imap_append() : basic functionality ***\n";
                     15: 
                     16: require_once(dirname(__FILE__).'/imap_include.inc');
                     17: 
                     18: echo "Create a new mailbox for test\n";
                     19: $imap_stream = setup_test_mailbox("", 0);
                     20: if (!is_resource($imap_stream)) {
                     21:        exit("TEST FAILED: Unable to create test mailbox\n");
                     22: }
                     23: 
                     24: $mb_details = imap_mailboxmsginfo($imap_stream);
                     25: echo "Add a couple of msgs to new mailbox " . $mb_details->Mailbox . "\n"; 
                     26: var_dump(imap_append($imap_stream, $mb_details->Mailbox
                     27:                    , "From: webmaster@something.com\r\n"
                     28:                    . "To: info@something.com\r\n"
                     29:                    . "Subject: Test message\r\n"
                     30:                    . "\r\n"
                     31:                    . "this is a test message, please ignore\r\n"
                     32:                    ));
                     33:                    
                     34: var_dump(imap_append($imap_stream, $mb_details->Mailbox
                     35:                    , "From: webmaster@something.com\r\n"
                     36:                    . "To: info@something.com\r\n"
                     37:                    . "Subject: Another test\r\n"
                     38:                    . "\r\n"
                     39:                    . "this is another test message, please ignore it too!!\r\n"
                     40:                    ));     
                     41:                    
                     42: $check = imap_check($imap_stream);
                     43: echo "Msg Count after append : ". $check->Nmsgs . "\n";
                     44: 
                     45: echo "List the msg headers\n";
                     46: var_dump(imap_headers($imap_stream));
                     47: 
                     48: imap_close($imap_stream);
                     49: ?>
                     50: ===Done===
                     51: --CLEAN--
                     52: <?php 
                     53: require_once('clean.inc');
                     54: ?>
                     55: --EXPECTF--
                     56: *** Testing imap_append() : basic functionality ***
                     57: Create a new mailbox for test
                     58: Create a temporary mailbox and add 0 msgs
                     59: .. mailbox '%s' created
                     60: Add a couple of msgs to new mailbox {%s}INBOX.%s
                     61: bool(true)
                     62: bool(true)
                     63: Msg Count after append : 2
                     64: List the msg headers
                     65: array(2) {
                     66:   [0]=>
                     67:   string(%d) "%w%s       1)%s webmaster@something. Test message (%d chars)"
                     68:   [1]=>
                     69:   string(%d) "%w%s       2)%s webmaster@something. Another test (%d chars)"
                     70: }
                     71: ===Done===
                     72: 

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>