imap_fetch_overview_variation3.phpt 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. --TEST--
  2. Test imap_fetch_overview() function : usage variations - FT_UID option
  3. --SKIPIF--
  4. <?php
  5. require_once(dirname(__FILE__).'/skipif.inc');
  6. ?>
  7. --FILE--
  8. <?php
  9. /* Prototype : array imap_fetch_overview(resource $stream_id, int $msg_no [, int $options])
  10. * Description: Read an overview of the information in the headers of the given message sequence
  11. * Source code: ext/imap/php_imap.c
  12. */
  13. /*
  14. * Test passing a range of values into the $options argument to imap_fetch_overview():
  15. * 1. values that equate to 1
  16. * 2. Minimum and maximum PHP values
  17. */
  18. echo "*** Testing imap_fetch_overview() : usage variations ***\n";
  19. require_once(dirname(__FILE__).'/imap_include.inc');
  20. // Initialise required variables
  21. $stream_id = setup_test_mailbox('', 1); // set up temporary mailbox with one simple message
  22. $msg_no = 1;
  23. $msg_uid = imap_uid($stream_id, $msg_no);
  24. $options = array ('1',
  25. true,
  26. 1.000000000000001,
  27. 0.00001e5,
  28. PHP_INT_MAX,
  29. -PHP_INT_MAX
  30. );
  31. // iterate over each element of $options array
  32. $iterator = 1;
  33. imap_check($stream_id);
  34. foreach($options as $option) {
  35. echo "\nTesting with option value:";
  36. var_dump($option);
  37. $overview = imap_fetch_overview($stream_id, $msg_uid, $option);
  38. if ($overview) {
  39. echo "imap_fetch_overview() returns an object\n";
  40. }
  41. $iterator++;
  42. }
  43. ?>
  44. ===DONE===
  45. --CLEAN--
  46. <?php
  47. require_once(dirname(__FILE__).'/clean.inc');
  48. ?>
  49. --EXPECTF--
  50. *** Testing imap_fetch_overview() : usage variations ***
  51. Create a temporary mailbox and add 1 msgs
  52. .. mailbox '{%s}%s' created
  53. Testing with option value:%string|unicode%(1) "1"
  54. imap_fetch_overview() returns an object
  55. Testing with option value:bool(true)
  56. imap_fetch_overview() returns an object
  57. Testing with option value:float(1)
  58. imap_fetch_overview() returns an object
  59. Testing with option value:float(1)
  60. imap_fetch_overview() returns an object
  61. Testing with option value:int(%d)
  62. Warning: imap_fetch_overview(): invalid value for the options parameter in %s on line %d
  63. Testing with option value:int(-%d)
  64. Warning: imap_fetch_overview(): invalid value for the options parameter in %s on line %d
  65. ===DONE===