TestPush.php 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  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. const test_android_member_id = 39625;//40287; //android
  15. const test_ios_member_id = 39623;//52169;
  16. //const test_member_id = 36490;
  17. public static function setUpBeforeClass()
  18. {
  19. Base::run_util();
  20. }
  21. public function testPusher()
  22. {
  23. $sender = new memsg\message_sender();
  24. $sender->send();
  25. }
  26. public function testTenPaysuccess()
  27. {
  28. for ($i = 0; $i < 10; ++$i)
  29. {
  30. push_helper::paysuccess_bonus(self::test_android_member_id,100);
  31. push_helper::paysuccess_bonus(self::test_ios_member_id,100);
  32. }
  33. }
  34. public function testPaysuccess()
  35. {
  36. account_helper::onAsyncOrderPaied('270563196360813623');
  37. }
  38. public function testOrderComplete()
  39. {
  40. account_helper::onAsyncOrderComplete('270563196360813623');
  41. }
  42. public function testMessage()
  43. {
  44. $pushor = new push_sender();
  45. $info['member_id'] = self::test_member_id;
  46. $info['text'] = 'hello message';
  47. $info['custom'] = ['type' => 'add_special','special_id' => 300];
  48. $pushor->send_message($info);
  49. }
  50. public function testDialog()
  51. {
  52. push_helper::first_present(self::test_android_member_id,'http://192.168.0.200/mobile/index.php?act=webpush&op=fcode&client_type=ios');
  53. push_helper::first_present(self::test_ios_member_id,'http://192.168.0.200/mobile/index.php?act=webpush&op=fcode&client_type=ios');
  54. }
  55. }