imap_body_basic.phpt 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. --TEST--
  2. Test imap_body() function : basic functionality
  3. --SKIPIF--
  4. <?php
  5. require_once(dirname(__FILE__).'/skipif.inc');
  6. ?>
  7. --FILE--
  8. <?php
  9. /* Prototype : string imap_body ( resource $imap_stream , int $msg_number [, int $options ] )
  10. * Description: Read the message body.
  11. * Source code: ext/imap/php_imap.c
  12. */
  13. echo "*** Testing imap_body() : basic functionality ***\n";
  14. require_once(dirname(__FILE__).'/imap_include.inc');
  15. echo "Create a new mailbox for test\n";
  16. $imap_stream = setup_test_mailbox("", 1);
  17. if (!is_resource($imap_stream)) {
  18. exit("TEST FAILED: Unable to create test mailbox\n");
  19. }
  20. $check = imap_check($imap_stream);
  21. echo "Msg Count in new mailbox: ". $check->Nmsgs . "\n";
  22. // show body for msg 1
  23. var_dump(imap_body($imap_stream, 1));
  24. //Access via FT_UID
  25. var_dump(imap_body($imap_stream, 1, FT_UID));
  26. imap_close($imap_stream);
  27. ?>
  28. ===Done===
  29. --CLEAN--
  30. <?php
  31. require_once('clean.inc');
  32. ?>
  33. --EXPECTF--
  34. *** Testing imap_body() : basic functionality ***
  35. Create a new mailbox for test
  36. Create a temporary mailbox and add 1 msgs
  37. .. mailbox '%s' created
  38. Msg Count in new mailbox: 1
  39. %unicode|string%(%d) "1: this is a test message, please ignore%a"
  40. %unicode|string%(%d) "1: this is a test message, please ignore%a"
  41. ===Done===