TestPush.php 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  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. $fc_id = 3070;
  53. $mod_fcode = Model('goods_fcode');
  54. $fcode = $mod_fcode->getGoodsFCode(['fc_id' => $fc_id],true);
  55. push_helper::first_present(self::test_android_member_id,$fcode);
  56. push_helper::first_present(self::test_ios_member_id,$fcode);
  57. }
  58. public function testAsyncPush()
  59. {
  60. QueueClient::async_push('onAsyncRegister',['user' => self::test_ios_member_id,'inviter' => self::test_android_member_id],1);
  61. }
  62. public function testBroadcast()
  63. {
  64. //"http://t.cn/RYTpzAr"
  65. $send_params =['type' => Sms::tpl_new_goods,
  66. 'sms_params' => ['day' => '周一','amount' => 50,'brand' => "婵真",'url' => "http://t.cn/RYTpzAr"],
  67. 'push_params' => []];
  68. $filters = ['member_filters' => [ ['type' => 'bonus','amount' => 50000],['type' => 'mobile']],
  69. 'sms_filters' => [['type' => 'regtime','days' => 5]]];
  70. $oper_param = ['type' => 'bonus','rate' => 30,'amount' => 50];
  71. account_helper::onAsyncBroadcastNormal($filters,$oper_param,$send_params);
  72. }
  73. public function testStaticCall()
  74. {
  75. }
  76. }