TestPush.php 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. <?php
  2. /**
  3. * Created by PhpStorm.
  4. * User: stanley-king
  5. * Date: 2017/4/11
  6. * Time: 下午5:52
  7. */
  8. define('BASE_ROOT_PATH',str_replace('/test','',dirname(__FILE__)));
  9. require_once(BASE_ROOT_PATH . '/fooder.php');
  10. require_once(BASE_ROOT_PATH . '/helper/memsg/message_sender.php');
  11. require_once(BASE_ROOT_PATH . '/helper/push_sender.php');
  12. class TestPush extends PHPUnit_Framework_TestCase
  13. {
  14. public static function setUpBeforeClass()
  15. {
  16. Base::run_util();
  17. }
  18. public function testPusher()
  19. {
  20. $sender = new memsg\message_sender();
  21. $sender->send();
  22. }
  23. public function testSubstring()
  24. {
  25. $str = "123456789ABCDEFG";
  26. $len = strlen($str);
  27. $start = 1;
  28. $x = substr($str,$start,$len - $start);
  29. $src = "BBB中国人AAA";
  30. $x = strlen($src);
  31. $y = substr($src,7,3);
  32. }
  33. public function testOption()
  34. {
  35. $ch = 65;
  36. $x = sprintf("%c",$ch);
  37. }
  38. public function testMessage()
  39. {
  40. $pushor = new push_sender();
  41. $info['member_id'] = 39187;
  42. $info['text'] = 'hello message';
  43. $info['custom'] = ['type' => 'add_special','special_id' => 300];
  44. $pushor->send_message($info);
  45. }
  46. }