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