004.phpt 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. --TEST--
  2. msg_set_queue() and msg_stat_queue()
  3. --EXTENSIONS--
  4. sysvmsg
  5. --FILE--
  6. <?php
  7. $id = ftok(__FILE__, 'r');
  8. $q = msg_get_queue($id);
  9. echo "Set mode:\n";
  10. $arr = array('msg_perm.mode' => 0600);
  11. var_dump(msg_set_queue($q, $arr));
  12. echo "Did really work:\n";
  13. var_dump(count(array_diff_assoc($arr, msg_stat_queue($q))) == 0);
  14. echo "Set uid:\n"; // same as the running user to make it succeed
  15. $arr = array('msg_perm.uid' => getmyuid());
  16. var_dump(msg_set_queue($q, $arr));
  17. echo "Did really work:\n";
  18. var_dump(count(array_diff_assoc($arr, msg_stat_queue($q))) == 0);
  19. echo "Set gid:\n"; // same as the running user to make it succeed
  20. $arr = array('msg_perm.gid' => getmygid());
  21. var_dump(msg_set_queue($q, $arr));
  22. echo "Did really work:\n";
  23. var_dump(count(array_diff_assoc($arr, msg_stat_queue($q))) == 0);
  24. echo "Set smaller qbytes:\n";
  25. $res = msg_stat_queue($q);
  26. $arr = array('msg_qbytes' => ($res['msg_qbytes'] -1));
  27. var_dump(msg_set_queue($q, $arr));
  28. echo "Did really work:\n";
  29. var_dump(count(array_diff_assoc($arr, msg_stat_queue($q))) == 0);
  30. if (!msg_remove_queue($q)) {
  31. echo "BAD: queue removal failed\n";
  32. }
  33. echo "Done\n";
  34. ?>
  35. --EXPECT--
  36. Set mode:
  37. bool(true)
  38. Did really work:
  39. bool(true)
  40. Set uid:
  41. bool(true)
  42. Did really work:
  43. bool(true)
  44. Set gid:
  45. bool(true)
  46. Did really work:
  47. bool(true)
  48. Set smaller qbytes:
  49. bool(true)
  50. Did really work:
  51. bool(true)
  52. Done