TestAccountHelper.php 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. <?php declare(strict_types=1);
  2. use PHPUnit\Framework\TestCase;
  3. /**
  4. * Created by PhpStorm.
  5. * User: stanley-king
  6. * Date: 16/6/27
  7. * Time: 下午10:27
  8. */
  9. define('APP_ID', 'test');
  10. define('BASE_ROOT_PATH', str_replace('/test', '', dirname(__FILE__)));
  11. require_once(BASE_ROOT_PATH . '/global.php');
  12. require_once(BASE_CORE_PATH . '/lrlz.php');
  13. require_once(BASE_ROOT_PATH . '/fooder.php');
  14. require_once(BASE_ROOT_PATH . '/helper/bonus_helper.php');
  15. require_once(BASE_ROOT_PATH . '/helper/account_helper.php');
  16. require_once(BASE_ROOT_PATH . '/helper/category_helper.php');
  17. require_once(BASE_ROOT_PATH . '/helper/brand_helper.php');
  18. class TestAccountHelper extends TestCase
  19. {
  20. public static function setUpBeforeClass() : void
  21. {
  22. Base::run_util();
  23. }
  24. public function testInviteBonus()
  25. {
  26. account_helper::invite_bonus(36490);
  27. }
  28. public function testEvaluate()
  29. {
  30. account_helper::onAsyncOrderEvaluate();
  31. }
  32. public function testGainSystem()
  33. {
  34. account_helper::gain_system(36490, 4.5);
  35. }
  36. public function testGainBonus()
  37. {
  38. account_helper::gain_bonus(36490,36485,4.5);
  39. }
  40. public function testLostBonus()
  41. {
  42. account_helper::gain_bonus(36490,36485,4.5);
  43. }
  44. public function testOnRegister()
  45. {
  46. account_helper::onRegister(36490,session_helper::relay_id());
  47. }
  48. public function testOrderCancel()
  49. {
  50. account_helper::order_cancel('8000000000001603',36490);
  51. }
  52. public function testPayRefund()
  53. {
  54. //account_helper::pay_refund(36490,500,'退款红包');
  55. }
  56. public function testPaysuccess()
  57. {
  58. $pay_sn = '910510761110261481';
  59. account_helper::onAsyncOrderPaied($pay_sn);
  60. }
  61. public function testOrderSuccessSys()
  62. {
  63. $mod = Model('order');
  64. $pay_sn = '910510761110261481';
  65. $order_info = $mod->getOrderInfo(['pay_sn' => $pay_sn]);
  66. $logic_order = Logic('order');
  67. $result = $logic_order->changeOrderStateReceive($order_info,'system','系统','超期未收货系统自动完成订单');
  68. }
  69. public function testUpfile()
  70. {
  71. $file = '/Users/stanley-king/work/PHPProject/shopnc/data/upload/uploadtmp/20161215081131-53be4be9-fe01-50e7-28c0-ded900c9a0f6.jpg';
  72. $ext = exif_imagetype($file);
  73. $exif = image_type_to_mime_type($ext);
  74. $tagnmae = exif_tagname($ext);
  75. $info = new SplFileInfo($file);
  76. $type = $info->getType();
  77. $type = $info->getExtension();
  78. $size = $info->getSize();
  79. $tmp_name = $info->getFilename();
  80. }
  81. public function testTask()
  82. {
  83. account_helper::onAsyncBroadcastOrder('290563492188164623',0.1,30);
  84. }
  85. }