TestAccountHelper.php 2.6 KB

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